diff --git a/Essentials/src/com/earth2me/essentials/Backup.java b/Essentials/src/com/earth2me/essentials/Backup.java index 1e9115e8737..419ea06caea 100644 --- a/Essentials/src/com/earth2me/essentials/Backup.java +++ b/Essentials/src/com/earth2me/essentials/Backup.java @@ -10,7 +10,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Backup implements Runnable { @@ -73,7 +73,7 @@ public void run() { active = false; return; } - LOGGER.log(Level.INFO, tl("backupStarted")); + LOGGER.log(Level.INFO, tlp(null, "backupStarted")); final CommandSender cs = server.getConsoleSender(); server.dispatchCommand(cs, "save-all"); server.dispatchCommand(cs, "save-off"); @@ -121,7 +121,7 @@ public void run() { stopTask(); } active = false; - LOGGER.log(Level.INFO, tl("backupFinished")); + LOGGER.log(Level.INFO, tlp(null, "backupFinished")); } } ess.scheduleSyncDelayedTask(new BackupEnableSaveTask()); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 97630f72b61..d4e15ae0ba1 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -15,7 +15,7 @@ import java.util.logging.Logger; import java.util.regex.Pattern; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class EssentialsEntityListener implements Listener { @@ -143,7 +143,7 @@ public void onPlayerDeathEvent(final PlayerDeathEvent event) { final User user = ess.getUser(event.getEntity()); if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back")) { user.setLastLocation(); - user.sendMessage(tl("backAfterDeath")); + user.sendMessage(tlp(user, "backAfterDeath")); } if (!ess.getSettings().areDeathMessagesEnabled()) { event.setDeathMessage(""); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index d67e8d9c6fb..c0890a2e470 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -44,7 +44,7 @@ import java.util.logging.Logger; import java.util.regex.Pattern; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class EssentialsPlayerListener implements Listener { @@ -80,8 +80,8 @@ public void onPlayerChat(final AsyncPlayerChatEvent event) { final User user = ess.getUser(event.getPlayer()); if (user.isMuted()) { event.setCancelled(true); - user.sendMessage(tl("voiceSilenced")); - LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage())); + user.sendMessage(tlp(user, "voiceSilenced")); + LOGGER.info(tlp(null, "mutedUserSpeaks", user.getName(), event.getMessage())); } try { final Iterator it = event.getRecipients().iterator(); @@ -276,7 +276,7 @@ public void run() { final List mail = user.getMails(); if (mail.isEmpty()) { if (ess.getSettings().isNotifyNoNewMail()) { - user.sendMessage(tl("noNewMail")); // Only notify if they want us to. + user.sendMessage(tlp(user, "noNewMail")); // Only notify if they want us to. } } else { user.notifyOfMail(); @@ -289,7 +289,7 @@ public void run() { user.getBase().setAllowFlight(true); user.getBase().setFlying(true); if (ess.getSettings().isSendFlyEnableOnJoin()) { - user.getBase().sendMessage(tl("flyMode", tl("enabled"), user.getDisplayName())); + user.getBase().sendMessage(tlp(user, "flyMode", tlp(user, "enabled"), user.getDisplayName())); } } } @@ -369,14 +369,14 @@ public void onPlayerLoginBanned(final PlayerLoginEvent event) { Date banExpiry = banEntry.getExpiration(); if (banExpiry != null) { String expiry = DateUtil.formatDateDiff(banExpiry.getTime()); - event.setKickMessage(tl("tempbanJoin", expiry, banEntry.getReason())); + event.setKickMessage(tlp(event.getPlayer(), "tempbanJoin", expiry, banEntry.getReason())); } else { - event.setKickMessage(tl("banJoin", banEntry.getReason())); + event.setKickMessage(tlp(event.getPlayer(), "banJoin", banEntry.getReason())); } } else { banEntry = ess.getServer().getBanList(BanList.Type.IP).getBanEntry(event.getAddress().getHostAddress()); if (banEntry != null) { - event.setKickMessage(tl("banIpJoin", banEntry.getReason())); + event.setKickMessage(tlp(event.getPlayer(), "banIpJoin", banEntry.getReason())); } } break; @@ -394,7 +394,7 @@ public void onPlayerLogin(final PlayerLoginEvent event) { event.allow(); return; } - event.disallow(Result.KICK_FULL, tl("serverFull")); + event.disallow(Result.KICK_FULL, tlp(kfuser, "serverFull")); break; default: break; @@ -456,10 +456,10 @@ public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) for (User spyer : ess.getOnlineUsers()) { if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) { if (user.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers()) { - spyer.sendMessage(tl("socialSpyMutedPrefix") + player.getDisplayName() + ": " + event.getMessage()); + spyer.sendMessage(tlp(spyer, "socialSpyMutedPrefix") + player.getDisplayName() + ": " + event.getMessage()); } else { - spyer.sendMessage(tl("socialSpyPrefix") + player.getDisplayName() + ": " + event.getMessage()); + spyer.sendMessage(tlp(spyer, "socialSpyPrefix") + player.getDisplayName() + ": " + event.getMessage()); } } } @@ -469,8 +469,8 @@ public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) if (ess.getUser(player).isMuted() && (ess.getSettings().getMuteCommands().contains(cmd) || ess.getSettings().getMuteCommands().contains("*"))) { event.setCancelled(true); - player.sendMessage(tl("voiceSilenced")); - LOGGER.info(tl("mutedUserSpeaks", player.getName(), event.getMessage())); + player.sendMessage(tlp(ess.getUser(player), "voiceSilenced")); + LOGGER.info(tlp(null, "mutedUserSpeaks", player.getName(), event.getMessage())); return; } @@ -512,7 +512,7 @@ public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) // User's current cooldown hasn't expired, inform and terminate cooldown code. if (entry.getValue() > System.currentTimeMillis()) { String commandCooldownTime = DateUtil.formatDateDiff(entry.getValue()); - user.sendMessage(tl("commandCooldown", commandCooldownTime)); + user.sendMessage(tlp(user, "commandCooldown", commandCooldownTime)); cooldownFound = true; event.setCancelled(true); break; @@ -571,11 +571,11 @@ public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) { if (ess.getSettings().getNoGodWorlds().contains(newWorld) && user.isGodModeEnabledRaw()) { // Player god mode is never disabled in order to retain it when changing worlds once more. // With that said, players will still take damage as per the result of User#isGodModeEnabled() - user.sendMessage(tl("noGodWorldWarning")); + user.sendMessage(tlp(user, "noGodWorldWarning")); } if (!user.getWorld().getName().equals(newWorld)) { - user.sendMessage(tl("currentWorld", newWorld)); + user.sendMessage(tlp(user, "currentWorld", newWorld)); } if (user.isVanished()) { user.setVanished(user.isAuthorized("essentials.vanish")); @@ -590,7 +590,7 @@ public void onPlayerInteract(final PlayerInteractEvent event) { User player = ess.getUser(event.getPlayer()); if (player.isAuthorized("essentials.sethome.bed")) { player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation()); - player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())); + player.sendMessage(tlp(player, "bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())); } } break; diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java index 91d91583f7d..c3ef7ab95fc 100644 --- a/Essentials/src/com/earth2me/essentials/I18n.java +++ b/Essentials/src/com/earth2me/essentials/I18n.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import java.io.File; import java.io.FileInputStream; @@ -14,6 +15,10 @@ import java.util.logging.Logger; import java.util.regex.Pattern; +import com.earth2me.essentials.utils.FormatUtil; + +import org.bukkit.entity.Player; + public class I18n implements net.ess3.api.II18n { private static I18n instance; @@ -69,6 +74,23 @@ private String translate(final String string) { } } + @SuppressWarnings("deprecation") + public static String tlp(final Object target, final String string, final Object... objects) { + String formatted = string; + if (target instanceof IUser) { + formatted = FormatUtil.placeholderAPIFormat((IUser) target, string); + } else if (target instanceof Player) { + formatted = FormatUtil.placeholderAPIFormat((Player) target, string); + } else if (target instanceof CommandSource && ((CommandSource) target).getSender() instanceof Player) { + formatted = FormatUtil.placeholderAPIFormat((Player) ((CommandSource) target).getSender(), string); + } else { + formatted = FormatUtil.placeholderAPIFormat((Player) null, string); + } + + return tl(formatted, objects); + } + + @Deprecated public static String tl(final String string, final Object... objects) { if (instance == null) { return ""; diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index ba793d7376a..c39c6b022ff 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -23,6 +23,7 @@ import java.util.regex.Pattern; import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class ItemDb implements IConf, net.ess3.api.IItemDb { @@ -232,7 +233,7 @@ public List getMatching(User user, String[] args) throws Exception { } if (is.isEmpty() || is.get(0).getType() == Material.AIR) { - throw new Exception(tl("itemSellAir")); + throw new Exception(tlp(user, "itemSellAir")); } return is; diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index 4d5a71493a8..e57c9e7f16d 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -17,6 +17,7 @@ import java.util.logging.Level; import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Kit { @@ -42,7 +43,7 @@ public String getName() { public void checkPerms(final User user) throws Exception { if (!user.isAuthorized("essentials.kits." + kitName)) { - throw new Exception(tl("noKitPermission", "essentials.kits." + kitName)); + throw new Exception(tlp(user, "noKitPermission", "essentials.kits." + kitName)); } } @@ -52,10 +53,10 @@ public void checkDelay(final User user) throws Exception { if (nextUse == 0L) { return; } else if (nextUse < 0L) { - user.sendMessage(tl("kitOnce")); + user.sendMessage(tlp(user, "kitOnce")); throw new NoChargeException(); } else { - user.sendMessage(tl("kitTimed", DateUtil.formatDateDiff(nextUse))); + user.sendMessage(tlp(user, "kitTimed", DateUtil.formatDateDiff(nextUse))); throw new NoChargeException(); } } @@ -85,7 +86,7 @@ public long getNextUse(final User user) throws Exception { // Make sure delay is valid delay = kit.containsKey("delay") ? ((Number) kit.get("delay")).doubleValue() : 0.0d; } catch (Exception e) { - throw new Exception(tl("kitError2")); + throw new Exception(tlp(user, "kitError2")); } // When was the last kit used? @@ -203,12 +204,12 @@ public void expandItems(final User user, final List items) throws Except } user.getBase().updateInventory(); if (spew) { - user.sendMessage(tl("kitInvFull")); + user.sendMessage(tlp(user, "kitInvFull")); } } catch (Exception e) { user.getBase().updateInventory(); ess.getLogger().log(Level.WARNING, e.getMessage()); - throw new Exception(tl("kitError2"), e); + throw new Exception(tlp(user, "kitError2"), e); } } } diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index bb4e7c03ecf..3bcb9e3ed22 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -30,6 +30,7 @@ import java.util.regex.Pattern; import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class MetaItemStack { @@ -476,7 +477,7 @@ public Enchantment getEnchantment(final User user, final String name) throws Exc final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); if (!hasMetaPermission(user, "enchantments." + enchantmentName, true, false)) { - throw new Exception(tl("enchantmentPerm", enchantmentName)); + throw new Exception(tlp(user, "enchantmentPerm", enchantmentName)); } return enchantment; } @@ -550,7 +551,7 @@ private boolean hasMetaPermission(final User user, final String metaPerm, final if (graceful) { return false; } else { - throw new Exception(tl("noMetaPerm", metaPerm)); + throw new Exception(tlp(user, "noMetaPerm", metaPerm)); } } diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index 9ae33429055..f06de62b7ad 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -15,7 +15,7 @@ import java.util.*; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class SpawnMob { @@ -28,7 +28,7 @@ public static String mobList(final User user) { } } if (availableList.isEmpty()) { - availableList.add(tl("none")); + availableList.add(tlp(user, "none")); } return StringUtil.joinList(availableList); } @@ -70,7 +70,7 @@ public static List mobData(final String mobString) { public static void spawnmob(final IEssentials ess, final Server server, final User user, final List parts, final List data, int mobCount) throws Exception { final Block block = LocationUtil.getTarget(user.getBase()).getBlock(); if (block == null) { - throw new Exception(tl("unableToSpawnMob")); + throw new Exception(tlp(user, "unableToSpawnMob")); } spawnmob(ess, server, user.getSource(), user, block.getLocation(), parts, data, mobCount); } @@ -101,7 +101,7 @@ public static void spawnmob(final IEssentials ess, final Server server, final Co if (mobCount > effectiveLimit) { mobCount = effectiveLimit; - sender.sendMessage(tl("mobSpawnLimit")); + sender.sendMessage(tlp(sender, "mobSpawnLimit")); } Mob mob = Mob.fromName(parts.get(0)); // Get the first mob @@ -109,13 +109,13 @@ public static void spawnmob(final IEssentials ess, final Server server, final Co for (int i = 0; i < mobCount; i++) { spawnMob(ess, server, sender, target, sloc, parts, data); } - sender.sendMessage(mobCount * parts.size() + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + tl("spawned")); + sender.sendMessage(mobCount * parts.size() + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + tlp(sender, "spawned")); } catch (MobException e1) { - throw new Exception(tl("unableToSpawnMob"), e1); + throw new Exception(tlp(sender, "unableToSpawnMob"), e1); } catch (NumberFormatException e2) { - throw new Exception(tl("numberRequired"), e2); + throw new Exception(tlp(sender, "numberRequired"), e2); } catch (NullPointerException np) { - throw new Exception(tl("soloMob"), np); + throw new Exception(tlp(sender, "soloMob"), np); } } @@ -155,15 +155,15 @@ private static void spawnMob(final IEssentials ess, final Server server, final C private static void checkSpawnable(IEssentials ess, CommandSource sender, Mob mob) throws Exception { if (mob == null || mob.getType() == null) { - throw new Exception(tl("invalidMob")); + throw new Exception(tlp(sender, "invalidMob")); } if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) { - throw new Exception(tl("disabledToSpawnMob")); + throw new Exception(tlp(sender, "disabledToSpawnMob")); } if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.spawnmob." + mob.name.toLowerCase(Locale.ENGLISH))) { - throw new Exception(tl("noPermToSpawnMob")); + throw new Exception(tlp(sender, "noPermToSpawnMob")); } } @@ -171,7 +171,7 @@ private static void changeMobData(final CommandSource sender, final EntityType t String data = inputData; if (data.isEmpty()) { - sender.sendMessage(tl("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned)))); + sender.sendMessage(tlp(sender, "mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned)))); } if (spawned instanceof Zombie) { diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index e45523a0ab9..69b00b898b6 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -4,6 +4,8 @@ import com.earth2me.essentials.utils.LocationUtil; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.api.events.UserWarpEvent; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerRespawnEvent; @@ -13,7 +15,7 @@ import java.util.Calendar; import java.util.GregorianCalendar; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Teleport implements net.ess3.api.ITeleport { @@ -59,7 +61,7 @@ && cooldownApplies()) { time.setTimeInMillis(lastTime); time.add(Calendar.SECOND, (int) cooldown); time.add(Calendar.MILLISECOND, (int) ((cooldown * 1000.0) % 1000.0)); - throw new Exception(tl("timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis()))); + throw new Exception(tlp(teleportOwner, "timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis()))); } } // if justCheck is set, don't update lastTeleport; we're just checking @@ -91,7 +93,7 @@ private void warnUser(final IUser user, final double delay) { Calendar c = new GregorianCalendar(); c.add(Calendar.SECOND, (int) delay); c.add(Calendar.MILLISECOND, (int) ((delay * 1000.0) % 1000.0)); - user.sendMessage(tl("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis()))); + user.sendMessage(tlp(user, "dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis()))); } //The now function is used when you want to skip tp delay when teleporting someone to a location or player. @@ -111,7 +113,7 @@ public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exc } final ITarget target = new PlayerTarget(entity); now(teleportOwner, target, cause); - teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); + teleportOwner.sendMessage(tlp(teleportOwner, "teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); } protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws Exception { @@ -127,7 +129,7 @@ protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws teleportee.getBase().teleport(LocationUtil.getSafeDestination(ess, teleportee, loc), cause); } } else { - throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + throw new Exception(tlp(teleportOwner, "unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } } else { if (ess.getSettings().isForceDisableTeleportSafety()) { @@ -158,7 +160,7 @@ public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws @Override public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception { ITarget target = new PlayerTarget(entity); - teleportOwner.sendMessage(tl("teleportToPlayer", entity.getDisplayName())); + teleportOwner.sendMessage(tlp(teleportOwner, "teleportToPlayer", entity.getDisplayName())); teleport(teleportOwner, target, chargeFor, cause); } @@ -173,8 +175,8 @@ public void teleportPlayer(IUser teleportee, Location loc, Trade chargeFor, Tele public void teleportPlayer(IUser teleportee, Player entity, Trade chargeFor, TeleportCause cause) throws Exception { ITarget target = new PlayerTarget(entity); teleport(teleportee, target, chargeFor, cause); - teleportee.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); - teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); + teleportee.sendMessage(tlp(teleportee, "teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); + teleportOwner.sendMessage(tlp(teleportOwner, "teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ())); } private void teleport(IUser teleportee, ITarget target, Trade chargeFor, TeleportCause cause) throws Exception { @@ -247,10 +249,17 @@ protected void respawnNow(IUser teleportee, TeleportCause cause) throws Exceptio //The warp function is a wrapper used to teleportPlayer a player to a /warp @Override public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { + UserWarpEvent event = new UserWarpEvent(teleportee, warp, chargeFor); + Bukkit.getServer().getPluginManager().callEvent(event); + + if(event.isCancelled()) { + return; + } + warp = event.getWarp(); Location loc = ess.getWarps().getWarp(warp); - teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + teleportee.sendMessage(tlp(teleportee, "warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); if (!teleportee.equals(teleportOwner)) { - teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + teleportOwner.sendMessage(tlp(teleportOwner, "warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } teleport(teleportee, new LocationTarget(loc), chargeFor, cause); } @@ -260,7 +269,7 @@ public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause c public void back(Trade chargeFor) throws Exception { tpType = TeleportType.BACK; final Location loc = teleportOwner.getLastLocation(); - teleportOwner.sendMessage(tl("backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + teleportOwner.sendMessage(tlp(teleportOwner, "backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); teleport(teleportOwner, new LocationTarget(loc), chargeFor, TeleportCause.COMMAND); } diff --git a/Essentials/src/com/earth2me/essentials/TimedTeleport.java b/Essentials/src/com/earth2me/essentials/TimedTeleport.java index 0544c6c8cb7..999276c2f89 100644 --- a/Essentials/src/com/earth2me/essentials/TimedTeleport.java +++ b/Essentials/src/com/earth2me/essentials/TimedTeleport.java @@ -7,7 +7,7 @@ import java.util.UUID; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class TimedTeleport implements Runnable { @@ -90,14 +90,14 @@ public void run() { try { teleport.cooldown(false); } catch (Exception ex) { - teleportOwner.sendMessage(tl("cooldownWithMessage", ex.getMessage())); + teleportOwner.sendMessage(tlp(teleportOwner, "cooldownWithMessage", ex.getMessage())); if (teleportOwner != teleportUser) { - teleportUser.sendMessage(tl("cooldownWithMessage", ex.getMessage())); + teleportUser.sendMessage(tlp(teleportUser, "cooldownWithMessage", ex.getMessage())); } } try { cancelTimer(false); - teleportUser.sendMessage(tl("teleportationCommencing")); + teleportUser.sendMessage(tlp(teleportUser, "teleportationCommencing")); try { if (timer_chargeFor != null) { @@ -131,9 +131,10 @@ public void cancelTimer(boolean notifyUser) { try { ess.getServer().getScheduler().cancelTask(timer_task); if (notifyUser) { - teleportOwner.sendMessage(tl("pendingTeleportCancelled")); + teleportOwner.sendMessage(tlp(teleportOwner, "pendingTeleportCancelled")); if (timer_teleportee != null && !timer_teleportee.equals(teleportOwner.getBase().getUniqueId())) { - ess.getUser(timer_teleportee).sendMessage(tl("pendingTeleportCancelled")); + IUser teleporteeUser = ess.getUser(timer_teleportee); + teleporteeUser.sendMessage(tlp(teleporteeUser, "pendingTeleportCancelled")); } } } finally { diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index e003dccacf2..306a8708d3f 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -21,7 +21,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Trade { @@ -87,20 +87,20 @@ public void isAffordableFor(final IUser user) throws ChargeException { } if (getMoney() != null && getMoney().signum() > 0 && !user.canAfford(getMoney())) { - throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); + throw new ChargeException(tlp(user, "notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); } if (getItemStack() != null && !user.getBase().getInventory().containsAtLeast(itemStack, itemStack.getAmount())) { - throw new ChargeException(tl("missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack()))); + throw new ChargeException(tlp(user, "missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack()))); } BigDecimal money; if (command != null && !command.isEmpty() && (money = getCommandCost(user)).signum() > 0 && !user.canAfford(money)) { - throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(money, ess))); + throw new ChargeException(tlp(user, "notEnoughMoney", NumberUtil.displayCurrency(money, ess))); } if (exp != null && exp > 0 && SetExpFix.getTotalExperience(user.getBase()) < exp) { - throw new ChargeException(tl("notEnoughExperience")); + throw new ChargeException(tlp(user, "notEnoughExperience")); } } @@ -183,7 +183,7 @@ public void charge(final IUser user) throws ChargeException { ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " money " + getMoney().toPlainString()); } if (!user.canAfford(getMoney()) && getMoney().signum() > 0) { - throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); + throw new ChargeException(tlp(user, "notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); } user.takeMoney(getMoney()); } @@ -192,7 +192,7 @@ public void charge(final IUser user) throws ChargeException { ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " itemstack " + getItemStack().toString()); } if (!user.getBase().getInventory().containsAtLeast(getItemStack(), getItemStack().getAmount())) { - throw new ChargeException(tl("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); + throw new ChargeException(tlp(user, "missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); } user.getBase().getInventory().removeItem(getItemStack()); user.getBase().updateInventory(); @@ -200,7 +200,7 @@ public void charge(final IUser user) throws ChargeException { if (command != null) { final BigDecimal cost = getCommandCost(user); if (!user.canAfford(cost) && cost.signum() > 0) { - throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(cost, ess))); + throw new ChargeException(tlp(user, "notEnoughMoney", NumberUtil.displayCurrency(cost, ess))); } user.takeMoney(cost); } @@ -210,7 +210,7 @@ public void charge(final IUser user) throws ChargeException { } final int experience = SetExpFix.getTotalExperience(user.getBase()); if (experience < getExperience() && getExperience() > 0) { - throw new ChargeException(tl("notEnoughExperience")); + throw new ChargeException(tlp(user, "notEnoughExperience")); } SetExpFix.setTotalExperience(user.getBase(), experience - getExperience()); } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index f6f502b172a..d52bf8a94be 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -35,7 +35,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class User extends UserData implements Comparable, IMessageRecipient, net.ess3.api.IUser { @@ -129,7 +129,7 @@ public void healCooldown() throws Exception { cooldownTime.add(Calendar.SECOND, (int) cooldown); cooldownTime.add(Calendar.MILLISECOND, (int) ((cooldown * 1000.0) % 1000.0)); if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass")) { - throw new Exception(tl("timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis()))); + throw new Exception(tlp(this, "timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis()))); } } setLastHealTimestamp(now.getTimeInMillis()); @@ -146,25 +146,25 @@ public void giveMoney(final BigDecimal value, final CommandSource initiator) thr return; } setMoney(getMoney().add(value)); - sendMessage(tl("addedToAccount", NumberUtil.displayCurrency(value, ess))); + sendMessage(tlp(this, "addedToAccount", NumberUtil.displayCurrency(value, ess))); if (initiator != null) { - initiator.sendMessage(tl("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); + initiator.sendMessage(tlp(this, "addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); } } @Override public void payUser(final User reciever, final BigDecimal value) throws Exception { if (value.compareTo(BigDecimal.ZERO) < 1) { - throw new Exception(tl("payMustBePositive")); + throw new Exception(tlp(this, "payMustBePositive")); } if (canAfford(value)) { setMoney(getMoney().subtract(value)); reciever.setMoney(reciever.getMoney().add(value)); - sendMessage(tl("moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName())); - reciever.sendMessage(tl("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName())); + sendMessage(tlp(this, "moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName())); + reciever.sendMessage(tlp(this, "moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName())); } else { - throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(value, ess))); + throw new ChargeException(tlp(this, "notEnoughMoney", NumberUtil.displayCurrency(value, ess))); } } @@ -183,9 +183,9 @@ public void takeMoney(final BigDecimal value, final CommandSource initiator) { } catch (MaxMoneyException ex) { ess.getLogger().log(Level.WARNING, "Invalid call to takeMoney, total balance can't be more than the max-money limit.", ex); } - sendMessage(tl("takenFromAccount", NumberUtil.displayCurrency(value, ess))); + sendMessage(tlp(this, "takenFromAccount", NumberUtil.displayCurrency(value, ess))); if (initiator != null) { - initiator.sendMessage(tl("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); + initiator.sendMessage(tlp(this, "takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); } } @@ -512,7 +512,7 @@ public boolean checkJailTimeout(final long currentTime) { if (!event.isCancelled()) { setJailTimeout(0); setJailed(false); - sendMessage(tl("haveBeenReleased")); + sendMessage(tlp(this, "haveBeenReleased")); setJail(null); try { getTeleport().back(); @@ -536,7 +536,7 @@ public boolean checkMuteTimeout(final long currentTime) { if (!event.isCancelled()) { setMuteTimeout(0); - sendMessage(tl("canTalkAgain")); + sendMessage(tlp(this, "canTalkAgain")); setMuted(false); return true; } @@ -549,7 +549,7 @@ public void updateActivity(final boolean broadcast) { setAfk(false); if (broadcast && !isHidden()) { setDisplayNick(); - final String msg = tl("userIsNotAway", getDisplayName()); + final String msg = tlp(null, "userIsNotAway", getDisplayName()); if (!msg.isEmpty()) { ess.broadcastMessage(this, msg); } @@ -581,14 +581,14 @@ public void checkActivity() { && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt")) { - final String kickReason = tl("autoAfkKickReason", autoafkkick / 60.0); + final String kickReason = tlp(this, "autoAfkKickReason", autoafkkick / 60.0); lastActivity = 0; this.getBase().kickPlayer(kickReason); for (User user : ess.getOnlineUsers()) { if (user.isAuthorized("essentials.kick.notify")) { - user.sendMessage(tl("playerKicked", Console.NAME, getName(), kickReason)); + user.sendMessage(tlp(user, "playerKicked", Console.NAME, getName(), kickReason)); } } } @@ -597,7 +597,7 @@ public void checkActivity() { setAfk(true); if (!isHidden()) { setDisplayNick(); - final String msg = tl("userIsAway", getDisplayName()); + final String msg = tlp(null, "userIsAway", getDisplayName()); if (!msg.isEmpty()) { ess.broadcastMessage(this, msg); } @@ -884,7 +884,7 @@ public void notifyOfMail() { if (mails != null && !mails.isEmpty()) { int notifyPlayerOfMailCooldown = ess.getSettings().getNotifyPlayerOfMailCooldown() * 1000; if (System.currentTimeMillis() - lastNotifiedAboutMailsMs >= notifyPlayerOfMailCooldown) { - sendMessage(tl("youHaveNewMail", mails.size())); + sendMessage(tlp(this, "youHaveNewMail", mails.size())); lastNotifiedAboutMailsMs = System.currentTimeMillis(); } } diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 1fe8f55819b..d07202c2eb5 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -17,7 +17,7 @@ import java.util.Map.Entry; import java.util.regex.Pattern; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public abstract class UserData extends PlayerExtension implements IConf { @@ -207,7 +207,7 @@ public void delHome(String name) throws Exception { config.removeProperty("homes." + search); config.save(); } else { - throw new Exception(tl("invalidHome", search)); + throw new Exception(tlp(null, "invalidHome", search)); } } diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index bff2f970fd9..873beb3721d 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -56,6 +56,7 @@ public Location getWarp(String warp) throws WarpNotFoundException, InvalidWorldE } @Override + @SuppressWarnings("deprecation") public void setWarp(String name, Location loc) throws Exception { String filename = StringUtil.sanitizeFileName(name); EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name)); @@ -77,6 +78,7 @@ public void setWarp(String name, Location loc) throws Exception { } @Override + @SuppressWarnings("deprecation") public void removeWarp(String name) throws Exception { EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name)); if (conf == null) { @@ -89,6 +91,7 @@ public void removeWarp(String name) throws Exception { } @Override + @SuppressWarnings("deprecation") public final void reloadConfig() { warpPoints.clear(); File[] listOfFiles = warpsFolder.listFiles(); diff --git a/Essentials/src/com/earth2me/essentials/Worth.java b/Essentials/src/com/earth2me/essentials/Worth.java index d029f3f5922..f3a6308b909 100644 --- a/Essentials/src/com/earth2me/essentials/Worth.java +++ b/Essentials/src/com/earth2me/essentials/Worth.java @@ -9,7 +9,7 @@ import java.math.BigDecimal; import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Worth implements IConf { @@ -69,7 +69,7 @@ public BigDecimal getPrice(ItemStack itemStack) { public int getAmount(IEssentials ess, User user, ItemStack is, String[] args, boolean isBulkSell) throws Exception { if (is == null || is.getType() == Material.AIR) { - throw new Exception(tl("itemSellAir")); + throw new Exception(tlp(user, "itemSellAir")); } int id = is.getTypeId(); int amount = 0; @@ -89,7 +89,7 @@ public int getAmount(IEssentials ess, User user, ItemStack is, String[] args, bo boolean requireStack = ess.getSettings().isTradeInStacks(id); if (requireStack && !stack) { - throw new Exception(tl("itemMustBeStacked")); + throw new Exception(tlp(user, "itemMustBeStacked")); } int max = 0; @@ -112,9 +112,9 @@ public int getAmount(IEssentials ess, User user, ItemStack is, String[] args, bo } if (amount > max || amount < 1) { if (!isBulkSell) { - user.sendMessage(tl("itemNotEnough2")); - user.sendMessage(tl("itemNotEnough3")); - throw new Exception(tl("itemNotEnough1")); + user.sendMessage(tlp(user, "itemNotEnough2")); + user.sendMessage(tlp(user, "itemNotEnough3")); + throw new Exception(tlp(user, "itemNotEnough1")); } else { return amount; } diff --git a/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java b/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java index 6e22640c92f..6c7fdd9fda4 100644 --- a/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java +++ b/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java @@ -1,13 +1,19 @@ package com.earth2me.essentials.api; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; + +import net.ess3.api.IUser; public class InvalidWorldException extends Exception { private final String world; public InvalidWorldException(final String world) { - super(tl("invalidWorld")); + this(null, world); + } + + public InvalidWorldException(final IUser target, final String world) { + super(tlp(target, "invalidWorld")); this.world = world; } diff --git a/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java b/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java index 316ee63652f..4da3ada8ac8 100644 --- a/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java +++ b/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java @@ -1,10 +1,16 @@ package com.earth2me.essentials.api; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; + +import net.ess3.api.IUser; public class UserDoesNotExistException extends Exception { - public UserDoesNotExistException(String name) { - super(tl("userDoesNotExist", name)); + public UserDoesNotExistException(final String name) { + this(null, name); + } + + public UserDoesNotExistException(final IUser target, final String name) { + super(tlp(target, "userDoesNotExist", name)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index a637f3b09b2..64ef8b89831 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -7,7 +7,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandafk extends EssentialsCommand { @@ -51,10 +51,10 @@ public void run(Server server, CommandSource sender, String commandLabel, String private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { - throw new Exception(tl("voiceSilenced")); + throw new Exception(tlp(sender, "voiceSilenced")); } if (!sender.isAuthorized("essentials.afk.message")) { - throw new Exception(tl("noPermToAFKMessage")); + throw new Exception(tlp(sender, "noPermToAFKMessage")); } } user.setDisplayNick(); @@ -62,16 +62,16 @@ private void toggleAfk(User sender, User user, String message) throws Exception if (!user.toggleAfk()) { //user.sendMessage(_("markedAsNotAway")); if (!user.isHidden()) { - msg = tl("userIsNotAway", user.getDisplayName()); + msg = tlp(null, "userIsNotAway", user.getDisplayName()); } user.updateActivity(false); } else { //user.sendMessage(_("markedAsAway")); if (!user.isHidden()) { if (message != null) { - msg = tl("userIsAwayWithMessage", user.getDisplayName(), message); + msg = tlp(null, "userIsAwayWithMessage", user.getDisplayName(), message); } else { - msg = tl("userIsAway", user.getDisplayName()); + msg = tlp(null, "userIsAway", user.getDisplayName()); } } user.setAfkMessage(message); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java index 618c84e7ae3..aefa7dfdbdb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java @@ -4,7 +4,7 @@ import com.earth2me.essentials.User; import org.bukkit.Server; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandback extends EssentialsCommand { @@ -15,10 +15,10 @@ public Commandback() { @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (user.getLastLocation() == null) { - throw new Exception(tl("noLocationFound")); + throw new Exception(tlp(user, "noLocationFound")); } if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + user.getLastLocation().getWorld().getName())) { - throw new Exception(tl("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName())); + throw new Exception(tlp(user, "noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName())); } final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java index e6ca18efaec..945d799ff9a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java @@ -10,7 +10,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandbigtree extends EssentialsCommand { @@ -35,9 +35,9 @@ public void run(final Server server, final User user, final String commandLabel, final Location safeLocation = LocationUtil.getSafeDestination(loc); final boolean success = user.getWorld().generateTree(safeLocation, tree); if (success) { - user.sendMessage(tl("bigTreeSuccess")); + user.sendMessage(tlp(user, "bigTreeSuccess")); } else { - throw new Exception(tl("bigTreeFailure")); + throw new Exception(tlp(user, "bigTreeFailure")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java index 118a614a1ab..199d3d40218 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java @@ -8,7 +8,7 @@ import java.util.Set; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandbreak extends EssentialsCommand { @@ -27,7 +27,7 @@ public void run(final Server server, final User user, final String commandLabel, throw new NoChargeException(); } if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock")) { - throw new Exception(tl("noBreakBedrock")); + throw new Exception(tlp(user, "noBreakBedrock")); } //final List list = (List)block.getDrops(); //final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java index dfd165f59b1..efe2ea818d4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java @@ -23,6 +23,7 @@ public void run(final Server server, final CommandSource sender, final String co sendBroadcast(sender.getSender().getName(), args); } + @SuppressWarnings("deprecation") private void sendBroadcast(final String name, final String[] args) throws NotEnoughArgumentsException { if (args.length < 1) { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcastworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcastworld.java index d289700a123..864f6959f00 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcastworld.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcastworld.java @@ -38,6 +38,7 @@ public void run(final Server server, final CommandSource sender, final String co sendBroadcast(args[0], sender.getSender().getName(), getFinalArg(args, 1)); } + @SuppressWarnings("deprecation") private void sendBroadcast(final String worldName, final String name, final String message) throws Exception { World world = ess.getWorld(worldName); if (world == null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java index b9d2b4484c3..e1ccb6c6f83 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java @@ -7,7 +7,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandburn extends EssentialsCommand { @@ -27,7 +27,7 @@ protected void run(final Server server, final CommandSource sender, final String User user = getPlayer(server, sender, args, 0); user.getBase().setFireTicks(Integer.parseInt(args[1]) * 20); - sender.sendMessage(tl("burnMsg", user.getDisplayName(), Integer.parseInt(args[1]))); + sender.sendMessage(tlp(sender, "burnMsg", user.getDisplayName(), Integer.parseInt(args[1]))); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index 7d07fae3bea..e1e43780430 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; @@ -55,7 +55,7 @@ private void parseCommand(Server server, CommandSource sender, String commandLab } if (allowAll && args.length > 0 && args[0].contentEquals("*")) { - sender.sendMessage(tl("inventoryClearingFromAll")); + sender.sendMessage(tlp(sender, "inventoryClearingFromAll")); offset = 1; players = ess.getOnlinePlayers(); } else if (allowOthers && args.length > 0 && args[0].trim().length() > 2) { @@ -73,7 +73,7 @@ private void parseCommand(Server server, CommandSource sender, String commandLab if (senderUser != null && senderUser.isPromptingClearConfirm()) { if (!formattedCommand.equals(previousClearCommand)) { senderUser.setConfirmingClearCommand(formattedCommand); - senderUser.sendMessage(tl("confirmClear", formattedCommand)); + senderUser.sendMessage(tlp(senderUser, "confirmClear", formattedCommand)); return; } } @@ -110,14 +110,14 @@ protected void clearHandler(CommandSource sender, Player player, String[] args, if (type == -1) // type -1 represents wildcard or all items { if (showExtended) { - sender.sendMessage(tl("inventoryClearingAllItems", player.getDisplayName())); + sender.sendMessage(tlp(sender, "inventoryClearingAllItems", player.getDisplayName())); } InventoryWorkaround.clearInventoryNoArmor(player.getInventory()); InventoryWorkaround.setItemInOffHand(player, null); } else if (type == -2) // type -2 represents double wildcard or all items and armor { if (showExtended) { - sender.sendMessage(tl("inventoryClearingAllArmor", player.getDisplayName())); + sender.sendMessage(tlp(sender, "inventoryClearingAllArmor", player.getDisplayName())); } InventoryWorkaround.clearInventoryNoArmor(player.getInventory()); InventoryWorkaround.setItemInOffHand(player, null); @@ -127,7 +127,7 @@ protected void clearHandler(CommandSource sender, Player player, String[] args, { ItemStack stack = new ItemStack(type); if (showExtended) { - sender.sendMessage(tl("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); + sender.sendMessage(tlp(sender, "inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); } player.getInventory().clear(type, data); } else if (amount == -1) // amount -1 means all items will be cleared @@ -136,7 +136,7 @@ protected void clearHandler(CommandSource sender, Player player, String[] args, ItemStack removedStack = player.getInventory().removeItem(stack).get(0); final int removedAmount = (BASE_AMOUNT - removedStack.getAmount()); if (removedAmount > 0 || showExtended) { - sender.sendMessage(tl("inventoryClearingStack", removedAmount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); + sender.sendMessage(tlp(sender, "inventoryClearingStack", removedAmount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); } } else { if (amount < 0) { @@ -144,11 +144,11 @@ protected void clearHandler(CommandSource sender, Player player, String[] args, } ItemStack stack = new ItemStack(type, amount, data); if (player.getInventory().containsAtLeast(stack, amount)) { - sender.sendMessage(tl("inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); + sender.sendMessage(tlp(sender, "inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); player.getInventory().removeItem(stack); } else { if (showExtended) { - sender.sendMessage(tl("inventoryClearFail", player.getDisplayName(), amount, stack.getType().toString().toLowerCase(Locale.ENGLISH))); + sender.sendMessage(tlp(sender, "inventoryClearFail", player.getDisplayName(), amount, stack.getType().toString().toLowerCase(Locale.ENGLISH))); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventoryconfirmtoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventoryconfirmtoggle.java index e7b3e90721d..7c09a6ca2fd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventoryconfirmtoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventoryconfirmtoggle.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import com.earth2me.essentials.User; @@ -22,9 +22,9 @@ public void run(Server server, User user, String commandLabel, String[] args) th } user.setPromptingClearConfirm(confirmingClear); if (confirmingClear) { - user.sendMessage(tl("clearInventoryConfirmToggleOn")); + user.sendMessage(tlp(user, "clearInventoryConfirmToggleOn")); } else { - user.sendMessage(tl("clearInventoryConfirmToggleOff")); + user.sendMessage(tlp(user, "clearInventoryConfirmToggleOff")); } user.setConfirmingClearCommand(null); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java index 24b6aa85f44..0e9b55a81a2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java @@ -3,7 +3,7 @@ import com.earth2me.essentials.User; import org.bukkit.Server; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandcompass extends EssentialsCommand { @@ -34,6 +34,6 @@ public void run(final Server server, final User user, final String commandLabel, } else { dir = "N"; } - user.sendMessage(tl("compassBearing", dir, bearing)); + user.sendMessage(tlp(user, "compassBearing", dir, bearing)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcreatekit.java b/Essentials/src/com/earth2me/essentials/commands/Commandcreatekit.java index 5d6459087ce..badce129aad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandcreatekit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandcreatekit.java @@ -30,7 +30,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandcreatekit extends EssentialsCommand { @@ -70,7 +70,7 @@ public void run(final Server server, final User user, final String commandLabel, // Some users might want to directly write to config knowing the consequences. *shrug* if (!ess.getSettings().isPastebinCreateKit()) { ess.getKits().addKit(kitname, list, delay); - user.sendMessage(tl("createdKit", kitname, list.size(), delay)); + user.sendMessage(tlp(user, "createdKit", kitname, list.size(), delay)); } else { ConfigurationSection config = new MemoryConfiguration(); config.set("kits." + kitname + ".delay", delay); @@ -99,7 +99,7 @@ public void run() { } // Error if (connection.getResponseCode() >= 400) { - sender.sendMessage(tl("createKitFailed", kitName)); + sender.sendMessage(tlp(sender, "createKitFailed", kitName)); String message = CharStreams.toString(new InputStreamReader(connection.getErrorStream(), Charsets.UTF_8)); ess.getLogger().severe("Error creating kit: " + message); return; @@ -110,19 +110,19 @@ public void run() { String pasteUrl = PASTE_URL + object.get("key").getAsString(); connection.disconnect(); - String separator = tl("createKitSeparator"); + String separator = tlp(sender, "createKitSeparator"); String delayFormat = "0"; if (delay > 0) { delayFormat = DateUtil.formatDateDiff(System.currentTimeMillis() + (delay * 1000)); } sender.sendMessage(separator); - sender.sendMessage(tl("createKitSuccess", kitName, delayFormat, pasteUrl)); + sender.sendMessage(tlp(sender, "createKitSuccess", kitName, delayFormat, pasteUrl)); sender.sendMessage(separator); if (ess.getSettings().isDebug()) { ess.getLogger().info(sender.getSender().getName() + " created a kit: " + pasteUrl); } } catch (Exception e) { - sender.sendMessage(tl("createKitFailed", kitName)); + sender.sendMessage(tlp(sender, "createKitFailed", kitName)); e.printStackTrace(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java index 4d0d2ef16f1..0cf113e81b4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commanddeljail extends EssentialsCommand { @@ -20,7 +20,7 @@ protected void run(final Server server, final CommandSource sender, final String } ess.getJails().removeJail(args[0]); - sender.sendMessage(tl("deleteJail", args[0])); + sender.sendMessage(tlp(sender, "deleteJail", args[0])); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java index 0ea9669fdf4..e9fb6bcea6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java @@ -7,7 +7,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commanddelwarp extends EssentialsCommand { @@ -22,7 +22,7 @@ public void run(final Server server, final CommandSource sender, final String co } ess.getWarps().removeWarp(args[0]); - sender.sendMessage(tl("deleteWarp", args[0])); + sender.sendMessage(tlp(sender, "deleteWarp", args[0])); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddisposal.java b/Essentials/src/com/earth2me/essentials/commands/Commanddisposal.java index f4751e0440a..efcd1317f5d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddisposal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddisposal.java @@ -3,7 +3,7 @@ import com.earth2me.essentials.User; import org.bukkit.Server; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commanddisposal extends EssentialsCommand { @@ -13,7 +13,7 @@ public Commanddisposal() { @Override protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { - user.sendMessage(tl("openingDisposal")); + user.sendMessage(tlp(user, "openingDisposal")); user.getBase().openInventory(ess.getServer().createInventory(user.getBase(), 36, "Disposal")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 0a687d775d2..4f5fefc4762 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -19,7 +19,7 @@ import java.util.Set; import java.util.TreeSet; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandenchant extends EssentialsCommand { @@ -32,7 +32,7 @@ public Commandenchant() { protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final ItemStack stack = user.getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { - throw new Exception(tl("nothingInHand")); + throw new Exception(tlp(user, "nothingInHand")); } if (args.length == 0) { final Set enchantmentslist = new TreeSet<>(); @@ -43,7 +43,7 @@ protected void run(final Server server, final User user, final String commandLab //enchantmentslist.add(enchantmentName); } } - throw new NotEnoughArgumentsException(tl("enchantments", StringUtil.joinList(enchantmentslist.toArray()))); + throw new NotEnoughArgumentsException(tlp(user, "enchantments", StringUtil.joinList(enchantmentslist.toArray()))); } int level = -1; @@ -65,9 +65,9 @@ protected void run(final Server server, final User user, final String commandLab user.getBase().updateInventory(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); if (level == 0) { - user.sendMessage(tl("enchantmentRemoved", enchantmentName.replace('_', ' '))); + user.sendMessage(tlp(user, "enchantmentRemoved", enchantmentName.replace('_', ' '))); } else { - user.sendMessage(tl("enchantmentApplied", enchantmentName.replace('_', ' '))); + user.sendMessage(tlp(user, "enchantmentApplied", enchantmentName.replace('_', ' '))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index b751b1e4c4d..e0d026f2b14 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -8,7 +8,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandext extends EssentialsLoopCommand { @@ -29,7 +29,7 @@ protected void run(final Server server, final CommandSource sender, final String public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { extPlayer(user.getBase()); - user.sendMessage(tl("extinguish")); + user.sendMessage(tlp(user, "extinguish")); return; } @@ -39,7 +39,7 @@ public void run(final Server server, final User user, final String commandLabel, @Override protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) { extPlayer(player.getBase()); - sender.sendMessage(tl("extinguishOthers", player.getDisplayName())); + sender.sendMessage(tlp(sender, "extinguishOthers", player.getDisplayName())); } private void extPlayer(final Player player) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index b0a4e3df73d..e710e7515b4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -9,7 +9,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandfeed extends EssentialsLoopCommand { @@ -29,7 +29,7 @@ protected void run(final Server server, final User user, final String commandLab } feedPlayer(user.getBase()); - user.sendMessage(tl("feed")); + user.sendMessage(tlp(user, "feed")); } @Override @@ -45,7 +45,7 @@ protected void run(final Server server, final CommandSource sender, final String protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws PlayerExemptException { try { feedPlayer(player.getBase()); - sender.sendMessage(tl("feedOther", player.getDisplayName())); + sender.sendMessage(tlp(sender, "feedOther", player.getDisplayName())); } catch (QuietAbortException e) { //Handle Quietly } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index 2087d78d6c1..ede5003cadd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -17,7 +17,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; //This command has quite a complicated syntax, in theory it has 4 seperate syntaxes which are all variable: // @@ -50,14 +50,14 @@ protected void run(final Server server, final User user, final String commandLab FireworkMeta fmeta = (FireworkMeta) stack.getItemMeta(); fmeta.clearEffects(); stack.setItemMeta(fmeta); - user.sendMessage(tl("fireworkEffectsCleared")); + user.sendMessage(tlp(user, "fireworkEffectsCleared")); } else if (args.length > 1 && (args[0].equalsIgnoreCase("power") || (args[0].equalsIgnoreCase("p")))) { FireworkMeta fmeta = (FireworkMeta) stack.getItemMeta(); try { int power = Integer.parseInt(args[1]); fmeta.setPower(power > 3 ? 4 : power); } catch (NumberFormatException e) { - throw new Exception(tl("invalidFireworkFormat", args[1], args[0])); + throw new Exception(tlp(user, "invalidFireworkFormat", args[1], args[0])); } stack.setItemMeta(fmeta); } else if ((args[0].equalsIgnoreCase("fire") || (args[0].equalsIgnoreCase("f"))) && user.isAuthorized("essentials.firework.fire")) { @@ -69,7 +69,7 @@ protected void run(final Server server, final User user, final String commandLab amount = Integer.parseInt(args[1]); if (amount > serverLimit) { amount = serverLimit; - user.sendMessage(tl("mobSpawnLimit")); + user.sendMessage(tlp(user, "mobSpawnLimit")); } } else { direction = true; @@ -93,7 +93,7 @@ protected void run(final Server server, final User user, final String commandLab try { mStack.addFireworkMeta(user.getSource(), true, arg, ess); } catch (Exception e) { - user.sendMessage(tl("fireworkSyntax")); + user.sendMessage(tlp(user, "fireworkSyntax")); throw e; } } @@ -102,20 +102,20 @@ protected void run(final Server server, final User user, final String commandLab FireworkMeta fmeta = (FireworkMeta) mStack.getItemStack().getItemMeta(); FireworkEffect effect = mStack.getFireworkBuilder().build(); if (fmeta.getEffects().size() > 0 && !user.isAuthorized("essentials.firework.multiple")) { - throw new Exception(tl("multipleCharges")); + throw new Exception(tlp(user, "multipleCharges")); } fmeta.addEffect(effect); stack.setItemMeta(fmeta); } else { - user.sendMessage(tl("fireworkSyntax")); - throw new Exception(tl("fireworkColor")); + user.sendMessage(tlp(user, "fireworkSyntax")); + throw new Exception(tlp(user, "fireworkColor")); } } } else { throw new NotEnoughArgumentsException(); } } else { - throw new Exception(tl("holdFirework")); + throw new Exception(tlp(user, "holdFirework")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index bdfbaeb929b..3eda05803a2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandhelp extends EssentialsCommand { @@ -48,7 +48,7 @@ protected void run(final Server server, final User user, final String commandLab @Override protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { - sender.sendMessage(tl("helpConsole")); + sender.sendMessage(tlp(sender, "helpConsole")); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index 51b1d666152..7f77d4725ea 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.logging.Level; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandhelpop extends EssentialsCommand { @@ -35,7 +35,7 @@ private String sendMessage(final Server server, final CommandSource sender, fina if (args.length < 1) { throw new NotEnoughArgumentsException(); } - final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0))); + final String message = tlp(null, "helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0))); server.getLogger().log(Level.INFO, message); ess.broadcastMessage("essentials.helpop.receive", message); return message; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java index a065a3450be..3d24cc5a011 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java @@ -6,7 +6,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandignore extends EssentialsCommand { @@ -22,7 +22,7 @@ protected void run(final Server server, final User user, final String commandLab sb.append(s).append(" "); } String ignoredList = sb.toString().trim(); - user.sendMessage(ignoredList.length() > 0 ? tl("ignoredList", ignoredList) : tl("noIgnored")); + user.sendMessage(ignoredList.length() > 0 ? tlp(user, "ignoredList", ignoredList) : tlp(user, "noIgnored")); } else { User player; try { @@ -34,13 +34,13 @@ protected void run(final Server server, final User user, final String commandLab throw new PlayerNotFoundException(); } if (player.isIgnoreExempt()) { - user.sendMessage(tl("ignoreExempt")); + user.sendMessage(tlp(user, "ignoreExempt")); } else if (user.isIgnoredPlayer(player)) { user.setIgnoredPlayer(player, false); - user.sendMessage(tl("unignorePlayer", player.getName())); + user.sendMessage(tlp(user, "unignorePlayer", player.getName())); } else { user.setIgnoredPlayer(player, true); - user.sendMessage(tl("ignorePlayer", player.getName())); + user.sendMessage(tlp(user, "ignorePlayer", player.getName())); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index b4015558c69..04b5f6d8f7c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -8,7 +8,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commanditemdb extends EssentialsCommand { @@ -31,18 +31,18 @@ protected void run(Server server, CommandSource sender, String commandLabel, Str } else { itemStack = ess.getItemDb().get(args[0]); } - sender.sendMessage(tl("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()))); + sender.sendMessage(tlp(sender, "itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()))); if (itemHeld && itemStack.getType() != Material.AIR) { int maxuses = itemStack.getType().getMaxDurability(); int durability = ((maxuses + 1) - itemStack.getDurability()); if (maxuses != 0) { - sender.sendMessage(tl("durability", Integer.toString(durability))); + sender.sendMessage(tlp(sender, "durability", Integer.toString(durability))); } } final String itemNameList = ess.getItemDb().names(itemStack); if (itemNameList != null) { - sender.sendMessage(tl("itemNames", ess.getItemDb().names(itemStack))); + sender.sendMessage(tlp(sender, "itemNames", ess.getItemDb().names(itemStack))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java index 046fd61a864..efd76f36e53 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java @@ -11,7 +11,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; // This method contains an undocumented sub command #EasterEgg public class Commandjump extends EssentialsCommand { @@ -41,7 +41,7 @@ public void run(final Server server, final User user, final String commandLabel, loc.setPitch(cloc.getPitch()); loc.setY(loc.getY() + 1); } catch (NullPointerException ex) { - throw new Exception(tl("jumpError"), ex); + throw new Exception(tlp(user, "jumpError"), ex); } final Trade charge = new Trade(this.getName(), ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index 5c96af2c268..87cfabfc5c9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -5,7 +5,7 @@ import org.bukkit.Server; import org.bukkit.entity.Player; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandkickall extends EssentialsCommand { @@ -15,14 +15,14 @@ public Commandkickall() { @Override public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { - String kickReason = args.length > 0 ? getFinalArg(args, 0) : tl("kickDefault"); - kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); for (Player onlinePlayer : ess.getOnlinePlayers()) { if (!sender.isPlayer() || !onlinePlayer.getName().equalsIgnoreCase(sender.getPlayer().getName())) { + String kickReason = args.length > 0 ? getFinalArg(args, 0) : tlp(onlinePlayer, "kickDefault"); + kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); onlinePlayer.kickPlayer(kickReason); } } - sender.sendMessage(tl("kickedAll")); + sender.sendMessage(tlp(sender, "kickedAll")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 5779deff750..a5f562ea284 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -12,7 +12,7 @@ import java.util.Locale; import java.util.logging.Level; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandkit extends EssentialsCommand { @@ -24,7 +24,7 @@ public Commandkit() { public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { final String kitList = ess.getKits().listKits(ess, user); - user.sendMessage(kitList.length() > 0 ? tl("kits", kitList) : tl("noKits")); + user.sendMessage(kitList.length() > 0 ? tlp(user, "kits", kitList) : tlp(user, "noKits")); throw new NoChargeException(); } else if (args.length > 1 && user.isAuthorized("essentials.kit.others")) { final User userTo = getPlayer(server, user, args, 1); @@ -40,7 +40,7 @@ public void run(final Server server, final User user, final String commandLabel, public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { final String kitList = ess.getKits().listKits(ess, null); - sender.sendMessage(kitList.length() > 0 ? tl("kits", kitList) : tl("noKits")); + sender.sendMessage(kitList.length() > 0 ? tlp(sender, "kits", kitList) : tlp(sender, "noKits")); throw new NoChargeException(); } else { final User userTo = getPlayer(server, args, 1, true, false); @@ -50,15 +50,15 @@ public void run(final Server server, final CommandSource sender, final String co final Kit kit = new Kit(kitName, ess); kit.expandItems(userTo); - sender.sendMessage(tl("kitGiveTo", kitName, userTo.getDisplayName())); - userTo.sendMessage(tl("kitReceive", kitName)); + sender.sendMessage(tlp(sender, "kitGiveTo", kitName, userTo.getDisplayName())); + userTo.sendMessage(tlp(userTo, "kitReceive", kitName)); } } } private void giveKits(final User userTo, final User userFrom, final String kitNames) throws Exception { if (kitNames.isEmpty()) { - throw new Exception(tl("kitNotFound")); + throw new Exception(tlp(userFrom, "kitNotFound")); } String[] kitList = kitNames.split(","); @@ -66,7 +66,7 @@ private void giveKits(final User userTo, final User userFrom, final String kitNa for (final String kitName : kitList) { if (kitName.isEmpty()) { - throw new Exception(tl("kitNotFound")); + throw new Exception(tlp(userFrom, "kitNotFound")); } Kit kit = new Kit(kitName, ess); @@ -86,10 +86,10 @@ private void giveKits(final User userTo, final User userFrom, final String kitNa kit.chargeUser(userTo); if (!userFrom.equals(userTo)) { - userFrom.sendMessage(tl("kitGiveTo", kit.getName(), userTo.getDisplayName())); + userFrom.sendMessage(tlp(userFrom, "kitGiveTo", kit.getName(), userTo.getDisplayName())); } - userTo.sendMessage(tl("kitReceive", kit.getName())); + userTo.sendMessage(tlp(userTo, "kitReceive", kit.getName())); } catch (NoChargeException ex) { if (ess.getSettings().isDebug()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index 1b479d0fc1f..e157e39c647 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Set; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandlightning extends EssentialsLoopCommand { @@ -44,14 +44,14 @@ public void run(final Server server, final CommandSource sender, final String co @Override protected void updatePlayer(final Server server, final CommandSource sender, final User matchUser, final String[] args) { - sender.sendMessage(tl("lightningUse", matchUser.getDisplayName())); + sender.sendMessage(tlp(sender, "lightningUse", matchUser.getDisplayName())); final LightningStrike strike = matchUser.getBase().getWorld().strikeLightningEffect(matchUser.getBase().getLocation()); if (!matchUser.isGodModeEnabled()) { matchUser.getBase().damage(power, strike); } if (ess.getSettings().warnOnSmite()) { - matchUser.sendMessage(tl("lightningSmited")); + matchUser.sendMessage(tlp(matchUser, "lightningSmited")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 41a0adad8bd..297d7d4932f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -9,7 +9,7 @@ import java.util.*; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandlist extends EssentialsCommand { @@ -67,7 +67,7 @@ private void sendGroupedList(CommandSource sender, String commandLabel, Map limit) { - sender.sendMessage(PlayerList.outputFormat(oConfigGroup, tl("groupNumber", matchedList.size(), commandLabel, FormatUtil.stripFormat(configGroup)))); + sender.sendMessage(PlayerList.outputFormat(oConfigGroup, tlp(sender, "groupNumber", matchedList.size(), commandLabel, FormatUtil.stripFormat(configGroup)))); } else { sender.sendMessage(PlayerList.outputFormat(oConfigGroup, PlayerList.listUsers(ess, outputUserList, ", "))); } @@ -107,7 +107,7 @@ private void sendGroupedList(CommandSource sender, String commandLabel, Map= 1 && "read".equalsIgnoreCase(args[0])) { final List mail = user.getMails(); if (mail.isEmpty()) { - user.sendMessage(tl("noMail")); + user.sendMessage(tlp(user, "noMail")); throw new NoChargeException(); } @@ -39,26 +39,26 @@ public void run(final Server server, final User user, final String commandLabel, final TextPager pager = new TextPager(input); pager.showPage(args.length > 1 ? args[1] : null, null, commandLabel + " " + args[0], user.getSource()); - user.sendMessage(tl("mailClear")); + user.sendMessage(tlp(user, "mailClear")); return; } if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { if (!user.isAuthorized("essentials.mail.send")) { - throw new Exception(tl("noPerm", "essentials.mail.send")); + throw new Exception(tlp(user, "noPerm", "essentials.mail.send")); } if (user.isMuted()) { - throw new Exception(tl("voiceSilenced")); + throw new Exception(tlp(user, "voiceSilenced")); } User u = getPlayer(server, args[1], true, true); if (u == null) { - throw new Exception(tl("playerNeverOnServer", args[1])); + throw new Exception(tlp(user, "playerNeverOnServer", args[1])); } - String mail = tl("mailFormat", user.getName(), FormatUtil.formatMessage(user, "essentials.mail", StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2))))); + String mail = tlp(null, "mailFormat", user.getName(), FormatUtil.formatMessage(user, "essentials.mail", StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2))))); if (mail.length() > 1000) { - throw new Exception(tl("mailTooLong")); + throw new Exception(tlp(user, "mailTooLong")); } if (!u.isIgnoredPlayer(user)) { @@ -68,27 +68,27 @@ public void run(final Server server, final User user, final String commandLabel, } mailsPerMinute++; if (mailsPerMinute > ess.getSettings().getMailsPerMinute()) { - throw new Exception(tl("mailDelay", ess.getSettings().getMailsPerMinute())); + throw new Exception(tlp(user, "mailDelay", ess.getSettings().getMailsPerMinute())); } - u.addMail(tl("mailMessage", mail)); + u.addMail(tlp(u, "mailMessage", mail)); } - user.sendMessage(tl("mailSentTo", u.getDisplayName(), u.getName())); + user.sendMessage(tlp(user, "mailSentTo", u.getDisplayName(), u.getName())); user.sendMessage(mail); return; } if (args.length > 1 && "sendall".equalsIgnoreCase(args[0])) { if (!user.isAuthorized("essentials.mail.sendall")) { - throw new Exception(tl("noPerm", "essentials.mail.sendall")); + throw new Exception(tlp(user, "noPerm", "essentials.mail.sendall")); } - ess.runTaskAsynchronously(new SendAll(tl("mailFormat", user.getName(), + ess.runTaskAsynchronously(new SendAll(tlp(null, "mailFormat", user.getName(), FormatUtil.formatMessage(user, "essentials.mail", StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 1))))))); - user.sendMessage(tl("mailSent")); + user.sendMessage(tlp(user, "mailSent")); return; } if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { user.setMails(null); - user.sendMessage(tl("mailCleared")); + user.sendMessage(tlp(user, "mailCleared")); return; } throw new NotEnoughArgumentsException(); @@ -97,29 +97,29 @@ public void run(final Server server, final User user, final String commandLabel, @Override protected void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception { if (args.length >= 1 && "read".equalsIgnoreCase(args[0])) { - throw new Exception(tl("onlyPlayers", commandLabel + " read")); + throw new Exception(tlp(sender, "onlyPlayers", commandLabel + " read")); } else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { - throw new Exception(tl("onlyPlayers", commandLabel + " clear")); + throw new Exception(tlp(sender, "onlyPlayers", commandLabel + " clear")); } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { User u = getPlayer(server, args[1], true, true); if (u == null) { - throw new Exception(tl("playerNeverOnServer", args[1])); + throw new Exception(tlp(sender, "playerNeverOnServer", args[1])); } - u.addMail(tl("mailFormat", "Server", getFinalArg(args, 2))); - sender.sendMessage(tl("mailSent")); + u.addMail(tlp(u, "mailFormat", "Server", getFinalArg(args, 2))); + sender.sendMessage(tlp(sender, "mailSent")); return; } else if (args.length >= 2 && "sendall".equalsIgnoreCase(args[0])) { - ess.runTaskAsynchronously(new SendAll(tl("mailFormat", "Server", getFinalArg(args, 1)))); - sender.sendMessage(tl("mailSent")); + ess.runTaskAsynchronously(new SendAll(tlp(null, "mailFormat", "Server", getFinalArg(args, 1)))); + sender.sendMessage(tlp(sender, "mailSent")); return; } else if (args.length >= 2) { //allow sending from console without "send" argument, since it's the only thing the console can do User u = getPlayer(server, args[0], true, true); if (u == null) { - throw new Exception(tl("playerNeverOnServer", args[0])); + throw new Exception(tlp(sender, "playerNeverOnServer", args[0])); } - u.addMail(tl("mailFormat", "Server", getFinalArg(args, 1))); - sender.sendMessage(tl("mailSent")); + u.addMail(tlp(u, "mailFormat", "Server", getFinalArg(args, 1))); + sender.sendMessage(tlp(sender, "mailSent")); return; } throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index e8fabd137dc..e0d84491c2a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; @@ -29,7 +29,7 @@ public void run(Server server, CommandSource sender, String commandLabel, String if (sender.isPlayer()) { User user = ess.getUser(sender.getPlayer()); if (user.isMuted()) { - throw new Exception(tl("voiceSilenced")); + throw new Exception(tlp(user, "voiceSilenced")); } message = FormatUtil.formatMessage(user, "essentials.msg", message); canWildcard = user.isAuthorized("essentials.msg.multiple"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 5d871c6bb1e..1c109a2c2e5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.logging.Level; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandmute extends EssentialsCommand { @@ -33,11 +33,11 @@ public void run(final Server server, final CommandSource sender, final String co } if (!user.getBase().isOnline()) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.mute.offline")) { - throw new Exception(tl("muteExemptOffline")); + throw new Exception(tlp(user, "muteExemptOffline")); } } else { if (user.isAuthorized("essentials.mute.exempt") && sender.isPlayer()) { - throw new Exception(tl("muteExempt")); + throw new Exception(tlp(user, "muteExempt")); } } @@ -61,28 +61,28 @@ public void run(final Server server, final CommandSource sender, final String co String muteTime = DateUtil.formatDateDiff(muteTimestamp); if (nomatch) { - sender.sendMessage(tl("userUnknown", user.getName())); + sender.sendMessage(tlp(sender, "userUnknown", user.getName())); } if (muted) { if (muteTimestamp > 0) { - sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime)); - user.sendMessage(tl("playerMutedFor", muteTime)); + sender.sendMessage(tlp(sender, "mutedPlayerFor", user.getDisplayName(), muteTime)); + user.sendMessage(tlp(user, "playerMutedFor", muteTime)); } else { - sender.sendMessage(tl("mutedPlayer", user.getDisplayName())); - user.sendMessage(tl("playerMuted")); + sender.sendMessage(tlp(sender, "mutedPlayer", user.getDisplayName())); + user.sendMessage(tlp(user, "playerMuted")); } final String message; if (muteTimestamp > 0) { - message = tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime); + message = tlp(null, "muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime); } else { - message = tl("muteNotify", sender.getSender().getName(), user.getName()); + message = tlp(null, "muteNotify", sender.getSender().getName(), user.getName()); } server.getLogger().log(Level.INFO, message); ess.broadcastMessage("essentials.mute.notify", message); } else { - sender.sendMessage(tl("unmutedPlayer", user.getDisplayName())); - user.sendMessage(tl("playerUnmuted")); + sender.sendMessage(tlp(sender, "unmutedPlayer", user.getDisplayName())); + user.sendMessage(tlp(user, "playerUnmuted")); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index c5ba7386ec1..7e2a35f3616 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandnick extends EssentialsLoopCommand { @@ -26,13 +26,13 @@ public void run(final Server server, final User user, final String commandLabel, throw new NotEnoughArgumentsException(); } if (!ess.getSettings().changeDisplayName()) { - throw new Exception(tl("nickDisplayName")); + throw new Exception(tlp(user, "nickDisplayName")); } if (args.length > 1 && user.isAuthorized("essentials.nick.others")) { final String[] nickname = formatNickname(user, args[1]).split(" "); loopOfflinePlayers(server, user.getSource(), false, true, args[0], nickname); - user.sendMessage(tl("nickChanged")); + user.sendMessage(tlp(user, "nickChanged")); } else { final String[] nickname = formatNickname(user, args[0]).split(" "); updatePlayer(server, user.getSource(), user, nickname); @@ -45,11 +45,11 @@ public void run(final Server server, final CommandSource sender, final String co throw new NotEnoughArgumentsException(); } if (!ess.getSettings().changeDisplayName()) { - throw new Exception(tl("nickDisplayName")); + throw new Exception(tlp(sender, "nickDisplayName")); } final String[] nickname = formatNickname(null, args[1]).split(" "); loopOfflinePlayers(server, sender, false, true, args[0], nickname); - sender.sendMessage(tl("nickChanged")); + sender.sendMessage(tlp(sender, "nickChanged")); } @Override @@ -59,30 +59,30 @@ protected void updatePlayer(final Server server, final CommandSource sender, fin String oldName = target.getDisplayName(); setNickname(server, sender, target, nick); if (!target.getDisplayName().equalsIgnoreCase(oldName)) { - target.sendMessage(tl("nickNoMore")); + target.sendMessage(tlp(target, "nickNoMore")); } - target.sendMessage(tl("nickSet", target.getDisplayName())); + target.sendMessage(tlp(target, "nickSet", target.getDisplayName())); } else if ("off".equalsIgnoreCase(nick)) { setNickname(server, sender, target, null); - target.sendMessage(tl("nickNoMore")); + target.sendMessage(tlp(target, "nickNoMore")); } else if (nickInUse(server, target, nick)) { - throw new NotEnoughArgumentsException(tl("nickInUse")); + throw new NotEnoughArgumentsException(tlp(sender, "nickInUse")); } else { setNickname(server, sender, target, nick); - target.sendMessage(tl("nickSet", target.getDisplayName())); + target.sendMessage(tlp(target, "nickSet", target.getDisplayName())); } } private String formatNickname(final User user, final String nick) throws Exception { String newNick = user == null ? FormatUtil.replaceFormat(nick) : FormatUtil.formatString(user, "essentials.nick", nick); if (!newNick.matches("^[a-zA-Z_0-9\u00a7]+$")) { - throw new Exception(tl("nickNamesAlpha")); + throw new Exception(tlp(user, "nickNamesAlpha")); } else if (getNickLength(newNick) > ess.getSettings().getMaxNickLength()) { - throw new Exception(tl("nickTooLong")); + throw new Exception(tlp(user, "nickTooLong")); } else if (FormatUtil.stripFormat(newNick).length() < 1) { - throw new Exception(tl("nickNamesAlpha")); + throw new Exception(tlp(user, "nickNamesAlpha")); } else if (user != null && (user.isAuthorized("essentials.nick.changecolors") && !user.isAuthorized("essentials.nick.changecolors.bypass")) && !FormatUtil.stripFormat(newNick).equals(user.getName())) { - throw new Exception(tl("nickNamesOnlyColorChanges")); + throw new Exception(tlp(user, "nickNamesOnlyColorChanges")); } return newNick; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index 9e412cb1bb6..1118394f813 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.List; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandpay extends EssentialsLoopCommand { @@ -34,7 +34,7 @@ public void run(final Server server, final User user, final String commandLabel, } if (args[1].contains("-")) { - throw new Exception(tl("payMustBePositive")); + throw new Exception(tlp(user, "payMustBePositive")); } String stringAmount = args[1].replaceAll("[^0-9\\.]", ""); @@ -45,12 +45,12 @@ public void run(final Server server, final User user, final String commandLabel, amount = new BigDecimal(stringAmount); if (amount.compareTo(ess.getSettings().getMinimumPayAmount()) < 0) { // Check if amount is less than minimum-pay-amount - throw new Exception(tl("minimumPayAmount", NumberUtil.displayCurrencyExactly(ess.getSettings().getMinimumPayAmount(), ess))); + throw new Exception(tlp(user, "minimumPayAmount", NumberUtil.displayCurrencyExactly(ess.getSettings().getMinimumPayAmount(), ess))); } loopOnlinePlayers(server, user.getSource(), false, user.isAuthorized("essentials.pay.multiple"), args[0], args); if (informToConfirm) { String cmd = "/" + commandLabel + " " + StringUtil.joinList(" ", (Object[]) args); - user.sendMessage(tl("confirmPayment", NumberUtil.displayCurrency(amount, ess), cmd)); + user.sendMessage(tlp(user, "confirmPayment", NumberUtil.displayCurrency(amount, ess), cmd)); } } @@ -59,7 +59,7 @@ protected void updatePlayer(final Server server, final CommandSource sender, fin User user = ess.getUser(sender.getPlayer()); try { if (!player.isAcceptingPay()) { - sender.sendMessage(tl("notAcceptingPay", player.getDisplayName())); + sender.sendMessage(tlp(sender, "notAcceptingPay", player.getDisplayName())); return; } if (user.isPromptingPayConfirm() && !amount.equals(user.getConfirmingPayments().get(player))) { // checks if exists and if command needs to be repeated. @@ -77,7 +77,7 @@ protected void updatePlayer(final Server server, final CommandSource sender, fin user.getConfirmingPayments().remove(player); Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess); } catch (MaxMoneyException ex) { - sender.sendMessage(tl("maxMoney")); + sender.sendMessage(tlp(sender, "maxMoney")); try { user.setMoney(user.getMoney().add(amount)); } catch (MaxMoneyException ignored) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpayconfirmtoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandpayconfirmtoggle.java index 3da30ccccbc..f580b1a39af 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpayconfirmtoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpayconfirmtoggle.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import com.earth2me.essentials.User; @@ -22,9 +22,9 @@ public void run(Server server, User user, String commandLabel, String[] args) th } user.setPromptingPayConfirm(confirmingPay); if (confirmingPay) { - user.sendMessage(tl("payConfirmToggleOn")); + user.sendMessage(tlp(user, "payConfirmToggleOn")); } else { - user.sendMessage(tl("payConfirmToggleOff")); + user.sendMessage(tlp(user, "payConfirmToggleOff")); } user.getConfirmingPayments().clear(); // Clear any outstanding confirmations. } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java index dba0ff32780..601e2e3301d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java @@ -4,7 +4,7 @@ import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; // This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg public class Commandping extends EssentialsCommand { @@ -16,7 +16,7 @@ public Commandping() { public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { - sender.sendMessage(tl("pong")); + sender.sendMessage(tlp(sender, "pong")); } else { sender.sendMessage(FormatUtil.replaceFormat(getFinalArg(args, 0))); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index 61466aadc39..6b06de9ec8d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -22,7 +22,7 @@ import java.util.Set; import java.util.TreeSet; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import net.ess3.nms.refl.ReflUtil; @@ -44,7 +44,7 @@ protected void run(final Server server, final User user, final String commandLab potionslist.add(entry.getKey()); } } - throw new NotEnoughArgumentsException(tl("potions", StringUtil.joinList(potionslist.toArray()))); + throw new NotEnoughArgumentsException(tlp(user, "potions", StringUtil.joinList(potionslist.toArray()))); } boolean holdingPotion = stack.getType() == Material.POTION; @@ -72,14 +72,14 @@ protected void run(final Server server, final User user, final String commandLab pmeta = (PotionMeta) mStack.getItemStack().getItemMeta(); stack.setItemMeta(pmeta); } else { - user.sendMessage(tl("invalidPotion")); + user.sendMessage(tlp(user, "invalidPotion")); throw new NotEnoughArgumentsException(); } } } } else { - throw new Exception(tl("holdPotion")); + throw new Exception(tlp(user, "holdPotion")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 556ab8be672..8cc6ed04742 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -13,7 +13,7 @@ import java.util.List; import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandpowertool extends EssentialsCommand { @@ -45,12 +45,12 @@ protected void powertool(final Server server, final CommandSource sender, final // check to see if this is a clear all command if (command != null && command.equalsIgnoreCase("d:")) { user.clearAllPowertools(); - sender.sendMessage(tl("powerToolClearAll")); + sender.sendMessage(tlp(sender, "powerToolClearAll")); return; } if (itemStack == null || itemStack.getType() == Material.AIR) { - throw new Exception(tl("powerToolAir")); + throw new Exception(tlp(sender, "powerToolAir")); } final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " "); @@ -58,28 +58,28 @@ protected void powertool(final Server server, final CommandSource sender, final if (command != null && !command.isEmpty()) { if (command.equalsIgnoreCase("l:")) { if (powertools == null || powertools.isEmpty()) { - throw new Exception(tl("powerToolListEmpty", itemName)); + throw new Exception(tlp(sender, "powerToolListEmpty", itemName)); } else { - sender.sendMessage(tl("powerToolList", StringUtil.joinList(powertools), itemName)); + sender.sendMessage(tlp(sender, "powerToolList", StringUtil.joinList(powertools), itemName)); } throw new NoChargeException(); } if (command.startsWith("r:")) { command = command.substring(2); if (!powertools.contains(command)) { - throw new Exception(tl("powerToolNoSuchCommandAssigned", command, itemName)); + throw new Exception(tlp(sender, "powerToolNoSuchCommandAssigned", command, itemName)); } powertools.remove(command); - sender.sendMessage(tl("powerToolRemove", command, itemName)); + sender.sendMessage(tlp(sender, "powerToolRemove", command, itemName)); } else { if (command.startsWith("a:")) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.powertool.append")) { - throw new Exception(tl("noPerm", "essentials.powertool.append")); + throw new Exception(tlp(sender, "noPerm", "essentials.powertool.append")); } command = command.substring(2); if (powertools.contains(command)) { - throw new Exception(tl("powerToolAlreadySet", command, itemName)); + throw new Exception(tlp(sender, "powerToolAlreadySet", command, itemName)); } } else if (powertools != null && !powertools.isEmpty()) { // Replace all commands with this one @@ -89,18 +89,18 @@ protected void powertool(final Server server, final CommandSource sender, final } powertools.add(command); - sender.sendMessage(tl("powerToolAttach", StringUtil.joinList(powertools), itemName)); + sender.sendMessage(tlp(sender, "powerToolAttach", StringUtil.joinList(powertools), itemName)); } } else { if (powertools != null) { powertools.clear(); } - sender.sendMessage(tl("powerToolRemoveAll", itemName)); + sender.sendMessage(tlp(sender, "powerToolRemoveAll", itemName)); } if (!user.arePowerToolsEnabled()) { user.setPowerToolsEnabled(true); - user.sendMessage(tl("powerToolsEnabled")); + user.sendMessage(tlp(user, "powerToolsEnabled")); } user.setPowertool(itemStack, powertools); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index 54ffda63e3f..bc67373bd1a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -11,7 +11,7 @@ import java.util.*; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandptime extends EssentialsCommand { @@ -46,7 +46,7 @@ public void run(final Server server, final CommandSource sender, final String co if (sender.isPlayer()) { User user = ess.getUser(sender.getPlayer()); if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.ptime.others")) { - user.sendMessage(tl("pTimeOthersPermission")); + user.sendMessage(tlp(user, "pTimeOthersPermission")); return; } } @@ -81,18 +81,18 @@ public void run(final Server server, final CommandSource sender, final String co */ private void getUsersTime(final CommandSource sender, final Collection users) { if (users.size() > 1) { - sender.sendMessage(tl("pTimePlayers")); + sender.sendMessage(tlp(sender, "pTimePlayers")); } for (User user : users) { if (user.getBase().getPlayerTimeOffset() == 0) { - sender.sendMessage(tl("pTimeNormal", user.getName())); + sender.sendMessage(tlp(sender, "pTimeNormal", user.getName())); } else { String time = DescParseTickFormat.format(user.getBase().getPlayerTime()); if (!user.getBase().isPlayerTimeRelative()) { - sender.sendMessage(tl("pTimeCurrentFixed", user.getName(), time)); + sender.sendMessage(tlp(sender, "pTimeCurrentFixed", user.getName(), time)); } else { - sender.sendMessage(tl("pTimeCurrent", user.getName(), time)); + sender.sendMessage(tlp(sender, "pTimeCurrent", user.getName(), time)); } } } @@ -133,13 +133,13 @@ private void setUsersTime(final CommandSource sender, final Collection use // Inform the sender of the change if (ticks == null) { - sender.sendMessage(tl("pTimeReset", msg.toString())); + sender.sendMessage(tlp(sender, "pTimeReset", msg.toString())); } else { String time = DescParseTickFormat.format(ticks); if (!relative) { - sender.sendMessage(tl("pTimeSetFixed", time, msg.toString())); + sender.sendMessage(tlp(sender, "pTimeSetFixed", time, msg.toString())); } else { - sender.sendMessage(tl("pTimeSet", time, msg.toString())); + sender.sendMessage(tlp(sender, "pTimeSet", time, msg.toString())); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index f105f5e2898..bed00abece1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -7,7 +7,7 @@ import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandr extends EssentialsCommand { @@ -28,7 +28,7 @@ public void run(final Server server, final CommandSource sender, final String co User user = ess.getUser(sender.getPlayer()); if (user.isMuted()) { - throw new Exception(tl("voiceSilenced")); + throw new Exception(tlp(sender, "voiceSilenced")); } message = FormatUtil.formatMessage(user, "essentials.msg", message); @@ -41,7 +41,7 @@ public void run(final Server server, final CommandSource sender, final String co final IMessageRecipient target = messageSender.getReplyRecipient(); // Check to make sure the sender does have a quick-reply recipient if (target == null) { - throw new Exception(tl("foreverAlone")); + throw new Exception(tlp(sender, "foreverAlone")); } messageSender.sendMessage(target, message); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index 4e4d1d67bd9..7c399bf5d0e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -7,7 +7,7 @@ import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandrealname extends EssentialsCommand { @@ -31,7 +31,7 @@ protected void run(final Server server, final CommandSource sender, final String final String displayName = FormatUtil.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH); if (displayName.contains(whois)) { foundUser = true; - sender.sendMessage(u.getDisplayName() + " " + tl("is") + " " + u.getName()); + sender.sendMessage(u.getDisplayName() + " " + tlp(sender, "is") + " " + u.getName()); } } if (!foundUser) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index dd957fe413b..edc2e5ec13e 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -14,6 +14,7 @@ import java.util.Map; import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import net.ess3.nms.refl.ReflUtil; @@ -43,21 +44,21 @@ public void run(final Server server, final CommandSource sender, final String co if (NumberUtil.isInt(args[1])) { recipeNo = Integer.parseInt(args[1]) - 1; } else { - throw new Exception(tl("invalidNumber")); + throw new Exception(tlp(sender, "invalidNumber")); } } final List recipesOfType = ess.getServer().getRecipesFor(itemType); if (recipesOfType.size() < 1) { - throw new Exception(tl("recipeNone", getMaterialName(itemType))); + throw new Exception(tlp(sender, "recipeNone", getMaterialName(itemType))); } if (recipeNo < 0 || recipeNo >= recipesOfType.size()) { - throw new Exception(tl("recipeBadIndex")); + throw new Exception(tlp(sender, "recipeBadIndex")); } final Recipe selectedRecipe = recipesOfType.get(recipeNo); - sender.sendMessage(tl("recipe", getMaterialName(itemType), recipeNo + 1, recipesOfType.size())); + sender.sendMessage(tlp(sender, "recipe", getMaterialName(itemType), recipeNo + 1, recipesOfType.size())); if (selectedRecipe instanceof FurnaceRecipe) { furnaceRecipe(sender, (FurnaceRecipe) selectedRecipe); @@ -76,12 +77,12 @@ public void run(final Server server, final CommandSource sender, final String co } if (recipesOfType.size() > 1 && args.length == 1) { - sender.sendMessage(tl("recipeMore", commandLabel, args[0], getMaterialName(itemType))); + sender.sendMessage(tlp(sender, "recipeMore", commandLabel, args[0], getMaterialName(itemType))); } } public void furnaceRecipe(final CommandSource sender, final FurnaceRecipe recipe) { - sender.sendMessage(tl("recipeFurnace", getMaterialName(recipe.getInput()))); + sender.sendMessage(tlp(sender, "recipeFurnace", getMaterialName(recipe.getInput()))); } public void shapedRecipe(final CommandSource sender, final ShapedRecipe recipe, final boolean showWindow) { @@ -122,15 +123,15 @@ public void shapedRecipe(final CommandSource sender, final ShapedRecipe recipe, materials[j][k] = item == null ? null : item.getType(); } } - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[0][0]), colorMap.get(materials[0][1]), colorMap.get(materials[0][2]))); - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[1][0]), colorMap.get(materials[1][1]), colorMap.get(materials[1][2]))); - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[2][0]), colorMap.get(materials[2][1]), colorMap.get(materials[2][2]))); + sender.sendMessage(tlp(sender, "recipeGrid", colorMap.get(materials[0][0]), colorMap.get(materials[0][1]), colorMap.get(materials[0][2]))); + sender.sendMessage(tlp(sender, "recipeGrid", colorMap.get(materials[1][0]), colorMap.get(materials[1][1]), colorMap.get(materials[1][2]))); + sender.sendMessage(tlp(sender, "recipeGrid", colorMap.get(materials[2][0]), colorMap.get(materials[2][1]), colorMap.get(materials[2][2]))); StringBuilder s = new StringBuilder(); for (Material items : colorMap.keySet().toArray(new Material[colorMap.size()])) { - s.append(tl("recipeGridItem", colorMap.get(items), getMaterialName(items))); + s.append(tlp(sender, "recipeGridItem", colorMap.get(items), getMaterialName(items))); } - sender.sendMessage(tl("recipeWhere", s.toString())); + sender.sendMessage(tlp(sender, "recipeWhere", s.toString())); } } @@ -157,10 +158,11 @@ public void shapelessRecipe(final CommandSource sender, final ShapelessRecipe re } s.append(" "); } - sender.sendMessage(tl("recipeShapeless", s.toString())); + sender.sendMessage(tlp(sender, "recipeShapeless", s.toString())); } } + @SuppressWarnings("deprecation") public String getMaterialName(final ItemStack stack) { if (stack == null) { return tl("recipeNothing"); @@ -168,6 +170,7 @@ public String getMaterialName(final ItemStack stack) { return getMaterialName(stack.getType()); } + @SuppressWarnings("deprecation") public String getMaterialName(final Material type) { if (type == null) { return tl("recipeNothing"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 0d4cfbe4102..cd5386d0d29 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -15,7 +15,7 @@ import java.util.List; import java.util.Locale; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandrepair extends EssentialsCommand { @@ -40,11 +40,11 @@ public void run(final Server server, final User user, final String commandLabel, public void repairHand(User user) throws Exception { final ItemStack item = user.getBase().getItemInHand(); if (item == null || item.getType().isBlock() || item.getDurability() == 0) { - throw new Exception(tl("repairInvalidType")); + throw new Exception(tlp(user, "repairInvalidType")); } if (!item.getEnchantments().isEmpty() && !ess.getSettings().getRepairEnchanted() && !user.isAuthorized("essentials.repair.enchanted")) { - throw new Exception(tl("repairEnchanted")); + throw new Exception(tlp(user, "repairEnchanted")); } final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); @@ -56,7 +56,7 @@ public void repairHand(User user) throws Exception { charge.charge(user); user.getBase().updateInventory(); - user.sendMessage(tl("repair", itemName.replace('_', ' '))); + user.sendMessage(tlp(user, "repair", itemName.replace('_', ' '))); } public void repairAll(User user) throws Exception { @@ -69,20 +69,20 @@ public void repairAll(User user) throws Exception { user.getBase().updateInventory(); if (repaired.isEmpty()) { - throw new Exception(tl("repairNone")); + throw new Exception(tlp(user, "repairNone")); } else { - user.sendMessage(tl("repair", StringUtil.joinList(repaired))); + user.sendMessage(tlp(user, "repair", StringUtil.joinList(repaired))); } } private void repairItem(final ItemStack item) throws Exception { final Material material = Material.getMaterial(item.getTypeId()); if (material.isBlock() || material.getMaxDurability() < 1) { - throw new Exception(tl("repairInvalidType")); + throw new Exception(tlp(null, "repairInvalidType")); } if (item.getDurability() == 0) { - throw new Exception(tl("repairAlreadyFixed")); + throw new Exception(tlp(null, "repairAlreadyFixed")); } item.setDurability((short) 0); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 1efa4ca1b48..34805dbd6f9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -18,7 +18,7 @@ import java.util.UUID; import java.util.Collections; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class Commandseen extends EssentialsCommand { @@ -55,10 +55,10 @@ protected void seen(final Server server, final CommandSource sender, final Strin seenIP(server, sender, args[0]); return; } else if (ess.getServer().getBanList(BanList.Type.IP).isBanned(args[0])) { - sender.sendMessage(tl("isIpBanned", args[0])); + sender.sendMessage(tlp(sender, "isIpBanned", args[0])); return; } else if (BanLookup.isBanned(ess, args[0])) { - sender.sendMessage(tl("whoisBanned", showBan ? BanLookup.getBanEntry(ess, args[0]).getReason() : tl("true"))); + sender.sendMessage(tlp(sender, "whoisBanned", showBan ? BanLookup.getBanEntry(ess, args[0]).getReason() : tlp(sender, "true"))); return; } ess.getScheduler().runTaskAsynchronously(ess, new Runnable() { @@ -99,7 +99,7 @@ private void showSeenMessage(Server server, CommandSource sender, User player, b private void seenOnline(final Server server, final CommandSource sender, final User user, final boolean showBan, final boolean showIp, final boolean showLocation) throws Exception { user.setDisplayNick(); - sender.sendMessage(tl("seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin()))); + sender.sendMessage(tlp(sender, "seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin()))); if (ess.getSettings().isDebug()) { ess.getLogger().info("UUID: " + user.getBase().getUniqueId().toString()); @@ -107,33 +107,33 @@ private void seenOnline(final Server server, final CommandSource sender, final U List history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId()); if (history != null && history.size() > 1) { - sender.sendMessage(tl("seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history))); + sender.sendMessage(tlp(sender, "seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history))); } if (user.isAfk()) { - sender.sendMessage(tl("whoisAFK", tl("true"))); + sender.sendMessage(tlp(sender, "whoisAFK", tlp(sender, "true"))); } if (user.isJailed()) { - sender.sendMessage(tl("whoisJail", (user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true")))); + sender.sendMessage(tlp(sender, "whoisJail", (user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tlp(sender, "true")))); } if (user.isMuted()) { - sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true")))); + sender.sendMessage(tlp(sender, "whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tlp(sender, "true")))); } final String location = user.getGeoLocation(); if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { - sender.sendMessage(tl("whoisGeoLocation", location)); + sender.sendMessage(tlp(sender, "whoisGeoLocation", location)); } if (showIp) { - sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); + sender.sendMessage(tlp(sender, "whoisIPAddress", user.getBase().getAddress().getAddress().toString())); } } private void seenOffline(final Server server, final CommandSource sender, User user, final boolean showBan, final boolean showIp, final boolean showLocation) throws Exception { user.setDisplayNick(); if (user.getLastLogout() > 0) { - sender.sendMessage(tl("seenOffline", user.getName(), DateUtil.formatDateDiff(user.getLastLogout()))); + sender.sendMessage(tlp(sender, "seenOffline", user.getName(), DateUtil.formatDateDiff(user.getLastLogout()))); } else { - sender.sendMessage(tl("userUnknown", user.getName())); + sender.sendMessage(tlp(sender, "userUnknown", user.getName())); } if (ess.getSettings().isDebug()) { @@ -142,36 +142,36 @@ private void seenOffline(final Server server, final CommandSource sender, User u List history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId()); if (history != null && history.size() > 1) { - sender.sendMessage(tl("seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history))); + sender.sendMessage(tlp(sender, "seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history))); } if (BanLookup.isBanned(ess, user)) { final BanEntry banEntry = BanLookup.getBanEntry(ess, user.getName()); - final String reason = showBan ? banEntry.getReason() : tl("true"); - sender.sendMessage(tl("whoisBanned", reason)); + final String reason = showBan ? banEntry.getReason() : tlp(sender, "true"); + sender.sendMessage(tlp(sender, "whoisBanned", reason)); if (banEntry.getExpiration() != null) { Date expiry = banEntry.getExpiration(); - String expireString = tl("now"); + String expireString = tlp(sender, "now"); if (expiry.after(new Date())) { expireString = DateUtil.formatDateDiff(expiry.getTime()); } - sender.sendMessage(tl("whoisTempBanned", expireString)); + sender.sendMessage(tlp(sender, "whoisTempBanned", expireString)); } } final String location = user.getGeoLocation(); if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { - sender.sendMessage(tl("whoisGeoLocation", location)); + sender.sendMessage(tlp(sender, "whoisGeoLocation", location)); } if (showIp) { if (!user.getLastLoginAddress().isEmpty()) { - sender.sendMessage(tl("whoisIPAddress", user.getLastLoginAddress())); + sender.sendMessage(tlp(sender, "whoisIPAddress", user.getLastLoginAddress())); } } if (showLocation) { final Location loc = user.getLogoutLocation(); if (loc != null) { - sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + sender.sendMessage(tlp(sender, "whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } } } @@ -180,10 +180,10 @@ private void seenIP(final Server server, final CommandSource sender, final Strin final UserMap userMap = ess.getUserMap(); if (ess.getServer().getBanList(BanList.Type.IP).isBanned(ipAddress)) { - sender.sendMessage(tl("isIpBanned", ipAddress)); + sender.sendMessage(tlp(sender, "isIpBanned", ipAddress)); } - sender.sendMessage(tl("runningPlayerMatch", ipAddress)); + sender.sendMessage(tlp(sender, "runningPlayerMatch", ipAddress)); ess.runTaskAsynchronously(new Runnable() { @Override @@ -203,10 +203,10 @@ public void run() { } if (matches.size() > 0) { - sender.sendMessage(tl("matchingIPAddress")); + sender.sendMessage(tlp(sender, "matchingIPAddress")); sender.sendMessage(StringUtil.joinList(matches)); } else { - sender.sendMessage(tl("noMatchingPlayers")); + sender.sendMessage(tlp(sender, "noMatchingPlayers")); } } diff --git a/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java b/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java index 612daeb6981..f52b1db736b 100644 --- a/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java +++ b/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.messaging; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; import com.earth2me.essentials.Console; import com.earth2me.essentials.IEssentials; @@ -66,10 +66,10 @@ public String getName() { MessageResponse messageResponse = recipient.onReceiveMessage(this.parent, message); switch (messageResponse) { case UNREACHABLE: - sendMessage(tl("recentlyForeverAlone", recipient.getDisplayName())); + sendMessage(tlp(getUser(recipient), "recentlyForeverAlone", recipient.getDisplayName())); break; case MESSAGES_IGNORED: - sendMessage(tl("msgIgnore", recipient.getDisplayName())); + sendMessage(tlp(getUser(recipient), "msgIgnore", recipient.getDisplayName())); break; case SENDER_IGNORED: break; @@ -77,12 +77,12 @@ public String getName() { case SUCCESS_BUT_AFK: // Currently, only IUser can be afk, so we unsafely cast to get the afk message. if (((IUser) recipient).getAfkMessage() != null) { - sendMessage(tl("userAFKWithMessage", recipient.getDisplayName(), ((IUser) recipient).getAfkMessage())); + sendMessage(tlp(getUser(recipient), "userAFKWithMessage", recipient.getDisplayName(), ((IUser) recipient).getAfkMessage())); } else { - sendMessage(tl("userAFK", recipient.getDisplayName())); + sendMessage(tlp(getUser(recipient), "userAFK", recipient.getDisplayName())); } default: - sendMessage(tl("msgFormat", tl("me"), recipient.getDisplayName(), message)); + sendMessage(tlp(getUser(recipient), "msgFormat", tlp(getUser(recipient), "me"), recipient.getDisplayName(), message)); // Better Social Spy User senderUser = getUser(this); @@ -97,9 +97,9 @@ public String getName() { && !onlineUser.equals(senderUser) && !onlineUser.equals(recipient)) { if (senderUser.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers()) { - onlineUser.sendMessage(tl("socialMutedSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); + onlineUser.sendMessage(tlp(onlineUser, "socialMutedSpyPrefix") + tlp(onlineUser, "socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); } else { - onlineUser.sendMessage(tl("socialSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); + onlineUser.sendMessage(tlp(onlineUser, "socialSpyPrefix") + tlp(onlineUser, "socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); } } } @@ -132,7 +132,7 @@ public MessageResponse onReceiveMessage(IMessageRecipient sender, String message } } // Display the formatted message to this recipient. - sendMessage(tl("msgFormat", sender.getDisplayName(), tl("me"), message)); + sendMessage(tlp(user, "msgFormat", sender.getDisplayName(), tlp(user, "me"), message)); if (ess.getSettings().isLastMessageReplyRecipient()) { // If this recipient doesn't have a reply recipient, initiate by setting the first diff --git a/Essentials/src/com/earth2me/essentials/textreader/BookPager.java b/Essentials/src/com/earth2me/essentials/textreader/BookPager.java index 72214fb2660..7f550e2938e 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/BookPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/BookPager.java @@ -18,6 +18,7 @@ public BookPager(final IText text) { this.text = text; } + @SuppressWarnings("deprecation") public List getPages(final String pageStr) throws Exception { List lines = text.getLines(); List chapters = text.getChapters(); diff --git a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java index 036761be10b..d3d1811dcc2 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java @@ -10,7 +10,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import static com.earth2me.essentials.I18n.tl; +import static com.earth2me.essentials.I18n.tlp; public class HelpInput implements IText { @@ -28,7 +28,7 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr String pluginName = ""; String pluginNameLow = ""; if (!match.equalsIgnoreCase("")) { - lines.add(tl("helpMatching", match)); + lines.add(tlp(user, "helpMatching", match)); } for (Plugin p : ess.getServer().getPluginManager().getPlugins()) { @@ -41,7 +41,7 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr if (pluginNameLow.equals(match)) { lines.clear(); newLines.clear(); - lines.add(tl("helpFrom", p.getDescription().getName())); + lines.add(tlp(user, "helpFrom", p.getDescription().getName())); } final boolean isOnWhitelist = user.isAuthorized("essentials.help." + pluginNameLow); @@ -54,7 +54,7 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr if (pluginNameLow.contains("essentials")) { final String node = "essentials." + k.getKey(); if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node)) { - pluginLines.add(tl("helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); + pluginLines.add(tlp(user, "helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); } } else { if (ess.getSettings().showNonEssCommandsInHelp()) { @@ -66,7 +66,7 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr permissions = value.get(PERMISSIONS); } if (isOnWhitelist || user.isAuthorized("essentials.help." + pluginNameLow + "." + k.getKey())) { - pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(tlp(user, "helpLine", k.getKey(), value.get(DESCRIPTION))); } else if (permissions instanceof List && !((List) permissions).isEmpty()) { boolean enabled = false; for (Object o : (List) permissions) { @@ -76,15 +76,15 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr } } if (enabled) { - pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(tlp(user, "helpLine", k.getKey(), value.get(DESCRIPTION))); } } else if (permissions instanceof String && !"".equals(permissions)) { if (user.isAuthorized(permissions.toString())) { - pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(tlp(user, "helpLine", k.getKey(), value.get(DESCRIPTION))); } } else { if (!ess.getSettings().hidePermissionlessHelp()) { - pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(tlp(user, "helpLine", k.getKey(), value.get(DESCRIPTION))); } } } @@ -98,13 +98,13 @@ public HelpInput(final User user, final String match, final IEssentials ess) thr break; } if (match.equalsIgnoreCase("")) { - lines.add(tl("helpPlugin", pluginName, pluginNameLow)); + lines.add(tlp(user, "helpPlugin", pluginName, pluginNameLow)); } } } catch (NullPointerException ex) { } catch (Exception ex) { if (!reported) { - logger.log(Level.WARNING, tl("commandHelpFailedForPlugin", pluginNameLow), ex); + logger.log(Level.WARNING, tlp(null, "commandHelpFailedForPlugin", pluginNameLow), ex); } reported = true; } diff --git a/Essentials/src/com/earth2me/essentials/utils/DateUtil.java b/Essentials/src/com/earth2me/essentials/utils/DateUtil.java index 913f4806bb2..35f8890c917 100644 --- a/Essentials/src/com/earth2me/essentials/utils/DateUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/DateUtil.java @@ -16,6 +16,7 @@ public static String removeTimePattern(String input) { return timePattern.matcher(input).replaceFirst("").trim(); } + @SuppressWarnings("deprecation") public static long parseDateDiff(String time, boolean future) throws Exception { Matcher m = timePattern.matcher(time); int years = 0; @@ -61,6 +62,7 @@ public static long parseDateDiff(String time, boolean future) throws Exception { break; } } + if (!found) { throw new Exception(tl("illegalDate")); } @@ -126,6 +128,7 @@ public static String formatDateDiff(long date) { return DateUtil.formatDateDiff(now, c); } + @SuppressWarnings("deprecation") public static String formatDateDiff(Calendar fromDate, Calendar toDate) { boolean future = false; if (toDate.equals(fromDate)) { diff --git a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java index 07b7d88949d..52ce271177d 100644 --- a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java @@ -184,6 +184,7 @@ public static boolean meansReset(final String desc) { } // ============================================ + @SuppressWarnings("deprecation") public static String format(final long ticks) { return tl("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks)); } diff --git a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java index 7de0a472688..b03594f7790 100644 --- a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java @@ -1,7 +1,10 @@ package com.earth2me.essentials.utils; +import me.clip.placeholderapi.PlaceholderAPI; import net.ess3.api.IUser; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.entity.Player; import java.util.regex.Pattern; @@ -22,6 +25,8 @@ public class FormatUtil { static final transient Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-zA-Z]{2,3}(?:/\\S+)?)"); public static final Pattern IPPATTERN = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); + static Boolean papiEnabled = null; + //This method is used to simply strip the native minecraft colour codes public static String stripFormat(final String input) { if (input == null) { @@ -38,6 +43,30 @@ public static String stripEssentialsFormat(final String input) { return stripColor(input, REPLACE_ALL_PATTERN); } + public static String placeholderAPIFormat(final IUser user, final String input) { + return placeholderAPIFormat(user.getBase(), input); + } + + //Formatting PlaceholderAPI Placeholders, returns the original string if the plugin isn't enabled + //Seperate this from #getChatFormat() in ISettings due to the requirement of Player as an argument + public static String placeholderAPIFormat(final Player player, String input) { + if (input == null) { + return null; + } + + input = input.replaceAll("\\{|\\}", "%"); + + if (papiEnabled == null) { + papiEnabled = Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"); + } + + //Checking here instead, please tell me if there is a better way + if (papiEnabled) { + return PlaceholderAPI.setPlaceholders(player, input); + } + return input; + } + //This is the general permission sensitive message format function, checks for urls. public static String formatMessage(final IUser user, final String permBase, final String input) { if (input == null) { diff --git a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java index 64d5bb2c6ef..9b2467610ed 100644 --- a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java @@ -13,7 +13,6 @@ import static com.earth2me.essentials.I18n.tl; -import com.earth2me.essentials.Essentials; import com.earth2me.essentials.IEssentials; @@ -291,6 +290,7 @@ public static Location getSafeDestination(final IEssentials ess, final IUser use return getSafeDestination(loc); } + @SuppressWarnings("deprecation") public static Location getSafeDestination(final Location loc) throws Exception { if (loc == null || loc.getWorld() == null) { throw new Exception(tl("destinationNotSet")); diff --git a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java index c4459f34cf4..faff67b304e 100644 --- a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java @@ -54,6 +54,7 @@ public static String formatAsPrettyCurrency(BigDecimal value) { return str; } + @SuppressWarnings("deprecation") public static String displayCurrency(final BigDecimal value, final IEssentials ess) { String currency = formatAsPrettyCurrency(value); String sign = ""; @@ -64,6 +65,7 @@ public static String displayCurrency(final BigDecimal value, final IEssentials e return sign + tl("currency", ess.getSettings().getCurrencySymbol(), currency); } + @SuppressWarnings("deprecation") public static String displayCurrencyExactly(final BigDecimal value, final IEssentials ess) { String currency = value.toPlainString(); String sign = ""; diff --git a/Essentials/src/net/ess3/api/events/UserWarpEvent.java b/Essentials/src/net/ess3/api/events/UserWarpEvent.java new file mode 100644 index 00000000000..6d46906f4f9 --- /dev/null +++ b/Essentials/src/net/ess3/api/events/UserWarpEvent.java @@ -0,0 +1,61 @@ +package net.ess3.api.events; + +import com.earth2me.essentials.Trade; +import net.ess3.api.IUser; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +/** + * Called when the player use the command /warp + */ +public class UserWarpEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + + private IUser user; + private String warp; + private Trade trade; + private boolean cancelled = false; + + + public UserWarpEvent(IUser user, String warp, Trade trade){ + this.user = user; + this.warp = warp; + this.trade = trade; + } + + public IUser getUser() { + return user; + } + + public String getWarp() { + return warp; + } + + public Trade getTrade() { + return trade; + } + + public void setWarp(String warp) { + this.warp = warp; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean b) { + cancelled = b; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 6012c572722..e7fdba30cf6 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials version: ${full.version} website: http://tiny.cc/EssentialsCommands description: Provides an essential, core set of commands for Bukkit. -softdepend: [Vault] +softdepend: [Vault, PlaceholderAPI] authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Iaccidentally, drtshock, vemacs, SupaHam, md678685] commands: afk: diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 95284e5c965..20d904b76e0 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -3,6 +3,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import net.ess3.api.IEssentials; +import org.bukkit.Bukkit; import org.bukkit.Server; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -57,6 +58,8 @@ public void onPlayerChat(final AsyncPlayerChatEvent event) { format = format.replace("{5}", team == null ? "" : team.getDisplayName()); format = format.replace("{6}", prefix); format = format.replace("{7}", suffix); + format = FormatUtil.placeholderAPIFormat(user, format); + synchronized (format) { event.setFormat(format); } diff --git a/EssentialsChat/src/plugin.yml b/EssentialsChat/src/plugin.yml index 5f855228b0e..09249aaa4d1 100644 --- a/EssentialsChat/src/plugin.yml +++ b/EssentialsChat/src/plugin.yml @@ -7,4 +7,4 @@ website: http://tiny.cc/EssentialsCommands description: Provides chat control features for Essentials. Requires Permissions. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy, Iaccidentally] depend: [Essentials] -#softdepend: [Factions] +softdepend: [PlaceholderAPI] diff --git a/pom.xml b/pom.xml index 3efbf97d14e..14250c2a433 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,10 @@ bukkit-repo https://hub.spigotmc.org/nexus/content/groups/public/ + + placeholderapi + http://repo.extendedclip.com/content/repositories/placeholderapi/ + @@ -68,6 +72,12 @@ 1.12.2 provided + + me.clip + placeholderapi + LATEST + provided +