Merge remote-tracking branch 'origin/1.18-dev' into 1.18

# Conflicts:
#	forge/src/main/java/io/github/flemmli97/flan/forgeevent/BlockInteractEventsForge.java
This commit is contained in:
Flemmli97
2022-01-30 18:33:53 +01:00
29 changed files with 567 additions and 536 deletions
@@ -19,33 +19,33 @@ public class CommandCurrencyImpl {
public static int sellClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
if (!Flan.diceMCMoneySign) {
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
return 0;
}
if (ConfigHandler.config.sellPrice == -1) {
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellDisabled, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellDisabled"), ChatFormatting.DARK_RED), false);
return 0;
}
int amount = Math.max(0, IntegerArgumentType.getInteger(context, "amount"));
PlayerClaimData data = PlayerClaimData.get(context.getSource().getPlayerOrException());
if (data.getAdditionalClaims() - Math.max(0, data.usedClaimBlocks() - data.getClaimBlocks()) < amount) {
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellFail, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellFail"), ChatFormatting.DARK_RED), false);
return 0;
}
double price = amount * ConfigHandler.config.sellPrice;
MoneyWSD.get(context.getSource().getLevel()).changeBalance(MoneyMod.AcctTypes.PLAYER.key, context.getSource().getPlayerOrException().getUUID(), price);
data.setAdditionalClaims(data.getAdditionalClaims() - amount);
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("sellSuccess"), amount, price), ChatFormatting.GOLD), false);
return Command.SINGLE_SUCCESS;
}
public static int buyClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
if (!Flan.diceMCMoneySign) {
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
return 0;
}
if (ConfigHandler.config.buyPrice == -1) {
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyDisabled, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyDisabled"), ChatFormatting.DARK_RED), false);
return 0;
}
UUID uuid = context.getSource().getPlayerOrException().getUUID();
@@ -57,10 +57,10 @@ public class CommandCurrencyImpl {
PlayerClaimData data = PlayerClaimData.get(context.getSource().getPlayerOrException());
data.setAdditionalClaims(data.getAdditionalClaims() + amount);
manager.changeBalance(MoneyMod.AcctTypes.PLAYER.key, uuid, -price);
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.buySuccess, amount, price), ChatFormatting.GOLD), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("buySuccess"), amount, price), ChatFormatting.GOLD), false);
return Command.SINGLE_SUCCESS;
}
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false);
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyFail"), ChatFormatting.DARK_RED), false);
return 0;
}
}