diff options
author | snowleo <schneeleo@gmail.com> | 2011-06-26 16:17:45 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-06-26 16:17:45 +0200 |
commit | 496f2ea19f04eab53aabb1c3f02f4621def9f50b (patch) | |
tree | 16eb28615fcecda1f0ae2cdea9fc8979c457b2f0 | |
parent | 6a6b0b77544673eac751038c361a33e5a49b3909 (diff) | |
download | Essentials-496f2ea19f04eab53aabb1c3f02f4621def9f50b.tar Essentials-496f2ea19f04eab53aabb1c3f02f4621def9f50b.tar.gz Essentials-496f2ea19f04eab53aabb1c3f02f4621def9f50b.tar.lz Essentials-496f2ea19f04eab53aabb1c3f02f4621def9f50b.tar.xz Essentials-496f2ea19f04eab53aabb1c3f02f4621def9f50b.zip |
Deprecating the old sign code and adding the new code.
Please test everything without EssentialsProtect. The signs should protect themselves.
6 files changed, 46 insertions, 22 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 4c39389ef..243971f07 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -27,6 +27,9 @@ import org.bukkit.command.CommandSender; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.register.payment.Methods; +import com.earth2me.essentials.signs.SignBlockListener; +import com.earth2me.essentials.signs.SignEntityListener; +import com.earth2me.essentials.signs.SignPlayerListener; import java.math.BigInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -185,9 +188,22 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); - pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Low, this); - pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, this); + //pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Low, this); + //pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this); + + final SignBlockListener signBlockListener = new SignBlockListener(this); + pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_PLACE, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this); + + final SignPlayerListener signPlayerListener = new SignPlayerListener(this); + pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this); + + final SignEntityListener signEntityListener = new SignEntityListener(this); + pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this); final EssentialsEntityListener entityListener = new EssentialsEntityListener(this); pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this); @@ -201,7 +217,7 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.BLOCK_DAMAGE, jail, Priority.High, this); pm.registerEvent(Type.BLOCK_PLACE, jail, Priority.High, this); pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.High, this); - attachEcoListeners(); + //attachEcoListeners(); if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2) { @@ -598,12 +614,12 @@ public class Essentials extends JavaPlugin implements IEssentials private void attachEcoListeners() { - PluginManager pm = getServer().getPluginManager(); - EssentialsEcoBlockListener ecoBlockListener = new EssentialsEcoBlockListener(this); - EssentialsEcoPlayerListener ecoPlayerListener = new EssentialsEcoPlayerListener(this); - pm.registerEvent(Type.PLAYER_INTERACT, ecoPlayerListener, Priority.High, this); - pm.registerEvent(Type.BLOCK_BREAK, ecoBlockListener, Priority.High, this); - pm.registerEvent(Type.SIGN_CHANGE, ecoBlockListener, Priority.Monitor, this); + //PluginManager pm = getServer().getPluginManager(); + //EssentialsEcoBlockListener ecoBlockListener = new EssentialsEcoBlockListener(this); + //EssentialsEcoPlayerListener ecoPlayerListener = new EssentialsEcoPlayerListener(this); + //pm.registerEvent(Type.PLAYER_INTERACT, ecoPlayerListener, Priority.High, this); + //pm.registerEvent(Type.BLOCK_BREAK, ecoBlockListener, Priority.High, this); + //pm.registerEvent(Type.SIGN_CHANGE, ecoBlockListener, Priority.Monitor, this); } public CraftScheduler getScheduler() diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index 64206dac0..b2e1d7d43 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -33,6 +33,7 @@ public class EssentialsBlockListener extends BlockListener } @Override + @Deprecated public void onBlockBreak(BlockBreakEvent event) { if (event.isCancelled()) @@ -63,6 +64,7 @@ public class EssentialsBlockListener extends BlockListener } @Override + @Deprecated public void onSignChange(SignChangeEvent event) { if (event.isCancelled()) @@ -231,7 +233,7 @@ public class EssentialsBlockListener extends BlockListener { return; } - Block signBlock = event.getBlockAgainst(); + /*Block signBlock = event.getBlockAgainst(); if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN_POST) { Sign sign = new CraftSign(signBlock); @@ -240,7 +242,7 @@ public class EssentialsBlockListener extends BlockListener event.setCancelled(true); return; } - } + }*/ final User user = ess.getUser(event.getPlayer()); // Do not rely on getItemInHand(); // http://leaky.bukkit.org/issues/663 @@ -320,7 +322,8 @@ public class EssentialsBlockListener extends BlockListener } } - public boolean hasAdjacentChest(Block block) + @Deprecated + private boolean hasAdjacentChest(Block block) { Block[] faces = getAdjacentBlocks(block); for (Block b : faces) @@ -337,6 +340,7 @@ public class EssentialsBlockListener extends BlockListener private static final int NOSIGN = 2; private static final int OWNER = 3; + @Deprecated private int checkProtectionSign(Block block, User user) { String username = user.getName().substring(0, user.getName().length() > 14 ? 14 : user.getName().length()); @@ -371,6 +375,7 @@ public class EssentialsBlockListener extends BlockListener return NOSIGN; } + @Deprecated private static Block[] getAdjacentBlocks(Block block) { return new Block[] @@ -384,7 +389,8 @@ public class EssentialsBlockListener extends BlockListener }; } - public boolean isBlockProtected(Block block, User user) + @Deprecated + private boolean isBlockProtected(Block block, User user) { Block[] faces = getAdjacentBlocks(block); boolean protect = false; @@ -421,7 +427,8 @@ public class EssentialsBlockListener extends BlockListener return protect; } - public static boolean isBlockProtected(Block block) + @Deprecated + private static boolean isBlockProtected(Block block) { Block[] faces = getAdjacentBlocks(block); for (Block b : faces) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java index 630b9b23d..bb12f8d4c 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java @@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.inventory.ItemStack; - +@Deprecated public class EssentialsEcoBlockListener extends BlockListener { private final IEssentials ess; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java index f3e01bd83..72154c886 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java @@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.inventory.ItemStack; - +@Deprecated public class EssentialsEcoPlayerListener extends PlayerListener { private final IEssentials ess; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index ace790c09..56a90dc44 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -357,7 +357,7 @@ public class EssentialsPlayerListener extends PlayerListener event.setCancelled(true); return; } - if (!ess.getSettings().areSignsDisabled() && EssentialsBlockListener.protectedBlocks.contains(event.getClickedBlock().getType())) + /*if (!ess.getSettings().areSignsDisabled() && EssentialsBlockListener.protectedBlocks.contains(event.getClickedBlock().getType())) { if (!user.isAuthorized("essentials.signs.protection.override")) { @@ -368,7 +368,7 @@ public class EssentialsPlayerListener extends PlayerListener return; } } - } + }*/ if (ess.getSettings().getBedSetsHome() && event.getClickedBlock().getType() == Material.BED_BLOCK) { @@ -383,7 +383,7 @@ public class EssentialsPlayerListener extends PlayerListener } - if (ess.getSettings().areSignsDisabled()) + /*if (ess.getSettings().areSignsDisabled()) { return; } @@ -517,9 +517,10 @@ public class EssentialsPlayerListener extends PlayerListener { logger.log(Level.WARNING, ex.getMessage(), ex); } - } + }*/ } + @Deprecated private Trade chargeUserForWarp(Sign sign, User user) throws Exception { if (!sign.getLine(3).isEmpty()) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index 42a55c874..f44021bce 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -249,12 +249,12 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true);
return;
}
- if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
+ /*if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
&& EssentialsBlockListener.isBlockProtected(block))
{
event.setCancelled(true);
return;
- }
+ }*/
}
}
|