Merge branch '2.x' into fix/5768
This commit is contained in:
commit
8d2ff38859
|
@ -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
|
||||
|
|
|
@ -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")) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -561,6 +561,7 @@ inventoryClearingAllArmor=<primary>Cleared all inventory items and armor from<se
|
|||
inventoryClearingAllItems=<primary>Cleared all inventory items from<secondary> {0}<primary>.
|
||||
inventoryClearingFromAll=<primary>Clearing the inventory of all users...
|
||||
inventoryClearingStack=<primary>Removed<secondary> {0} <primary>of<secondary> {1} <primary>from<secondary> {2}<primary>.
|
||||
inventoryFull=<dark_red>Your inventory is full.
|
||||
invseeCommandDescription=See the inventory of other players.
|
||||
invseeCommandUsage=/<command> <player>
|
||||
invseeCommandUsage1=/<command> <player>
|
||||
|
|
Loading…
Reference in New Issue