diff --git a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java new file mode 100644 index 000000000..a352bcb5a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java @@ -0,0 +1,39 @@ +package com.earth2me.essentials; + +import org.bukkit.entity.Player; + + +public class BukkitPermissionsHandler implements IPermissionsHandler +{ + + public String getGroup(Player base) + { + return "default"; + } + + public boolean canBuild(Player base, String group) + { + return true; + } + + public boolean inGroup(Player base, String group) + { + return false; + } + + public boolean hasPermission(Player base, String node) + { + return base.hasPermission(node); + } + + public String getPrefix(Player base) + { + return ""; + } + + public String getSuffix(Player base) + { + return ""; + } + +} diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index a7252b1c5..45a2aff60 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -46,7 +46,7 @@ import org.bukkit.plugin.java.*; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 974; + public static final int BUKKIT_VERSION = 1000; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); @@ -158,7 +158,14 @@ public class Essentials extends JavaPlugin implements IEssentials } else { - this.permissionsHandler = new ConfigPermissionsHandler(this); + if (this.getSettings().useBukkitPermissions()) + { + this.permissionsHandler = new BukkitPermissionsHandler(); + } + else + { + this.permissionsHandler = new ConfigPermissionsHandler(this); + } } final ServerListener serverListener = new EssentialsPluginListener(paymentMethod); @@ -190,6 +197,8 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this); pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_PISTON_EXTEND, signBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_PISTON_RETRACT, signBlockListener, Priority.Low, this); final SignPlayerListener signPlayerListener = new SignPlayerListener(this); pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this); @@ -642,7 +651,7 @@ public class Essentials extends JavaPlugin implements IEssentials { return bans; } - + public ItemDb getItemDb() { return itemDb; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 64905a4bc..f539227f0 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -60,6 +60,7 @@ public class EssentialsPlayerListener extends PlayerListener if (user.isMuted()) { event.setCancelled(true); + user.sendMessage(Util.i18n("playerMuted")); LOGGER.info(Util.format("mutedUserSpeaks", user.getName())); } final Iterator it = event.getRecipients().iterator(); diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java index 976566704..d39df60e4 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import java.util.List; +import java.util.UUID; import org.bukkit.BlockChangeDelegate; import org.bukkit.Chunk; import org.bukkit.ChunkSnapshot; @@ -8,6 +9,7 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.TreeType; import org.bukkit.World; +import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.entity.Arrow; import org.bukkit.entity.Boat; @@ -172,26 +174,6 @@ public class FakeWorld implements World throw new UnsupportedOperationException("Not supported yet."); } - public Minecart spawnMinecart(Location lctn) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - public StorageMinecart spawnStorageMinecart(Location lctn) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - public PoweredMinecart spawnPoweredMinecart(Location lctn) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - public Boat spawnBoat(Location lctn) - { - throw new UnsupportedOperationException("Not supported yet."); - } - public LivingEntity spawnCreature(Location lctn, CreatureType ct) { throw new UnsupportedOperationException("Not supported yet."); @@ -392,7 +374,33 @@ public class FakeWorld implements World throw new UnsupportedOperationException("Not supported yet."); } - public long getUID() + public UUID getUID() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Block getHighestBlockAt(int i, int i1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Block getHighestBlockAt(Location lctn) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + + public Biome getBiome(int i, int i1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public double getTemperature(int i, int i1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public double getHumidity(int i, int i1) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 638f0593a..c53992461 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -128,4 +128,6 @@ public interface ISettings extends IConf boolean changeDisplayName(); boolean isPlayerCommand(String string); + + public boolean useBukkitPermissions(); } diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index ff0b73fbd..895e2c4d5 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import java.net.InetSocketAddress; import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.UUID; import org.bukkit.Achievement; import org.bukkit.Effect; @@ -23,6 +24,10 @@ import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionAttachment; +import org.bukkit.permissions.PermissionAttachmentInfo; +import org.bukkit.plugin.Plugin; import org.bukkit.util.Vector; @@ -513,4 +518,62 @@ public class OfflinePlayer implements Player { throw new UnsupportedOperationException("Not supported yet."); } + + public boolean isPermissionSet(String string) + { + return false; + } + + public boolean isPermissionSet(Permission prmsn) + { + return false; + } + + public boolean hasPermission(String string) + { + return false; + } + + public boolean hasPermission(Permission prmsn) + { + return false; + } + + public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public PermissionAttachment addAttachment(Plugin plugin) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln, int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public PermissionAttachment addAttachment(Plugin plugin, int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void removeAttachment(PermissionAttachment pa) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void recalculatePermissions() + { + } + + public Set getEffectivePermissions() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setOp(boolean bln) + { + } } diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java index 99ade90ce..8acd7fed6 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java +++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java @@ -7,6 +7,10 @@ import org.bukkit.block.Block; import org.bukkit.entity.*; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.*; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionAttachment; +import org.bukkit.permissions.PermissionAttachmentInfo; +import org.bukkit.plugin.Plugin; import org.bukkit.util.Vector; public class PlayerWrapper implements Player @@ -560,4 +564,64 @@ public class PlayerWrapper implements Player { base.resetPlayerTime(); } + + public boolean isPermissionSet(String string) + { + return base.isPermissionSet(string); + } + + public boolean isPermissionSet(Permission prmsn) + { + return base.isPermissionSet(prmsn); + } + + public boolean hasPermission(String string) + { + return base.hasPermission(string); + } + + public boolean hasPermission(Permission prmsn) + { + return base.hasPermission(prmsn); + } + + public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln) + { + return base.addAttachment(plugin, string, bln); + } + + public PermissionAttachment addAttachment(Plugin plugin) + { + return base.addAttachment(plugin); + } + + public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln, int i) + { + return base.addAttachment(plugin, string, bln, i); + } + + public PermissionAttachment addAttachment(Plugin plugin, int i) + { + return base.addAttachment(plugin, i); + } + + public void removeAttachment(PermissionAttachment pa) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void recalculatePermissions() + { + base.recalculatePermissions(); + } + + public Set getEffectivePermissions() + { + return base.getEffectivePermissions(); + } + + public void setOp(boolean bln) + { + base.setOp(bln); + } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index d63bc7194..9f4bde9e0 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -463,5 +463,9 @@ public class Settings implements ISettings { return config.getBoolean("change-displayname", true); } - + + public boolean useBukkitPermissions() + { + return config.getBoolean("use-bukkit-permissions", false); + } } diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 515ef83a5..2ba7f0eb7 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -375,7 +375,6 @@ public class Util } catch (IOException ex) { - return cl.getResourceAsStream(string); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 5b3fef6de..8c8c2e6bf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -1,42 +1,52 @@ -package com.earth2me.essentials.commands; - -import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; - - -public class Commandmute extends EssentialsCommand -{ - public Commandmute() - { - super("mute"); - } - - @Override - public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - - User p = getPlayer(server, args, 0, true); - long muteTimestamp = 0; - if (args.length > 1) - { - String time = getFinalArg(args, 1); - muteTimestamp = Util.parseDateDiff(time, true); - } - p.setMuteTimeout(muteTimestamp); - charge(sender); - - - sender.sendMessage( - p.toggleMuted() - ? (muteTimestamp > 0 - ? Util.format("mutedPlayerFor", p.getDisplayName(), Util.formatDateDiff(muteTimestamp)) - : Util.format("mutedPlayer", p.getDisplayName())) - : Util.format("unmutedPlayer", p.getDisplayName())); - } -} +package com.earth2me.essentials.commands; + +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; + + +public class Commandmute extends EssentialsCommand +{ + public Commandmute() + { + super("mute"); + } + + @Override + public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + User p = getPlayer(server, args, 0, true); + if (p.isAuthorized("essentials.mute.exempt")) + { + sender.sendMessage(Util.i18n("muteExempt")); + return; + } + long muteTimestamp = 0; + if (args.length > 1) + { + String time = getFinalArg(args, 1); + muteTimestamp = Util.parseDateDiff(time, true); + } + p.setMuteTimeout(muteTimestamp); + charge(sender); + boolean muted = p.toggleMuted(); + sender.sendMessage( + muted + ? (muteTimestamp > 0 + ? Util.format("mutedPlayerFor", p.getDisplayName(), Util.formatDateDiff(muteTimestamp)) + : Util.format("mutedPlayer", p.getDisplayName())) + : Util.format("unmutedPlayer", p.getDisplayName())); + p.sendMessage( + muted + ? (muteTimestamp > 0 + ? Util.format("playerMutedFor", Util.formatDateDiff(muteTimestamp)) + : Util.i18n("playerMuted")) + : Util.i18n("playerUnmuted")); + } +} diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index c4853c31e..52b16404e 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -189,9 +189,14 @@ public class EssentialsSign return true; } + public boolean onBlockPush(Block block, IEssentials ess) + { + return true; + } + public static boolean checkIfBlockBreaksSigns(final Block block) { - if (block.getFace(BlockFace.UP).getType() == Material.SIGN_POST) + if (block.getRelative(BlockFace.UP).getType() == Material.SIGN_POST) { return true; } @@ -204,7 +209,7 @@ public class EssentialsSign }; for (BlockFace blockFace : directions) { - final Block signblock = block.getFace(blockFace); + final Block signblock = block.getRelative(blockFace); if (signblock.getType() == Material.WALL_SIGN) { final org.bukkit.material.Sign sign = (org.bukkit.material.Sign)signblock.getState().getData(); @@ -333,7 +338,7 @@ public class EssentialsSign protected final Double getDoublePositive(final String line) throws SignException { final double quantity = getDouble(line); - if (Math.round(quantity*100.0) < 1.0) + if (Math.round(quantity * 100.0) < 1.0) { throw new SignException(Util.i18n("moreThanZero")); } @@ -425,7 +430,6 @@ public class EssentialsSign { return; } - } @@ -454,7 +458,7 @@ public class EssentialsSign { return block; } - + public final void updateSign() { sign.update(); @@ -469,7 +473,7 @@ public class EssentialsSign void setLine(final int index, final String text); public Block getBlock(); - + void updateSign(); } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java index c452e1b63..7574b7691 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -13,6 +13,8 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockListener; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.SignChangeEvent; @@ -21,12 +23,12 @@ public class SignBlockListener extends BlockListener { private final transient IEssentials ess; private final static Logger LOGGER = Logger.getLogger("Minecraft"); - + public SignBlockListener(IEssentials ess) { this.ess = ess; } - + @Override public void onBlockBreak(final BlockBreakEvent event) { @@ -34,13 +36,13 @@ public class SignBlockListener extends BlockListener { return; } - + if (protectSignsAndBlocks(event.getBlock(), event.getPlayer())) { event.setCancelled(true); } } - + public boolean protectSignsAndBlocks(final Block block, final Player player) { final int mat = block.getTypeId(); @@ -78,7 +80,7 @@ public class SignBlockListener extends BlockListener } return false; } - + @Override public void onSignChange(final SignChangeEvent event) { @@ -104,12 +106,13 @@ public class SignBlockListener extends BlockListener User user = ess.getUser(event.getPlayer()); if (user.isAuthorized("essentials.signs.color")) { - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { event.setLine(i, event.getLine(i).replaceAll("&([0-9a-f])", "§$1")); } } } - + @Override public void onBlockPlace(final BlockPlaceEvent event) { @@ -117,7 +120,7 @@ public class SignBlockListener extends BlockListener { return; } - + final Block against = event.getBlockAgainst(); if (against.getType() == Material.WALL_SIGN || against.getType() == Material.SIGN_POST) @@ -142,7 +145,7 @@ public class SignBlockListener extends BlockListener } } } - + @Override public void onBlockBurn(final BlockBurnEvent event) { @@ -150,7 +153,7 @@ public class SignBlockListener extends BlockListener { return; } - + final Block block = event.getBlock(); if ((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST @@ -170,7 +173,7 @@ public class SignBlockListener extends BlockListener } } } - + @Override public void onBlockIgnite(final BlockIgniteEvent event) { @@ -178,10 +181,61 @@ public class SignBlockListener extends BlockListener { return; } - + if (protectSignsAndBlocks(event.getBlock(), event.getPlayer())) { event.setCancelled(true); } } + + @Override + public void onBlockPistonExtend(BlockPistonExtendEvent event) + { + for (Block block : event.getBlocks()) + { + if ((block.getType() == Material.WALL_SIGN + || block.getType() == Material.SIGN_POST + || EssentialsSign.checkIfBlockBreaksSigns(block))) + { + event.setCancelled(true); + return; + } + for (Signs signs : Signs.values()) + { + final EssentialsSign sign = signs.getSign(); + if (sign.getBlocks().contains(block.getType()) + && !sign.onBlockPush(block, ess)) + { + event.setCancelled(true); + return; + } + } + } + } + + @Override + public void onBlockPistonRetract(BlockPistonRetractEvent event) + { + if (event.isSticky()) + { + final Block block = event.getBlock(); + if ((block.getType() == Material.WALL_SIGN + || block.getType() == Material.SIGN_POST + || EssentialsSign.checkIfBlockBreaksSigns(block))) + { + event.setCancelled(true); + return; + } + for (Signs signs : Signs.values()) + { + final EssentialsSign sign = signs.getSign(); + if (sign.getBlocks().contains(block.getType()) + && !sign.onBlockPush(block, ess)) + { + event.setCancelled(true); + return; + } + } + } + } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index 555bb0114..4922b3dbb 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -21,7 +21,7 @@ import org.bukkit.inventory.ItemStack; public class SignProtection extends EssentialsSign { private final transient Set protectedBlocks = EnumSet.noneOf(Material.class); - + public SignProtection() { super("Protection"); @@ -30,7 +30,7 @@ public class SignProtection extends EssentialsSign protectedBlocks.add(Material.FURNACE); protectedBlocks.add(Material.DISPENSER); } - + @Override protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { @@ -43,14 +43,14 @@ public class SignProtection extends EssentialsSign player.sendMessage("§4You are not allowed to create sign here."); return false; } - + @Override protected boolean onSignBreak(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { final SignProtectionState state = checkProtectionSign(sign, player, username); return state == SignProtectionState.OWNER; } - + public boolean hasAdjacentBlock(final Block block, final Block... ignoredBlocks) { final Block[] faces = getAdjacentBlocks(block); @@ -70,7 +70,7 @@ public class SignProtection extends EssentialsSign } return false; } - + private void checkIfSignsAreBroken(final Block block, final User player, final String username, final IEssentials ess) { final Map signs = getConnectedSigns(block, player, username, false); @@ -88,14 +88,14 @@ public class SignProtection extends EssentialsSign } } } - + private Map getConnectedSigns(final Block block, final User user, final String username, boolean secure) { final Map signs = new HashMap(); getConnectedSigns(block, signs, user, username, secure ? 4 : 2); return signs; } - + private void getConnectedSigns(final Block block, final Map signs, final User user, final String username, final int depth) { final Block[] faces = getAdjacentBlocks(block); @@ -108,20 +108,20 @@ public class SignProtection extends EssentialsSign } final SignProtectionState check = checkProtectionSign(b, user, username); signs.put(loc, check); - + if (protectedBlocks.contains(b.getType()) && depth > 0) { getConnectedSigns(b, signs, user, username, depth - 1); } } } - - + + public enum SignProtectionState { NOT_ALLOWED, ALLOWED, NOSIGN, OWNER } - + private SignProtectionState checkProtectionSign(final Block block, final User user, final String username) { if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN) @@ -134,7 +134,7 @@ public class SignProtection extends EssentialsSign } return SignProtectionState.NOSIGN; } - + private SignProtectionState checkProtectionSign(final ISign sign, final User user, final String username) { if (user == null || username == null) @@ -163,20 +163,20 @@ public class SignProtection extends EssentialsSign } return SignProtectionState.NOT_ALLOWED; } - + private Block[] getAdjacentBlocks(final Block block) { return new Block[] { - block.getFace(BlockFace.NORTH), - block.getFace(BlockFace.SOUTH), - block.getFace(BlockFace.EAST), - block.getFace(BlockFace.WEST), - block.getFace(BlockFace.DOWN), - block.getFace(BlockFace.UP) + block.getRelative(BlockFace.NORTH), + block.getRelative(BlockFace.SOUTH), + block.getRelative(BlockFace.EAST), + block.getRelative(BlockFace.WEST), + block.getRelative(BlockFace.DOWN), + block.getRelative(BlockFace.UP) }; } - + public SignProtectionState isBlockProtected(final Block block, final User user, final String username, boolean secure) { final Map signs = getConnectedSigns(block, user, username, secure); @@ -194,7 +194,7 @@ public class SignProtection extends EssentialsSign } return retstate; } - + public boolean isBlockProtected(final Block block) { final Block[] faces = getAdjacentBlocks(block); @@ -211,7 +211,7 @@ public class SignProtection extends EssentialsSign if (protectedBlocks.contains(b.getType())) { final Block[] faceChest = getAdjacentBlocks(b); - + for (Block a : faceChest) { if (a.getType() == Material.SIGN_POST || a.getType() == Material.WALL_SIGN) @@ -227,20 +227,20 @@ public class SignProtection extends EssentialsSign } return false; } - + @Override public Set getBlocks() { return protectedBlocks; } - + @Override protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException { for (Block adjBlock : getAdjacentBlocks(block)) { final SignProtectionState state = isBlockProtected(adjBlock, player, username, true); - + if ((state == SignProtectionState.ALLOWED || state == SignProtectionState.NOT_ALLOWED) && !player.isAuthorized("essentials.signs.protection.override")) { @@ -249,66 +249,74 @@ public class SignProtection extends EssentialsSign } } return true; - + } - + @Override protected boolean onBlockInteract(final Block block, final User player, final String username, final IEssentials ess) throws SignException { final SignProtectionState state = isBlockProtected(block, player, username, false); - + if (state == SignProtectionState.OWNER || state == SignProtectionState.NOSIGN || state == SignProtectionState.ALLOWED) { return true; } - + if (state == SignProtectionState.NOT_ALLOWED && player.isAuthorized("essentials.signs.protection.override")) { return true; } - - + + player.sendMessage(Util.format("noAccessPermission", block.getType().toString().toLowerCase())); return false; } - + @Override protected boolean onBlockBreak(final Block block, final User player, final String username, final IEssentials ess) throws SignException { final SignProtectionState state = isBlockProtected(block, player, username, false); - + if (state == SignProtectionState.OWNER || state == SignProtectionState.NOSIGN) { checkIfSignsAreBroken(block, player, username, ess); return true; } - + if ((state == SignProtectionState.ALLOWED || state == SignProtectionState.NOT_ALLOWED) && player.isAuthorized("essentials.signs.protection.override")) { checkIfSignsAreBroken(block, player, username, ess); return true; } - - + + player.sendMessage(Util.format("noDestroyPermission", block.getType().toString().toLowerCase())); return false; } - + @Override public boolean onBlockExplode(final Block block, final IEssentials ess) { final SignProtectionState state = isBlockProtected(block, null, null, false); - + return state == SignProtectionState.NOSIGN; } - + @Override public boolean onBlockBurn(final Block block, final IEssentials ess) { final SignProtectionState state = isBlockProtected(block, null, null, false); - + + return state == SignProtectionState.NOSIGN; + } + + @Override + public boolean onBlockPush(final Block block, final IEssentials ess) + { + final SignProtectionState state = isBlockProtected(block, null, null, false); + return state == SignProtectionState.NOSIGN; } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index d50144956..1d6e7ef81 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -182,10 +182,16 @@ debug: false # Set the locale for all messages # If you don't set this, the default locale of the server will be used. +# Don't forget to remove the # infront of the line #locale: de_DE #turn off god mode when people exit remove-god-on-disconnect: false + +# Use the permission system of bukkit +# This only works if no other permission plugins are installed +use-bukkit-permissions: false + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # @@ -299,7 +305,7 @@ protect: on-placement: 10,11,46 on-use: # 46: TNT - on-break: 46 + on-break: # Users cannot PLACE these types of blocks/items. # < 255 designates a BLOCK @@ -311,7 +317,9 @@ protect: #prevent people from breaking blocks #break: 20,50 break: - + + # Which blocks should not be pushed by pistons + piston: # General physics/behavior modifications prevent: diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index cd7607c24..842d4a613 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -168,6 +168,7 @@ month = month months = months moreThanZero = Quantities must be greater than 0. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Player {0} muted. mutedPlayerFor = Player {0} muted for {1}. mutedUserSpeaks = {0} tried to speak, but is muted. @@ -182,6 +183,7 @@ nickSet = \u00a77Your nickname is now \u00a7c{0} noAccessCommand = \u00a7cYou do not have access to that command. noAccessPermission = \u00a7cYou do not have permission to access that {0}. noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}. +noHelpFound = \u00a7cNo matching commands. noHomeSet = You have not set a home. noHomeSetPlayer = Player has not set a home. noKitPermission = \u00a7cYou need the \u00a7c{0}\u00a7c permission to use that kit. @@ -213,8 +215,11 @@ playerInJail = \u00a7cPlayer is already in jail {0}. playerJailed = \u00a77Player {0} jailed. playerJailedFor = \u00a77Player {0} jailed for {1}. playerKicked = \u00a7cPlayer {0} kicked: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cPlayer {0} was never on this server. playerNotFound = \u00a7cPlayer not found. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index bd0352289..555e8c677 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -170,6 +170,7 @@ month = m\u00e5ned months = m\u00e5neder moreThanZero = M\u00e6ngder skal v\u00e6re st\u00f8rre end 0. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Spiller {0} d\u00e6mpet. mutedPlayerFor = Spiller {0} d\u00e6mpet for {1}. mutedUserSpeaks = {0} pr\u00f8vede at snakke, men er muted. @@ -184,6 +185,7 @@ nickSet = \u00a77Dit kaldenavn er nu \u00a7c{0} noAccessCommand = \u00a7cDu har ikke adgang til den kommando. noAccessPermission = \u00a7cDu har ikke tilladelse til at f\u00e5 adgang til det {0}. noDestroyPermission = \u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge det {0}. +noHelpFound = \u00a7cNo matching commands. noHomeSet = Du har sat et nyt hjem. noHomeSetPlayer = Spiller har ikke sat et hjem. noKitPermission = \u00a7cDu har brug for \u00a7c{0}\u00a7c tilladelsen for at bruge den pakke. @@ -215,8 +217,11 @@ playerInJail = \u00a7cSpiller er allerede i f\u00e6ngsel {0}. playerJailed = \u00a77Spiller {0} f\u00e6ngslet. playerJailedFor = \u00a77Spiller {0} f\u00e6ngslet for {1}. playerKicked = \u00a7cPlayer {0} kicked: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cSpiller {0} var aldrig p\u00e5 denne server. playerNotFound = \u00a7cSpiller ikke fundet. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77Mulige verdener er numrene 0 igennem {0}. powerToolAir = Kommando kan ikke blive tildelt luft. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 5161fe335..b4a222c4e 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -168,6 +168,7 @@ month = Monat months = Monate moreThanZero = Anzahl muss gr\u00f6sser als 0 sein. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Player {0} ist nun stumm. mutedPlayerFor = Player {0} ist nun stumm f\u00fcr {1}. mutedUserSpeaks = {0} versuchte zu sprechen, aber ist stumm geschalt. @@ -182,6 +183,7 @@ nickSet = \u00a77Dein Nickname ist nun \u00a7c{0} noAccessCommand = \u00a7cDu hast keinen Zugriff auf diesen Befehl. noAccessPermission = \u00a7cDu hast keine Rechte, den Block {0} zu \u00f6ffnen. noDestroyPermission = \u00a7cDu hast keine Rechte, den Block {0} zu zerst\u00f6ren. +noHelpFound = \u00a7cNo matching commands. noHomeSet = Du hast kein Zuhause gesetzt. noHomeSetPlayer = Spieler hat kein Zuhause gesetzt. noKitPermission = \u00a7cDu brauchst die Berechtigung \u00a7c{0}\u00a7c um diese Ausr\u00fcstung anzufordern. @@ -213,8 +215,11 @@ playerInJail = \u00a7cSpieler ist bereits in Gef\u00e4ngnis {0}. playerJailed = \u00a77Spieler {0} eingesperrt. playerJailedFor = \u00a77Spieler {0} eingesperrt f\u00fcr {1}. playerKicked = \u00a7cSpieler {0} rausgeworfen: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cSpieler {0} war niemals auf diesem Server. playerNotFound = \u00a7cSpieler nicht gefunden. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77M\u00f6gliche Welten sind nummeriet von 0 bis {0}. powerToolAir = Befehl kann nicht mit Luft verbunden werden. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index d65e6fd7f..9f0bbc6bc 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -168,6 +168,7 @@ month = month months = months moreThanZero = Quantities must be greater than 0. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Player {0} muted. mutedPlayerFor = Player {0} muted for {1}. mutedUserSpeaks = {0} tried to speak, but is muted. @@ -214,8 +215,11 @@ playerInJail = \u00a7cPlayer is already in jail {0}. playerJailed = \u00a77Player {0} jailed. playerJailedFor = \u00a77Player {0} jailed for {1}. playerKicked = \u00a7cPlayer {0} kicked: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cPlayer {0} was never on this server. playerNotFound = \u00a7cPlayer not found. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index e5591cb96..4c5f757db 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -168,6 +168,7 @@ month = mois months = mois moreThanZero = Les Quantit\u00e9s doivent \u00eatre sup\u00e9rieures \u00e0 z\u00e9ro. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Le joueur {0} est d\u00e9sormais muet. mutedPlayerFor = {0} a \u00e9t\u00e9 mute pour {1}. mutedUserSpeaks = {0} a essay\u00e9 de parler mais est muet. @@ -182,6 +183,7 @@ nickSet = \u00a77Votre pseudo est maintenant \u00a7c{0} noAccessCommand = \u00a7cVous n''avez pas acc\u00e8s \u00e0 cette commande. noAccessPermission = \u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noDestroyPermission = \u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. +noHelpFound = \u00a7cNo matching commands. noHomeSet = Vous n''avez pas d\u00e9fini de home. noHomeSetPlayer = Le joueur n''a pas d\u00e9fini son home. noKitPermission = \u00a7cVous avez besoin de la permission \u00a7c{0}\u00a7c pour utiliser ce kit. @@ -213,8 +215,11 @@ playerInJail = \u00a7cLe joueur est d\u00e9j\u00e0 dans la prison {0}. playerJailed = \u00a77Le joueur {0} a \u00e9t\u00e9 emprisonn\u00e9. playerJailedFor = \u00a77{0} a \u00e9t\u00e9 emprisonn\u00e9 pour {1}. playerKicked = \u00a7cPlayer {0} kicked: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cLe joueur {0} n''a jamais \u00e9t\u00e9 sur le serveur. playerNotFound = \u00a7cLe joueur est introuvable. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77Les mondes possibles sont les nombres 0 par {0}. powerToolAir = La commande ne peut pas \u00eatre attach\u00e9e \u00e0 l''air. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 5091b6d42..85184886f 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -169,6 +169,7 @@ month = maand months = maanden moreThanZero = Aantal moet groter zijn dan 0. msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt = \u00a7cYou may not mute that player. mutedPlayer = Speler {0} gemute. mutedPlayerFor = Speler {0} is gemute voor {1}. mutedUserSpeaks = {0} probeerde te praten, maar is gemute. @@ -183,6 +184,7 @@ nickSet = \u00a77Je nickname is nu \u00a7c{0} noAccessCommand = \u00a7cJe hebt geen toegang tot die opdracht. noAccessPermission = \u00a7cJe hebt hier geen toegang voor {0}. noDestroyPermission = \u00a7cJe hebt geen toegang om dat te vernietigen {0}. +noHelpFound = \u00a7cNo matching commands. noHomeSet = Je hebt geen home gemaakt. noHomeSetPlayer = Speler heeft geen home. noKitPermission = \u00a7cJe hebt de \u00a7c{0}\u00a7c toestemming nodig om die kit te gebruiken. @@ -214,8 +216,11 @@ playerInJail = \u00a7cSpeler zit al in de gevangenis {0}. playerJailed = \u00a77Speler {0} is in de gevangenis gezet. playerJailedFor = \u00a77Speler {0} is in de gevangenis gezet voor {1}. playerKicked = \u00a7cPlayer {0} kicked: {1} +playerMuted = "\u00a77You have been muted" +playerMutedFor = "\u00a77You have been muted for {0}" playerNeverOnServer = \u00a7cSpeler {0} is nooit op deze server geweest. playerNotFound = \u00a7cSpeler niet gevonden. +playerUnmuted = "\u00a77You have been unmuted" pong = Pong! possibleWorlds = \u00a77Mogelijk zijn de werelden de nummer 0 tot en met {0}. powerToolAir = Command kan niet worden bevestigd aan de lucht. diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 1d2ddd9c1..a8e8dd89b 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -4,6 +4,7 @@ import com.avaje.ebean.config.ServerConfig; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Server; @@ -244,4 +245,9 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + public World getWorld(UUID uuid) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 18acd9be3..53843843f 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -45,6 +45,8 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this); + pm.registerEvent(Type.BLOCK_PISTON_EXTEND, blockListener, Priority.Highest, this); + pm.registerEvent(Type.BLOCK_PISTON_RETRACT, blockListener, Priority.Highest, this); final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this); pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index 1b9736a5a..7b5f93d0e 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -14,6 +14,8 @@ import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockListener; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; @@ -58,7 +60,7 @@ public class EssentialsProtectBlockListener extends BlockListener prot.alert(user, blockPlaced.getType().toString(), Util.i18n("alertPlaced")); } - final Block below = blockPlaced.getFace(BlockFace.DOWN); + final Block below = blockPlaced.getRelative(BlockFace.DOWN); if (below.getType() == Material.RAILS && prot.getSettingBool(ProtectConfig.prevent_block_on_rail) && prot.getStorage().isProtected(below, user.getName())) @@ -75,7 +77,7 @@ public class EssentialsProtectBlockListener extends BlockListener protect.add(blockPlaced); if (prot.getSettingBool(ProtectConfig.protect_below_rails)) { - protect.add(blockPlaced.getFace(BlockFace.DOWN)); + protect.add(blockPlaced.getRelative(BlockFace.DOWN)); } } if ((blockPlaced.getType() == Material.SIGN_POST || blockPlaced.getType() == Material.WALL_SIGN) @@ -115,7 +117,7 @@ public class EssentialsProtectBlockListener extends BlockListener return; } if (event.getBlock().getType() == Material.OBSIDIAN - || event.getBlock().getFace(BlockFace.DOWN).getType() == Material.OBSIDIAN) + || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.OBSIDIAN) { event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_portal_creation)); return; @@ -260,14 +262,14 @@ public class EssentialsProtectBlockListener extends BlockListener storage.unprotectBlock(block); if (type == Material.RAILS || type == Material.SIGN_POST) { - final Block below = block.getFace(BlockFace.DOWN); + final Block below = block.getRelative(BlockFace.DOWN); storage.unprotectBlock(below); } else { for (BlockFace blockFace : faces) { - final Block against = block.getFace(blockFace); + final Block against = block.getRelative(blockFace); storage.unprotectBlock(against); } } @@ -276,7 +278,7 @@ public class EssentialsProtectBlockListener extends BlockListener { for (BlockFace blockFace : faces) { - final Block against = block.getFace(blockFace); + final Block against = block.getRelative(blockFace); storage.unprotectBlock(against); } } @@ -296,14 +298,14 @@ public class EssentialsProtectBlockListener extends BlockListener storage.unprotectBlock(block); if (type == Material.RAILS || type == Material.SIGN_POST) { - final Block below = block.getFace(BlockFace.DOWN); + final Block below = block.getRelative(BlockFace.DOWN); storage.unprotectBlock(below); } else { for (BlockFace blockFace : faces) { - final Block against = block.getFace(blockFace); + final Block against = block.getRelative(blockFace); storage.unprotectBlock(against); } } @@ -312,11 +314,107 @@ public class EssentialsProtectBlockListener extends BlockListener { for (BlockFace blockFace : faces) { - final Block against = block.getFace(blockFace); + final Block against = block.getRelative(blockFace); storage.unprotectBlock(against); } } } } } + + @Override + public void onBlockPistonExtend(BlockPistonExtendEvent event) + { + if (event.isCancelled()) + { + return; + } + 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) + && prot.getSettingBool(ProtectConfig.protect_rails)) + { + event.setCancelled(true); + return; + } + if (prot.getSettingBool(ProtectConfig.protect_signs)) + { + for (BlockFace blockFace : faces) + { + if (blockFace == BlockFace.DOWN) + { + continue; + } + final Block sign = block.getRelative(blockFace); + if ((blockFace == BlockFace.UP || blockFace == BlockFace.SELF) + && sign.getType() == Material.SIGN_POST) + { + event.setCancelled(true); + return; + } + if ((blockFace == BlockFace.NORTH || blockFace == BlockFace.EAST + || blockFace == BlockFace.SOUTH || blockFace == BlockFace.WEST + || blockFace == BlockFace.SELF) + && sign.getType() == Material.WALL_SIGN) + { + event.setCancelled(true); + return; + } + } + } + } + } + + @Override + public void onBlockPistonRetract(BlockPistonRetractEvent event) + { + if (event.isCancelled() || !event.isSticky()) + { + 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) + && prot.getSettingBool(ProtectConfig.protect_rails)) + { + event.setCancelled(true); + return; + } + if (prot.getSettingBool(ProtectConfig.protect_signs)) + { + for (BlockFace blockFace : faces) + { + if (blockFace == BlockFace.DOWN) + { + continue; + } + final Block sign = block.getRelative(blockFace); + if ((blockFace == BlockFace.UP || blockFace == BlockFace.SELF) + && sign.getType() == Material.SIGN_POST) + { + event.setCancelled(true); + return; + } + if ((blockFace == BlockFace.NORTH || blockFace == BlockFace.EAST + || blockFace == BlockFace.SOUTH || blockFace == BlockFace.WEST + || blockFace == BlockFace.SELF) + && sign.getType() == Material.WALL_SIGN) + { + event.setCancelled(true); + return; + } + } + } + } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index defbde243..ceb72bd8d 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -240,19 +240,19 @@ public class EssentialsProtectEntityListener extends EntityListener for (Block block : event.blockList()) { - if ((block.getType() == Material.RAILS || block.getFace(BlockFace.UP).getType() == Material.RAILS) + if ((block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.RAILS) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); return; } if ((block.getType() == Material.WALL_SIGN - || block.getFace(BlockFace.NORTH).getType() == Material.WALL_SIGN - || block.getFace(BlockFace.EAST).getType() == Material.WALL_SIGN - || block.getFace(BlockFace.SOUTH).getType() == Material.WALL_SIGN - || block.getFace(BlockFace.WEST).getType() == Material.WALL_SIGN + || block.getRelative(BlockFace.NORTH).getType() == Material.WALL_SIGN + || block.getRelative(BlockFace.EAST).getType() == Material.WALL_SIGN + || block.getRelative(BlockFace.SOUTH).getType() == Material.WALL_SIGN + || block.getRelative(BlockFace.WEST).getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST - || block.getFace(BlockFace.UP).getType() == Material.SIGN_POST) + || block.getRelative(BlockFace.UP).getType() == Material.SIGN_POST) && prot.getSettingBool(ProtectConfig.protect_signs)) { event.setCancelled(true); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index 75824c368..950da0ebf 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -45,7 +45,8 @@ public enum ProtectConfig alert_on_break("protect.alert.on-break"), blacklist_placement("protect.blacklist.placement"), blacklist_usage("protect.blacklist.usage"), - blacklist_break("protect.blacklist.break"); + blacklist_break("protect.blacklist.break"), + blacklist_piston("protect.blacklist.piston"); private final String configName; private final String defValueString; private final boolean defValueBoolean; diff --git a/lib/bukkit-0.0.1-SNAPSHOT.jar b/lib/bukkit-0.0.1-SNAPSHOT.jar index e6adbd697..011a54e63 100644 Binary files a/lib/bukkit-0.0.1-SNAPSHOT.jar and b/lib/bukkit-0.0.1-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-0.0.1-SNAPSHOT.jar b/lib/craftbukkit-0.0.1-SNAPSHOT.jar index f66289350..7aff0e06c 100644 Binary files a/lib/craftbukkit-0.0.1-SNAPSHOT.jar and b/lib/craftbukkit-0.0.1-SNAPSHOT.jar differ