diff options
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java')
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index 7543a5244..98daecb97 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -1,14 +1,14 @@ 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.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.inventory.ItemStack; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; -import org.bukkit.Material; -import org.bukkit.event.block.Action; public class EssentialsProtectPlayerListener extends PlayerListener @@ -25,10 +25,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener @Override public void onPlayerInteract(final PlayerInteractEvent event) { - if (event.isCancelled()) - { - return; - } + // Do not return if cancelled, because the interact event has 2 cancelled states. final User user = ess.getUser(event.getPlayer()); if (event.hasItem() @@ -38,7 +35,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener { if (ess.getSettings().warnOnBuildDisallow()) { - user.sendMessage(Util.i18n("buildAlert")); + user.sendMessage(_("buildAlert")); } event.setCancelled(true); return; @@ -48,7 +45,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener { if (ess.getSettings().warnOnBuildDisallow()) { - user.sendMessage(Util.i18n("buildAlert")); + user.sendMessage(_("buildAlert")); } event.setCancelled(true); return; @@ -80,13 +77,13 @@ public class EssentialsProtectPlayerListener extends PlayerListener final String ownerNames = stringBuilder.toString(); if (ownerNames != null && !ownerNames.isEmpty()) { - user.sendMessage(Util.format("protectionOwner", ownerNames)); + user.sendMessage(_("protectionOwner", ownerNames)); } } if (item != null && prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId())) { - prot.alert(user, item.getType().toString(), Util.i18n("alertUsed")); + prot.alert(user, item.getType().toString(), _("alertUsed")); } } } |