diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java index 26409815f..a7bca0435 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java @@ -455,7 +455,7 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor { user.getBase().setAllowFlight(true); user.getBase().setFlying(true); if (ess.getSettings().isSendFlyEnableOnJoin()) { - user.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), true), CommonPlaceholders.displayName(user)); + user.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), true), user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/User.java b/Essentials/src/main/java/com/earth2me/essentials/User.java index fe0c74f6a..46e2e03e4 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/User.java +++ b/Essentials/src/main/java/com/earth2me/essentials/User.java @@ -7,7 +7,6 @@ import com.earth2me.essentials.economy.EconomyLayers; import com.earth2me.essentials.messaging.IMessageRecipient; import com.earth2me.essentials.messaging.SimpleMessageRecipient; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.EnumUtil; import com.earth2me.essentials.utils.FormatUtil; @@ -16,7 +15,6 @@ import com.earth2me.essentials.utils.TriState; import com.earth2me.essentials.utils.VersionUtil; import com.google.common.collect.Lists; import net.ess3.api.IEssentials; -import net.ess3.api.IUser; import net.ess3.api.MaxMoneyException; import net.ess3.api.events.AfkStatusChangeEvent; import net.ess3.api.events.JailStatusChangeEvent; @@ -250,7 +248,7 @@ public class User extends UserData implements Comparable, IMessageRecipien setMoney(getMoney().add(value), cause); sendTl("addedToAccount", NumberUtil.displayCurrency(value, ess)); if (initiator != null) { - initiator.sendTl("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), CommonPlaceholders.displayName((IUser) this), NumberUtil.displayCurrency(getMoney(), ess)); + initiator.sendTl("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)); } } @@ -267,8 +265,8 @@ public class User extends UserData implements Comparable, IMessageRecipien if (canAfford(value)) { setMoney(getMoney().subtract(value), cause); reciever.setMoney(reciever.getMoney().add(value), cause); - sendTl("moneySentTo", NumberUtil.displayCurrency(value, ess), CommonPlaceholders.displayName((IUser) reciever)); - reciever.sendTl("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), CommonPlaceholders.displayName((IUser) this)); + sendTl("moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName()); + reciever.sendTl("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName()); final TransactionEvent transactionEvent = new TransactionEvent(this.getSource(), reciever, value); ess.getServer().getPluginManager().callEvent(transactionEvent); } else { @@ -297,7 +295,7 @@ public class User extends UserData implements Comparable, IMessageRecipien } sendTl("takenFromAccount", NumberUtil.displayCurrency(value, ess)); if (initiator != null) { - initiator.sendTl("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), CommonPlaceholders.displayName((IUser) this), NumberUtil.displayCurrency(getMoney(), ess)); + initiator.sendTl("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)); } } @@ -409,7 +407,7 @@ public class User extends UserData implements Comparable, IMessageRecipien } teleportRequestQueue.remove(playerUsername); if (inform) { - sendTl("requestTimedOutFrom", CommonPlaceholders.displayName((IUser) ess.getUser(request.getRequesterUuid()))); + sendTl("requestTimedOutFrom", ess.getUser(request.getRequesterUuid()).getDisplayName()); } return null; } @@ -443,7 +441,7 @@ public class User extends UserData implements Comparable, IMessageRecipien } } else { if (inform) { - sendTl("requestTimedOutFrom", CommonPlaceholders.displayName((IUser) ess.getUser(request.getRequesterUuid()))); + sendTl("requestTimedOutFrom", ess.getUser(request.getRequesterUuid()).getDisplayName()); } teleportRequestQueue.remove(key); } @@ -806,9 +804,9 @@ public class User extends UserData implements Comparable, IMessageRecipien if (broadcast && !isHidden() && !isAfk()) { setDisplayNick(); if (ess.getSettings().broadcastAfkMessage()) { - ess.broadcastTl(this, u -> u == this, "userIsNotAway", CommonPlaceholders.displayName((IUser) this)); + ess.broadcastTl(this, u -> u == this, "userIsNotAway", getDisplayName()); } - sendTl("userIsNotAwaySelf", CommonPlaceholders.displayName((IUser) this)); + sendTl("userIsNotAwaySelf", getDisplayName()); } } lastActivity = System.currentTimeMillis(); @@ -861,9 +859,9 @@ public class User extends UserData implements Comparable, IMessageRecipien if (isAfk() && !isHidden()) { setDisplayNick(); if (ess.getSettings().broadcastAfkMessage()) { - ess.broadcastTl(this, u -> u == this, "userIsAway", CommonPlaceholders.displayName((IUser) this)); + ess.broadcastTl(this, u -> u == this, "userIsAway", getDisplayName()); } - sendTl("userIsAwaySelf", CommonPlaceholders.displayName((IUser) this)); + sendTl("userIsAwaySelf", getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandafk.java index 4514635f6..51ec11841 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandafk.java @@ -2,9 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.DateUtil; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import net.ess3.api.events.AfkStatusChangeEvent; import org.bukkit.Server; @@ -97,10 +95,10 @@ public class Commandafk extends EssentialsCommand { } if (!tlKey.isEmpty() && ess.getSettings().broadcastAfkMessage()) { // exclude user from receiving general AFK announcement in favor of personal message - ess.broadcastTl(user, u -> u == user, tlKey, CommonPlaceholders.displayName((IUser) user), message); + ess.broadcastTl(user, u -> u == user, tlKey, user.getDisplayName(), message); } if (!selfTlKey.isEmpty()) { - user.sendTl(selfTlKey, CommonPlaceholders.displayName((IUser) user), message); + user.sendTl(selfTlKey, user.getDisplayName(), message); } user.setDisplayNick(); // Set this again after toggling } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalance.java index 5ab239d31..67a8db25e 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalance.java @@ -2,9 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; -import net.ess3.api.IUser; import org.bukkit.Server; import java.util.Collections; @@ -22,14 +20,14 @@ public class Commandbalance extends EssentialsCommand { } final User target = getPlayer(server, args, 0, false, true); - sender.sendTl("balanceOther", target.isHidden() ? target.getName() : CommonPlaceholders.displayName((IUser) target), NumberUtil.displayCurrency(target.getMoney(), ess)); + sender.sendTl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)); } @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length == 1 && user.isAuthorized("essentials.balance.others")) { final User target = getPlayer(server, args, 0, true, true); - user.sendTl("balanceOther", target.isHidden() ? target.getName() : CommonPlaceholders.displayName((IUser) target), NumberUtil.displayCurrency(target.getMoney(), ess)); + user.sendTl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)); } else if (args.length < 2) { user.sendTl("balance", NumberUtil.displayCurrency(user.getMoney(), ess)); } else { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandburn.java index 0e2032e61..0455e2dad 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandburn.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandburn.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; import java.util.Collections; @@ -22,7 +20,7 @@ public class Commandburn extends EssentialsCommand { final User user = getPlayer(server, sender, args, 0); user.getBase().setFireTicks(Integer.parseInt(args[1]) * 20); - sender.sendTl("burnMsg", CommonPlaceholders.displayName((IUser) user), Integer.parseInt(args[1])); + sender.sendTl("burnMsg", user.getDisplayName(), Integer.parseInt(args[1])); } @Override diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java index 96b27646b..887703339 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java @@ -3,10 +3,8 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; import com.google.common.collect.Lists; -import net.ess3.api.IUser; import net.ess3.api.MaxMoneyException; import net.ess3.api.TranslatableException; import net.ess3.api.events.UserBalanceUpdateEvent; @@ -67,7 +65,7 @@ public class Commandeco extends EssentialsLoopCommand { final boolean aboveMax = userAmount.compareTo(maxBal) > 0; player.setMoney(underMin ? minBal : aboveMax ? maxBal : userAmount, UserBalanceUpdateEvent.Cause.COMMAND_ECO); player.sendTl("setBal", NumberUtil.displayCurrency(player.getMoney(), ess)); - sender.sendTl("setBalOthers", CommonPlaceholders.displayName((IUser) player), NumberUtil.displayCurrency(player.getMoney(), ess)); + sender.sendTl("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess)); break; } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java index bd2a1017f..eede838da 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java @@ -9,7 +9,6 @@ import com.earth2me.essentials.economy.EconomyLayers; import com.earth2me.essentials.userstorage.ModernUserMap; import com.earth2me.essentials.utils.AdventureUtil; import com.earth2me.essentials.utils.CommandMapUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.EnumUtil; import com.earth2me.essentials.utils.FloatUtil; @@ -22,7 +21,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -485,7 +483,7 @@ public class Commandessentials extends EssentialsCommand { } final User user = getPlayer(server, args, 1, true, true); user.reset(); - sender.sendMessage("Reset Essentials userdata for player: " + CommonPlaceholders.displayName((IUser) user)); + sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName()); } // Toggles debug mode. diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandexp.java index d579be1a3..9f4270aa0 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandexp.java @@ -4,8 +4,6 @@ import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.IUser; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.SetExpFix; -import com.earth2me.essentials.messaging.IMessageRecipient; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; import com.google.common.collect.Lists; import org.bukkit.Server; @@ -99,7 +97,7 @@ public class Commandexp extends EssentialsLoopCommand { } private void showExp(final CommandSource sender, final IUser target) { - sender.sendTl("exp", CommonPlaceholders.displayNameRecipient((IMessageRecipient) target), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase())); + sender.sendTl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase())); } //TODO: Limit who can give negative exp? @@ -131,7 +129,7 @@ public class Commandexp extends EssentialsLoopCommand { amount = 0L; } SetExpFix.setTotalExperience(target.getBase(), (int) amount); - sender.sendTl("expSet", CommonPlaceholders.displayNameRecipient((IMessageRecipient) target), amount); + sender.sendTl("expSet", target.getDisplayName(), amount); } @Override diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandext.java index 5344c557b..ba3df39f4 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandext.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; import org.bukkit.entity.Player; @@ -38,7 +36,7 @@ public class Commandext extends EssentialsLoopCommand { @Override protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) { extPlayer(player.getBase()); - sender.sendTl("extinguishOthers", CommonPlaceholders.displayName((IUser) player)); + sender.sendTl("extinguishOthers", player.getDisplayName()); } private void extPlayer(final Player player) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfeed.java index ab1b2dfb0..72efa62ac 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfeed.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; import org.bukkit.entity.Player; import org.bukkit.event.entity.FoodLevelChangeEvent; @@ -44,7 +42,7 @@ public class Commandfeed extends EssentialsLoopCommand { protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws PlayerExemptException { try { feedPlayer(player.getBase()); - sender.sendTl("feedOther", CommonPlaceholders.displayName((IUser) player)); + sender.sendTl("feedOther", player.getDisplayName()); } catch (final QuietAbortException e) { //Handle Quietly } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfly.java index 885a52549..c6a38fa47 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandfly.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import net.ess3.api.events.FlyStatusChangeEvent; import org.bukkit.Server; @@ -39,9 +38,9 @@ public class Commandfly extends EssentialsToggleCommand { user.getBase().setFlying(false); } - user.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), enabled), CommonPlaceholders.displayName((IUser) user)); + user.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), enabled), user.getDisplayName()); if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) { - sender.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), enabled), CommonPlaceholders.displayName((IUser) user)); + sender.sendTl("flyMode", CommonPlaceholders.enableDisable(user.getSource(), enabled), user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgamemode.java index 65a6432c9..52a2a2215 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgamemode.java @@ -3,8 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.IUser; import com.earth2me.essentials.User; -import com.earth2me.essentials.messaging.IMessageRecipient; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.google.common.collect.ImmutableList; import org.bukkit.GameMode; import org.bukkit.Server; @@ -62,7 +60,7 @@ public class Commandgamemode extends EssentialsLoopCommand { } user.getBase().setGameMode(gameMode); - user.sendTl("gameMode", user.playerTl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), CommonPlaceholders.displayNameRecipient((IMessageRecipient) user)); + user.sendTl("gameMode", user.playerTl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()); } private void setUserGamemode(final CommandSource sender, final GameMode gameMode, final User user) throws NotEnoughArgumentsException { @@ -76,7 +74,7 @@ public class Commandgamemode extends EssentialsLoopCommand { } user.getBase().setGameMode(gameMode); - sender.sendTl("gameMode", sender.tl(gameMode.toString().toLowerCase(Locale.ENGLISH)), CommonPlaceholders.displayNameRecipient((IMessageRecipient) user)); + sender.sendTl("gameMode", sender.tl(gameMode.toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()); } // essentials.gamemode will let them change to any but essentials.gamemode.survival would only let them change to survival. diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgive.java index cd7ecde5e..9991e826a 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandgive.java @@ -4,11 +4,9 @@ import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.Inventories; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.VersionUtil; import com.google.common.collect.Lists; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import org.bukkit.Material; import org.bukkit.Server; @@ -81,7 +79,7 @@ public class Commandgive extends EssentialsLoopCommand { final boolean isDropItemsIfFull = ess.getSettings().isDropItemsIfFull(); final ItemStack finalStack = stack; loopOnlinePlayersConsumer(server, sender, false, true, args[0], player -> { - sender.sendTl("giveSpawn", finalStack.getAmount(), itemName, CommonPlaceholders.displayName((IUser) player)); + sender.sendTl("giveSpawn", finalStack.getAmount(), itemName, player.getDisplayName()); final Map leftovers = Inventories.addItem(player.getBase(), player.isAuthorized("essentials.oversizedstacks") ? ess.getSettings().getOversizedStackSize() : 0, finalStack); @@ -90,7 +88,7 @@ public class Commandgive extends EssentialsLoopCommand { final World w = player.getWorld(); w.dropItemNaturally(player.getLocation(), item); } else { - sender.sendTl("giveSpawnFailure", item.getAmount(), itemName, CommonPlaceholders.displayName((IUser) player)); + sender.sendTl("giveSpawnFailure", item.getAmount(), itemName, player.getDisplayName()); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandheal.java index 4f27d86ce..e65eed752 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandheal.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityRegainHealthEvent; @@ -71,7 +69,7 @@ public class Commandheal extends EssentialsLoopCommand { player.removePotionEffect(effect.getType()); } } - sender.sendTl("healOther", CommonPlaceholders.displayName((IUser) user)); + sender.sendTl("healOther", user.getDisplayName()); } catch (final QuietAbortException e) { //Handle Quietly } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandhelpop.java index 0e3ba10c7..28d5870dd 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandhelpop.java @@ -5,7 +5,6 @@ import com.earth2me.essentials.Console; import com.earth2me.essentials.User; import com.earth2me.essentials.messaging.IMessageRecipient; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.FormatUtil; import net.ess3.api.IUser; import net.essentialsx.api.v2.events.HelpopMessageSendEvent; @@ -40,8 +39,7 @@ public class Commandhelpop extends EssentialsCommand { } final String message = FormatUtil.stripFormat(getFinalArg(args, 0)); - final AdventureUtil.ParsedPlaceholder displayName = CommonPlaceholders.displayNameRecipient(from); - ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("helpOp", displayName, message))); + ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("helpOp", from.getDisplayName(), message))); final List recipients = new ArrayList<>(); for (IUser user : ess.getOnlineUsers()) { @@ -54,7 +52,7 @@ public class Commandhelpop extends EssentialsCommand { ess.getServer().getPluginManager().callEvent(sendEvent); for (IUser recipient : sendEvent.getRecipients()) { - recipient.sendTl("helpOp", displayName, message); + recipient.sendTl("helpOp", from.getDisplayName(), message); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandice.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandice.java index 098141151..4c802a79f 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandice.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandice.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.VersionUtil; import net.ess3.api.IUser; import net.ess3.api.MaxMoneyException; @@ -39,7 +38,7 @@ public class Commandice extends EssentialsLoopCommand { @Override protected void updatePlayer(Server server, CommandSource sender, User user, String[] args) throws NotEnoughArgumentsException, PlayerExemptException, ChargeException, MaxMoneyException { freezePlayer(user); - sender.sendTl("iceOther", CommonPlaceholders.displayName((IUser) user)); + sender.sendTl("iceOther", user.getDisplayName()); } private void freezePlayer(final IUser user) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandkitreset.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandkitreset.java index 72bfad0dd..70c8873f7 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandkitreset.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandkitreset.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import org.bukkit.Server; @@ -36,7 +34,7 @@ public class Commandkitreset extends EssentialsCommand { if (user.equals(target)) { user.sendTl("kitReset", kitName); } else { - user.sendTl("kitResetOther", kitName, CommonPlaceholders.displayName((IUser) target)); + user.sendTl("kitResetOther", kitName, target.getDisplayName()); } } @@ -53,7 +51,7 @@ public class Commandkitreset extends EssentialsCommand { final User target = getPlayer(server, sender, args, 1); target.setKitTimestamp(kitName, 0); - sender.sendTl("kitResetOther", kitName, CommonPlaceholders.displayName((IUser) target)); + sender.sendTl("kitResetOther", kitName, target.getDisplayName()); } @Override diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandlightning.java index 5d1fc812e..a8a53db62 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandlightning.java @@ -2,9 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.google.common.collect.Lists; -import net.ess3.api.IUser; import org.bukkit.Server; import org.bukkit.entity.LightningStrike; @@ -35,7 +33,7 @@ public class Commandlightning extends EssentialsLoopCommand { } final int finalPower = power; loopOnlinePlayersConsumer(server, sender, false, true, args[0], player -> { - sender.sendTl("lightningUse", CommonPlaceholders.displayName((IUser) player)); + sender.sendTl("lightningUse", player.getDisplayName()); final LightningStrike strike = player.getBase().getWorld().strikeLightningEffect(player.getBase().getLocation()); if (!player.isGodModeEnabled()) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index fc19a582d..7dad73063 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -6,13 +6,11 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.messaging.IMessageRecipient; import com.earth2me.essentials.textreader.SimpleTextPager; import com.earth2me.essentials.textreader.SimpleTranslatableText; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.StringUtil; import com.google.common.collect.Lists; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import net.essentialsx.api.v2.services.mail.MailMessage; import org.bukkit.Server; @@ -102,7 +100,7 @@ public class Commandmail extends EssentialsCommand { u.sendMail(user, msg); } - user.sendTl("mailSentTo", CommonPlaceholders.displayName((IUser) u), u.getName()); + user.sendTl("mailSentTo", u.getDisplayName(), u.getName()); user.sendMessage(msg); return; } @@ -145,7 +143,7 @@ public class Commandmail extends EssentialsCommand { u.sendMail(user, msg, dateDiff); } - user.sendTl("mailSentToExpire", CommonPlaceholders.displayName((IUser) u), DateUtil.formatDateDiff(dateDiff), u.getName()); + user.sendTl("mailSentToExpire", u.getDisplayName(), DateUtil.formatDateDiff(dateDiff), u.getName()); user.sendMessage(msg); return; } @@ -187,7 +185,7 @@ public class Commandmail extends EssentialsCommand { final ArrayList mails = mailUser.getMailMessages(); if (mails == null || mails.isEmpty()) { - user.sendTl(mailUser == user ? "noMail" : "noMailOther", CommonPlaceholders.displayName((IUser) mailUser)); + user.sendTl(mailUser == user ? "noMail" : "noMailOther", mailUser.getDisplayName()); throw new NoChargeException(); } @@ -227,7 +225,7 @@ public class Commandmail extends EssentialsCommand { final ArrayList mails = mailUser.getMailMessages(); if (mails == null || mails.isEmpty()) { - sender.sendTl("noMailOther", CommonPlaceholders.displayName((IUser) mailUser)); + sender.sendTl("noMailOther", mailUser.getDisplayName()); throw new NoChargeException(); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsgtoggle.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsgtoggle.java index df4aa2db9..1bdb484a5 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsgtoggle.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmsgtoggle.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; public class Commandmsgtoggle extends EssentialsToggleCommand { @@ -31,7 +29,7 @@ public class Commandmsgtoggle extends EssentialsToggleCommand { user.sendTl(!enabled ? "msgEnabled" : "msgDisabled"); if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(!enabled ? "msgEnabledFor" : "msgDisabledFor", CommonPlaceholders.displayName((IUser) user)); + sender.sendTl(!enabled ? "msgEnabledFor" : "msgDisabledFor", user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmute.java index d47b7c21f..53d1b2175 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmute.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.OfflinePlayerStub; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.DateUtil; import net.ess3.api.TranslatableException; import net.ess3.api.events.MuteStatusChangeEvent; @@ -87,18 +86,18 @@ public class Commandmute extends EssentialsCommand { if (muted) { if (muteTimestamp > 0) { if (!user.hasMuteReason()) { - sender.sendTl("mutedPlayerFor", CommonPlaceholders.displayName(user), muteTime); + sender.sendTl("mutedPlayerFor", user.getDisplayName(), muteTime); user.sendTl("playerMutedFor", muteTime); } else { - sender.sendTl("mutedPlayerForReason", CommonPlaceholders.displayName(user), muteTime, user.getMuteReason()); + sender.sendTl("mutedPlayerForReason", user.getDisplayName(), muteTime, user.getMuteReason()); user.sendTl("playerMutedForReason", muteTime, user.getMuteReason()); } } else { if (!user.hasMuteReason()) { - sender.sendTl("mutedPlayer", CommonPlaceholders.displayName(user)); + sender.sendTl("mutedPlayer", user.getDisplayName()); user.sendTl("playerMuted"); } else { - sender.sendTl("mutedPlayerReason", CommonPlaceholders.displayName(user), user.getMuteReason()); + sender.sendTl("mutedPlayerReason", user.getDisplayName(), user.getMuteReason()); user.sendTl("playerMutedReason", user.getMuteReason()); } } @@ -121,7 +120,7 @@ public class Commandmute extends EssentialsCommand { ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral(tlKey, objects))); ess.broadcastTl(null, "essentials.mute.notify", tlKey, objects); } else { - sender.sendTl("unmutedPlayer", CommonPlaceholders.displayName(user)); + sender.sendTl("unmutedPlayer", user.getDisplayName()); user.sendTl("playerUnmuted"); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandnick.java index cd69214fe..8b47afb02 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandnick.java @@ -2,9 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.FormatUtil; -import net.ess3.api.IUser; import net.ess3.api.TranslatableException; import net.ess3.api.events.NickChangeEvent; import org.bukkit.ChatColor; @@ -54,12 +52,12 @@ public class Commandnick extends EssentialsLoopCommand { if (!target.getDisplayName().equalsIgnoreCase(target.getDisplayName())) { target.sendTl("nickNoMore"); } - target.sendTl("nickSet", ess.getSettings().changeDisplayName() ? CommonPlaceholders.displayName((IUser) target) : nick); + target.sendTl("nickSet", ess.getSettings().changeDisplayName() ? target.getDisplayName() : nick); } else if (nickInUse(target, nick)) { throw new NotEnoughArgumentsException(sender.tl("nickInUse")); } else { setNickname(server, sender, target, nick); - target.sendTl("nickSet", ess.getSettings().changeDisplayName() ? CommonPlaceholders.displayName((IUser) target) : nick); + target.sendTl("nickSet", ess.getSettings().changeDisplayName() ? target.getDisplayName() : nick); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java index 4530c0ee1..734c90fc8 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java @@ -3,11 +3,9 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.StringUtil; import com.google.common.collect.Lists; -import net.ess3.api.IUser; import net.ess3.api.MaxMoneyException; import net.ess3.api.TranslatableException; import net.ess3.api.events.UserBalanceUpdateEvent; @@ -88,7 +86,7 @@ public class Commandpay extends EssentialsLoopCommand { } if (!player.isAcceptingPay() || (ess.getSettings().isPayExcludesIgnoreList() && player.isIgnoredPlayer(user))) { - user.sendTl("notAcceptingPay", CommonPlaceholders.displayName((IUser) player)); + user.sendTl("notAcceptingPay", player.getDisplayName()); return; } if (user.isPromptingPayConfirm() && !amount.equals(user.getConfirmingPayments().get(player))) { // checks if exists and if command needs to be repeated. diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpaytoggle.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpaytoggle.java index a6e20e749..66efcf960 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpaytoggle.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpaytoggle.java @@ -2,8 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; public class Commandpaytoggle extends EssentialsToggleCommand { @@ -38,7 +36,7 @@ public class Commandpaytoggle extends EssentialsToggleCommand { user.sendTl(enabled ? "payToggleOn" : "payToggleOff"); if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(enabled ? "payEnabledFor" : "payDisabledFor", CommonPlaceholders.displayName((IUser) user)); + sender.sendTl(enabled ? "payEnabledFor" : "payDisabledFor", user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrealname.java index a5e8ccbc5..387264115 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrealname.java @@ -2,9 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.FormatUtil; -import net.ess3.api.IUser; import org.bukkit.Server; import java.util.Locale; @@ -31,7 +29,7 @@ public class Commandrealname extends EssentialsCommand { u.setDisplayNick(); if (FormatUtil.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH).contains(lookup)) { foundUser = true; - sender.sendTl("realName", CommonPlaceholders.displayName((IUser) u), u.getName()); + sender.sendTl("realName", u.getDisplayName(), u.getName()); } } if (!foundUser) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrest.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrest.java index 2060c139d..82946b4f0 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrest.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrest.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.IUser; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.VersionUtil; import org.bukkit.Server; import org.bukkit.Statistic; @@ -35,7 +34,7 @@ public class Commandrest extends EssentialsLoopCommand { @Override protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws PlayerExemptException { restPlayer(player); - sender.sendTl("restOther", CommonPlaceholders.displayName(player)); + sender.sendTl("restOther", player.getDisplayName()); } private void restPlayer(final IUser user) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrtoggle.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrtoggle.java index 918b1a319..f566dbd54 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrtoggle.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrtoggle.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import org.bukkit.Server; public class Commandrtoggle extends EssentialsToggleCommand { @@ -30,7 +29,7 @@ public class Commandrtoggle extends EssentialsToggleCommand { user.sendTl(!enabled ? "replyLastRecipientDisabled" : "replyLastRecipientEnabled"); if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(!enabled ? "replyLastRecipientDisabledFor" : "replyLastRecipientEnabledFor", CommonPlaceholders.displayName(user)); + sender.sendTl(!enabled ? "replyLastRecipientDisabledFor" : "replyLastRecipientEnabledFor", user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java index ac6ae93be..6acfc2c45 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java @@ -102,7 +102,7 @@ public class Commandseen extends EssentialsCommand { private void seenOnline(final CommandSource sender, final User user, final boolean showIp) { user.setDisplayNick(); - sender.sendTl("seenOnline", CommonPlaceholders.displayName(user), DateUtil.formatDateDiff(user.getLastLogin())); + sender.sendTl("seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin())); final List history = user.getPastUsernames(); if (history != null && !history.isEmpty()) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsell.java index a24d1044e..92ef2b3e2 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsell.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.Inventories; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.NumberUtil; import com.google.common.collect.Lists; import net.ess3.api.TranslatableException; @@ -123,7 +122,7 @@ public class Commandsell extends EssentialsCommand { final String typeName = is.getType().toString().toLowerCase(Locale.ENGLISH); final String worthDisplay = NumberUtil.displayCurrency(worth, ess); user.sendTl("itemSold", NumberUtil.displayCurrency(result, ess), amount, typeName, worthDisplay); - ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("itemSoldConsole", user.getName(), typeName, NumberUtil.displayCurrency(result, ess), amount, worthDisplay, CommonPlaceholders.displayName(user)))); + ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("itemSoldConsole", user.getName(), typeName, NumberUtil.displayCurrency(result, ess), amount, worthDisplay, user.getDisplayName()))); return result; } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsocialspy.java index 3ff406db7..e8cd954d7 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsocialspy.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsocialspy.java @@ -28,9 +28,9 @@ public class Commandsocialspy extends EssentialsToggleCommand { user.setSocialSpyEnabled(enabled); - user.sendTl("socialSpy", CommonPlaceholders.displayName(user), CommonPlaceholders.enableDisable(user.getSource(), enabled)); + user.sendTl("socialSpy", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled)); if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) { - sender.sendTl("socialSpy", CommonPlaceholders.displayName(user), CommonPlaceholders.enableDisable(user.getSource(), enabled)); + sender.sendTl("socialSpy", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled)); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandspeed.java index f86a8d2fb..6eb6975ad 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandspeed.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.earth2me.essentials.utils.FloatUtil; import org.bukkit.Server; import org.bukkit.entity.Player; @@ -54,11 +53,11 @@ public class Commandspeed extends EssentialsCommand { if (isFly) { user.getBase().setFlySpeed(getRealMoveSpeed(speed, true, isBypass)); - user.sendTl("moveSpeed", AdventureUtil.parsed(user.playerTl("flying")), speed, CommonPlaceholders.displayName(user)); + user.sendTl("moveSpeed", AdventureUtil.parsed(user.playerTl("flying")), speed, user.getDisplayName()); return; } user.getBase().setWalkSpeed(getRealMoveSpeed(speed, false, isBypass)); - user.sendTl("moveSpeed", AdventureUtil.parsed(user.playerTl("walking")), speed, CommonPlaceholders.displayName(user)); + user.sendTl("moveSpeed", AdventureUtil.parsed(user.playerTl("walking")), speed, user.getDisplayName()); } private void speedOtherPlayers(final Server server, final CommandSource sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws PlayerNotFoundException { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsuicide.java index 2abb5e07c..53b170f67 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsuicide.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsuicide.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import org.bukkit.Server; import org.bukkit.event.entity.EntityDamageEvent; @@ -21,7 +20,7 @@ public class Commandsuicide extends EssentialsCommand { user.getBase().setHealth(0); user.sendTl("suicideMessage"); user.setDisplayNick(); - ess.broadcastTl(user, "suicideSuccess", CommonPlaceholders.displayName(user)); + ess.broadcastTl(user, "suicideSuccess", user.getDisplayName()); } @Override diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtp.java index cb0cad879..747775d4a 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtp.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import org.bukkit.Location; import org.bukkit.Server; @@ -29,12 +28,12 @@ public class Commandtp extends EssentialsCommand { final User player = getPlayer(server, user, args, 0, false, true); if (!player.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportDisabled", player.getDisplayName()); } if (!player.getBase().isOnline()) { if (user.isAuthorized("essentials.tpoffline")) { - throw new TranslatableException("teleportOffline", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportOffline", player.getDisplayName()); } throw new PlayerNotFoundException(); } @@ -80,7 +79,7 @@ public class Commandtp extends EssentialsCommand { } final Location locposother = new Location(target2.getWorld(), x, y, z, target2.getLocation().getYaw(), target2.getLocation().getPitch()); if (!target2.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(target2)); + throw new TranslatableException("teleportDisabled", target2.getDisplayName()); } user.sendTl("teleporting", locposother.getWorld().getName(), locposother.getBlockX(), locposother.getBlockY(), locposother.getBlockZ()); target2.getAsyncTeleport().now(locposother, false, TeleportCause.COMMAND, future); @@ -98,15 +97,15 @@ public class Commandtp extends EssentialsCommand { final User target = getPlayer(server, user, args, 0); final User toPlayer = getPlayer(server, user, args, 1); if (!target.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(target)); + throw new TranslatableException("teleportDisabled", target.getDisplayName()); } if (!toPlayer.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(toPlayer)); + throw new TranslatableException("teleportDisabled", toPlayer.getDisplayName()); } if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName())) { throw new TranslatableException("noPerm", "essentials.worlds." + toPlayer.getWorld().getName()); } - target.sendTl("teleportAtoB", CommonPlaceholders.displayName(user), CommonPlaceholders.displayName(toPlayer)); + target.sendTl("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()); target.getAsyncTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND, future); break; } @@ -121,7 +120,7 @@ public class Commandtp extends EssentialsCommand { final User target = getPlayer(server, args, 0, true, false); if (args.length == 2) { final User toPlayer = getPlayer(server, args, 1, true, false); - target.sendTl("teleportAtoB", Console.DISPLAY_NAME, CommonPlaceholders.displayName(toPlayer)); + target.sendTl("teleportAtoB", Console.DISPLAY_NAME, toPlayer.getDisplayName()); target.getAsyncTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND, getNewExceptionFuture(sender, commandLabel)); } else if (args.length > 3) { final double x = args[1].startsWith("~") ? target.getLocation().getX() + (args[1].length() > 1 ? Double.parseDouble(args[1].substring(1)) : 0) : Double.parseDouble(args[1]); diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java index 3f88df273..f33e83246 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.AsyncTeleport; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import net.ess3.api.events.TPARequestEvent; import org.bukkit.Server; @@ -29,10 +28,10 @@ public class Commandtpa extends EssentialsCommand { throw new NotEnoughArgumentsException(); } if (!player.isAuthorized("essentials.tpaccept")) { - throw new TranslatableException("teleportNoAcceptPermission", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportNoAcceptPermission", player.getDisplayName()); } if (!player.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportDisabled", player.getDisplayName()); } if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) { throw new TranslatableException("noPerm", "essentials.worlds." + player.getWorld().getName()); @@ -40,7 +39,7 @@ public class Commandtpa extends EssentialsCommand { // Don't let sender request teleport twice to the same player. if (player.hasOutstandingTpaRequest(user.getName(), false)) { - throw new TranslatableException("requestSentAlready", CommonPlaceholders.displayName(player)); + throw new TranslatableException("requestSentAlready", player.getDisplayName()); } if (player.isAutoTeleportEnabled() && !player.isIgnoredPlayer(user)) { @@ -51,8 +50,8 @@ public class Commandtpa extends EssentialsCommand { teleport.teleport(player.getBase(), charge, PlayerTeleportEvent.TeleportCause.COMMAND, future); future.thenAccept(success -> { if (success) { - player.sendTl("requestAcceptedAuto", CommonPlaceholders.displayName(user)); - user.sendTl("requestAcceptedFromAuto", CommonPlaceholders.displayName(player)); + player.sendTl("requestAcceptedAuto", user.getDisplayName()); + user.sendTl("requestAcceptedFromAuto", player.getDisplayName()); } }); throw new NoChargeException(); @@ -62,10 +61,10 @@ public class Commandtpa extends EssentialsCommand { final TPARequestEvent tpaEvent = new TPARequestEvent(user.getSource(), player, false); ess.getServer().getPluginManager().callEvent(tpaEvent); if (tpaEvent.isCancelled()) { - throw new TranslatableException("teleportRequestCancelled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportRequestCancelled", player.getDisplayName()); } player.requestTeleport(user, false); - player.sendTl("teleportRequest", CommonPlaceholders.displayName(user)); + player.sendTl("teleportRequest", user.getDisplayName()); player.sendTl("typeTpaccept"); player.sendTl("typeTpdeny"); if (ess.getSettings().getTpaAcceptCancellation() != 0) { @@ -73,7 +72,7 @@ public class Commandtpa extends EssentialsCommand { } } - user.sendTl("requestSent", CommonPlaceholders.displayName(player)); + user.sendTl("requestSent", player.getDisplayName()); if (user.isAuthorized("essentials.tpacancel")) { user.sendTl("typeTpacancel"); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaall.java index 5193d0531..9cc135294 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaall.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaall.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.events.TPARequestEvent; import org.bukkit.Server; @@ -45,11 +44,11 @@ public class Commandtpaall extends EssentialsCommand { final TPARequestEvent tpaEvent = new TPARequestEvent(sender, player, true); ess.getServer().getPluginManager().callEvent(tpaEvent); if (tpaEvent.isCancelled()) { - sender.sendTl("teleportRequestCancelled", CommonPlaceholders.displayName(player)); + sender.sendTl("teleportRequestCancelled", player.getDisplayName()); continue; } player.requestTeleport(target, true); - player.sendTl("teleportHereRequest", CommonPlaceholders.displayName(target)); + player.sendTl("teleportHereRequest", target.getDisplayName()); player.sendTl("typeTpaccept"); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendTl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation()); diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaccept.java index b90e980b3..43398bdb7 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpaccept.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.AsyncTeleport; import com.earth2me.essentials.IUser; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import net.essentialsx.api.v2.events.TeleportRequestResponseEvent; import org.bukkit.Bukkit; @@ -105,7 +104,7 @@ public class Commandtpaccept extends EssentialsCommand { } final Trade charge = new Trade(this.getName(), ess); - requester.sendTl("requestAcceptedFrom", CommonPlaceholders.displayName(user)); + requester.sendTl("requestAcceptedFrom", user.getDisplayName()); final CompletableFuture future = getNewExceptionFuture(requester.getSource(), commandLabel); future.exceptionally(e -> { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpahere.java index d27ced895..54383495c 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpahere.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpahere.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import net.ess3.api.events.TPARequestEvent; import org.bukkit.Server; @@ -25,10 +24,10 @@ public class Commandtpahere extends EssentialsCommand { throw new NotEnoughArgumentsException(); } if (!player.isAuthorized("essentials.tpaccept")) { - throw new TranslatableException("teleportNoAcceptPermission", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportNoAcceptPermission", player.getDisplayName()); } if (!player.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportDisabled", player.getDisplayName()); } if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) { throw new TranslatableException("noPerm", "essentials.worlds." + user.getWorld().getName()); @@ -36,24 +35,24 @@ public class Commandtpahere extends EssentialsCommand { // Don't let sender request teleport twice to the same player. if (player.hasOutstandingTpaRequest(user.getName(), true)) { - throw new TranslatableException("requestSentAlready", CommonPlaceholders.displayName(player)); + throw new TranslatableException("requestSentAlready", player.getDisplayName()); } if (!player.isIgnoredPlayer(user)) { final TPARequestEvent tpaEvent = new TPARequestEvent(user.getSource(), player, true); ess.getServer().getPluginManager().callEvent(tpaEvent); if (tpaEvent.isCancelled()) { - throw new TranslatableException("teleportRequestCancelled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportRequestCancelled", player.getDisplayName()); } player.requestTeleport(user, true); - player.sendTl("teleportHereRequest", CommonPlaceholders.displayName(user)); + player.sendTl("teleportHereRequest", user.getDisplayName()); player.sendTl("typeTpaccept"); player.sendTl("typeTpdeny"); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendTl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation()); } } - user.sendTl("requestSent", CommonPlaceholders.displayName(player)); + user.sendTl("requestSent", player.getDisplayName()); user.sendTl("typeTpacancel"); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpauto.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpauto.java index efc97a0a4..c084f437e 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpauto.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpauto.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import org.bukkit.Server; public class Commandtpauto extends EssentialsToggleCommand { @@ -33,7 +32,7 @@ public class Commandtpauto extends EssentialsToggleCommand { user.sendTl("teleportationDisabledWarning"); } if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(enabled ? "autoTeleportEnabledFor" : "autoTeleportDisabledFor", CommonPlaceholders.displayName(user)); + sender.sendTl(enabled ? "autoTeleportEnabledFor" : "autoTeleportDisabledFor", user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpdeny.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpdeny.java index 8f4f056b1..869eb7da2 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpdeny.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpdeny.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.IUser; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import net.essentialsx.api.v2.events.TeleportRequestResponseEvent; import org.bukkit.Bukkit; @@ -55,7 +54,7 @@ public class Commandtpdeny extends EssentialsCommand { } user.sendTl("requestDenied"); - player.sendTl("requestDeniedFrom", CommonPlaceholders.displayName(user)); + player.sendTl("requestDeniedFrom", user.getDisplayName()); user.removeTpaRequest(denyRequest.getName()); } @@ -70,7 +69,7 @@ public class Commandtpdeny extends EssentialsCommand { } if (player != null && player.getBase().isOnline()) { - player.sendTl("requestDeniedFrom", CommonPlaceholders.displayName(user)); + player.sendTl("requestDeniedFrom", user.getDisplayName()); } user.removeTpaRequest(request.getName()); diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtphere.java index b3334dd35..c18609c5d 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtphere.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -19,7 +18,7 @@ public class Commandtphere extends EssentialsCommand { public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final User player = getPlayer(server, user, args, 0); if (!player.isTeleportEnabled()) { - throw new TranslatableException("teleportDisabled", CommonPlaceholders.displayName(player)); + throw new TranslatableException("teleportDisabled", player.getDisplayName()); } if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) { throw new TranslatableException("noPerm", "essentials.worlds." + user.getWorld().getName()); diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpo.java index 6ef2324a6..448628187 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpo.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -44,7 +43,7 @@ public class Commandtpo extends EssentialsCommand { target.getAsyncTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND, future); future.thenAccept(success -> { if (success) { - target.sendTl("teleportAtoB", CommonPlaceholders.displayName(user), CommonPlaceholders.displayName(toPlayer)); + target.sendTl("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()); } }); break; diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java index 75ee93642..5448aa7cf 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import org.bukkit.Location; import org.bukkit.Server; @@ -22,7 +21,7 @@ public class Commandtpoffline extends EssentialsCommand { final Location logout = target.getLogoutLocation(); if (logout == null) { - user.sendTl("teleportOfflineUnknown", CommonPlaceholders.displayName(user)); + user.sendTl("teleportOfflineUnknown", user.getDisplayName()); throw new NoChargeException(); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtptoggle.java index c01f7951e..cae89c1ec 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtptoggle.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import org.bukkit.Server; public class Commandtptoggle extends EssentialsToggleCommand { @@ -30,7 +29,7 @@ public class Commandtptoggle extends EssentialsToggleCommand { user.sendTl(enabled ? "teleportationEnabled" : "teleportationDisabled"); if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(enabled ? "teleportationEnabledFor" : "teleportationDisabledFor", CommonPlaceholders.displayName(user)); + sender.sendTl(enabled ? "teleportationEnabledFor" : "teleportationDisabledFor", user.getDisplayName()); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandunlimited.java index a79de2f04..d3581c20f 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandunlimited.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandunlimited.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.Inventories; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.TranslatableException; import org.bukkit.Material; import org.bukkit.Server; @@ -82,9 +81,9 @@ public class Commandunlimited extends EssentialsCommand { } if (user != target) { - user.sendTl(message, itemname, CommonPlaceholders.displayName(target)); + user.sendTl(message, itemname, target.getDisplayName()); } - target.sendTl(message, itemname, CommonPlaceholders.displayName(target)); + target.sendTl(message, itemname, target.getDisplayName()); target.setUnlimited(stack, enableUnlimited); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandvanish.java index 316e2b58f..3c31bc14c 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandvanish.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandvanish.java @@ -34,13 +34,13 @@ public class Commandvanish extends EssentialsToggleCommand { } user.setVanished(enabled); - user.sendTl("vanish", CommonPlaceholders.displayName(user), CommonPlaceholders.enableDisable(user.getSource(), enabled)); + user.sendTl("vanish", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled)); if (enabled) { user.sendTl("vanished"); } if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) { - sender.sendTl("vanish", CommonPlaceholders.displayName(user), CommonPlaceholders.enableDisable(user.getSource(), enabled)); + sender.sendTl("vanish", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled)); } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandwhois.java index 694cb25f1..4a82d9eab 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandwhois.java @@ -34,7 +34,7 @@ public class Commandwhois extends EssentialsCommand { sender.sendTl("whoisTop", user.getName()); user.setDisplayNick(); - sender.sendTl("whoisNick", CommonPlaceholders.displayName(user)); + sender.sendTl("whoisNick", user.getDisplayName()); sender.sendTl("whoisUuid", user.getBase().getUniqueId().toString()); sender.sendTl("whoisHealth", user.getBase().getHealth()); sender.sendTl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()); diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignGameMode.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignGameMode.java index 3a9d5aba9..d60e07e8a 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/signs/SignGameMode.java +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignGameMode.java @@ -3,9 +3,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.CommonPlaceholders; import net.ess3.api.IEssentials; -import net.ess3.api.IUser; import org.bukkit.GameMode; import org.bukkit.entity.Player; @@ -40,7 +38,7 @@ public class SignGameMode extends EssentialsSign { charge.isAffordableFor(player); performSetMode(mode.toLowerCase(Locale.ENGLISH), player.getBase()); - player.sendTl("gameMode", player.playerTl(player.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), CommonPlaceholders.displayName((IUser) player)); + player.sendTl("gameMode", player.playerTl(player.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()); Trade.log("Sign", "gameMode", "Interact", username, null, username, charge, sign.getBlock().getLocation(), player.getMoney(), ess); charge.charge(player); return true; diff --git a/Essentials/src/main/java/com/earth2me/essentials/utils/CommonPlaceholders.java b/Essentials/src/main/java/com/earth2me/essentials/utils/CommonPlaceholders.java index 13ca6c7f8..9910940ae 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/CommonPlaceholders.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/CommonPlaceholders.java @@ -1,8 +1,6 @@ package com.earth2me.essentials.utils; import com.earth2me.essentials.CommandSource; -import com.earth2me.essentials.messaging.IMessageRecipient; -import net.ess3.api.IUser; public final class CommonPlaceholders { private CommonPlaceholders() { @@ -15,12 +13,4 @@ public final class CommonPlaceholders { public static AdventureUtil.ParsedPlaceholder trueFalse(final CommandSource source, final boolean condition) { return AdventureUtil.parsed(source.tl(condition ? "true" : "false")); } - - public static AdventureUtil.ParsedPlaceholder displayNameRecipient(final IMessageRecipient recipient) { - return AdventureUtil.parsed(AdventureUtil.legacyToMini(recipient.getDisplayName())); - } - - public static AdventureUtil.ParsedPlaceholder displayName(final IUser user) { - return AdventureUtil.parsed(AdventureUtil.legacyToMini(user.getDisplayName())); - } } diff --git a/EssentialsChat/src/main/java/com/earth2me/essentials/chat/Commandtoggleshout.java b/EssentialsChat/src/main/java/com/earth2me/essentials/chat/Commandtoggleshout.java index 726c62911..7a4b29a3e 100644 --- a/EssentialsChat/src/main/java/com/earth2me/essentials/chat/Commandtoggleshout.java +++ b/EssentialsChat/src/main/java/com/earth2me/essentials/chat/Commandtoggleshout.java @@ -3,8 +3,6 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import com.earth2me.essentials.commands.EssentialsToggleCommand; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import org.bukkit.Server; public class Commandtoggleshout extends EssentialsToggleCommand { @@ -32,7 +30,7 @@ public class Commandtoggleshout extends EssentialsToggleCommand { user.sendTl(enabled ? "shoutEnabled" : "shoutDisabled"); if (!sender.isPlayer() || !user.getBase().equals(sender.getPlayer())) { - sender.sendTl(enabled ? "shoutEnabledFor" : "shoutDisabledFor", CommonPlaceholders.displayName((IUser) user)); + sender.sendTl(enabled ? "shoutEnabledFor" : "shoutDisabledFor", user.getDisplayName()); } } } diff --git a/EssentialsGeoIP/src/main/java/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/main/java/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java index 8196adc94..b8594e267 100644 --- a/EssentialsGeoIP/src/main/java/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/main/java/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.IConf; import com.earth2me.essentials.User; import com.earth2me.essentials.config.EssentialsConfiguration; import com.earth2me.essentials.utils.AdventureUtil; -import com.earth2me.essentials.utils.CommonPlaceholders; import com.ice.tar.TarEntry; import com.ice.tar.TarInputStream; import com.maxmind.geoip2.DatabaseReader; @@ -13,7 +12,6 @@ import com.maxmind.geoip2.exception.GeoIp2Exception; import com.maxmind.geoip2.model.CityResponse; import com.maxmind.geoip2.model.CountryResponse; import net.ess3.api.IEssentials; -import net.ess3.api.IUser; import net.essentialsx.api.v2.events.AsyncUserDataLoadEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -102,7 +100,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { for (final Player online : player.getServer().getOnlinePlayers()) { final User user = ess.getUser(online); if (user.isAuthorized("essentials.geoip.show")) { - user.sendTl("geoipCantFind", CommonPlaceholders.displayName((IUser) u)); + user.sendTl("geoipCantFind", u.getDisplayName()); } } return; @@ -121,7 +119,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf { for (final Player onlinePlayer : player.getServer().getOnlinePlayers()) { final User user = ess.getUser(onlinePlayer); if (user.isAuthorized("essentials.geoip.show")) { - user.sendTl("geoipJoinFormat", CommonPlaceholders.displayName((IUser) u), sb.toString()); + user.sendTl("geoipJoinFormat", u.getDisplayName(), sb.toString()); } } } diff --git a/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/Commandspawn.java index 74b275728..7fa8b7f1b 100644 --- a/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/Commandspawn.java +++ b/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/Commandspawn.java @@ -7,8 +7,6 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import com.earth2me.essentials.utils.CommonPlaceholders; -import net.ess3.api.IUser; import net.essentialsx.api.v2.events.UserTeleportSpawnEvent; import org.bukkit.Location; import org.bukkit.Server; @@ -33,7 +31,7 @@ public class Commandspawn extends EssentialsCommand { future.thenAccept(success -> { if (success) { if (!otherUser.equals(user)) { - otherUser.sendTl("teleportAtoB", CommonPlaceholders.displayName((IUser) user), "spawn"); + otherUser.sendTl("teleportAtoB", user.getDisplayName(), "spawn"); } } });