diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 12 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_cs.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_es.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_fi.properties | 8 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_it.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_pl.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_pt.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_se.properties | 8 | ||||
-rw-r--r-- | EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java | 71 |
15 files changed, 108 insertions, 35 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index c5bef5f92..73beb1891 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -431,6 +431,7 @@ public class Settings implements ISettings disablePrefix = _disablePrefix(); disableSuffix = _disableSuffix(); chatRadius = _getChatRadius(); + warnOnBuildDisallow = _warnOnBuildDisallow(); } private List<Integer> itemSpawnBl = new ArrayList<Integer>(); @@ -511,12 +512,21 @@ public class Settings implements ISettings { return config.getBoolean("spawn-if-no-home", false); } + + private boolean warnOnBuildDisallow; + private boolean _warnOnBuildDisallow() + { + return config.getBoolean("protect.disable.warn-on-build-disallow", false); + } + @Override public boolean warnOnBuildDisallow() { - return config.getBoolean("protect.disable.warn-on-build-disallow", false); + return warnOnBuildDisallow; } + + private boolean debug = false; private boolean configDebug = false; diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 25d6b6b3a..a00ea1e7f 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 241bb8ac3..4b0879747 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -448,3 +448,7 @@ youAreHealed=\u00a77Byl jsi uzdraven. youHaveNewMail=\u00a7cMas {0} zprav!\u00a7f Napis \u00a77/mail read\u00a7f aby jsi si precetl sve zpravy. moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index d030fe59d..7a23abb8a 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 90f4c9d84..8048bb599 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 25d6b6b3a..a00ea1e7f 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 3f6db8c4b..b4e8bd73a 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 7a32d2ced..16173d6f2 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -441,3 +441,11 @@ whoisNick=\u00a76 - Nick:\u00a7f {0} whoisOp=\u00a76 - OP:\u00a7f {0} whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== walking=walking +chatTypeAdmin=[A] +flying=flying +hatEmpty=\u00a7cYou are not wearing a hat. +notFlying=not flying +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 0cb35f9c8..46053ad6c 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 05f5c3e50..c3634eaad 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index b1cb2590c..a56888081 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 84b7cc82e..9dc4d541f 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 8b6868695..43dfa69cf 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -445,3 +445,7 @@ hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} moveSpeed=\u00a77Set {0} speed to {1} for {2}. walking=walking +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index e9c5800b6..2b339f037 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -441,3 +441,11 @@ whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} walking=walking +chatTypeAdmin=[A] +flying=flying +hatEmpty=\u00a7cYou are not wearing a hat. +notFlying=not flying +antiBuildPlace=\u00a74You are not permitted to place {0} here. +antiBuildBreak=\u00a74You are not permitted to break {0} blocks here. +antiBuildUse=\u00a74You are not permitted to use {0}. +antiBuildInteract=\u00a74You are not permitted to interact with {0}. diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index cb29af086..7a1052cce 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -6,7 +6,6 @@ import com.earth2me.essentials.User; import java.util.logging.Level; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.event.Event.Result; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -48,7 +47,7 @@ public class EssentialsAntiBuildListener implements Listener { if (ess.getSettings().isDebug()) { - ess.getLogger().log(Level.INFO, "abort checking if " + user.getName() + " has " + dataPerm + " - not directly set"); + ess.getLogger().log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm); } } @@ -64,31 +63,35 @@ public class EssentialsAntiBuildListener implements Listener } final User user = ess.getUser(event.getPlayer()); + final Block block = event.getBlockPlaced(); + final int typeId = block.getTypeId(); + final Material type = block.getType(); if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") - && !metaPermCheck(user, "place", event.getBlock())) + && !metaPermCheck(user, "place", block)) { if (ess.getSettings().warnOnBuildDisallow()) { - user.sendMessage(_("buildAlert")); + user.sendMessage(_("antiBuildPlace", type.toString())); } event.setCancelled(true); return; } - final Block blockPlaced = event.getBlockPlaced(); - final int id = blockPlaced.getTypeId(); - - if (prot.checkProtectionItems(AntiBuildConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement")) + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_placement, typeId) && !user.isAuthorized("essentials.protect.exemptplacement")) { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("antiBuildPlace", type.toString())); + } event.setCancelled(true); return; } - if (prot.checkProtectionItems(AntiBuildConfig.alert_on_placement, id) + if (prot.checkProtectionItems(AntiBuildConfig.alert_on_placement, typeId) && !user.isAuthorized("essentials.protect.alerts.notrigger")) { - prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); + prot.getEssentialsConnect().alert(user, type.toString(), _("alertPlaced")); } } @@ -100,27 +103,31 @@ public class EssentialsAntiBuildListener implements Listener return; } final User user = ess.getUser(event.getPlayer()); + final Block block = event.getBlock(); + final int typeId = block.getTypeId(); + final Material type = block.getType(); if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") - && !metaPermCheck(user, "break", event.getBlock())) + && !metaPermCheck(user, "break", block)) { if (ess.getSettings().warnOnBuildDisallow()) { - user.sendMessage(_("buildAlert")); + user.sendMessage(_("antiBuildBreak", type.toString())); } event.setCancelled(true); return; } - final Block block = event.getBlock(); - final int typeId = block.getTypeId(); if (prot.checkProtectionItems(AntiBuildConfig.blacklist_break, typeId) && !user.isAuthorized("essentials.protect.exemptbreak")) { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("antiBuildBreak", type.toString())); + } event.setCancelled(true); return; } - final Material type = block.getType(); if (prot.checkProtectionItems(AntiBuildConfig.alert_on_break, typeId) && !user.isAuthorized("essentials.protect.alerts.notrigger")) @@ -166,25 +173,16 @@ public class EssentialsAntiBuildListener implements Listener { // Do not return if cancelled, because the interact event has 2 cancelled states. final User user = ess.getUser(event.getPlayer()); - - if (event.hasItem() - && (event.getItem().getType() == Material.WATER_BUCKET - || event.getItem().getType() == Material.LAVA_BUCKET) - && prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) - { - if (ess.getSettings().warnOnBuildDisallow()) - { - user.sendMessage(_("buildAlert")); - } - event.setCancelled(true); - return; - } - final ItemStack item = event.getItem(); + if (item != null && prot.checkProtectionItems(AntiBuildConfig.blacklist_usage, item.getTypeId()) && !user.isAuthorized("essentials.protect.exemptusage")) { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("antiBuildUse", item.getType().toString())); + } event.setCancelled(true); return; } @@ -198,17 +196,22 @@ public class EssentialsAntiBuildListener implements Listener if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (!metaPermCheck(user, "interact", event.getClickedBlock())) + if (event.hasItem() && !metaPermCheck(user, "interact", item.getTypeId(), item.getData().getData())) { - event.setUseInteractedBlock(Result.DENY); + event.setCancelled(true); if (ess.getSettings().warnOnBuildDisallow()) { - user.sendMessage(_("buildAlert")); + user.sendMessage(_("antiBuildUse", item.getType().toString())); } + return; } - if (event.hasItem() && !metaPermCheck(user, "use", event.getItem().getTypeId(), event.getItem().getData().getData())) + if (event.hasBlock() && !metaPermCheck(user, "interact", event.getClickedBlock())) { - event.setUseItemInHand(Result.DENY); + event.setCancelled(true); + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("antiBuildInteract", event.getClickedBlock().getType().toString())); + } } } } |