Compare commits
14 Commits
ebd68a578c
...
037540b3ff
Author | SHA1 | Date |
---|---|---|
Flask Bot | 037540b3ff | |
Flask Bot | 98c5bcc7da | |
Emilia Kond | c60ed56190 | |
pop4959 | c85e179718 | |
DarkLaw | 71ca7ffbf6 | |
pop4959 | 76a513a05c | |
pop4959 | 8cfe680abc | |
pop4959 | 2cb0af0ca4 | |
Charles DeLancey | 570eca2e21 | |
Charles DeLancey | 3817a11d9d | |
Catarina Freire | c19b20ea3b | |
Charles DeLancey | a4ac720057 | |
Charles DeLancey | 993d7ede56 | |
Bobcat00 | 622c8147a9 |
|
@ -70,10 +70,13 @@ body:
|
|||
validations:
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
- type: textarea
|
||||
attributes:
|
||||
value: |
|
||||
In the text box below, you can attach any relevant screenshots, files and links to Timings/spark profiler reports.
|
||||
label: Additional Information
|
||||
description: |
|
||||
In this box, you can attach any relevant screenshots, files and links to Timings/spark profiler reports.
|
||||
You can also include a link to a heapdump if necessary, but please make sure you don't include any private player data in the heapdump.
|
||||
If you suspect this issue is related to a prior issue/PR/commit, please mention it here.
|
||||
|
||||
validations:
|
||||
required: false
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package com.earth2me.essentials;
|
||||
|
||||
public class ChargeException extends Exception {
|
||||
public ChargeException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
import net.ess3.api.TranslatableException;
|
||||
|
||||
public ChargeException(final String message, final Throwable throwable) {
|
||||
super(message, throwable);
|
||||
public class ChargeException extends TranslatableException {
|
||||
public ChargeException(String tlKey, Object... args) {
|
||||
super(tlKey, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ public class CommandSource {
|
|||
}
|
||||
|
||||
final String translation = tlLiteral(tlKey, args);
|
||||
sendComponent(AdventureUtil.miniMessage().deserialize(translation));
|
||||
if (!translation.isEmpty()) {
|
||||
sendComponent(AdventureUtil.miniMessage().deserialize(translation));
|
||||
}
|
||||
}
|
||||
|
||||
public String tl(final String tlKey, final Object... args) {
|
||||
|
|
|
@ -69,6 +69,9 @@ public final class Console implements IMessageRecipient {
|
|||
@Override
|
||||
public void sendTl(String tlKey, Object... args) {
|
||||
final String translation = tlLiteral(tlKey, args);
|
||||
if (translation.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Audience consoleAudience = ((Essentials) ess).getBukkitAudience().sender(getCommandSender());
|
||||
final Component component = AdventureUtil.miniMessage()
|
||||
|
|
|
@ -1200,7 +1200,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
|
||||
@Override
|
||||
public void broadcastTl(final String tlKey, final Object... args) {
|
||||
broadcastTl(null, null, true, tlKey, args);
|
||||
broadcastTl(null, null, false, tlKey, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -545,14 +545,14 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
|||
final Date banExpiry = banEntry.getExpiration();
|
||||
if (banExpiry != null) {
|
||||
final String expiry = DateUtil.formatDateDiff(banExpiry.getTime());
|
||||
event.setKickMessage(tlLiteral("tempbanJoin", expiry, banEntry.getReason()));
|
||||
event.setKickMessage(AdventureUtil.miniToLegacy(tlLiteral("tempbanJoin", expiry, banEntry.getReason())));
|
||||
} else {
|
||||
event.setKickMessage(tlLiteral("banJoin", banEntry.getReason()));
|
||||
event.setKickMessage(AdventureUtil.miniToLegacy(tlLiteral("banJoin", banEntry.getReason())));
|
||||
}
|
||||
} else {
|
||||
banEntry = ess.getServer().getBanList(BanList.Type.IP).getBanEntry(event.getAddress().getHostAddress());
|
||||
if (banEntry != null) {
|
||||
event.setKickMessage(tlLiteral("banIpJoin", banEntry.getReason()));
|
||||
event.setKickMessage(AdventureUtil.miniToLegacy(tlLiteral("banIpJoin", banEntry.getReason())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -640,12 +640,13 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
|||
|| (!pluginCommand.getName().equals("msg") && !pluginCommand.getName().equals("r"))) { // /msg and /r are handled in SimpleMessageRecipient
|
||||
final User user = ess.getUser(player);
|
||||
if (!user.isAuthorized("essentials.chat.spy.exempt")) {
|
||||
final String playerName = ess.getSettings().isSocialSpyDisplayNames() ? player.getDisplayName() : player.getName();
|
||||
for (final User spyer : ess.getOnlineUsers()) {
|
||||
if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) {
|
||||
final Component base = (user.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers())
|
||||
? spyer.tlComponent("socialSpyMutedPrefix")
|
||||
: spyer.tlComponent("socialSpyPrefix");
|
||||
spyer.sendComponent(base.append(AdventureUtil.legacyToAdventure(player.getDisplayName())).append(Component.text(": " + event.getMessage())));
|
||||
spyer.sendComponent(base.append(AdventureUtil.legacyToAdventure(playerName)).append(Component.text(": " + event.getMessage())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
boolean isSocialSpyMessages();
|
||||
|
||||
boolean isSocialSpyDisplayNames();
|
||||
|
||||
Set<String> getMuteCommands();
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -633,7 +633,7 @@ public class MetaItemStack {
|
|||
|
||||
PatternType patternType = null;
|
||||
try {
|
||||
patternType = PatternType.valueOf(split[0]);
|
||||
patternType = PatternType.getByIdentifier(split[0]);
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ public class MetaItemStack {
|
|||
final Color color = Color.fromRGB(Integer.parseInt(split[1]));
|
||||
meta.setBaseColor(DyeColor.getByColor(color));
|
||||
} else if (patternType != null) {
|
||||
final PatternType type = PatternType.valueOf(split[0]);
|
||||
final PatternType type = PatternType.getByIdentifier(split[0]);
|
||||
final DyeColor color = DyeColor.getByColor(Color.fromRGB(Integer.parseInt(split[1])));
|
||||
final org.bukkit.block.banner.Pattern pattern = new org.bukkit.block.banner.Pattern(color, type);
|
||||
meta.addPattern(pattern);
|
||||
|
@ -658,7 +658,7 @@ public class MetaItemStack {
|
|||
|
||||
PatternType patternType = null;
|
||||
try {
|
||||
patternType = PatternType.valueOf(split[0]);
|
||||
patternType = PatternType.getByIdentifier(split[0]);
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ public class MetaItemStack {
|
|||
final Color color = Color.fromRGB(Integer.parseInt(split[1]));
|
||||
banner.setBaseColor(DyeColor.getByColor(color));
|
||||
} else if (patternType != null) {
|
||||
final PatternType type = PatternType.valueOf(split[0]);
|
||||
final PatternType type = PatternType.getByIdentifier(split[0]);
|
||||
final DyeColor color = DyeColor.getByColor(Color.fromRGB(Integer.parseInt(split[1])));
|
||||
final org.bukkit.block.banner.Pattern pattern = new org.bukkit.block.banner.Pattern(color, type);
|
||||
banner.addPattern(pattern);
|
||||
|
|
|
@ -456,6 +456,11 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getBoolean("socialspy-messages", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSocialSpyDisplayNames() {
|
||||
return config.getBoolean("socialspy-uses-displaynames", true);
|
||||
}
|
||||
|
||||
private Set<String> _getMuteCommands() {
|
||||
final Set<String> muteCommands = new HashSet<>();
|
||||
if (config.isList("mute-commands")) {
|
||||
|
|
|
@ -191,23 +191,23 @@ public class Trade {
|
|||
}
|
||||
|
||||
if (getMoney() != null && getMoney().signum() > 0 && !user.canAfford(getMoney())) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))));
|
||||
future.completeExceptionally(new ChargeException("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (getItemStack() != null && !Inventories.containsAtLeast(user.getBase(), itemStack, itemStack.getAmount())) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack()))));
|
||||
future.completeExceptionally(new ChargeException("missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack())));
|
||||
return;
|
||||
}
|
||||
|
||||
final BigDecimal money;
|
||||
if (command != null && !command.isEmpty() && (money = getCommandCost(user)).signum() > 0 && !user.canAfford(money)) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughMoney", NumberUtil.displayCurrency(money, ess))));
|
||||
future.completeExceptionally(new ChargeException("notEnoughMoney", NumberUtil.displayCurrency(money, ess)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (exp != null && exp > 0 && SetExpFix.getTotalExperience(user.getBase()) < exp) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughExperience")));
|
||||
future.completeExceptionally(new ChargeException("notEnoughExperience"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class Trade {
|
|||
ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " money " + getMoney().toPlainString());
|
||||
}
|
||||
if (!user.canAfford(getMoney()) && getMoney().signum() > 0) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))));
|
||||
future.completeExceptionally(new ChargeException("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
return;
|
||||
}
|
||||
user.takeMoney(getMoney());
|
||||
|
@ -295,7 +295,7 @@ public class Trade {
|
|||
ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " itemstack " + getItemStack().toString());
|
||||
}
|
||||
if (!Inventories.containsAtLeast(user.getBase(), getItemStack(), getItemStack().getAmount())) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))));
|
||||
future.completeExceptionally(new ChargeException("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||
return;
|
||||
}
|
||||
Inventories.removeItemAmount(user.getBase(), getItemStack(), getItemStack().getAmount());
|
||||
|
@ -304,7 +304,7 @@ public class Trade {
|
|||
if (command != null) {
|
||||
final BigDecimal cost = getCommandCost(user);
|
||||
if (!user.canAfford(cost) && cost.signum() > 0) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughMoney", NumberUtil.displayCurrency(cost, ess))));
|
||||
future.completeExceptionally(new ChargeException("notEnoughMoney", NumberUtil.displayCurrency(cost, ess)));
|
||||
return;
|
||||
}
|
||||
user.takeMoney(cost);
|
||||
|
@ -315,7 +315,7 @@ public class Trade {
|
|||
}
|
||||
final int experience = SetExpFix.getTotalExperience(user.getBase());
|
||||
if (experience < getExperience() && getExperience() > 0) {
|
||||
future.completeExceptionally(new ChargeException(user.playerTl("notEnoughExperience")));
|
||||
future.completeExceptionally(new ChargeException("notEnoughExperience"));
|
||||
return;
|
||||
}
|
||||
SetExpFix.setTotalExperience(user.getBase(), experience - getExperience());
|
||||
|
|
|
@ -271,7 +271,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||
final TransactionEvent transactionEvent = new TransactionEvent(this.getSource(), reciever, value);
|
||||
ess.getServer().getPluginManager().callEvent(transactionEvent);
|
||||
} else {
|
||||
throw new ChargeException(tlLocale(playerLocale, "notEnoughMoney", NumberUtil.displayCurrency(value, ess)));
|
||||
throw new ChargeException("notEnoughMoney", NumberUtil.displayCurrency(value, ess));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.earth2me.essentials.IUser;
|
|||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.AdventureUtil;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class Commandtempban extends EssentialsCommand {
|
|||
}
|
||||
final String time = getFinalArg(args, 1);
|
||||
final long banTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
String banReason = DateUtil.removeTimePattern(time);
|
||||
String banReason = FormatUtil.replaceFormat(DateUtil.removeTimePattern(time));
|
||||
|
||||
final long maxBanLength = ess.getSettings().getMaxTempban() * 1000;
|
||||
if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.unlimited")) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class Commandtempbanip extends EssentialsCommand {
|
|||
|
||||
final String time = getFinalArg(args, 1);
|
||||
final long banTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
String banReason = DateUtil.removeTimePattern(time);
|
||||
String banReason = FormatUtil.replaceFormat(DateUtil.removeTimePattern(time));
|
||||
|
||||
final long maxBanLength = ess.getSettings().getMaxTempban() * 1000;
|
||||
if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.unlimited")) {
|
||||
|
|
|
@ -121,15 +121,17 @@ public class SimpleMessageRecipient implements IMessageRecipient {
|
|||
// Dont spy on chats involving socialspy exempt players
|
||||
&& !senderUser.isAuthorized("essentials.chat.spy.exempt")
|
||||
&& recipientUser != null && !recipientUser.isAuthorized("essentials.chat.spy.exempt")) {
|
||||
final String senderName = ess.getSettings().isSocialSpyDisplayNames() ? getDisplayName() : getName();
|
||||
final String recipientName = ess.getSettings().isSocialSpyDisplayNames() ? recipient.getDisplayName() : recipient.getName();
|
||||
for (final User onlineUser : ess.getOnlineUsers()) {
|
||||
if (onlineUser.isSocialSpyEnabled()
|
||||
// Don't send socialspy messages to message sender/receiver to prevent spam
|
||||
&& !onlineUser.equals(senderUser)
|
||||
&& !onlineUser.equals(recipient)) {
|
||||
if (senderUser.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers()) {
|
||||
onlineUser.sendComponent(AdventureUtil.miniMessage().deserialize(tlSender("socialSpyMutedPrefix") + tlLiteral("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)));
|
||||
onlineUser.sendComponent(AdventureUtil.miniMessage().deserialize(tlSender("socialSpyMutedPrefix") + tlLiteral("socialSpyMsgFormat", senderName, recipientName, message)));
|
||||
} else {
|
||||
onlineUser.sendComponent(AdventureUtil.miniMessage().deserialize(tlLiteral("socialSpyPrefix") + tlLiteral("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)));
|
||||
onlineUser.sendComponent(AdventureUtil.miniMessage().deserialize(tlLiteral("socialSpyPrefix") + tlLiteral("socialSpyMsgFormat", senderName, recipientName, message)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SignBuy extends EssentialsSign {
|
|||
|
||||
charge.isAffordableFor(player);
|
||||
if (!items.pay(player)) {
|
||||
throw new ChargeException("Inventory full"); //TODO: TL
|
||||
throw new ChargeException("inventoryFull");
|
||||
}
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), player.getMoney(), ess);
|
||||
|
|
|
@ -21,9 +21,10 @@ public class SignHeal extends EssentialsSign {
|
|||
if (player.getBase().getHealth() == 0) {
|
||||
throw new SignException("healDead");
|
||||
}
|
||||
final double amount = player.getBase().getMaxHealth();
|
||||
final Trade charge = getTrade(sign, 1, ess);
|
||||
charge.isAffordableFor(player);
|
||||
player.getBase().setHealth(20);
|
||||
player.getBase().setHealth(amount);
|
||||
player.getBase().setFoodLevel(20);
|
||||
player.getBase().setFireTicks(0);
|
||||
player.sendTl("youAreHealed");
|
||||
|
|
|
@ -72,7 +72,7 @@ public class SignTrade extends EssentialsSign {
|
|||
if (!trade.pay(player)) {
|
||||
subtractAmount(sign, 1, charge, ess);
|
||||
addAmount(sign, 2, trade, ess);
|
||||
throw new ChargeException("Full inventory");
|
||||
throw new ChargeException("inventoryFull");
|
||||
}
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Trade", "Interact", sign.getLine(3).substring(2), charge, username, trade, sign.getBlock().getLocation(), player.getMoney(), ess);
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class AdventureUtil {
|
|||
}
|
||||
LEGACY_SERIALIZER = builder.build();
|
||||
|
||||
MINI_MESSAGE_NO_TAGS = MiniMessage.miniMessage();
|
||||
MINI_MESSAGE_NO_TAGS = MiniMessage.builder().strict(true).build();
|
||||
|
||||
miniMessageInstance = createMiniMessageInstance();
|
||||
}
|
||||
|
|
|
@ -213,6 +213,10 @@ socialspy-listen-muted-players: true
|
|||
# If false, social spy will only monitor commands from the list above.
|
||||
socialspy-messages: true
|
||||
|
||||
# Whether social spy should use formatted display names which may include color.
|
||||
# If false, social spy will use only the actual player names.
|
||||
socialspy-uses-displaynames: true
|
||||
|
||||
# The following settings listen for when a player changes worlds.
|
||||
# If you use another plugin to control speed and flight, you should change these to false.
|
||||
|
||||
|
|
|
@ -561,6 +561,7 @@ inventoryClearingAllArmor=<primary>Es wurden alle Gegenstände im Inventar sowie
|
|||
inventoryClearingAllItems=<primary>Alle Inventargegenstände von<secondary> {0}<primary> entfernt.
|
||||
inventoryClearingFromAll=<primary>Die Inventare aller Spieler wurden geleert...
|
||||
inventoryClearingStack=<secondary>{0} {1}<primary> von<secondary> {2} <primary>entfernt.
|
||||
inventoryFull=<dark_red>Dein Inventar ist voll.
|
||||
invseeCommandDescription=Zeige das Inventar anderer Spieler an.
|
||||
invseeCommandUsage=/<command> <spieler>
|
||||
invseeCommandUsage1=/<command> <spieler>
|
||||
|
|
|
@ -218,7 +218,7 @@ public abstract class AbstractChatHandler {
|
|||
|
||||
// Strip local chat prefix to preserve API behaviour
|
||||
final String localPrefix = AdventureUtil.miniToLegacy(tlLiteral("chatTypeLocal"));
|
||||
String baseFormat = event.getFormat();
|
||||
String baseFormat = AdventureUtil.legacyToMini(event.getFormat());
|
||||
if (event.getFormat().startsWith(localPrefix)) {
|
||||
baseFormat = baseFormat.substring(localPrefix.length());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue