diff --git a/config.yml b/config.yml
index ba5498f..dc2bcf1 100644
--- a/config.yml
+++ b/config.yml
@@ -90,7 +90,7 @@ limit:
button: false
# BlockWorkbenches
- # When enabled also blocks usage of workbenches like chests (so the creative player never can see his inventar).
+ # When enabled also blocks usage of workbenches, anvils and vendor-villagers like chests.
# default: false
workbench: false
diff --git a/lang/de_DE.yml b/lang/de_DE.yml
index 2b63eac..ca1fafe 100644
--- a/lang/de_DE.yml
+++ b/lang/de_DE.yml
@@ -13,9 +13,9 @@ basic:
command:
player: Spieler
switch:
- survival: ÿndert den Spiel-Modus des Charakters zu ÿberleben
- creative: ÿndert den Spiel-Modus des Charakters zu Kreativ
- adventure: ÿndert den Spiel-Modus des Charakters zu Abenteuer
+ survival: Ändert den Spiel-Modus des Charakters zu Überleben
+ creative: Ändert den Spiel-Modus des Charakters zu Kreativ
+ adventure: Ändert den Spiel-Modus des Charakters zu Abenteuer
config:
overview: "[Einstellung] - liste durch weglassen"
settings: "Verfügbare Einstellungen: "
@@ -57,10 +57,12 @@ blocked:
button: Im Kreativ-Modus kann nicht mit Buttons interagiert werden
lever: Im Kreativ-Modus kann nicht mit Schaltern interagiert werden
survival_flying: Du solltest auf dem Boden stehen wenn du Kreativ-Regionen verlässt
- outside_place: Du kannst keine Blöcke auÿerhalb von Spiel-Modus-Regionen setzen
- outside_break: Du kannst keine Blöcke auÿerhalb von Spiel-Modus-Regionen zerstören
+ outside_place: Du kannst keine Blöcke außerhalb von Spiel-Modus-Regionen setzen
+ outside_break: Du kannst keine Blöcke außerhalb von Spiel-Modus-Regionen zerstören
+ outside_interact: Du kannst nicht mit Blöcken außerhalb von Spiel-Modus-Regionen interagieren
inside_place: Du kannst keine Blöcke innerhalb von Spiel-Modus-Regionen setzen
inside_break: Du kannst keine Blöcke innerhalb von Spiel-Modus-Regionen zerstören
+ inside_interact: Du kannst nicht mit Blöcken innerhalb von Spiel-Modus-Regionen interagieren
use: Du darfst diese Art von Gegenständen im Kreativ-Modus verwenden
place: Du darfst diese Art von Blöcken im Kreativ-Modus nicht setzen
break: Du darfst diese Art von Blöcken im Kreativ-Modus nicht zerstören
diff --git a/lang/en_US.yml b/lang/en_US.yml
index ad4779a..63a4f4e 100644
--- a/lang/en_US.yml
+++ b/lang/en_US.yml
@@ -59,8 +59,10 @@ blocked:
survival_flying: You should stay on ground, when leaving a creative-area
outside_place: You can not place blocks outside of the gamemode-area
outside_break: You can not destroy blocks outside of the gamemode-area
+ outside_interact: You can not interact with blocks outside of the gamemode-area
inside_place: You can not place blocks inside of the gamemode-area
inside_break: You can not destroy blocks inside of the gamemode-area
+ inside_interact: You can not interact with blocks inside of the gamemode-area
use: You are not allowed to use this type of item
place: You are not allowed to place this type of block
break: You are not allowed to break this type of block
diff --git a/plugin.yml b/plugin.yml
index 16d6cff..41fed30 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,6 +1,6 @@
name: LimitedCreative
main: de.jaschastarke.minecraft.limitedcreative.Core
-version: 1.4.0b
+version: 1.4.5a
softdepend: [WorldGuard, WorldEdit, MultiInv]
dev-url: http://dev.bukkit.org/server-mods/limited-creative/
commands:
diff --git a/pom.xml b/pom.xml
index 5d20281..16a8953 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
de.jaschastarke
LimitedCreative
LimitedCreative
- 1.4.0b
+ 1.4.5a
https://github.com/possi/LimitedCreative
scm:git:git://github.com/possi/LimitedCreative.git
@@ -72,8 +72,13 @@
org.bukkit
bukkit
- 1.4.2-R0.2
+ 1.4.5-R0.2
+
+ org.bukkit
+ craftbukkit
+ 1.4.5-R0.2
+
com.sk89q
worldguard
diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java
index 8b45d9e..0b2bf3a 100644
--- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java
+++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java
@@ -356,6 +356,14 @@ public class LCPlayer {
event.getPlayer().sendMessage(L("blocked.chest"));
event.setCancelled(true);
}
+ public void onBenchAccess(PlayerInteractEntityEvent event) {
+ if (!plugin.config.getBenchBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE)
+ return;
+ if (hasPermission(Perms.NoLimit.CHEST))
+ return;
+ event.getPlayer().sendMessage(L("blocked.chest"));
+ event.setCancelled(true);
+ }
public void onSignAccess(PlayerInteractEvent event) {
if (!plugin.config.getSignBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE)
return;
diff --git a/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java b/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java
index 61b347b..aa5700a 100644
--- a/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java
+++ b/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java
@@ -29,6 +29,7 @@ import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.StorageMinecart;
+import org.bukkit.entity.Villager;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
@@ -98,7 +99,7 @@ public class LimitListener implements Listener {
player.onSignAccess(event);
} else if (block.getState() instanceof Lever || block.getState() instanceof Button) {
player.onButtonAccess(event);
- } else if (block.getType() == Material.WORKBENCH) {
+ } else if (block.getType() == Material.WORKBENCH || block.getType() == Material.ANVIL) {
player.onBenchAccess(event);
}
}
@@ -120,6 +121,7 @@ public class LimitListener implements Listener {
// Temporary Solution: While dropping of Items is prevented we don't allow Interaction with ItemFrames, so no
// Items can be "placed" anywhere.
+ // TODO: Improve Configuration
if (!player.hasPermission(Perms.NoLimit.DROP)) {
if (entity instanceof ItemFrame && plugin.config.getRemoveDrop()) {
event.setCancelled(true);
@@ -130,6 +132,8 @@ public class LimitListener implements Listener {
if (entity instanceof StorageMinecart) {
player.onChestAccess(event);
+ } else if (entity instanceof Villager) {
+ player.onBenchAccess(event);
}
}
diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java
index 6144a66..a8b6b49 100644
--- a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java
+++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java
@@ -6,21 +6,28 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.Sign;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.material.Button;
+import org.bukkit.material.Lever;
import de.jaschastarke.minecraft.limitedcreative.Core;
import de.jaschastarke.minecraft.limitedcreative.LCPlayer;
import de.jaschastarke.minecraft.limitedcreative.Players;
+import de.jaschastarke.minecraft.limitedcreative.listeners.MainListener;
import de.jaschastarke.minecraft.utils.Util;
import de.jaschastarke.minecraft.worldguard.ApplicableRegions;
import de.jaschastarke.minecraft.worldguard.CRegionManager;
@@ -56,6 +63,40 @@ public class RegionListener implements Listener {
whenBlockBreak(event, event.getEntity().getLocation().getBlock(), eventPlayer);
}
}
+
+ @EventHandler
+ public void onPlayerInteract(PlayerInteractEvent event) {
+ if (MainListener.isCancelled(event))
+ return;
+
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
+ return;
+
+ Block block = event.getClickedBlock();
+
+ if (block.getState() instanceof InventoryHolder || block.getType() == Material.ENDER_CHEST || // Workaround, Bukkit not recognize a Enderchest
+ block.getState() instanceof Sign ||
+ block.getState() instanceof Lever || block.getState() instanceof Button ||
+ block.getType() == Material.WORKBENCH || block.getType() == Material.ANVIL) {
+
+ LCPlayer player = Players.get(event.getPlayer());
+ boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), block.getLocation());
+
+ if (player.isActiveRegionGameMode() && diffrent_region) {
+ // do not break outside of "gamemod-change-region" when in the region
+ if (rm.getRegionSet(block).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getActiveRegionGameMode()) {
+ event.getPlayer().sendMessage(L("blocked.outside_interact"));
+ event.setCancelled(true);
+ }
+ } else if (diffrent_region) {
+ // do not break inside of "survial-region in creative world" when outside
+ if (rm.getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
+ event.getPlayer().sendMessage(L("blocked.inside_interact"));
+ event.setCancelled(true);
+ }
+ }
+ }
+ }
private void whenBlockBreak(Cancellable event, Block block, Player eventPlayer) {
LCPlayer player = Players.get(eventPlayer);