mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-13 06:15:08 +01:00
Merge branch '2.x' into ajmaacc
This commit is contained in:
commit
1b46db6675
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<User>, 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<User>, 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<User>, 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<User>, 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<User>, 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<User>, 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<User>, 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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<Integer, ItemStack> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class Commandhelp extends EssentialsCommand {
|
||||
final IEssentialsCommand essCommand = isEssCommand ? ess.getCommandMap().get(knownCmd.getValue().getName()) : null;
|
||||
if (essCommand != null && !essCommand.getUsageStrings().isEmpty()) {
|
||||
for (Map.Entry<String, String> usage : essCommand.getUsageStrings().entrySet()) {
|
||||
user.sendTl("commandHelpLineUsage", usage.getKey().replace("<command>", cmd), AdventureUtil.parsed(usage.getValue()));
|
||||
user.sendTl("commandHelpLineUsage", AdventureUtil.parsed(usage.getKey().replace("<command>", cmd)), AdventureUtil.parsed(usage.getValue()));
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(knownCmd.getValue().getUsage());
|
||||
|
@ -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<IUser> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.OfflinePlayerStub;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.AdventureUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.ess3.api.TranslatableException;
|
||||
@ -97,7 +98,7 @@ public class Commandhome extends EssentialsCommand {
|
||||
homes.add(user.playerTl("bedNull"));
|
||||
}
|
||||
}
|
||||
user.sendTl("homes", StringUtil.joinList(homes), count, getHomeLimit(finalPlayer));
|
||||
user.sendTl("homes", AdventureUtil.parsed(StringUtil.joinList(homes)), count, getHomeLimit(finalPlayer));
|
||||
}
|
||||
});
|
||||
if (!player.getBase().isOnline() || player.getBase() instanceof OfflinePlayerStub) {
|
||||
|
@ -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) {
|
||||
|
@ -3,9 +3,8 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Kit;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.CommonPlaceholders;
|
||||
import com.earth2me.essentials.utils.AdventureUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.TranslatableException;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@ -24,7 +23,7 @@ public class Commandkit extends EssentialsCommand {
|
||||
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.sendTl(kitList.length() > 0 ? "kits" : "noKits", kitList);
|
||||
user.sendTl(kitList.length() > 0 ? "kits" : "noKits", AdventureUtil.parsed(kitList));
|
||||
throw new NoChargeException();
|
||||
} else if (args.length > 1 && user.isAuthorized("essentials.kit.others")) {
|
||||
giveKits(getPlayer(server, user, args, 1), user, StringUtil.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim());
|
||||
@ -37,7 +36,7 @@ public class Commandkit extends EssentialsCommand {
|
||||
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.sendTl(kitList.length() > 0 ? "kits" : "noKits", kitList);
|
||||
sender.sendTl(kitList.length() > 0 ? "kits" : "noKits", AdventureUtil.parsed(kitList));
|
||||
throw new NoChargeException();
|
||||
} else {
|
||||
final User userTo = getPlayer(server, args, 1, true, false);
|
||||
@ -45,7 +44,7 @@ public class Commandkit extends EssentialsCommand {
|
||||
for (final String kitName : args[0].toLowerCase(Locale.ENGLISH).split(",")) {
|
||||
new Kit(kitName, ess).expandItems(userTo);
|
||||
|
||||
sender.sendTl("kitGiveTo", kitName, CommonPlaceholders.displayName((IUser) userTo));
|
||||
sender.sendTl("kitGiveTo", kitName, userTo.getDisplayName());
|
||||
userTo.sendTl("kitReceive", kitName);
|
||||
}
|
||||
}
|
||||
@ -81,7 +80,7 @@ public class Commandkit extends EssentialsCommand {
|
||||
kit.chargeUser(userTo);
|
||||
|
||||
if (!userFrom.equals(userTo)) {
|
||||
userFrom.sendTl("kitGiveTo", kit.getName(), CommonPlaceholders.displayName((IUser) userTo));
|
||||
userFrom.sendTl("kitGiveTo", kit.getName(), userTo.getDisplayName());
|
||||
}
|
||||
|
||||
userTo.sendTl("kitReceive", kit.getName());
|
||||
|
@ -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
|
||||
|
@ -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()) {
|
||||
|
@ -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<MailMessage> 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<MailMessage> mails = mailUser.getMailMessages();
|
||||
if (mails == null || mails.isEmpty()) {
|
||||
sender.sendTl("noMailOther", CommonPlaceholders.displayName((IUser) mailUser));
|
||||
sender.sendTl("noMailOther", mailUser.getDisplayName());
|
||||
throw new NoChargeException();
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,8 @@ 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 com.earth2me.essentials.utils.FormatUtil;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.TranslatableException;
|
||||
import net.essentialsx.api.v2.events.UserActionEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -45,9 +43,8 @@ public class Commandme extends EssentialsCommand {
|
||||
|
||||
user.setDisplayNick();
|
||||
long radius = ess.getSettings().getChatRadius();
|
||||
final String toSend = tlLiteral("action", CommonPlaceholders.displayName((IUser) user), message);
|
||||
if (radius < 1) {
|
||||
ess.broadcastMessage(user, toSend);
|
||||
ess.broadcastTl("action", user.getDisplayName(), message);
|
||||
ess.getServer().getPluginManager().callEvent(new UserActionEvent(user, message, Collections.unmodifiableCollection(ess.getServer().getOnlinePlayers())));
|
||||
return;
|
||||
}
|
||||
@ -55,7 +52,7 @@ public class Commandme extends EssentialsCommand {
|
||||
|
||||
final World world = user.getWorld();
|
||||
final Location loc = user.getLocation();
|
||||
final Set<Player> outList = new HashSet<>();
|
||||
final Set<User> outList = new HashSet<>();
|
||||
|
||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||
final User onlineUser = ess.getUser(player);
|
||||
@ -74,13 +71,13 @@ public class Commandme extends EssentialsCommand {
|
||||
}
|
||||
if (abort) {
|
||||
if (onlineUser.isAuthorized("essentials.chat.spy")) {
|
||||
outList.add(player); // Just use the same list unless we wanted to format spyying for this.
|
||||
outList.add(onlineUser); // Just use the same list unless we wanted to format spyying for this.
|
||||
}
|
||||
} else {
|
||||
outList.add(player);
|
||||
outList.add(onlineUser);
|
||||
}
|
||||
} else {
|
||||
outList.add(player); // Add yourself to the list.
|
||||
outList.add(onlineUser); // Add yourself to the list.
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,10 +85,19 @@ public class Commandme extends EssentialsCommand {
|
||||
user.sendTl("localNoOne");
|
||||
}
|
||||
|
||||
for (final Player onlinePlayer : outList) {
|
||||
onlinePlayer.sendMessage(toSend);
|
||||
for (final User onlineUser : outList) {
|
||||
onlineUser.sendTl("action", user.getDisplayName(), message);
|
||||
}
|
||||
|
||||
// Only take the time to generate this list if there are listeners.
|
||||
if (UserActionEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
||||
final Set<Player> outListPlayers = new HashSet<>();
|
||||
for (final User onlineUser : outList) {
|
||||
outListPlayers.add(onlineUser.getBase());
|
||||
}
|
||||
|
||||
ess.getServer().getPluginManager().callEvent(new UserActionEvent(user, message, Collections.unmodifiableCollection(outListPlayers)));
|
||||
}
|
||||
ess.getServer().getPluginManager().callEvent(new UserActionEvent(user, message, Collections.unmodifiableCollection(outList)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,7 @@ 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.google.common.collect.Lists;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
@ -59,7 +57,7 @@ public class Commandnear extends EssentialsCommand {
|
||||
if (otherUser == null || !user.isAuthorized("essentials.near.others")) {
|
||||
otherUser = user;
|
||||
}
|
||||
user.sendTl("nearbyPlayers", getLocal(user.getSource(), otherUser, radius));
|
||||
user.sendTl("nearbyPlayers", AdventureUtil.parsed(getLocal(user.getSource(), otherUser, radius)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,7 +107,7 @@ public class Commandnear extends EssentialsCommand {
|
||||
if (nearbyPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
output.append(user.playerTl("nearbyPlayersList", CommonPlaceholders.displayName((IUser) nearbyPlayer), (long)nearbyPlayer.getLocation().distance(loc)));
|
||||
output.append(user.playerTl("nearbyPlayersList", nearbyPlayer.getDisplayName(), (long)nearbyPlayer.getLocation().distance(loc)));
|
||||
}
|
||||
|
||||
return output.length() > 1 ? output.toString() : source.tl("none");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -91,7 +89,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.
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ 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.AdventureUtil;
|
||||
import com.earth2me.essentials.utils.DescParseTickFormat;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Server;
|
||||
@ -82,7 +83,7 @@ public class Commandptime extends EssentialsLoopCommand {
|
||||
}
|
||||
|
||||
final String formattedTime = DescParseTickFormat.format(ticks);
|
||||
sender.sendTl(fixed ? "pTimeSetFixed" : "pTimeSet", formattedTime, joiner.toString());
|
||||
sender.sendTl(fixed ? "pTimeSetFixed" : "pTimeSet", AdventureUtil.parsed(formattedTime), joiner.toString());
|
||||
}
|
||||
|
||||
public void getUserTime(final CommandSource sender, final IUser user) {
|
||||
@ -96,7 +97,7 @@ public class Commandptime extends EssentialsLoopCommand {
|
||||
}
|
||||
|
||||
final String time = DescParseTickFormat.format(user.getBase().getPlayerTime());
|
||||
sender.sendTl(user.getBase().isPlayerTimeRelative() ? "pTimeCurrent" : "pTimeCurrentFixed", user.getName(), time);
|
||||
sender.sendTl(user.getBase().isPlayerTimeRelative() ? "pTimeCurrent" : "pTimeCurrentFixed", user.getName(), AdventureUtil.parsed(time));
|
||||
}
|
||||
|
||||
private void setUserTime(final User user, final Long ticks, final Boolean relative) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<String> history = user.getPastUsernames();
|
||||
if (history != null && !history.isEmpty()) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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]);
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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<Boolean> future = getNewExceptionFuture(requester.getSource(), commandLabel);
|
||||
future.exceptionally(e -> {
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -10,7 +10,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -67,7 +66,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand {
|
||||
final Matcher matcher = ARGUMENT_PATTERN.matcher(usage);
|
||||
while (matcher.find()) {
|
||||
final String color = matcher.group(3).equals("<") ? tlLiteral("commandArgumentRequired") : tlLiteral("commandArgumentOptional");
|
||||
matcher.appendReplacement(buffer, "$1" + color + matcher.group(2).replace("|", tlLiteral("commandArgumentOr") + "|" + color) + ChatColor.RESET);
|
||||
matcher.appendReplacement(buffer, "$1" + color + matcher.group(2).replace("|", tlLiteral("commandArgumentOr") + "|" + color) + "<reset>");
|
||||
}
|
||||
matcher.appendTail(buffer);
|
||||
usageStrings.put(buffer.toString(), description);
|
||||
|
@ -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;
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user