summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-08-19 23:41:28 +0100
committerKHobbits <rob@khobbits.co.uk>2012-08-19 23:41:28 +0100
commit1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe (patch)
tree266de57d0d9c2213f4150f88a0345eb56fab68f5 /EssentialsProtect/src/com/earth2me/essentials/protect
parent2c965ce9aee030fcc94e564506ffd592a4ac0346 (diff)
parentf0f37a16714123694e7cc6f7de07161c6ccd71a2 (diff)
downloadEssentials-1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe.tar
Essentials-1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe.tar.gz
Essentials-1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe.tar.lz
Essentials-1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe.tar.xz
Essentials-1bc0b8a97dae9893d8de64b78bb8916cdaa5adbe.zip
Merge branch 'antibuild' into 2.9
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java20
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java7
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java44
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java40
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java2
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java11
6 files changed, 1 insertions, 123 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
index 7503c334c..e17264ca9 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
@@ -2,7 +2,6 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
import com.earth2me.essentials.protect.data.ProtectedBlockMemory;
import com.earth2me.essentials.protect.data.ProtectedBlockMySQL;
import com.earth2me.essentials.protect.data.ProtectedBlockSQLite;
@@ -10,8 +9,6 @@ import java.beans.PropertyVetoException;
import static com.earth2me.essentials.I18n._;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -43,23 +40,6 @@ public class EssentialsConnect
return ess;
}
- public void alert(final User user, final String item, final String type)
- {
- final Location loc = user.getLocation();
- final String warnMessage = _("alertFormat", user.getName(), type, item,
- loc.getWorld().getName() + "," + loc.getBlockX() + ","
- + loc.getBlockY() + "," + loc.getBlockZ());
- LOGGER.log(Level.WARNING, warnMessage);
- for (Player p : ess.getServer().getOnlinePlayers())
- {
- final User alertUser = ess.getUser(p);
- if (alertUser.isAuthorized("essentials.protect.alerts"))
- {
- alertUser.sendMessage(warnMessage);
- }
- }
- }
-
private class ProtectReloader implements IConf
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 9c257662d..06dc03656 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -74,13 +74,6 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
}
@Override
- public boolean checkProtectionItems(final ProtectConfig list, final int id)
- {
- final List<Integer> itemList = settingsList.get(list);
- return itemList != null && !itemList.isEmpty() && itemList.contains(id);
- }
-
- @Override
public IProtectedBlock getStorage()
{
return storage;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index 8e5e9cca8..bd760b0ec 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.protect;
-import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.protect.data.IProtectedBlock;
@@ -36,26 +35,9 @@ public class EssentialsProtectBlockListener implements Listener
final User user = ess.getUser(event.getPlayer());
- if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
- {
- event.setCancelled(true);
- return;
- }
-
final Block blockPlaced = event.getBlockPlaced();
final int id = blockPlaced.getTypeId();
- if (prot.checkProtectionItems(ProtectConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement"))
- {
- event.setCancelled(true);
- return;
- }
-
- if (!user.hasPermission("essentials.protect.alerts.notrigger")
- && prot.checkProtectionItems(ProtectConfig.alert_on_placement, id))
- {
- prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced"));
- }
final Block below = blockPlaced.getRelative(BlockFace.DOWN);
if ((below.getType() == Material.RAILS || below.getType() == Material.POWERED_RAIL || below.getType() == Material.DETECTOR_RAIL)
@@ -234,27 +216,11 @@ public class EssentialsProtectBlockListener implements Listener
}
final User user = ess.getUser(event.getPlayer());
- if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
- {
- event.setCancelled(true);
- return;
- }
final Block block = event.getBlock();
final int typeId = block.getTypeId();
- if (prot.checkProtectionItems(ProtectConfig.blacklist_break, typeId)
- && !user.isAuthorized("essentials.protect.exemptbreak"))
- {
- event.setCancelled(true);
- return;
- }
final Material type = block.getType();
- if (!user.hasPermission("essentials.protect.alerts.notrigger")
- && prot.checkProtectionItems(ProtectConfig.alert_on_break, typeId))
- {
- prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke"));
- }
final IProtectedBlock storage = prot.getStorage();
if (user.isAuthorized("essentials.protect.admin"))
@@ -333,11 +299,6 @@ public class EssentialsProtectBlockListener implements Listener
}
for (Block block : event.getBlocks())
{
- if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId()))
- {
- event.setCancelled(true);
- return;
- }
if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS
|| block.getType() == Material.RAILS
|| block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL
@@ -385,11 +346,6 @@ public class EssentialsProtectBlockListener implements Listener
return;
}
final Block block = event.getRetractLocation().getBlock();
- if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId()))
- {
- event.setCancelled(true);
- return;
- }
if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS
|| block.getType() == Material.RAILS
|| block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index 6e515e56d..393376b6f 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -3,14 +3,12 @@ package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.inventory.ItemStack;
public class EssentialsProtectPlayerListener implements Listener
@@ -30,38 +28,6 @@ public class EssentialsProtectPlayerListener 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(ProtectConfig.disable_build) && !user.canBuild())
- {
- if (ess.getSettings().warnOnBuildDisallow())
- {
- user.sendMessage(_("buildAlert"));
- }
- event.setCancelled(true);
- return;
- }
-
- if (prot.getSettingBool(ProtectConfig.disable_use) && !user.canBuild())
- {
- if (ess.getSettings().warnOnBuildDisallow())
- {
- user.sendMessage(_("buildAlert"));
- }
- event.setCancelled(true);
- return;
- }
-
- final ItemStack item = event.getItem();
- if (item != null
- && prot.checkProtectionItems(ProtectConfig.blacklist_usage, item.getTypeId())
- && !user.isAuthorized("essentials.protect.exemptusage"))
- {
- event.setCancelled(true);
- return;
- }
-
if (user.isAuthorized("essentials.protect.ownerinfo") && event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
final StringBuilder stringBuilder = new StringBuilder();
@@ -82,11 +48,5 @@ public class EssentialsProtectPlayerListener implements Listener
user.sendMessage(_("protectionOwner", ownerNames));
}
}
- if (item != null
- && !user.hasPermission("essentials.protect.alerts.notrigger")
- && prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId()))
- {
- prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed"));
- }
}
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java
index afcb6e8ce..b82481267 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java
@@ -8,8 +8,6 @@ import org.bukkit.plugin.Plugin;
public interface IProtect extends Plugin
{
- boolean checkProtectionItems(final ProtectConfig list, final int id);
-
boolean getSettingBool(final ProtectConfig protectConfig);
String getSettingString(final ProtectConfig protectConfig);
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index bee8d0f4d..31141d7e7 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -10,8 +10,6 @@ public enum ProtectConfig
memstore("protect.memstore", false),
disable_contactdmg("protect.disable.contactdmg", false),
disable_lavadmg("protect.disable.lavadmg", false),
- disable_build("protect.disable.build", true),
- disable_use("protect.disable.use", true),
disable_pvp("protect.disable.pvp", false),
disable_projectiles("protect.disable.projectiles", false),
disable_fall("protect.disable.fall", false),
@@ -47,14 +45,7 @@ public enum ProtectConfig
protect_below_rails("protect.protect.block-below", true),
protect_signs("protect.protect.signs", true),
protect_against_signs("protect.protect.block-below", true),
- enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false),
- alert_on_placement("protect.alert.on-placement"),
- alert_on_use("protect.alert.on-use"),
- alert_on_break("protect.alert.on-break"),
- blacklist_placement("protect.blacklist.placement"),
- blacklist_usage("protect.blacklist.usage"),
- blacklist_break("protect.blacklist.break"),
- blacklist_piston("protect.blacklist.piston");
+ enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false);
private final String configName;
private final String defValueString;
private final boolean defValueBoolean;