diff --git a/bukkit/src/main/java/com/griefdefender/GriefDefenderPlugin.java b/bukkit/src/main/java/com/griefdefender/GriefDefenderPlugin.java index f4665e0..2ae020b 100644 --- a/bukkit/src/main/java/com/griefdefender/GriefDefenderPlugin.java +++ b/bukkit/src/main/java/com/griefdefender/GriefDefenderPlugin.java @@ -133,6 +133,8 @@ import com.griefdefender.command.CommandClaimUnban; import com.griefdefender.command.CommandClaimWorldEdit; import com.griefdefender.command.CommandDebug; +import com.griefdefender.command.CommandGDBlockTransfer; +import com.griefdefender.command.CommandGDConfirm; import com.griefdefender.command.CommandGDReload; import com.griefdefender.command.CommandGDVersion; import com.griefdefender.command.CommandGiveBlocks; @@ -752,6 +754,8 @@ public void registerBaseCommands() { manager.registerCommand(new CommandClaimWorldEdit()); manager.registerCommand(new CommandContainerTrust()); manager.registerCommand(new CommandDebug()); + manager.registerCommand(new CommandGDBlockTransfer()); + manager.registerCommand(new CommandGDConfirm()); manager.registerCommand(new CommandGDReload()); manager.registerCommand(new CommandGDVersion()); manager.registerCommand(new CommandGiveBlocks()); diff --git a/bukkit/src/main/java/com/griefdefender/cache/MessageCache.java b/bukkit/src/main/java/com/griefdefender/cache/MessageCache.java index be76e54..d2f562b 100644 --- a/bukkit/src/main/java/com/griefdefender/cache/MessageCache.java +++ b/bukkit/src/main/java/com/griefdefender/cache/MessageCache.java @@ -128,6 +128,7 @@ public static MessageCache getInstance() { public Component COMMAND_PET_TRANSFER_READY; public Component COMMAND_PET_TRANSFER_CANCEL; public Component COMMAND_WORLDEDIT_MISSING; + public Component CONFIRM_NOT_FOUND; public Component CREATE_CANCEL; public Component CREATE_CUBOID_DISABLED; public Component CREATE_OVERLAP; @@ -145,6 +146,8 @@ public static MessageCache getInstance() { public Component ECONOMY_BLOCK_NOT_AVAILABLE; public Component ECONOMY_BLOCK_ONLY_BUY; public Component ECONOMY_BLOCK_ONLY_SELL; + public Component ECONOMY_BLOCK_TRANSFER_CANCEL; + public Component ECONOMY_BLOCK_TRANSFER_WARNING; public Component ECONOMY_CLAIM_NOT_FOR_SALE; public Component ECONOMY_CLAIM_RENT_CANCEL_CONFIRMATION; public Component ECONOMY_CLAIM_RENT_RESTORE_CANCEL_CONFIRMATION; @@ -153,6 +156,7 @@ public static MessageCache getInstance() { public Component ECONOMY_CLAIM_RENT_OWNER_NOT_RENTING; public Component ECONOMY_CLAIM_SALE_CANCEL_CONFIRMATION; public Component ECONOMY_CLAIM_SALE_CANCELLED; + public Component ECONOMY_MODE_NOT_ENABLED; public Component ECONOMY_NOT_INSTALLED; public Component ECONOMY_SIGN_RENT_DAYS_LEFT; public Component ECONOMY_SIGN_RENT_DESCRIPTION; @@ -177,6 +181,8 @@ public static MessageCache getInstance() { public Component FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS; public Component FLAG_DESCRIPTION_CUSTOM_END_CRYSTAL_USE; public Component FLAG_DESCRIPTION_CUSTOM_ENDERMAN_GRIEF; + public Component FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE; + public Component FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_EXP_DROP; public Component FLAG_DESCRIPTION_CUSTOM_FALL_ENTITY_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_FALL_PLAYER_DAMAGE; @@ -211,6 +217,7 @@ public static MessageCache getInstance() { public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_ITEM_PICKUP; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_FROM; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_TO; + public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_PISTON_ITEM_SPAWN; public Component FLAG_DESCRIPTION_CUSTOM_PISTON_USE; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_PORTAL_USE; @@ -420,7 +427,6 @@ public static MessageCache getInstance() { public Component PERMISSION_PLAYER_VIEW_OTHERS; public Component PERMISSION_TAX; public Component PERMISSION_VISUAL_CLAIMS_NEARBY; - public Component PLAYERINFO_UI_TITLE; public Component PLUGIN_EVENT_CANCEL; public Component PLUGIN_RELOAD; public Component PVP_CLAIM_NOT_ALLOWED; @@ -579,6 +585,7 @@ public void loadCache() { COMMAND_PET_TRANSFER_READY = MessageStorage.MESSAGE_DATA.getMessage("command-pet-transfer-ready"); COMMAND_PET_TRANSFER_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("command-pet-transfer-cancel"); COMMAND_WORLDEDIT_MISSING = MessageStorage.MESSAGE_DATA.getMessage("command-worldedit-missing"); + CONFIRM_NOT_FOUND = MessageStorage.MESSAGE_DATA.getMessage("confirm-not-found"); CREATE_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("create-cancel"); CREATE_CUBOID_DISABLED = MessageStorage.MESSAGE_DATA.getMessage("create-cuboid-disabled"); CREATE_OVERLAP = MessageStorage.MESSAGE_DATA.getMessage("create-overlap"); @@ -596,6 +603,8 @@ public void loadCache() { ECONOMY_BLOCK_NOT_AVAILABLE = MessageStorage.MESSAGE_DATA.getMessage("economy-block-not-available"); ECONOMY_BLOCK_ONLY_BUY = MessageStorage.MESSAGE_DATA.getMessage("economy-block-only-buy"); ECONOMY_BLOCK_ONLY_SELL = MessageStorage.MESSAGE_DATA.getMessage("economy-block-only-sell"); + ECONOMY_BLOCK_TRANSFER_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("economy-block-transfer-cancel"); + ECONOMY_BLOCK_TRANSFER_WARNING = MessageStorage.MESSAGE_DATA.getMessage("economy-block-transfer-warning"); ECONOMY_CLAIM_NOT_FOR_SALE = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-not-for-sale"); ECONOMY_CLAIM_RENT_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-cancel-confirmation"); ECONOMY_CLAIM_RENT_RESTORE_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-restore-cancel-confirmation"); @@ -604,6 +613,7 @@ public void loadCache() { ECONOMY_CLAIM_RENT_OWNER_NOT_RENTING = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-owner-not-renting"); ECONOMY_CLAIM_SALE_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-sale-cancel-confirmation"); ECONOMY_CLAIM_SALE_CANCELLED = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-sale-cancelled"); + ECONOMY_MODE_NOT_ENABLED = MessageStorage.MESSAGE_DATA.getMessage("economy-mode-not-enabled"); ECONOMY_NOT_INSTALLED = MessageStorage.MESSAGE_DATA.getMessage("economy-not-installed"); ECONOMY_SIGN_RENT_DESCRIPTION = MessageStorage.MESSAGE_DATA.getMessage("economy-sign-rent-description"); ECONOMY_SIGN_RENT_FOOTER = MessageStorage.MESSAGE_DATA.getMessage("economy-sign-rent-footer"); @@ -627,6 +637,8 @@ public void loadCache() { FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-damage-animals"); FLAG_DESCRIPTION_CUSTOM_END_CRYSTAL_USE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-endcrystal-use"); FLAG_DESCRIPTION_CUSTOM_ENDERMAN_GRIEF = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-enderman-grief"); + FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-entity-armorstand-damage"); + FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-entity-itemframe-damage"); FLAG_DESCRIPTION_CUSTOM_EXP_DROP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-exp-drop"); FLAG_DESCRIPTION_CUSTOM_FALL_ENTITY_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-fall-entity-damage"); FLAG_DESCRIPTION_CUSTOM_FALL_PLAYER_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-fall-player-damage"); @@ -664,6 +676,7 @@ public void loadCache() { FLAG_DESCRIPTION_CUSTOM_PLAYER_PORTAL_USE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-portal-use"); FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_FROM = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-teleport-from"); FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_TO = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-teleport-to"); + FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-villager-damage"); FLAG_DESCRIPTION_CUSTOM_PVP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-pvp"); FLAG_DESCRIPTION_CUSTOM_RIDE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-ride"); FLAG_DESCRIPTION_CUSTOM_SLEEP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-sleep"); @@ -869,7 +882,6 @@ public void loadCache() { PERMISSION_PLAYER_VIEW_OTHERS = MessageStorage.MESSAGE_DATA.getMessage("permission-player-view-others"); PERMISSION_TAX = MessageStorage.MESSAGE_DATA.getMessage("permission-tax"); PERMISSION_VISUAL_CLAIMS_NEARBY = MessageStorage.MESSAGE_DATA.getMessage("permission-visual-claims-nearby"); - PLAYERINFO_UI_TITLE = MessageStorage.MESSAGE_DATA.getMessage("playerinfo-ui-title"); PLUGIN_EVENT_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("plugin-event-cancel"); PLUGIN_RELOAD = MessageStorage.MESSAGE_DATA.getMessage("plugin-reload"); PVP_CLAIM_NOT_ALLOWED = MessageStorage.MESSAGE_DATA.getMessage("pvp-claim-not-allowed"); diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java b/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java index 22a7fe8..c3a6cb3 100644 --- a/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java +++ b/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java @@ -198,11 +198,11 @@ private static Consumer createConfirmationConsumer(GDPermissionUs if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { final Economy economy = GriefDefenderPlugin.getInstance().getVaultProvider().getApi(); - if (!economy.hasAccount(player)) { + if (!economy.hasAccount(user.getOfflinePlayer())) { return; } - final EconomyResponse result = economy.depositPlayer(user.getOnlinePlayer(), refund); + final EconomyResponse result = economy.depositPlayer(user.getOfflinePlayer(), refund); if (result.transactionSuccess()) { Component message = null; if (world != null) { diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java b/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java index b67e457..ce25d81 100644 --- a/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java +++ b/bukkit/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java @@ -119,6 +119,15 @@ private static Consumer createConfirmationConsumer(Player source, if (user == null) { continue; } + if (playerData.playerID.equals(GriefDefenderPlugin.ADMIN_USER_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.PUBLIC_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.WORLD_USER_UUID)) { + continue; + } Set allowedClaims = new HashSet<>(); final Player player = user.getOnlinePlayer(); @@ -160,18 +169,18 @@ private static Consumer createConfirmationConsumer(Player source, if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { final Economy economy = GriefDefenderPlugin.getInstance().getVaultProvider().getApi(); - if (!economy.hasAccount(player)) { + if (!economy.hasAccount(user.getOfflinePlayer())) { return; } final EconomyResponse result = economy.depositPlayer(user.getOfflinePlayer(), refund); - if (result.transactionSuccess()) { + if (result.transactionSuccess() && player != null) { final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS_WORLD, ImmutableMap.of( "world", world.getName(), "amount", TextComponent.of(String.valueOf(refund)))); TextAdapter.sendComponent(player, message); } - } else { + } else if (player != null) { int remainingBlocks = playerData.getRemainingClaimBlocks(); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ABANDON_SUCCESS_WORLD, ImmutableMap.of( "world", world.getName(), diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java b/bukkit/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java index 8f0370c..87f2ad3 100644 --- a/bukkit/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java +++ b/bukkit/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java @@ -39,9 +39,6 @@ import com.griefdefender.configuration.MessageStorage; import com.griefdefender.permission.GDPermissions; import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.adapter.bukkit.TextAdapter; -import net.kyori.text.format.TextColor; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.EconomyResponse; @@ -56,12 +53,15 @@ public class CommandClaimSellBlocks extends BaseCommand { @Syntax("[]") @Subcommand("sell blocks") public void execute(Player player, @Optional Integer blockCount) { - final boolean economyMode = GriefDefenderPlugin.getInstance().isEconomyModeEnabled(); // if economy is disabled, don't do anything if (GriefDefenderPlugin.getInstance().getVaultProvider() == null) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().ECONOMY_NOT_INSTALLED); return; } + if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_NOT_AVAILABLE_ECONOMY); + return; + } final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); if (playerData.getEconomyClaimBlockReturn() <= 0) { @@ -83,7 +83,7 @@ public void execute(Player player, @Optional Integer blockCount) { return; } - int availableBlocks = economyMode ? playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks() : playerData.getInternalRemainingClaimBlocks(); + int availableBlocks = playerData.getInternalRemainingClaimBlocks(); if (blockCount == null) { final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_PURCHASE_COST, ImmutableMap.of( @@ -113,19 +113,6 @@ public void execute(Player player, @Optional Integer blockCount) { return; } - Component message = null; - if (economyMode) { - message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_BLOCK_SALE_CONFIRMATION, - ImmutableMap.of( - "deposit", economyTotalValue, - "balance", String.valueOf("$" + economy.getBalance(player)), - "amount", playerData.getRemainingClaimBlocks())); - } else { - message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_SALE_CONFIRMATION, - ImmutableMap.of( - "deposit", economyTotalValue, - "amount", playerData.getRemainingClaimBlocks())); - } int bonusBlocks = playerData.getBonusClaimBlocks(); int accruedBlocks = playerData.getAccruedClaimBlocks(); if (bonusBlocks > 0) { @@ -142,6 +129,10 @@ public void execute(Player player, @Optional Integer blockCount) { playerData.setAccruedClaimBlocks(accruedBlocks); } + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_SALE_CONFIRMATION, + ImmutableMap.of( + "deposit", "$" + String.format("%.2f", economyTotalValue), + "amount", playerData.getRemainingClaimBlocks())); GriefDefenderPlugin.sendMessage(player, message); } } diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java b/bukkit/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java new file mode 100644 index 0000000..dcdfc4e --- /dev/null +++ b/bukkit/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java @@ -0,0 +1,177 @@ +/* + * This file is part of GriefDefender, licensed under the MIT License (MIT). + * + * Copyright (c) bloodmc + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.griefdefender.command; + +import co.aikar.commands.BaseCommand; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Optional; +import co.aikar.commands.annotation.Subcommand; + +import com.google.common.collect.ImmutableMap; +import com.griefdefender.GDPlayerData; +import com.griefdefender.GriefDefenderPlugin; +import com.griefdefender.cache.MessageCache; +import com.griefdefender.cache.PermissionHolderCache; +import com.griefdefender.claim.GDClaimManager; +import com.griefdefender.configuration.MessageStorage; +import com.griefdefender.permission.GDPermissionUser; +import com.griefdefender.permission.GDPermissions; +import com.griefdefender.storage.BaseStorage; +import com.griefdefender.text.action.GDCallbackHolder; + +import net.kyori.text.Component; +import net.kyori.text.TextComponent; +import net.kyori.text.adapter.bukkit.TextAdapter; +import net.kyori.text.event.ClickEvent; +import net.kyori.text.event.HoverEvent; +import net.kyori.text.format.TextColor; +import net.milkbowl.vault.economy.Economy; +import net.milkbowl.vault.economy.EconomyResponse; + +import java.util.HashSet; +import java.util.Set; +import java.util.function.Consumer; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.command.CommandSender; + +@CommandAlias("%griefdefender") +@CommandPermission(GDPermissions.COMMAND_ECONOMY_BLOCK_TRANSFER) +public class CommandGDBlockTransfer extends BaseCommand { + + @CommandAlias("gdblocktransfer") + @Description("Transfers ALL player remaining accrued/bonus claim blocks into currency then sets their accrued and bonus amounts to 0.\nNote: This MUST be used if you are switching from claim blocks system to economy mode.") + @Subcommand("economy blocktransfer") + public void execute(CommandSender source, @Optional Integer blockCount) { + // if economy is disabled, don't do anything + if (GriefDefenderPlugin.getInstance().getVaultProvider() == null) { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_NOT_INSTALLED); + return; + } + if (!GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_MODE_NOT_ENABLED); + return; + } + + final Component confirmationText = TextComponent.builder() + .append(MessageCache.getInstance().ECONOMY_BLOCK_TRANSFER_WARNING) + .append(TextComponent.builder() + .append("\n[") + .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) + .append("]\n") + .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(source, createConfirmationConsumer(source), true))) + .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) + .build(); + TextAdapter.sendComponent(source, confirmationText); + } + + public Consumer createConfirmationConsumer(CommandSender source) { + return confirm -> { + Set playerDataSet = new HashSet<>(); + if (BaseStorage.USE_GLOBAL_PLAYER_STORAGE) { + final World world = Bukkit.getWorlds().get(0); + final GDClaimManager claimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(world.getUID()); + playerDataSet.addAll(claimManager.getPlayerDataMap().values()); + } else { + for (World world : Bukkit.getServer().getWorlds()) { + final GDClaimManager claimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(world.getUID()); + playerDataSet.addAll(claimManager.getPlayerDataMap().values()); + } + } + + int count = 0; + for (GDPlayerData playerData : playerDataSet) { + final double economyBlockCost = playerData.getEconomyClaimBlockCost(); + if (economyBlockCost <= 0) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.ADMIN_USER_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.PUBLIC_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.WORLD_USER_UUID)) { + continue; + } + + final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(playerData.getUniqueId()); + if (user == null) { + continue; + } + System.out.println("Migrating user " + user.getFriendlyName() + " remaining claimblocks..."); + final Economy economy = GriefDefenderPlugin.getInstance().getVaultProvider().getApi(); + if (!economy.hasAccount(user.getOfflinePlayer())) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_PLAYER_NOT_FOUND, ImmutableMap.of( + "player", user.getFriendlyName())); + GriefDefenderPlugin.sendMessage(source, message); + continue; + } + + int availableBlocks = playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks(); + int totalClaimCost = playerData.getTotalClaimsCost(); + final int remainingBlocks = availableBlocks - totalClaimCost; + if (remainingBlocks <= 0) { + System.out.println("User " + user.getFriendlyName() + " has " + remainingBlocks + " remaining claim blocks. Skipping..."); + continue; + } + + // attempt to compute value and deposit it + double economyTotalValue = economyBlockCost * remainingBlocks; + final EconomyResponse result = economy.depositPlayer(user.getOfflinePlayer(), economyTotalValue); + + if (!result.transactionSuccess()) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_DEPOSIT_ERROR, ImmutableMap.of( + "reason", result.errorMessage)); + GriefDefenderPlugin.sendMessage(source, message); + continue; + } + + Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_BLOCK_SALE_CONFIRMATION, + ImmutableMap.of( + "deposit", "$" + String.format("%.2f", economyTotalValue), + "balance", "$" + String.format("%.2f", economy.getBalance(user.getOfflinePlayer())), + "amount", playerData.getRemainingClaimBlocks())); + playerData.setAccruedClaimBlocks(0); + playerData.setBonusClaimBlocks(0); + if (user.getOnlinePlayer() != null) { + GriefDefenderPlugin.sendMessage(user.getOnlinePlayer(), message); + } + count++; + } + if (count > 0) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_TRANSFER_SUCCESS, + ImmutableMap.of( + "count", count)); + GriefDefenderPlugin.sendMessage(source, message); + } else { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_BLOCK_TRANSFER_CANCEL); + } + }; + } +} diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandGDConfirm.java b/bukkit/src/main/java/com/griefdefender/command/CommandGDConfirm.java new file mode 100644 index 0000000..f3a5d9d --- /dev/null +++ b/bukkit/src/main/java/com/griefdefender/command/CommandGDConfirm.java @@ -0,0 +1,59 @@ +/* + * This file is part of GriefDefender, licensed under the MIT License (MIT). + * + * Copyright (c) bloodmc + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.griefdefender.command; + +import co.aikar.commands.BaseCommand; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Subcommand; +import net.kyori.text.TextComponent; +import net.kyori.text.adapter.bukkit.TextAdapter; + +import com.griefdefender.permission.GDPermissions; +import com.griefdefender.text.action.GDCallbackHolder; + +import java.util.function.Consumer; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandAlias("%griefdefender") +@CommandPermission(GDPermissions.COMMAND_CONFIRM) +public class CommandGDConfirm extends BaseCommand { + + @CommandAlias("gdconfirm") + @Description("Alternate way to confirm chat confirmations.") + @Subcommand("confirm") + public void execute(Player player) { + + final Consumer callback = GDCallbackHolder.getInstance().getConfirmationForPlayer(player); + if (callback != null) { + callback.accept(player); + } else { + TextAdapter.sendComponent(player, TextComponent.of("No confirmation found.")); + } + } +} diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandPlayerInfo.java b/bukkit/src/main/java/com/griefdefender/command/CommandPlayerInfo.java index 44f11a4..507348d 100644 --- a/bukkit/src/main/java/com/griefdefender/command/CommandPlayerInfo.java +++ b/bukkit/src/main/java/com/griefdefender/command/CommandPlayerInfo.java @@ -74,7 +74,7 @@ public class CommandPlayerInfo extends BaseCommand { @CommandCompletion("@gdplayers @gddummy") - @CommandAlias("playerinfo") + @CommandAlias("gdplayerinfo|playerinfo") @Description("Gets information about a player.") @Syntax("[| ]") @Subcommand("player info") @@ -159,58 +159,53 @@ public void execute(CommandSender src, @Optional String[] args) throws InvalidCo final Component economyBlockAvailablePurchaseText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_AVAILABLE_PURCHASE, ImmutableMap.of("amount", String.valueOf(playerData.getRemainingClaimBlocks()))); final Component economyBlockCostText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_COST, - ImmutableMap.of("amount", String.valueOf("$" + playerData.getInternalEconomyBlockCost()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getInternalEconomyBlockCost()))); final Component economyBlockSellReturnText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_SELL_RETURN, - ImmutableMap.of("amount", String.valueOf("$" + playerData.getEconomyClaimBlockReturn()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getEconomyClaimBlockReturn()))); final Component minMaxLevelText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_LEVEL, ImmutableMap.of("level", String.valueOf(playerData.getMinClaimLevel() + "-" + playerData.getMaxClaimLevel()))); final Component abandonRatioText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ABANDON_RETURN_RATIO, ImmutableMap.of("ratio", String.valueOf(playerData.getAbandonedReturnRatio(ClaimTypes.BASIC)))); final Component totalTaxText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_TAX_TOTAL, - ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getTotalTax()))); final Component totalBlockText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_BLOCK_TOTAL, - ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks()))); + ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks() + playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks()))); final Component totalClaimableChunkText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CHUNK_TOTAL, ImmutableMap.of("amount", String.valueOf(Math.round(claimableChunks * 100.0)/100.0))); final Component totalClaimText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_TOTAL, - ImmutableMap.of("amount", String.valueOf(claimList.size()))); + ImmutableMap.of("amount", claimList.size(), + "block_amount", playerData.getTotalClaimsCost())); List claimsTextList = Lists.newArrayList(); claimsTextList.add(uuidText); claimsTextList.add(worldText); claimsTextList.add(sizeLimitText); - claimsTextList.add(initialBlockText); - claimsTextList.add(accruedBlockText); - claimsTextList.add(maxAccruedBlockText); - claimsTextList.add(bonusBlockText); - if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { - claimsTextList.add(economyBlockAvailablePurchaseText); - claimsTextList.add(economyBlockCostText); - claimsTextList.add(economyBlockSellReturnText); - } else { - claimsTextList.add(remainingBlockText); - } - claimsTextList.add(minMaxLevelText); - claimsTextList.add(abandonRatioText); final int townLimit = playerData.getCreateClaimLimit(ClaimTypes.TOWN); final int basicLimit = playerData.getCreateClaimLimit(ClaimTypes.BASIC); final int subLimit = playerData.getCreateClaimLimit(ClaimTypes.SUBDIVISION); String townLimitText = townLimit < 0 ? "∞" : String.valueOf(townLimit); String basicLimitText = basicLimit < 0 ? "∞" : String.valueOf(basicLimit); String subLimitText = subLimit < 0 ? "∞" : String.valueOf(subLimit); - - Component claimCreateLimits = TextComponent.builder("") - .append("TOWN", TextColor.GRAY) - .append(" : ") - .append(townLimitText, TextColor.GREEN) - .append(" BASIC", TextColor.GRAY) - .append(" : ") - .append(basicLimitText, TextColor.GREEN) - .append(" SUB", TextColor.GRAY) - .append(" : ") - .append(subLimitText, TextColor.GREEN) - .build(); + Component claimCreateLimits = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_CREATION_LIMIT, + ImmutableMap.of("basic_limit", basicLimitText, + "sub_limit", subLimitText, + "town_limit", townLimitText)); claimsTextList.add(claimCreateLimits); + claimsTextList.add(initialBlockText); + claimsTextList.add(accruedBlockText); + claimsTextList.add(bonusBlockText); + claimsTextList.add(totalBlockText); + if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + claimsTextList.add(economyBlockCostText); + claimsTextList.add(economyBlockSellReturnText); + claimsTextList.add(economyBlockAvailablePurchaseText); + } else { + claimsTextList.add(remainingBlockText); + } + claimsTextList.add(maxAccruedBlockText); + claimsTextList.add(minMaxLevelText); + claimsTextList.add(abandonRatioText); + if (GriefDefenderPlugin.getActiveConfig(world.getUID()).getConfig().economy.taxSystem) { Component townTaxRate = TextComponent.builder("") .append("TOWN", TextColor.GRAY) @@ -250,7 +245,6 @@ public void execute(CommandSender src, @Optional String[] args) throws InvalidCo claimsTextList.add(globalClaimTaxText); claimsTextList.add(totalTaxText); } - claimsTextList.add(totalBlockText); claimsTextList.add(totalClaimableChunkText); claimsTextList.add(totalClaimText); @@ -267,8 +261,10 @@ public void execute(CommandSender src, @Optional String[] args) throws InvalidCo } } + final Component title = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_TITLE, + ImmutableMap.of("name", playerData.getName())); PaginationList.Builder paginationBuilder = PaginationList.builder() - .title(MessageCache.getInstance().PLAYERINFO_UI_TITLE).padding(TextComponent.of(" ").decoration(TextDecoration.STRIKETHROUGH, true)).contents(claimsTextList); + .title(title).padding(TextComponent.of(" ").decoration(TextDecoration.STRIKETHROUGH, true)).contents(claimsTextList); paginationBuilder.sendTo(src); } } diff --git a/bukkit/src/main/java/com/griefdefender/configuration/MessageStorage.java b/bukkit/src/main/java/com/griefdefender/configuration/MessageStorage.java index cc7d06f..52c0c8e 100644 --- a/bukkit/src/main/java/com/griefdefender/configuration/MessageStorage.java +++ b/bukkit/src/main/java/com/griefdefender/configuration/MessageStorage.java @@ -187,6 +187,7 @@ public class MessageStorage { public static final String ECONOMY_BLOCK_PURCHASE_LIMIT = "economy-block-purchase-limit"; public static final String ECONOMY_BLOCK_SALE_CONFIRMATION = "economy-block-sale-confirmation"; public static final String ECONOMY_BLOCK_SELL_ERROR = "economy-block-sell-error"; + public static final String ECONOMY_BLOCK_TRANSFER_SUCCESS = "economy-block-transfer-success"; public static final String ECONOMY_CLAIM_ABANDON_SUCCESS = "economy-claim-abandon-success"; public static final String ECONOMY_CLAIM_ABANDON_SUCCESS_WORLD = "economy-claim-abandon-success-world"; public static final String ECONOMY_CLAIM_BUY_CANCELLED = "economy-claim-buy-cancelled"; @@ -220,6 +221,7 @@ public class MessageStorage { public static final String ECONOMY_CLAIM_SALE_CONFIRMED = "economy-claim-sale-confirmed"; public static final String ECONOMY_CLAIM_SALE_INVALID_PRICE = "economy-claim-sale-invalid-price"; public static final String ECONOMY_CLAIM_SOLD = "economy-claim-sold"; + public static final String ECONOMY_DEPOSIT_ERROR = "economy-deposit-error"; public static final String ECONOMY_MODE_BLOCK_SALE_CONFIRMATION = "economy-mode-block-sale-confirmation"; public static final String ECONOMY_MODE_BLOCK_COST_NOT_SET = "economy-mode-block-cost-not-set"; public static final String ECONOMY_MODE_RESIZE_SUCCESS_2D = "economy-mode-resize-success-2d"; @@ -288,6 +290,7 @@ public class MessageStorage { public static final String PLAYERINFO_UI_ABANDON_RETURN_RATIO = "playerinfo-ui-abandon-return-ratio"; public static final String PLAYERINFO_UI_BLOCK_ACCRUED = "playerinfo-ui-block-accrued"; public static final String PLAYERINFO_UI_BLOCK_BONUS = "playerinfo-ui-block-bonus"; + public static final String PLAYERINFO_UI_CLAIM_CREATION_LIMIT = "playerinfo-ui-claim-creation-limit"; public static final String PLAYERINFO_UI_CLAIM_LEVEL = "playerinfo-ui-claim-level"; public static final String PLAYERINFO_UI_CLAIM_SIZE_LIMIT = "playerinfo-ui-claim-size-limit"; public static final String PLAYERINFO_UI_BLOCK_INITIAL = "playerinfo-ui-block-initial"; @@ -304,6 +307,7 @@ public class MessageStorage { public static final String PLAYERINFO_UI_TAX_GLOBAL_CLAIM_RATE = "playerinfo-ui-tax-global-claim-rate"; public static final String PLAYERINFO_UI_TAX_GLOBAL_TOWN_RATE = "playerinfo-ui-tax-global-town-rate"; public static final String PLAYERINFO_UI_TAX_TOTAL = "playerinfo-ui-tax-total"; + public static final String PLAYERINFO_UI_TITLE = "playerinfo-ui-title"; public static final String PLAYERINFO_UI_UUID = "playerinfo-ui-uuid"; public static final String PLAYERINFO_UI_WORLD = "playerinfo-ui-world"; public static final String PLUGIN_COMMAND_NOT_FOUND = "plugin-command-not-found"; diff --git a/bukkit/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java b/bukkit/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java index 26c7ad0..f3a6766 100644 --- a/bukkit/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java +++ b/bukkit/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java @@ -36,7 +36,7 @@ public class EconomyCategory extends ConfigCategory { @Setting(value = "economy-mode", comment = "Uses economy instead of player claim blocks for claim creation." + "\nIf true, disables the claim block system in favor of economy." + "\nNote: Using this mode disables the '/buyblocks' command as claim creation will pull funds directly from a player's economy balance." - + "\nNote: If players have existing claimblocks from past configurations, they can use the '/sellblocks' command to convert remainder to currency.") + + "\nNote: If players have existing claimblocks from past configurations, an admin must use the '/ecomigrateblocks' command to convert remainder to currency.") public boolean economyMode = false; @Setting(value = "use-claim-block-task", comment = "Claim blocks earned will be converted to economy based on 'claim-block-cost'." + "\n(Default: false)\nNote: This setting can only be used if 'economy-mode' is true.") diff --git a/bukkit/src/main/java/com/griefdefender/listener/BlockEventHandler.java b/bukkit/src/main/java/com/griefdefender/listener/BlockEventHandler.java index c6190c6..b3d3db8 100644 --- a/bukkit/src/main/java/com/griefdefender/listener/BlockEventHandler.java +++ b/bukkit/src/main/java/com/griefdefender/listener/BlockEventHandler.java @@ -42,7 +42,6 @@ import com.griefdefender.api.permission.option.Options; import com.griefdefender.cache.EventResultCache; import com.griefdefender.cache.MessageCache; -import com.griefdefender.cache.PermissionHolderCache; import com.griefdefender.claim.GDClaim; import com.griefdefender.claim.GDClaimManager; import com.griefdefender.configuration.GriefDefenderConfig; @@ -64,9 +63,7 @@ import com.griefdefender.util.PlayerUtil; import com.griefdefender.util.SignUtil; import net.kyori.text.Component; -import net.kyori.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -91,6 +88,7 @@ import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; @@ -98,17 +96,12 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.List; -import java.util.UUID; public class BlockEventHandler implements Listener { - private int lastBlockPreTick = -1; - private boolean lastBlockPreCancelled = false; - private final BaseStorage storage; public BlockEventHandler(BaseStorage dataStore) { @@ -165,54 +158,73 @@ public void onBlockBurn(BlockBurnEvent event) { @EventHandler(priority = EventPriority.LOWEST) public void onBlockPistonExtend(BlockPistonExtendEvent event) { GDCauseStackManager.getInstance().pushCause(event.getBlock()); - if (lastBlockPreTick == NMSUtil.getInstance().getRunningServerTicks()) { - // IGNORE - event.setCancelled(lastBlockPreCancelled); - return; - } - lastBlockPreTick = NMSUtil.getInstance().getRunningServerTicks(); final World world = event.getBlock().getWorld(); if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) { return; } - final GDPermissionUser user = CauseContextHelper.getEventUser(event.getBlock().getLocation()); + final Block sourceBlock = event.getBlock(); + final GDPermissionUser user = CauseContextHelper.getEventUser(sourceBlock.getLocation()); if (user == null) { - lastBlockPreCancelled = false; return; } - GDClaim targetClaim = null; - if (event.getBlocks().isEmpty()) { - Location location = BlockUtil.getInstance().getBlockRelative(event.getBlock().getLocation(), event.getDirection()); - targetClaim = this.storage.getClaimAt(location); - if (targetClaim.isWilderness()) { - // Sticky pistons will attach to next block so we need to check it - location = BlockUtil.getInstance().getBlockRelative(location, event.getDirection()); - targetClaim = this.storage.getClaimAt(location); - } - - if (handleBlockBreak(event, location, targetClaim, event.getBlock(), location.getBlock(), user, false)) { - event.setCancelled(true); - lastBlockPreCancelled = true; - return; - } - } - + final GDClaim sourceClaim = this.storage.getClaimAt(sourceBlock.getLocation()); for (Block block : event.getBlocks()) { - Location location = BlockUtil.getInstance().getBlockRelative(block.getLocation(), event.getDirection()); - targetClaim = this.storage.getClaimAt(location); - if (targetClaim.isWilderness()) { + // always check next block in direction + final Location location = BlockUtil.getInstance().getBlockRelative(block.getLocation(), event.getDirection()); + final GDClaim targetClaim = this.storage.getClaimAt(location); + if (targetClaim.isWilderness() || sourceClaim.getUniqueId().equals(targetClaim.getUniqueId())) { continue; } - if (handleBlockBreak(event, location, targetClaim, event.getBlock(), block, user, false)) { - event.setCancelled(true); - lastBlockPreCancelled = true; - return; + if (location.getBlock().isEmpty()) { + if (handleBlockPlace(event, location, targetClaim, sourceBlock, block, user, false)) { + event.setCancelled(true); + return; + } + } else { + if (handleBlockBreak(event, location, targetClaim, sourceBlock, location.getBlock(), user, false)) { + event.setCancelled(true); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onBlockPistonRetract(BlockPistonRetractEvent event) { + final World world = event.getBlock().getWorld(); + if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) { + return; + } + + final Block sourceBlock = event.getBlock(); + final GDPermissionUser user = CauseContextHelper.getEventUser(sourceBlock.getLocation()); + if (user == null) { + return; + } + + final GDClaim sourceClaim = this.storage.getClaimAt(sourceBlock.getLocation()); + for (Block block : event.getBlocks()) { + final Location location = block.getLocation(); + final GDClaim targetClaim = this.storage.getClaimAt(location); + if (sourceClaim.getUniqueId().equals(targetClaim.getUniqueId())) { + continue; + } + + if (location.getBlock().isEmpty()) { + if (handleBlockPlace(event, location, targetClaim, sourceBlock, block, user, false)) { + event.setCancelled(true); + return; + } + } else { + if (handleBlockBreak(event, location, targetClaim, sourceBlock, location.getBlock(), user, false)) { + event.setCancelled(true); + return; + } } } - lastBlockPreCancelled = false; } @EventHandler(priority = EventPriority.LOWEST) @@ -226,17 +238,14 @@ public void onBlockDispense(BlockDispenseEvent event) { final Location location = block.getLocation(); final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(world.getUID()); final GDChunk gpChunk = claimWorldManager.getChunk(block.getChunk()); - final GDPermissionUser user = gpChunk.getBlockOwner(location); + final GDPermissionUser user = gpChunk.getBlockNotifier(location); if (user != null) { final BlockFace face = NMSUtil.getInstance().getFacing(block); final Location faceLocation = BlockUtil.getInstance().getBlockRelative(location, face); final GDClaim targetClaim = this.storage.getClaimAt(faceLocation); - final ItemStack activeItem = user != null && user.getOnlinePlayer() != null ? NMSUtil.getInstance().getActiveItem(user.getOnlinePlayer()) : null; - final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.INTERACT_BLOCK_SECONDARY, activeItem, event.getBlock(), user, TrustTypes.BUILDER, true); + final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.ITEM_SPAWN, event.getBlock(), event.getItem(), user, TrustTypes.BUILDER, true); if (result == Tristate.FALSE) { event.setCancelled(true); - } else { - GDCauseStackManager.getInstance().pushCause(user); } } } @@ -337,6 +346,27 @@ private boolean handleBlockBreak(BlockEvent event, Location location, GDClaim cl return false; } + private boolean handleBlockPlace(BlockEvent event, Location location, GDClaim claim, Object source, Object target, GDPermissionUser user, boolean sendDenyMessage) { + // check overrides + final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.BLOCK_PLACE, source, target, user, TrustTypes.BUILDER, true); + if (result == Tristate.FALSE) { + if (sendDenyMessage && user != null) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_BUILD, + ImmutableMap.of( + "player", claim.getOwnerDisplayName() + )); + final Player player = Bukkit.getPlayer(user.getUniqueId()); + if (player != null && player.isOnline()) { + GriefDefenderPlugin.sendClaimDenyMessage(claim, (Player) player, message); + } + } + + return true; + } + + return false; + } + @EventHandler(priority = EventPriority.LOWEST) public void onBlockIgnite(BlockIgniteEvent event) { if (!GDFlags.BLOCK_MODIFY) { @@ -402,7 +432,6 @@ public void onBlockNotify(BlockPhysicsEvent event) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(world, user.getUniqueId()); final GDClaim sourceClaim = this.storage.getClaimAt(sourceLocation); - final Vector3i pos = VecHelper.toVector3i(location); final GDClaim targetClaim = this.storage.getClaimAt(location); if (sourceClaim.isWilderness() && targetClaim.isWilderness()) { if (playerData != null) { @@ -496,7 +525,6 @@ public void onBlockBreak(BlockBreakEvent event) { } final Player player = event.getPlayer(); - final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player); GDCauseStackManager.getInstance().pushCause(player); final World world = event.getPlayer().getWorld(); if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) { @@ -566,7 +594,7 @@ public void onBlockPlace(BlockPlaceEvent event) { final GDClaim targetClaim = this.storage.getClaimAtPlayer(location, playerData, true); // check surroundings for chest in protected claim - for (Direction direction : BlockUtil.getInstance().CARDINAL_SET) { + for (Direction direction : BlockUtil.CARDINAL_SET) { final Location relative = BlockUtil.getInstance().getBlockRelative(location, direction); final GDClaim claim = this.storage.getClaimAtPlayer(relative, playerData, true); if (!claim.equals(targetClaim)) { diff --git a/bukkit/src/main/java/com/griefdefender/listener/EntityEventHandler.java b/bukkit/src/main/java/com/griefdefender/listener/EntityEventHandler.java index 055d6d0..edd7d9e 100644 --- a/bukkit/src/main/java/com/griefdefender/listener/EntityEventHandler.java +++ b/bukkit/src/main/java/com/griefdefender/listener/EntityEventHandler.java @@ -44,8 +44,6 @@ import com.griefdefender.claim.GDClaimManager; import com.griefdefender.configuration.MessageStorage; import com.griefdefender.event.GDCauseStackManager; -import com.griefdefender.internal.registry.EntityTypeRegistryModule; -import com.griefdefender.internal.registry.GDEntityType; import com.griefdefender.internal.tracking.EntityTracker; import com.griefdefender.internal.tracking.PlayerTracker; import com.griefdefender.internal.tracking.entity.GDEntity; @@ -95,7 +93,6 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; @@ -530,12 +527,6 @@ public boolean protectEntity(Event event, Object source, Entity targetEntity) { } } - // Always allow damage against monsters - if (!this.isEntityProtected(targetEntity)) { - GDPermissionManager.getInstance().processEventLog(event, location, claim, flag.getPermission(), source, targetEntity, user, TrustTypes.NONE.getName().toLowerCase(), Tristate.TRUE); - return false; - } - final TrustType trustType = TrustTypes.BUILDER; if (projectileSource != null && projectileSource instanceof Monster) { // check monster source damage first @@ -553,6 +544,10 @@ public boolean protectEntity(Event event, Object source, Entity targetEntity) { return true; } + if (targetEntity instanceof Monster) { + return false; + } + // allow trusted users to attack entities within claim if (!(targetEntity instanceof Player) && user != null && claim.isUserTrusted(user, TrustTypes.BUILDER)) { return false; @@ -700,7 +695,7 @@ public void handleEntitySpawn(Event event, Object source, Entity entity) { return; } - final boolean isEntityProtected = this.isEntityProtected(entity); + final boolean isEntityProtected = !(entity instanceof Monster); GDTimings.ENTITY_SPAWN_EVENT.startTiming(); GDPermissionUser user = null; // Make sure not to pass trusted user for non-protected entities such as monsters @@ -832,30 +827,4 @@ public void onEntityMount(VehicleEnterEvent event) { GDTimings.ENTITY_MOUNT_EVENT.stopTiming(); } - - private boolean isEntityProtected(Entity entity) { - if (entity.getType() == null) { - if (entity instanceof Monster) { - return false; - } - return true; - } - - // ignore monsters - final String name = entity.getType().getName() == null ? entity.getType().name().toLowerCase() : entity.getType().getName(); - final GDEntityType type = EntityTypeRegistryModule.getInstance().getById(name).orElse(null); - if (type == null) { - return true; - } - - final String creatureType = type.getEnumCreatureTypeId(); - if (creatureType == null) { - return true; - } - if (creatureType.contains("monster")) { - return false; - } - - return true; - } } diff --git a/bukkit/src/main/java/com/griefdefender/migrator/GriefPreventionMigrator.java b/bukkit/src/main/java/com/griefdefender/migrator/GriefPreventionMigrator.java index e47103a..616f756 100644 --- a/bukkit/src/main/java/com/griefdefender/migrator/GriefPreventionMigrator.java +++ b/bukkit/src/main/java/com/griefdefender/migrator/GriefPreventionMigrator.java @@ -479,6 +479,9 @@ private static void migratePlayerData(World world) { GriefDefenderPlugin.getInstance().getLogger().info("Migrating " + files.length + " player data files..."); for (int i = 0; i < files.length; i++) { final File file = files[i]; + if (file.getName().endsWith("ignore")) { + continue; + } GriefDefenderPlugin.getInstance().getLogger().info("Migrating playerdata " + file.getName() + "..."); UUID uuid = null; try { diff --git a/bukkit/src/main/java/com/griefdefender/permission/GDPermissions.java b/bukkit/src/main/java/com/griefdefender/permission/GDPermissions.java index 8a1631d..1f36a10 100644 --- a/bukkit/src/main/java/com/griefdefender/permission/GDPermissions.java +++ b/bukkit/src/main/java/com/griefdefender/permission/GDPermissions.java @@ -91,6 +91,7 @@ public class GDPermissions { public static final String CLAIM_SHOW_TUTORIAL = "griefdefender.user.claim.show-tutorial"; public static final String VISUALIZE_CLAIMS = "griefdefender.user.claim.visualize.base"; public static final String VISUALIZE_CLAIMS_NEARBY = "griefdefender.user.claim.visualize.nearby"; + public static final String COMMAND_CONFIRM = "griefdefender.user.command.confirm"; public static final String COMMAND_PLAYER_INFO_BASE = "griefdefender.user.command.info.base"; public static final String COMMAND_PLAYER_INFO_OTHERS = "griefdefender.user.command.info.others"; public static final String COMMAND_VERSION = "griefdefender.user.command.version"; @@ -154,6 +155,7 @@ public class GDPermissions { public static final String COMMAND_DELETE_CLAIM_BASE = "griefdefender.admin.claim.command.delete.base"; public static final String COMMAND_DELETE_CLAIMS = "griefdefender.admin.claim.command.delete-claims"; public static final String COMMAND_DELETE_ADMIN_CLAIMS = "griefdefender.admin.command.delete-admin-claims"; + public static final String COMMAND_ECONOMY_BLOCK_TRANSFER = "griefdefender.admin.command.block-transfer"; public static final String COMMAND_SET_ACCRUED_CLAIM_BLOCKS = "griefdefender.admin.command.set-accrued-claim-blocks"; public static final String COMMAND_RESTORE_CLAIM = "griefdefender.admin.command.restore-claim.base"; public static final String COMMAND_RESTORE_NATURE = "griefdefender.admin.command.restore-nature.base"; diff --git a/bukkit/src/main/java/com/griefdefender/permission/flag/FlagContexts.java b/bukkit/src/main/java/com/griefdefender/permission/flag/FlagContexts.java index 93be129..01a9e42 100644 --- a/bukkit/src/main/java/com/griefdefender/permission/flag/FlagContexts.java +++ b/bukkit/src/main/java/com/griefdefender/permission/flag/FlagContexts.java @@ -65,19 +65,17 @@ public class FlagContexts { // Targets public static final Context TARGET_AIR = new Context(ContextKeys.TARGET, "minecraft:air"); + public static final Context TARGET_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armor_stand"); public static final Context TARGET_BED = new Context(ContextKeys.TARGET, "minecraft:bed"); public static final Context TARGET_BOAT = new Context(ContextKeys.TARGET, "minecraft:boat"); public static final Context TARGET_CHEST = new Context(ContextKeys.TARGET, "minecraft:chest"); public static final Context TARGET_CHORUS_FRUIT = new Context(ContextKeys.TARGET, "minecraft:chorus_fruit"); - public static final Context TARGET_ENDERPEARL = new Context(ContextKeys.TARGET, "minecraft:enderpearl"); - public static final Context TARGET_ENTITY_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armorstand"); - public static final Context TARGET_ENTITY_ENDER_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:endercrystal"); + public static final Context TARGET_ENDERPEARL = new Context(ContextKeys.TARGET, "minecraft:ender_pearl"); + public static final Context TARGET_END_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:end_crystal"); public static final Context TARGET_FARMLAND = new Context(ContextKeys.TARGET, "minecraft:farmland"); public static final Context TARGET_FLINTANDSTEEL = new Context(ContextKeys.TARGET, "minecraft:flint_and_steel"); public static final Context TARGET_GRASS= new Context(ContextKeys.TARGET, "minecraft:grass"); public static final Context TARGET_HANGING = new Context(ContextKeys.TARGET, "#hanging"); - public static final Context TARGET_ITEM_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armor_stand"); - public static final Context TARGET_ITEM_END_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:end_crystal"); public static final Context TARGET_ITEM_FRAME = new Context(ContextKeys.TARGET, "minecraft:item_frame"); public static final Context TARGET_LAVA_BUCKET = new Context(ContextKeys.TARGET, "minecraft:lava_bucket"); public static final Context TARGET_MINECART = new Context(ContextKeys.TARGET, "minecraft:minecart"); diff --git a/bukkit/src/main/java/com/griefdefender/permission/flag/GDFlag.java b/bukkit/src/main/java/com/griefdefender/permission/flag/GDFlag.java index 02a9d05..9f58a85 100644 --- a/bukkit/src/main/java/com/griefdefender/permission/flag/GDFlag.java +++ b/bukkit/src/main/java/com/griefdefender/permission/flag/GDFlag.java @@ -88,7 +88,6 @@ public boolean getDefaultClaimTypeValue(ClaimType type) { case "block-place" : case "collide-block" : case "collide-entity" : - case "entity-damage" : case "explosion-block" : case "explosion-entity" : case "interact-block-primary" : @@ -97,7 +96,6 @@ public boolean getDefaultClaimTypeValue(ClaimType type) { case "interact-inventory" : case "liquid-flow" : case "projectile-impact-block" : - case "projectile-impact-entity" : return false; default : return true; diff --git a/bukkit/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java b/bukkit/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java index 36d6240..dea0f72 100644 --- a/bukkit/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java +++ b/bukkit/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java @@ -137,7 +137,7 @@ public void registerDefaults() { flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ITEM_ARMOR_STAND); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); flagData = new ArrayList<>(); flagData.add(flagDataBuilder .reset() @@ -146,7 +146,7 @@ public void registerDefaults() { .build()); flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ENTITY_ARMOR_STAND); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); flagData.add(flagDataBuilder .reset() .flag(Flags.ENTITY_DAMAGE) @@ -219,7 +219,7 @@ public void registerDefaults() { flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ITEM_END_CRYSTAL); + flagContexts.add(FlagContexts.TARGET_END_CRYSTAL); flagData = new ArrayList<>(); flagData.add(flagDataBuilder .reset() @@ -228,7 +228,7 @@ public void registerDefaults() { .build()); flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ENTITY_ENDER_CRYSTAL); + flagContexts.add(FlagContexts.TARGET_END_CRYSTAL); flagData.add(flagDataBuilder .reset() .flag(Flags.ENTITY_DAMAGE) @@ -251,6 +251,56 @@ public void registerDefaults() { .flagData(flagData) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("entity-armorstand-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_ITEM_FRAME); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("entity-itemframe-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + this.registerCustomType( definitionBuilder .reset() @@ -508,7 +558,7 @@ public void registerDefaults() { .reset() .name("piston-use") .admin(true) - .context(new Context(ContextKeys.CLAIM, "claim")) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) .defaultValue(Tristate.FALSE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PISTON_USE) .group("admin") @@ -563,6 +613,19 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_PLAYER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -572,11 +635,7 @@ public void registerDefaults() { .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PLAYER_DAMAGE) .group("admin") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .context(FlagContexts.TARGET_PLAYER) - .build()) + .flagData(flagData) .build()); flagContexts = new HashSet<>(); @@ -767,9 +826,46 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.SOURCE_PLAYER); + flagContexts.add(FlagContexts.TARGET_VILLAGER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("player-villager-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); flagContexts.add(FlagContexts.TARGET_PLAYER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -779,11 +875,7 @@ public void registerDefaults() { .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PVP) .group("admin") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .contexts(flagContexts) - .build()) + .flagData(flagData) .build()); this.registerCustomType( @@ -879,10 +971,10 @@ public void registerDefaults() { this.registerCustomType( definitionBuilder .reset() - .name("wither-entity-break") + .name("wither-entity-damage") .admin(true) .context(ClaimContexts.USER_DEFAULT_CONTEXT) - .defaultValue(Tristate.FALSE) + .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_WITHER_ENTITY_DAMAGE) .group("admin") .flagData(flagDataBuilder @@ -978,6 +1070,19 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_TYPE_ANIMAL); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -987,11 +1092,7 @@ public void registerDefaults() { .defaultValue(Tristate.FALSE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS) .group("user") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .context(FlagContexts.TARGET_TYPE_ANIMAL) - .build()) + .flagData(flagData) .build()); this.registerCustomType( @@ -1011,7 +1112,7 @@ public void registerDefaults() { .build()); definitionContexts = new HashSet<>(); - definitionContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT); + definitionContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT); definitionContexts.add(OWNER_OVERRIDE_CONTEXT); flagData = new ArrayList<>(); flagData.add(flagDataBuilder diff --git a/bukkit/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java b/bukkit/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java index 3444aab..da52d2a 100644 --- a/bukkit/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java +++ b/bukkit/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java @@ -92,6 +92,17 @@ public Consumer getCallbackForUUID(UUID id) { return consumer; } + @Nullable + public Consumer getConfirmationForPlayer(Player player) { + Consumer consumer = null; + final UUID callbackUniqueId = confirmConsumerMap.get(player.getUniqueId()); + if (callbackUniqueId != null) { + consumer = reverseMap.remove(callbackUniqueId); + confirmConsumerMap.remove(player.getUniqueId()); + } + return consumer; + } + public String createCallbackRunCommand(Consumer consumer) { return this.createCallbackRunCommand(null, consumer, false); } diff --git a/bukkit/src/main/java/com/griefdefender/util/BlockUtil.java b/bukkit/src/main/java/com/griefdefender/util/BlockUtil.java index b48ed36..6a16908 100644 --- a/bukkit/src/main/java/com/griefdefender/util/BlockUtil.java +++ b/bukkit/src/main/java/com/griefdefender/util/BlockUtil.java @@ -251,6 +251,18 @@ public Location getBlockRelative(Location location, BlockFace face) { return getBlockRelative(location, blockFaceToDirectionMap.get(face)); } + public Location getBlockRelative(Location location, BlockFace face, int distance) { + int count = 0; + Location relativeLocation = null; + Location sourceLocation = location.clone(); + while (count < distance) { + relativeLocation = getBlockRelative(sourceLocation, blockFaceToDirectionMap.get(face)); + sourceLocation = relativeLocation; + count++; + } + return relativeLocation; + } + public Location getBlockRelative(Location location, Direction direction) { final Vector3i offset = direction.asBlockOffset(); // We must clone here as Bukkit's location is mutable diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 928274a..e9fa398 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -3,5 +3,5 @@ main: com.griefdefender.GDBootstrap softdepend: [dynmap, PlaceholderAPI, WorldEdit, WorldGuard, Vault] depend: [LuckPerms] load: STARTUP -version: '1.4.5' +version: '1.4.6' api-version: 1.13 diff --git a/common/src/main/resources/assets/lang/de_DE.conf b/common/src/main/resources/assets/lang/de_DE.conf index 22c1f74..b1f8a59 100644 --- a/common/src/main/resources/assets/lang/de_DE.conf +++ b/common/src/main/resources/assets/lang/de_DE.conf @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&cSpieler '&6{player}&c' nicht gefunden." command-world-not-found="&cWelt '&6{world}&c' nicht gefunden." command-worldedit-missing="&cDieser Befehl benötigt installiertes WorldEdit auf dem Server." + confirm-not-found="No confirmation found." create-cancel="&cDie Erstellung des Grundstückes wurde abgebrochen." create-cuboid-disabled="&cDas Erstellen von 3D Grundstücken ist ausgeschaltet.\nDu musst ein Admin sein, um die Funktion zu nutzen oder sie auf einem deiner Grundstücke nutzen." create-failed-claim-limit="&cDu hast die Grenze von &a{limit}&c deiner {type}&c Grundstücke erreicht. Nutze &f/abandon&c um eines zu entfernen, bevor du ein neues erstellst." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&cDie neue Anzahl Baublöcke &a{total}&c ist größer als das Maximum &a{limit}&c. Transaktion abgebrochen." economy-block-sale-confirmation="&6{deposit}&a verkauft. Du hast nun &6{amount}&a Baublöcke." economy-block-sell-error="&cKonnte die Baublöcke nicht verkaufen. Meldung: &f{reason}&c." + economy-block-transfer-cancel="&cTransfer cancelled. Could not locate any players with remaining claim blocks." + economy-block-transfer-success="&aTransfer complete. You have successfully transferred &6{count}&a players remaining claimblocks into currency." + economy-block-transfer-warning="&6Are you sure you want to transfer &cALL&6 player remaining claim blocks into currency? This will reset each player's accrued and bonus blocks to 0 after transfer. \n\nClick confirm to proceed." economy-claim-abandon-success="&aGrundstück aufgegeben. Du hast '&6{amount}&a' Baublöcke zurückerhalten." economy-claim-abandon-success-world="&aGrundstück aufgegeben auf &6{world}&a. Du hast '&6{amount}&a' Baublöcke zurückerhalten." economy-claim-buy-cancelled="&cKauf abgebrochen! Konnte das Grundstück von &6{player}&c nicht kaufen. Meldung: &a{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&aDu hast dein Grundstück erfolgreich für &6{amount}&a zum Verkauf angeboten." economy-claim-sale-invalid-price="&cDer Verkaufspreis &a{amount}&c muss größer sein als &a0&c." economy-claim-sold="&aDein Grundstück wurde verkauft! &6{amount}&a wurde an dich überwiesen. Dein neuer Kontostand ist: &6{balance}&a." + economy-deposit-error="&cCould not deposit funds. Reason: &f{reason}&c." economy-mode-block-cost-not-set="&cEconomy mode is enabled but the current price for blocks is &6{price}&c.\nRaise the value for option 'economy-block-cost' in 'options.conf' or via '/gd option claim' command." economy-mode-block-sale-confirmation="&aErfolgreich &6{deposit}&a verkauft. Dein Kontostand ist nun &6{balance}&a. Du hast jetzt genug Geld, um dir &6{amount}&a Baublöcke zu kaufen." + economy-mode-not-enabled="&cEconomy mode is not enabled." economy-mode-resize-success-2d="&aGrundstücksgröße erfolgreich geändert. Neuer Kontostand: &6{balance}&a. Du hast genug Geld, um dir &6{block-amount} &aBaublöcke zu kaufen." economy-mode-resize-success-3d="&aGrundstücksgröße erfolgreich geändert. Neuer Kontostand: &6{balance}&a. Du kannst dir noch &6{chunk-amount} &azusätzliche Chunks kaufen. &f({block-amount})" economy-not-enough-funds="&cDu hast nicht genug Geld, um dieses Grundstück zu erstellen. Dein Kontostand: '&a{balance}&c'. Du benötigst '&a{amount}&c'." @@ -340,6 +346,8 @@ GriefDefender { flag-description-custom-damage-animals="Kontrolliert, ob Tiere geschädigt werden können." flag-description-custom-endcrystal-use="Controls whether endcrystals can be placed or broken." flag-description-custom-enderman-grief="Kontrolliert, ob Enderman Blöcke stehlen können." + flag-description-custom-entity-armorstand-damage="Controls whether entities can deal damage to armorstands." + flag-description-custom-entity-itemframe-damage="Controls whether entities can deal damage to item frames." flag-description-custom-exp-drop="Kontrolliert, ob EXP droppt." flag-description-custom-explosion-block="Kontrolliert, ob Explosionen Blöcke beeinflussen." flag-description-custom-explosion-entity="Kontrolliert, ob Explosionen Entitäten beeinflussen." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Kontrolliert, ob Spieler Portale nutzen können." flag-description-custom-player-teleport-from="Kontrolliert, ob sich Spieler aus dem Grundstück rausteleportieren können." flag-description-custom-player-teleport-to="Kontrolliert, ob sich Spieler zu diesem Grundstück teleportieren können." + flag-description-custom-player-villager-damage="Controls whether players can deal damage to villagers." flag-description-custom-pvp="Kontrolliert, ob PVP erlaubt ist." flag-description-custom-ride="Kontrolliert, ob das Aufsitzen und Fortbewegen mit Tieren und Fortbewegungsmitteln möglich ist." flag-description-custom-sleep="Kontrolliert, ob Spieler in Betten schlafen können." @@ -632,25 +641,26 @@ GriefDefender { player-remaining-blocks-2d="&aDu hast noch &6{block-amount}&a freie Baublöcke." player-remaining-blocks-3d="&aDu kannst noch bis zu &6{chunk-amount}&a Chunks sichern. &f({block-amount})" playerinfo-ui-abandon-return-ratio="&eVerhältnis Aufgegebener-Wiedererlangter Blöcke&f : &a{ratio}" - playerinfo-ui-block-accrued="&eAngesammelte Baublöcke&f : &a{amount}&7(&d{block_amount}&f pro Stunde&7)" + playerinfo-ui-block-accrued="&eAngesammelte Baublöcke&f : &a{amount} &7(&6{block_amount}&7 pro Stunde)" playerinfo-ui-block-bonus="&eBonus Baublöcke&f : &a{amount}" playerinfo-ui-block-initial="&eStart Baublöcke&f : &a{amount}" playerinfo-ui-block-max-accrued="&eMaximalanzahl angesammelter Blöcke&f : &a{amount}" playerinfo-ui-block-remaining="&eBaublöcke übrig&f : &a{amount}" playerinfo-ui-block-total="&eGesamtanzahl Baublöcke&f : &a{amount}" playerinfo-ui-chunk-total="&eGesamtanzahl Chunks&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eClaim Creation Limits&f : &7BASIC &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7TOWN &6{town_limit} " playerinfo-ui-claim-level="&eMinimale/Maximale Grundstücksebene&f : &a{level}" playerinfo-ui-claim-size-limit="&eGrundstücksbegrenzung&f : &a{limit}" - playerinfo-ui-claim-total="&eGesamtanzahl Grundstücke&f : &a{amount}" + playerinfo-ui-claim-total="&eGesamtanzahl Grundstücke&f : &a{amount} &7(&6{block_amount}&7 Baublöcke used)" playerinfo-ui-economy-block-available-purchase="&eKaufbare Baublöcke&f : &a{amount}" playerinfo-ui-economy-block-cost="&ePreis pro Baublock&f : &a{amount}" playerinfo-ui-economy-block-sell-return="&eVerkaufspreis pro Baublock&f : &a{amount}" - playerinfo-ui-last-active="&eZuletzt aktiv&f : {date}" + playerinfo-ui-last-active="&eZuletzt aktiv&f : &7{date}" playerinfo-ui-tax-current-rate="&eMomentane Steuerlast&f : &a{rate}" playerinfo-ui-tax-global-claim-rate="&eGlobale Grundstückssteuer&f : &a{rate}" playerinfo-ui-tax-global-town-rate="&eGlobale Stadtsteuer&f : &a{rate}" playerinfo-ui-tax-total="&eSteuerliche Gesamtbelastung&f : &a{amount}" - playerinfo-ui-title="&bSpieler Informationen" + playerinfo-ui-title="&bSpieler Informationen &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" playerinfo-ui-world="&eWelt&f : &7{name}" plugin-command-not-found="&cKonnte den Befehl '&a{command}&c' für das Plugin &b{id}&c nicht finden." diff --git a/common/src/main/resources/assets/lang/en_US.conf b/common/src/main/resources/assets/lang/en_US.conf index cfa2590..9dcb640 100644 --- a/common/src/main/resources/assets/lang/en_US.conf +++ b/common/src/main/resources/assets/lang/en_US.conf @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&cPlayer '&6{player}&c' could not be found." command-world-not-found="&cWorld '&6{world}&c' could not be found." command-worldedit-missing="&cThis command requires WorldEdit to be installed on server." + confirm-not-found="No confirmation found." create-cancel="&cThe creation of this claim has been cancelled." create-cuboid-disabled="&cThe creation of &d3D&c cuboid claims has been disabled by an administrator.\nYou can only create &d3D&c claims as an Admin or on a &d2D&c claim that you own." create-failed-claim-limit="&cYou've reached your limit of &a{limit}&c on {type}&c claims. Use &f/abandon&c to remove one before creating another." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&cThe new claim block total of &a{total}&c will exceed your claim block limit of &a{limit}&c. The transaction has been cancelled." economy-block-sale-confirmation="&aDeposited &6{deposit}&a in your account. You now have &6{amount}&a available claim blocks." economy-block-sell-error="&cCould not sell blocks. Reason: &f{reason}&c." + economy-block-transfer-cancel="&cTransfer cancelled. Could not locate any players with remaining claim blocks." + economy-block-transfer-success="&aTransfer complete. You have successfully transferred &6{count}&a players remaining claimblocks into currency." + economy-block-transfer-warning="&6Are you sure you want to transfer &cALL&6 player remaining claim blocks into currency? This will reset each player's accrued and bonus blocks to 0 after transfer. \n\nClick confirm to proceed." economy-claim-abandon-success="&aClaim(s) abandoned. You have been refunded a total of '&6{amount}&a'." economy-claim-abandon-success-world="&aClaim(s) abandoned in &6{world}&a. You have been refunded a total of '&6{amount}&a'." economy-claim-buy-cancelled="&cBuy cancelled! Could not buy claim from &6{player}&c. Result was &a{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&aYou have successfully put your claim up for sale for the amount of &6{amount}&a." economy-claim-sale-invalid-price="&cThe sale price of &a{amount}&c must be greater than or equal to &a0&c." economy-claim-sold="&aYour claim sold! The amount of &6{amount}&a has been deposited into your account. Your total available balance is now &6{balance}&a." + economy-deposit-error="&cCould not deposit funds. Reason: &f{reason}&c." economy-mode-block-cost-not-set="&cEconomy mode is enabled but the current price for blocks is &6{price}&c.\nRaise the value for option 'economy-block-cost' in 'options.conf' or via '/gd option claim' command." economy-mode-block-sale-confirmation="&aDeposited &6{deposit}&a in your account. Your total balance is &6{balance}&a. You now have enough funds to claim up to &6{amount}&a more claim blocks." + economy-mode-not-enabled="&cEconomy mode is not enabled." economy-mode-resize-success-2d="&aClaim resized. Your new balance is &6{balance}&a. You have enough funds to claim up to &6{block-amount} &amore blocks." economy-mode-resize-success-3d="&aClaim resized. Your new balance is &6{balance}&a. You have enough funds to claim up to &6{chunk-amount} &amore chunks. &f({block-amount})" economy-not-enough-funds="&cYou do not have enough funds to purchase this land. Your current economy balance is '&a{balance}&c' but you require '&a{amount}&c' to complete the purchase." @@ -340,6 +346,8 @@ GriefDefender { flag-description-custom-damage-animals="Controls whether animals can be damaged." flag-description-custom-endcrystal-use="Controls whether endcrystals can be placed or broken." flag-description-custom-enderman-grief="Controls whether enderman can grief." + flag-description-custom-entity-armorstand-damage="Controls whether entities can deal damage to armorstands." + flag-description-custom-entity-itemframe-damage="Controls whether entities can deal damage to item frames." flag-description-custom-exp-drop="Controls whether experience orbs can drop." flag-description-custom-explosion-block="Controls whether explosions affect blocks." flag-description-custom-explosion-entity="Controls whether explosions affect entities." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Controls whether players can use portals." flag-description-custom-player-teleport-from="Controls whether players can teleport from this claim." flag-description-custom-player-teleport-to="Controls whether players can teleport to this claim." + flag-description-custom-player-villager-damage="Controls whether players can deal damage to villagers." flag-description-custom-pvp="Controls whether PvP combat is allowed." flag-description-custom-ride="Controls whether vehicles(including animals) can be mounted." flag-description-custom-sleep="Controls whether players can sleep in beds." @@ -632,25 +641,26 @@ GriefDefender { player-remaining-blocks-2d="&aYou may claim up to &6{block-amount}&a more blocks." player-remaining-blocks-3d="&aYou may claim up to &6{chunk-amount}&a more chunks. &f({block-amount})" playerinfo-ui-abandon-return-ratio="&eAbandoned Return Ratio&f : &a{ratio}" - playerinfo-ui-block-accrued="&eAccrued Blocks&f : &a{amount}&7(&d{block_amount}&f per hour&7)" + playerinfo-ui-block-accrued="&eAccrued Blocks&f : &a{amount} &7(&6{block_amount}&7 per hour)" playerinfo-ui-block-bonus="&eBonus Blocks&f : &a{amount}" playerinfo-ui-block-initial="&eInitial Blocks&f : &a{amount}" playerinfo-ui-block-max-accrued="&eMax Accrued Blocks&f : &a{amount}" playerinfo-ui-block-remaining="&eRemaining Blocks&f : &a{amount}" playerinfo-ui-block-total="&eTotal Blocks&f : &a{amount}" playerinfo-ui-chunk-total="&eTotal Claimable Chunks&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eClaim Creation Limits&f : &7BASIC &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7TOWN &6{town_limit}" playerinfo-ui-claim-level="&eMin/Max Claim Level&f : &a{level}" playerinfo-ui-claim-size-limit="&eClaim Size Limits&f : &a{limit}" - playerinfo-ui-claim-total="&eTotal Claims&f : &a{amount}" + playerinfo-ui-claim-total="&eTotal Claims&f : &a{amount} &7(&6{block_amount}&7 blocks used)" playerinfo-ui-economy-block-available-purchase="&eRemaining Blocks for Purchase&f : &a{amount}" playerinfo-ui-economy-block-cost="&eClaim Block Price&f : &a{amount} per block" playerinfo-ui-economy-block-sell-return="&eClaim Block Sell Return&f : &a{amount} per block" - playerinfo-ui-last-active="&eLast Active&f : {date}" + playerinfo-ui-last-active="&eLast Active&f : &7{date}" playerinfo-ui-tax-current-rate="&eCurrent Claim Tax Rate&f : &a{rate}" playerinfo-ui-tax-global-claim-rate="&eGlobal Claim Tax Rate&f : &a{rate}" playerinfo-ui-tax-global-town-rate="&eGlobal Town Tax Rate&f : &a{rate}" playerinfo-ui-tax-total="&eTotal Tax&f : &a{amount}" - playerinfo-ui-title="&bPlayer Info" + playerinfo-ui-title="&bPlayer Info &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" playerinfo-ui-world="&eWorld&f : &7{name}" plugin-command-not-found="&cCould not locate the command '&a{command}&c' for plugin &b{id}&c." diff --git a/common/src/main/resources/assets/lang/es_ES.conf b/common/src/main/resources/assets/lang/es_ES.conf index ed3605c..c684891 100644 --- a/common/src/main/resources/assets/lang/es_ES.conf +++ b/common/src/main/resources/assets/lang/es_ES.conf @@ -72,7 +72,7 @@ GriefDefender { abandon-town-children="&4&l[ERROR] &c&lNo tienes permiso para abandonar una CIUDAD con Child Claims que no son de tu propiedad. &cUsa &6&l&o/ignoreclaims &co tienes que pedir al dueño que abandone ese &lC&child &lC&claim primero, sin embargo, lo único que quieres es abandonar la ciudad sin afectar al &lCC&c entonces usa &6&l&o/abandon&c." abandon-warning="&4&l[ATENCION] &c&l¿Estás seguro de querer abandonar este Claim? &cCualquiera podrá grifearte la zona." abandon-world-success="&aTodas las claims del mundo &6{world}&a han sido abandonadas." - abandon-world-warning="&4&l[ATENCION] &6¿Estás seguro que deseas abandonar &cTODAS&6 las claims de los usuarios en el mundo &a{world}&6? + abandon-world-warning="&4&l[ATENCION] &6¿Estás seguro que deseas abandonar &cTODAS&6 las claims de los usuarios en el mundo &a{world}&6?" adjust-accrued-blocks-success="&2&l[MODIFICADO] &ala cantidad de bloques acumulados a &6&o{amount} &aal jugador &6&o{player}&a. &aTOTAL BLOQUES ACUMULADOS: &6&o{total}&a." adjust-bonus-blocks-success="&2&l[MODIFICADO] &ael bonus de ClaimBlocks a &6&o{amount} &aal jugador &6&o{player}&a. &aTOTAL DE BONOS ACUMULADOS: &6&o{total}&a." bank-click-view-transactions="&aClick aqui para ver las transacciones del Banco." @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&4&l[ERROR] &cJugador ➜ &6&o'{player}'&c ➜ &lNO ENCONTRADO" command-world-not-found="&4&l[ERROR] &cMundo ➜ &6&o'{world}'&c ➜ &lNO ENCONTRADO" command-worldedit-missing="&4&l[ERROR] &cEste comando necesita tener instalado en el Servidor el plugin &6&l'WorldEdit'" + confirm-not-found="Confirmación no encontrada." create-cancel="&4&l[ERROR] &cCreación de Claim ➜ &lCANCELADA" create-cuboid-disabled="&4&l[ERROR] &c&lLa creación de Claim en &lmodo &d&l3D&c&l ha sido desactivada por el Administrador&c.\nSolo puedes activar este modo, si eres Administrador o en un Claim en modo &d&l2D&c&l&n de tú propiedad&c." create-failed-claim-limit="&4&l[ATENCION] &c&lHas alcanzado el limite de Claim permitidos para tu rango.\n&6&lLIMITE: {limit}\nTIPO: {type}&c claims.\n\n&4&l[NOTA] Usa &6&o'/abandon'&c para eliminarlo y después crear otro." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&4&l[ERROR] &cEl total nuevo de &6&o{total}CB's&c ha excedido el limite de Claim Blocks que es de &6&o{limit}&c. &lLa transacción ha sido cancelada." economy-block-sale-confirmation="&2&l[VENTA CONFIRMADA] &aSe han depositado &6&o{deposit}CB's&a en tu cuenta.\n&a&lCB's Disponibles: &6&o{amount}&a." economy-block-sell-error="&4&l[ERROR] &cNo puedes vender &6&oCB's&c. RAZON: &6&o{reason}&c." + economy-block-transfer-cancel="&4&l[ERROR] &cTransferencia cancelada. No se ha detectado ningún jugador con claimblocks restantes." + economy-block-transfer-success="&2&l[AVISO] &aTransferencia completada. Has transferido exitósamente &6{count}&a claimblocks restantes de los jugadores a economía." + economy-block-transfer-warning="&2&l[CONFIRMAR ACCIÓN] &6¿Estás seguro que deseas transferir &cTODOS&6 los claimblocks restantes de los jugadores a economía? Esto reseteará los bloques acumulados u obtenidos por bonus de cada jugador a 0 después de la migración. \n\nClick a confirmar para proceder." economy-claim-abandon-success="&2&l[CLAIMS ABANDONADOS] &acon éxito.\n&a&lTOTAL DEVUELTO: &6&o'{amount}'&a." economy-claim-abandon-success-world="&aClaim(s) abandonadas en el mundo &6{world}&a. Se te ha reembolsado un total de '&6{amount}&a' claimblocks." economy-claim-buy-cancelled="&4&l[COMPRA CANCELADA] &cNo puedes comprar un terreno &6&o{player}&c.\n&c&lRESULTADO: &6&o{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&2&l[VENTA CONFIRMADA] &aHas puesto tu terreno en venta por el precio de &6&o{amount}&a." economy-claim-sale-invalid-price="&4&l[PRECIO INVALIDO] &cEl precio de venta ➜ &6&o{amount} &cdebe ser mayor o igual que &6&o0&c." economy-claim-sold="&2&l[TERRENO VENDIDO] &a&l+&6&o{amount}&a&l depositados en tu Banco.\nDINERO TOTAL: &6&o{balance}&a." + economy-deposit-error="&4&l[ERROR] &cNo se han podido depositar los fondos. Razón: &f{reason}&c." economy-mode-block-cost-not-set="&cEl modo economía está habilitado, pero el precio por bloque actual es de &6{price}&c.\nIncrementa el valor de la opción 'economy-block-cost' en 'options.conf' o a usa el comando '/gd option claim'." economy-mode-block-sale-confirmation="&2&l[DINERO DEPOSITADO EN BANCO]\n&a&lCantidad: +&6&o{deposit}\n&a&lSaldo Actual: &6&o{balance}\n&4&l[NOTA] &aAhora tienes &6&o{amount}CB's &apara reclamar de más." + economy-mode-not-enabled="&4&l[ERROR] &cEl modo Economía no está habilitado." economy-mode-resize-success-2d="&2&l[TERRENO &d&l2D &2&lREDIMENSIONADO] &aEl tamaño del terreno ha cambiado.\n&a&lDinero Actual: &6&o{balance}&a.\n&4&l[NOTA] &aAhora tienes &6&o{block-amount}CB's &apara reclamar de más." economy-mode-resize-success-3d="&2&l[TERRENO &d&l3D &2&lREDIMENSIONADO] &aEl tamaño del terreno ha cambiado.\n&a&lDinero Actual: &6&o{balance}&a.\n&4&l[NOTA] &aAhora tienes &6&o{chunk-amount}CHUNK's = &f&l(&6&o{block-amount}&f&l) &apara reclamar de más." economy-not-enough-funds="&4&l[DINERO INSUFICIENTE] &cNo puedes comprar este terreno; te falta dinero.\n\n&a&lDINERO ACTUAL: &6&o{balance}\n&c&lDINERO NECESARIO: &6&o{amount}" @@ -340,6 +346,8 @@ GriefDefender { flag-description-custom-damage-animals="Controla si los animales puedes ser dañados." flag-description-custom-endcrystal-use="Controla si los cristales de Ender pueden ser colocados o destruidos." flag-description-custom-enderman-grief="Controla si cualquier Enderman puede grifear bloques." + flag-description-custom-entity-armorstand-damage="Controla si las entidades pueden causar daño a soportes de armadura." + flag-description-custom-entity-itemframe-damage="Controla si las entidades pueden causar daño a los marcos." flag-description-custom-exp-drop="Controla si los orbes de experiencia pueden ser dropeados." flag-description-custom-explosion-block="Controla si las explosiones pueden dañar bloques." flag-description-custom-explosion-entity="Controla si las explosiones pueden dañar entidades." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Controla si los portales pueden ser usados." flag-description-custom-player-teleport-from="Controla si los jugadores puede ser teletransportados desde este terreno." flag-description-custom-player-teleport-to="Controla si los jugadores pueden teletransportarse a este terreno." + flag-description-custom-player-villager-damage="Controla si los jugadores pueden causar daño a los aldeanos." flag-description-custom-pvp="Controla si el combate PvP está permitido." flag-description-custom-ride="Controla si los vehiculos(incluyendo animales) pueden ser montados." flag-description-custom-sleep="Controla si un jugador puede dormir en camas." @@ -630,29 +639,30 @@ GriefDefender { player-accrued-blocks-exceeded="&cEl jugador &6&o{player}&c tiene un total de &6&o{total}CB's&c y ha excedido el máximo permitido de &lCBA's &r&c(&nClaim Block Adquiridos&r&c) que garantiza &a&l+&6&o{amount} &abloques adicionales&c.\n&4&l[NOTA] &cReduzca la cantidad general o que un &4Administrador&c disminuya al Jugador la cantidad excedida de CB's." player-no-claims-to-delete="&aEl jugador &6{player}&a no tiene claims para eliminar" player-remaining-blocks-2d="&3&l---------------------------------------------\n&2&l[INFO] &aTienes &6&o{block-amount} ClaimBlocks&a para reclamar más terreno.\n&3&l---------------------------------------------" - player-remaining-blocks-3d="&2&l[INFORMACIÓN] &6&o{chunk-amount}CHUNK's &f&l=&6&o{block-amount} ClaimBlocks&a para reclamar +terreno." - playerinfo-ui-abandon-return-ratio="&eIndice Devolución de Bloques por Abandono&f : &a{ratio}" - playerinfo-ui-block-accrued="&eBLOQUES ADQUIRIDOS&f : &a{amount}&7 (&d{block_amount}CB's&f/hora&7)" - playerinfo-ui-block-bonus="&eBONUS&f : &a{amount}" - playerinfo-ui-block-initial="&eBLOQUES INICIALES&f : &a{amount}" - playerinfo-ui-block-max-accrued="&eLIMITE MAX. BA's&f : &a{amount}" + player-remaining-blocks-3d="&3&l---------------------------------------------\n&2&l[INFO] &6&o{chunk-amount}Chunks &f&l= &6&o{block-amount} ClaimBlocks&a para reclamar más terreno.\n&3&l---------------------------------------------" + playerinfo-ui-abandon-return-ratio="&eÍndice de devolución de bloques por abandono&f : &a{ratio}" + playerinfo-ui-block-accrued="&eBloques adquiridos&f : &a{amount} &7(&6{block_amount}CBs&7 por hora&7)" + playerinfo-ui-block-bonus="&eBonus&f : &a{amount}" + playerinfo-ui-block-initial="&eBloques iniciales&f : &a{amount}" + playerinfo-ui-block-max-accrued="&eBloques máx. adquiribles&f : &a{amount}" playerinfo-ui-block-remaining="&eBloques por gastar&f : &a{amount}" - playerinfo-ui-block-total="&eBLOQUES TOTALES&f : &a{amount}" - playerinfo-ui-chunk-total="&eCHUNKS RECLAMABLES TOTALES&f : &a{amount}" - playerinfo-ui-claim-level="&eNivel Min/Max de Claim&f : &a{level}" - playerinfo-ui-claim-size-limit="&eLIMITE DE TAMAÑO&f : &a{limit}" - playerinfo-ui-claim-total="&eCLAIMS TOTALES&f : &a{amount}" - playerinfo-ui-economy-block-available-purchase="&eBLOQUES DISPONIBLES&f : &a{amount}" - playerinfo-ui-economy-block-cost="&ePrecio por Bloque&f : &a{amount} per block" - playerinfo-ui-economy-block-sell-return="&eCantidad Devuelta por Venta de Bloque&f : &a{amount} per block" - playerinfo-ui-last-active="&eULTIMA CONEXION&f : {date}" - playerinfo-ui-tax-current-rate="&eImpuesto del Claim&f : &a{rate}" - playerinfo-ui-tax-global-claim-rate="&eImpuesto Global de Claimf : &a{rate}" - playerinfo-ui-tax-global-town-rate="&eImpuesto Global de Ciudad&f : &a{rate}" - playerinfo-ui-tax-total="&eIMPUESTO TOTAL&f : &a{amount}" - playerinfo-ui-title="&6&l[INFORMACION DE JUGADOR]" + playerinfo-ui-block-total="&eTotal de bloques&f : &a{amount}" + playerinfo-ui-chunk-total="&eTotal de chunks reclamables&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eLímites de creación de claims&f : &7BÁSICA &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7CIUDAD &6{town_limit}" + playerinfo-ui-claim-level="&eNivel min/max de claim&f : &a{level}" + playerinfo-ui-claim-size-limit="&eLímite de tamaño de claim&f : &a{limit}" + playerinfo-ui-claim-total="&eTotal de claims&f : &a{amount} &7(&6{block_amount}&7 bloques usados)" + playerinfo-ui-economy-block-available-purchase="&eBloques disponibles&f : &a{amount}" + playerinfo-ui-economy-block-cost="&ePrecio por bloque&f : &a{amount} por bloque" + playerinfo-ui-economy-block-sell-return="&eCantidad devuelta por venta de bloque&f : &a{amount} por bloque" + playerinfo-ui-last-active="&eUltima conexión&f : &7{date}" + playerinfo-ui-tax-current-rate="&eImpuesto de claim&f : &a{rate}" + playerinfo-ui-tax-global-claim-rate="&eImpuesto global de claim&f : &a{rate}" + playerinfo-ui-tax-global-town-rate="&eImpuesto global de ciudad&f : &a{rate}" + playerinfo-ui-tax-total="&eTotal de impuesto&f : &a{amount}" + playerinfo-ui-title="&bInformación de jugador &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" - playerinfo-ui-world="&eMUNDO&f : &7{name}" + playerinfo-ui-world="&eMundo&f : &7{name}" plugin-command-not-found="&4&l[ERROR] &cNo es posible localizar el comando &6&o{command}'&c por el Plugin &b{id}&c." plugin-event-cancel="[ACCION-CANCELADA] &cUn Plugin ha cancelado esta acción." plugin-not-found="&4&l[ERROR] &cNo es posible localizar el Plugin con ID &b{id}&c." diff --git a/common/src/main/resources/assets/lang/fr_FR.conf b/common/src/main/resources/assets/lang/fr_FR.conf index acaef8f..8b060d7 100644 --- a/common/src/main/resources/assets/lang/fr_FR.conf +++ b/common/src/main/resources/assets/lang/fr_FR.conf @@ -59,8 +59,8 @@ GriefDefender { } messages { abandon-all-delay-warning="&aCes terrains ont été créés récemment et ne peuvent être abandonnés." - abandon-all-success="&aAll your claims have been abandoned. You now have &6{amount}&a available claim blocks." - abandon-all-success-world="&aAll your claims have been abandoned in &6{world}&a. You now have &6{amount}&a available claim blocks." + abandon-all-success="&aToutes tes protections ont été abandonné. Tu as maintenant &6{amount}&a blocs de protection disponible." + abandon-all-success-world="&aToutes tes protections ont été abandonné dans le monde &6{world}&a. Tu as maintenant &6{amount}&a blocs de protection disponible." abandon-all-warning="&6Es-tu sûr de vouloir abandonner &cTOUS&6 tes terrains ?" abandon-all-warning-world="&6Es-tu sûr de vouloir abandonner &cTOUS&6 tes terrains en &a{world}&6?" abandon-claim-delay-warning="&aCe terrain a été créé récemment et ne peut pas être abandonnée avant le &6{date}&a." @@ -71,8 +71,8 @@ GriefDefender { abandon-top-level="&cCe terrain ne peut être abandonné car il contient un ou plusieurs terrain(s) enfant(s). Pour abandonner un terrain avec enfant, tu dois utiliser &f/abandontop&c à la place." abandon-town-children="&cTu n'as pas la permission pour abandonner un village contenant des terrains enfants qui ne t'appartiennent pas. Utilises &f/ignoreclaims&c ou fais en sorte que le propriétaire des terrains enfants les abandonne d'abord. Si tu veux abandonner le village sans affecter les terrains enfants, utilises &f/abandon&c à la place." abandon-warning="&6Es-tu sûr de vouloir abandonner ce terrain ? Il ne sera plus protégé contre les dégâts." - abandon-world-success="&aAbandoned all player claims in &6{world}&a." - abandon-world-warning="&6Are you sure you want to abandon &cALL&6 user claims in &a{world}&6?" + abandon-world-success="&aToutes les protections de l'ensemble des joueurs dans le monde &6{world}&a ont été abandonné." + abandon-world-warning="&6Es-tu sûr de vouloir abandonner &cTOUTES&6 les protections des joueurs dans le monde &a{world}&6 ?" adjust-accrued-blocks-success="&aAjustement du nombre de blocs de terrain gagnés par &6{player}&a de &6{amount}&a. Nouveau total de blocs de terrain gagnés: &6{total}&a." adjust-bonus-blocks-success="&aAjustement du nombre de blocs de terrain, bonus &6{player}&a de &6{amount}&a. Nouveau total de blocs de terrain bonus: &6{total}&a." bank-click-view-transactions="Clique ici pour voir les transactions bancaires" @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&cJoueur '&6{player}&c' introuvable." command-world-not-found="&cMonde '&6{world}&c' introuvable." command-worldedit-missing="&cCette commande a besoin que WorldEdit soit installé sur le serveur." + confirm-not-found="Pas de confirmation trouvé." create-cancel="&cLa création de ce terrain a été annulé." create-cuboid-disabled="&cLa création de terrain en mode &d3D&c a été désactivé par un administrateur.\nTu peux uniquement créer un terrain en mode &d3D&c en tant qu'Admin ou dans un terrain en mode &d2D&c qui t'appartient." create-failed-claim-limit="&cTu as atteint la limite de &a{limit}&c pour les terrains de type {type}&c. Utilises &f/abandon&c pour en supprimer un avant d'en créer un nouveau." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&cLe nouveau nombre de bloc de terrain total de &a{total}&c va dépasser la limite de bloc maximum de &a{limit}&c. La transaction a été annulée." economy-block-sale-confirmation="&aDéposé &6{deposit}&a sur ton compte. Tu as maintenant &6{amount}&a blocs de terrain disponibles." economy-block-sell-error="&cImpossible de vendre les blocs. Raison: &f{reason}&c." + economy-block-transfer-cancel="&cTransfert annulé. Ne peut pas trouver de joueur ayant des blocs de protection restant." + economy-block-transfer-success="&aTransfert complété. Tu as transféré avec succès &6{count}&a blocs de protection joueur restant vers la devise." + economy-block-transfer-warning="&6Es-tu sûr que tu veux transferer &cTOUT&6 les blocs de protection joueur restant vers la devise ? Cela va réinitialiser chaque bloc de protection gagné et bonus des joueurs à 0 après le transfert. \n\nClique confirm pour valider." economy-claim-abandon-success="&Terrain abandonné. Tu as été remboursé d'un total de '&6{amount}&a'." economy-claim-abandon-success-world="&Terrain abandonné en &6{world}&a. Tu as été remboursé d'un total de '&6{amount}&a'." economy-claim-buy-cancelled="&cAchat annulé ! Impossible d'acheter le terrain de &6{player}&c. Resultat est &a{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&aTu as mis en vente ton terrain avec succès pour un montant de &6{amount}&a." economy-claim-sale-invalid-price="&cLe prix de vente de &a{amount}&c doit être supérieur ou égal à &a0&c." economy-claim-sold="&aTon terrain est vendu ! Un montant de &6{amount}&a a été déposé sur ton compte. Ton solde total est maintenant de &6{balance}&a." - economy-mode-block-cost-not-set="&cEconomy mode is enabled but the current price for blocks is &6{price}&c.\nRaise the value for option 'economy-block-cost' in 'options.conf' or via '/gd option claim' command." + economy-deposit-error="&cNe peut déposer les fonds. Raison: &f{reason}&c." + economy-mode-block-cost-not-set="&cLe mode économie est activé mais le prix actuel pour le bloc est &6{price}&c.\nAugmentes la valeur pour l'option 'economy-block-cost' dans 'options.conf' ou avec la commande '/gd option claim'." economy-mode-block-sale-confirmation="&aDépôt de &6{deposit}&a sur votre compte. Votre solde total est de &6{balance}&a. Tu as maintenant suffisamment de fonds pour protéger jusqu'à &6{amount}&a blocs supplémentaires." + economy-mode-not-enabled="&cEconomy mode is not enabled." economy-mode-resize-success-2d="&Terrain redimensionné. Ton nouveau solde est de &6{balance}&a. Tu as maintenant suffisamment de fonds pour protéger jusqu'à &6{block-amount} &ablocs supplémentaires." economy-mode-resize-success-3d="&Terrain redimensionné. Ton nouveau solde est de &6{balance}&a. Tu as maintenant suffisamment de fonds pour protéger jusqu'à &6{chunk-amount} &achunks supplémentaires. &f({block-amount})" economy-not-enough-funds="&cTu n'as pas suffisamment de fonds pour acheter ce terrain. Ton solde actuel est de '&a{balance}&c' mais tu as besoin de '&a{amount}&c' pour valider l'achat." @@ -338,8 +344,10 @@ GriefDefender { flag-description-custom-creeper-entity-explosion="Contrôle si un creeper peut exploser des entités." flag-description-custom-crop-growth="Contrôle si les pousses peuvent grandir." flag-description-custom-damage-animals="Contrôle si les animaux peuvent prendre des dégâts." - flag-description-custom-endcrystal-use="Controls whether endcrystals can be placed or broken." + flag-description-custom-endcrystal-use="Contrôle si l'endcrystal peut être placé ou cassé." flag-description-custom-enderman-grief="Contrôle si les enderman peuvent prendre des blocs." + flag-description-custom-entity-armorstand-damage="Contrôle si une entité peut faire des dégâts au porte-armure." + flag-description-custom-entity-itemframe-damage="Contrôle si une entité peut faire des dégâts au cadre." flag-description-custom-exp-drop="Contrôle si les orbes d'expériences peuvent apparaîtres." flag-description-custom-explosion-block="Contrôle si les explosions affectent les blocs." flag-description-custom-explosion-entity="Contrôle si les explosions affectent les entités." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Contrôle si un portail peut être utilisé par un joueur." flag-description-custom-player-teleport-from="Contrôle si les joueurs peuvent se téléporter depuis la protection." flag-description-custom-player-teleport-to="Contrôle si les joueur peuvent se téléporter vers la protection." + flag-description-custom-player-villager-damage="Contrôle si le joueur peut infliger des dégâts au villageois." flag-description-custom-pvp="Contrôle si le combat Joueur contre Joueur est autorisé." flag-description-custom-ride="Contrôle si les véhicules (incluant les animaux) peuvent être montés." flag-description-custom-sleep="Contrôle si les joueurs peuvent dormir dans les lits." @@ -388,7 +397,7 @@ GriefDefender { flag-description-custom-spawn-aquatic="Contrôle si les aquatiques, comme les poulpes et gardiens, peuvent apparaître." flag-description-custom-tnt-block-explosion="Contrôle si une TnT peut exploser les blocs." flag-description-custom-tnt-entity-explosion="Contrôle si une TnT peut exploser les entités." - flag-description-custom-turtle-egg-hatch="Controls whether turtle eggs can hatch." + flag-description-custom-turtle-egg-hatch="Contrôle si les œufs de tortue peuvent éclores." flag-description-custom-use="Contrôle si les joueurs peuvent utiliser des blocs sans inventaire dans la protection." flag-description-custom-vehicle-use="Contrôle si un véhicule (bateau, minecart) peut être placé, montés ou détruit." flag-description-custom-vine-growth="Contrôle si les vignes (et les algues) peuvent grandir." @@ -468,7 +477,7 @@ GriefDefender { label-displaying=Affiche label-expired=Expiré label-farewell="Message de sortie" - label-filter=Filter + label-filter=Filtre label-flag=Flag label-greeting="Message d'accueil" label-group=Groupe @@ -481,7 +490,7 @@ GriefDefender { label-minutes=Minutes label-name=Nom label-no=Non - label-none=none + label-none=Rien label-output=Sortie label-owner=Propriétaire label-permission=Permission @@ -496,7 +505,7 @@ GriefDefender { label-schematic=Patron label-source=Source label-spawn="Point d'apparition" - label-status=Status + label-status=Statut label-target=Cible label-trust=Confiance label-type=Type @@ -632,25 +641,26 @@ GriefDefender { player-remaining-blocks-2d="&aTu peut protéger jusqu'à &6{block-amount}&a blocs supplémentaires." player-remaining-blocks-3d="&aTu peut protéger jusqu'à &6{chunk-amount}&a chunks supplémentaire. &f({block-amount})" playerinfo-ui-abandon-return-ratio="&eAbandonné, Ratio de retour&f : &a{ratio}" - playerinfo-ui-block-accrued="&eBlocs gagnés&f : &a{amount}&7(&d{block_amount}&f par heure&7)" + playerinfo-ui-block-accrued="&eBlocs gagnés&f : &a{amount} &7(&6{block_amount}&7 par heure)" playerinfo-ui-block-bonus="&eBlocs bonus&f : &a{amount}" playerinfo-ui-block-initial="&eBloc Initial&f : &a{amount}" playerinfo-ui-block-max-accrued="&eMaximum de blocs gagnés&f : &a{amount}" playerinfo-ui-block-remaining="&eBlocs restants&f : &a{amount}" playerinfo-ui-block-total="&eTotal de Blocs&f : &a{amount}" - playerinfo-ui-chunk-total="&eTotal Chunks Protectable&f : %a{amount}" + playerinfo-ui-chunk-total="&eTotal Chunks Protectable&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eClaim Creation Limits&f : &7BASIC &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7TOWN &6{town_limit}" playerinfo-ui-claim-level="&eMin/Niveau de protection max&f : &a{level}" playerinfo-ui-claim-size-limit="&eLimite de taille de protection&f : &a{limit}" - playerinfo-ui-claim-total="&eProtections Total&f : &a{amount}" + playerinfo-ui-claim-total="&eProtections Total&f : &a{amount} &7(&6{block_amount}&7 blocks used)" playerinfo-ui-economy-block-available-purchase="&eBlocs restants pour l'achat&f : &a{amount}" playerinfo-ui-economy-block-cost="&ePrix de blocs de protection&f : &a{amount} par bloc" playerinfo-ui-economy-block-sell-return="&ePrix de retour de blocs de proteciton vendus&f : &a{amount} par bloc" - playerinfo-ui-last-active="&eDernière Activité&f : {date}" + playerinfo-ui-last-active="&eDernière Activité&f : &7{date}" playerinfo-ui-tax-current-rate="&eTaux de taxe actuel de la protection&f : &a{rate}" playerinfo-ui-tax-global-claim-rate="&eTaux de taxe de la protection Global&f : &a{rate}" playerinfo-ui-tax-global-town-rate="&eTaux de taxe de Village Global&f : &a{rate}" playerinfo-ui-tax-total="&eTaxe Total&f : &a{amount}" - playerinfo-ui-title="&bInfo joueur" + playerinfo-ui-title="&bInfo joueur &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" playerinfo-ui-world="&eMonde&f : &7{name}" plugin-command-not-found="&cImpossible de localiser la commande '&a{command}&c' pour le plug-in &b{id}&a." @@ -666,7 +676,7 @@ GriefDefender { registry-block-not-found="&cLe bloc {id} ne peut pas être trouvé dans le registre." registry-entity-not-found="&cL'entité {id} ne peut pas être trouvé dans le registre." registry-item-not-found="&cL'objet {id} ne peut pas être trouvé dans le registre." - rent-system-disabled="&cThe rent system is not enabled." + rent-system-disabled="&cLe système de location n'est pas activé." rent-ui-click-cancel="Click here to cancel " rent-ui-click-rent="Click here to rent" rent-ui-end-date="Date de fin" @@ -678,7 +688,7 @@ GriefDefender { rent-ui-return-info="Retour au info de la location" rent-ui-start-date="Date de début" rent-ui-title-transactions="Transaction de location" - rent-ui-view-transactions="View Transactions" + rent-ui-view-transactions="Voir les transactions" resize-overlap="&cImpossible de redimensionner ici car cela chauvecherait une protection à proximité." resize-overlap-subdivision="&cTu ne peut pas créer une sous-division ici car cela chevaucherait une autre sous-division. Considère &f/abandon&c pour la supprimer ou utilise la pelle sur un coin pour le redimensionner." resize-same-location="&cTu dois sélectionner un bloc à un endroit différent pour redimensionner une protection." @@ -689,11 +699,11 @@ GriefDefender { result-type-change-not-admin="&cTu n'as pas la permission d'un administrateur pour changer le type en {type}&c." result-type-child-same="Protection {type}&c ne peuvent pas avoir directement des protections enfant de type {type}&c." result-type-create-deny="{type}&c ne peut pas être créé dans {target_type}." - result-type-fail=FAIL + result-type-fail=ÉCHEC result-type-no-children="{type}&c ne peut pas contenir de protection enfant." result-type-only-subdivision="{type}&c peut seulement contenir des sous-division." result-type-requires-owner="&cImpossible de convertir la protection {type} en {target_type}. Le propriétaire est requis." - result-type-success=SUCCESS + result-type-success=SUCCÈS schematic-abandon-all-restore-warning="&6Es-tu sûr de vouloir &nabandonner&6 &cTOUTES&6 tes protections ? &cL'ENSEMBLE DES DONNÉES SERONT PERDUES&f !&6 Tes protections seront restorées à leur état d'origine lors de la confirmation." schematic-abandon-all-restore-warning-world="&6Es-tu sûr de vouloir &nabandonner&6 &cTOUTES&6 tes protections en &a{world} ? &cL'ENSEMBLE DES DONNÉES SERONT PERDUES&f !&6 Tes protections seront restorées à leur état d'origine lors de la confirmation." schematic-abandon-restore-warning="&6Es-tu sûr de vouloir &nabandonner&6 cette protection ? &cL'ENSEMBLE DES DONNÉES SERONT PERDUES&f !&6 Cette protection sera restorée à son état d'origine lors de la confirmation." @@ -771,6 +781,6 @@ GriefDefender { untrust-no-claims="&cTu n'as pas de protection où enlever la confiance." untrust-owner="&6{owner}&a est le propriétaire et ne pas pas perdre la confiance." untrust-self="&cTu ne peut pas te retirer la confiance toi-même." - visual-update-in-progress="&aUpdating claim visuals. Pending: &6{count}&a visual blocks. Please wait." + visual-update-in-progress="&aMise à jour visuel de protection. En attente: &6{count}&a blocs visuels. Un moment de patience." } } diff --git a/common/src/main/resources/assets/lang/pl_PL.conf b/common/src/main/resources/assets/lang/pl_PL.conf index c7a4f68..0b4db37 100644 --- a/common/src/main/resources/assets/lang/pl_PL.conf +++ b/common/src/main/resources/assets/lang/pl_PL.conf @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&cGracz '&6{player}&c' nie został znaleziony." command-world-not-found="&cŚwiat '&6{world}&c' nie został znaleziony." command-worldedit-missing="&cTa komenda wymaga instalacji pluginu WorldEdit." + confirm-not-found="No confirmation found." create-cancel="&cAnulowano tworzenie działki." create-cuboid-disabled="&cTryb &d3D&c został wyłączony.\nTryb &d3D&c można używać będąć Adminem lub na własnej działce &d2D&c." create-failed-claim-limit="&cOsiągasz już swój limit działek wynoszący &a{limit}&c szt. typu {type}&c. Wpisz &f/abandon&c aby zwolnić działkę zanim zrobisz kolejną." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&cNowa ilość &a{total}&c przekroczy limit bloków wynoszący &a{limit}&c. Transakcja anulowana." economy-block-sale-confirmation="&aZdeponowano &6{deposit}&a na Twoim koncie. Masz teraz &6{amount}&a szt. bloków do dyspozycji." economy-block-sell-error="&cNie można sprzedać bloków. Powód: &f{reason}&c." + economy-block-transfer-cancel="&cTransfer cancelled. Could not locate any players with remaining claim blocks." + economy-block-transfer-success="&aTransfer complete. You have successfully transferred &6{count}&a players remaining claimblocks into currency." + economy-block-transfer-warning="&6Are you sure you want to transfer &cALL&6 player remaining claim blocks into currency? This will reset each player's accrued and bonus blocks to 0 after transfer. \n\nClick confirm to proceed." economy-claim-abandon-success="&aTeren opuszczony. Przywrócono Ci '&6{amount}&a'." economy-claim-abandon-success-world="&aTeren opuszczony w &6{world}&a. Przywrócono Ci '&6{amount}&a'." economy-claim-buy-cancelled="&cKupno anulowane! Nie kupujesz od &6{player}&c. Powód was &a{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&aWystawiasz ofertę sprzedaży działki za &6{amount}&a." economy-claim-sale-invalid-price="&cCena &a{amount}&c musi być równa lub większa niż &a0&c." economy-claim-sold="&aTwoja działka sprzedana! Kwota &6{amount}&a została przelana na Twoje konto. Twój stan konta to teraz &6{balance}&a." + economy-deposit-error="&cCould not deposit funds. Reason: &f{reason}&c." economy-mode-block-cost-not-set="&cEconomy mode is enabled but the current price for blocks is &6{price}&c.\nRaise the value for option 'economy-block-cost' in 'options.conf' or via '/gd option claim' command." economy-mode-block-sale-confirmation="&aWpłacono &6{deposit}&a na Twoje konto. Twój stan konta to &6{balance}&a. Stać cię jeszcze na &6{amount}&a szt. bloków terenu." + economy-mode-not-enabled="&cEconomy mode is not enabled." economy-mode-resize-success-2d="&aGranice działki zmienione. Twój stan konta to &6{balance}&a. Stać cię na jeszcze na &6{block-amount} &aszt. bloków terenu." economy-mode-resize-success-3d="&aGranice działki zmienione. Twój stan konta to &6{balance}&a. Stać cię na jeszcze na &6{chunk-amount} &aszt. chunków. &f({block-amount})" economy-not-enough-funds="&cNie stać Cię na zakup terenu. Twój stan konta to '&a{balance}&c', a potrzebujesz '&a{amount}&c'." @@ -340,6 +346,8 @@ GriefDefender { flag-description-custom-damage-animals="Ustala, czy można bić zwierzątka." flag-description-custom-endcrystal-use="Controls whether endcrystals can be placed or broken." flag-description-custom-enderman-grief="Ustala, czy enderman może podnosić bloki." + flag-description-custom-entity-armorstand-damage="Controls whether entities can deal damage to armorstands." + flag-description-custom-entity-itemframe-damage="Controls whether entities can deal damage to item frames." flag-description-custom-exp-drop="Ustala wypadanie kul z doświadczeniem." flag-description-custom-explosion-block="Ustala, czy eksplozje niszczą bloki." flag-description-custom-explosion-entity="Ustala, czy wybuchy zadają obrażenia obiektom." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Ustala, czy gracze mogą używać portali." flag-description-custom-player-teleport-from="Ustala, czy gracze mogą teleportować się będąc na działce." flag-description-custom-player-teleport-to="Ustala, czy gracze mogą teleportować się na tę działkę." + flag-description-custom-player-villager-damage="Controls whether players can deal damage to villagers." flag-description-custom-pvp="Ustala, czy PvP jest włączone." flag-description-custom-ride="Ustala, czy można jeździć pojazdami i na zwierzętach." flag-description-custom-sleep="Ustala, czy można spać w łóżku." @@ -632,25 +641,26 @@ GriefDefender { player-remaining-blocks-2d="&aMożesz zająć jeszcze do &6{block-amount}&a szt. bloków." player-remaining-blocks-3d="&aMożesz zająć jeszcze &6{chunk-amount}&a szt. chunków. &f({block-amount})" playerinfo-ui-abandon-return-ratio="&eWspółczynnik zwrotu po likwidacji działki&f : &a{ratio}" - playerinfo-ui-block-accrued="&eNabyte bloki&f : &a{amount}&7(&d{block_amount}&f na godzinę&7)" + playerinfo-ui-block-accrued="&eNabyte bloki&f : &a{amount} &7(&6{block_amount}&7 na godzinę)" playerinfo-ui-block-bonus="&eBonusowe bloki&f : &a{amount}" playerinfo-ui-block-initial="&ePodstawowa ilość bloków&f : &a{amount}" playerinfo-ui-block-max-accrued="&eMaksymalna ilość nabytych bloków&f : &a{amount}" playerinfo-ui-block-remaining="&ePozostałe bloki&f : &a{amount}" playerinfo-ui-block-total="&eBloki łącznie&f : &a{amount}" playerinfo-ui-chunk-total="&eŁączna ilość chunków do zajęcia&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eClaim Creation Limits&f : &7BASIC &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7TOWN &6{town_limit}" playerinfo-ui-claim-level="&eNajniższy/Najwyższy poziom działki&f : &a{level}" playerinfo-ui-claim-size-limit="&eOgraniczenia wielkości działki&f : &a{limit}" - playerinfo-ui-claim-total="&eŁączna ilość działek&f : &a{amount}" + playerinfo-ui-claim-total="&eŁączna ilość działek&f : &a{amount} &7(&6{block_amount}&7 blocks used)" playerinfo-ui-economy-block-available-purchase="&ePozostało bloków do wykupienia&f : &a{amount}" playerinfo-ui-economy-block-cost="&eCena za jeden blok działki&f : &a{amount} per block" playerinfo-ui-economy-block-sell-return="&eCena za sprzedaż posiadanych bloków działki&f : &a{amount} za każdy blok" - playerinfo-ui-last-active="&eOstatnia aktywność&f : {date}" + playerinfo-ui-last-active="&eOstatnia aktywność&f : &7{date}" playerinfo-ui-tax-current-rate="&eObecny podatek za działkę&f : &a{rate}" playerinfo-ui-tax-global-claim-rate="&eŚwiatowy podatek za działkę&f : &a{rate}" playerinfo-ui-tax-global-town-rate="&eŚwiatowy podatek za miasto&f : &a{rate}" playerinfo-ui-tax-total="&ePodsuma podatków&f : &a{amount}" - playerinfo-ui-title="&bInformacje o graczu" + playerinfo-ui-title="&bInformacje o graczu &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" playerinfo-ui-world="&eŚwiat&f : &7{name}" plugin-command-not-found="&cNie można znaleźć komendy '&a{command}&c' dla pluginu &b{id}&c." diff --git a/common/src/main/resources/assets/lang/ru_RU.conf b/common/src/main/resources/assets/lang/ru_RU.conf index 9e7e068..25e4a3c 100644 --- a/common/src/main/resources/assets/lang/ru_RU.conf +++ b/common/src/main/resources/assets/lang/ru_RU.conf @@ -212,6 +212,7 @@ GriefDefender { command-player-not-found="&cИгрок '&6{player}&c' не найден." command-world-not-found="&cМир '&6{world}&c' не найден." command-worldedit-missing="&cДля использования этой команды на сервер должен быть установлен WorldEdit." + confirm-not-found="No confirmation found." create-cancel="&cСоздание региона отменено." create-cuboid-disabled="&cВозможность создавать регионы в форме &d3D&c-кубоида отключено администратором.\nВы можете создавать регионы в форме &d3D&c-кубоида, только если вы являетесь администратором или поверх вашего &d2D&c-региона." create-failed-claim-limit="&cВы достигли ограничения в &a{limit}&c по количеству регионов вида &a{type}&c. Используйте &f/abandon&c, чтобы удалить существующий регион." @@ -258,6 +259,9 @@ GriefDefender { economy-block-purchase-limit="&cНовое количество доступных блоков региона &a{total}&c превышает ограничение в &a{limit}&c. Операция отменена." economy-block-sale-confirmation="&aНа ваш счёт начислено &6{deposit}&a. Теперь у вас доступно &6{amount}&a блоков региона." economy-block-sell-error="&cНе удалось продать блоки. Причина: &f{reason}&c." + economy-block-transfer-cancel="&cTransfer cancelled. Could not locate any players with remaining claim blocks." + economy-block-transfer-success="&aTransfer complete. You have successfully transferred &6{count}&a players remaining claimblocks into currency." + economy-block-transfer-warning="&6Are you sure you want to transfer &cALL&6 player remaining claim blocks into currency? This will reset each player's accrued and bonus blocks to 0 after transfer. \n\nClick confirm to proceed." economy-claim-abandon-success="&aРегион(ы) удалены. Вам возмещены средства в размере '&6{amount}&a'." economy-claim-abandon-success-world="&aРегион(ы) удалены в &6{world}&a. Вам возмещены средства в размере '&6{amount}&a'." economy-claim-buy-cancelled="&cПокупка отменена! Не удалось купить регион, принадлежащий &6{player}&c. Результат действия: &a{result}" @@ -300,8 +304,10 @@ GriefDefender { economy-claim-sale-confirmed="&aРегион выставлен на продажу по стоимости &6{amount}&a." economy-claim-sale-invalid-price="&cСтоимость региона &a{amount}&c должна быть больше или равна &a0&c." economy-claim-sold="&aВаш регион продан! &6{amount}&a было записано на ваш счёт. Ваш текущий баланс: &6{balance}&a." + economy-deposit-error="&cCould not deposit funds. Reason: &f{reason}&c." economy-mode-block-cost-not-set="&cEconomy mode is enabled but the current price for blocks is &6{price}&c.\nRaise the value for option 'economy-block-cost' in 'options.conf' or via '/gd option claim' command." economy-mode-block-sale-confirmation="&aНа ваш счёт зачислено &6{deposit}&a. Ваш текущий баланс: &6{balance}&a. Теперь у вас достаточно средств, чтобы создать регион ещё на &6{amount}&a блоков." + economy-mode-not-enabled="&cEconomy mode is not enabled." economy-mode-resize-success-2d="&aРазмер региона изменён. Ваш новый баланс: &6{balance}&a. У вас достаточно средств, чтобы создать регион ещё на &6{block-amount}&a блоков." economy-mode-resize-success-3d="&aРазмер региона изменён. Ваш новый баланс: &6{balance}&a. У вас достаточно средств, чтобы создать регион ещё на &6{chunk-amount}&a чанков. &f({block-amount} блоков)" economy-not-enough-funds="&cУ вас недостаточно средств на покупку этого региона. Ваш текущий баланс: '&a{balance}&c', а для покупки необходимо '&a{amount}&c'." @@ -340,6 +346,8 @@ GriefDefender { flag-description-custom-damage-animals="Управляет возможностью животных получать урон." flag-description-custom-endcrystal-use="Controls whether endcrystals can be placed or broken." flag-description-custom-enderman-grief="Управляет возможностью Странников Края ломать и ставить блоки." + flag-description-custom-entity-armorstand-damage="Controls whether entities can deal damage to armorstands." + flag-description-custom-entity-itemframe-damage="Controls whether entities can deal damage to item frames." flag-description-custom-exp-drop="Управляет возможностью выпадения сфер опыта." flag-description-custom-explosion-block="Управляет возможностью взрывов влиять на блоки." flag-description-custom-explosion-entity="Управляет возможностью взрывов влиять на сущности." @@ -376,6 +384,7 @@ GriefDefender { flag-description-custom-player-portal-use="Управляет возможностью использования порталов." flag-description-custom-player-teleport-from="Управляет возможностью игроков телепортироваться из региона." flag-description-custom-player-teleport-to="Управляет возможностью игроков телепортироваться в регион." + flag-description-custom-player-villager-damage="Controls whether players can deal damage to villagers." flag-description-custom-pvp="Управляет возможностью сражений между игроками." flag-description-custom-ride="Управляет возможностью садиться на транспорт (включая животных)." flag-description-custom-sleep="Управляет возможностью игрока спать в кроватях." @@ -632,25 +641,26 @@ GriefDefender { player-remaining-blocks-2d="&aВы можете занять ещё &6{block-amount}&a блоков." player-remaining-blocks-3d="&aВы можете занять ещё &6{chunk-amount}&a чанков. &f({block-amount} блоков)" playerinfo-ui-abandon-return-ratio="&eДоля возврата при удалении региона&f : &a{ratio}" - playerinfo-ui-block-accrued="&eНакоплено блоков&f : &a{amount}&7(&d{block_amount}&f per hour&7)" + playerinfo-ui-block-accrued="&eНакоплено блоков&f : &a{amount} &7(&6{block_amount}&7 per hour)" playerinfo-ui-block-bonus="&eБонусных блоков&f : &a{amount}" playerinfo-ui-block-initial="&eНачальное количество блоков&f : &a{amount}" playerinfo-ui-block-max-accrued="&eМаксимум накопления блоков&f : &a{amount}" playerinfo-ui-block-remaining="&eОсталось блоков&f : &a{amount}" playerinfo-ui-block-total="&eВсего блоков&f : &a{amount}" playerinfo-ui-chunk-total="&eВсего чанков&f : &a{amount}" + playerinfo-ui-claim-creation-limit="&eClaim Creation Limits&f : &7BASIC &6{basic_limit}&7, &7SUB &6{sub_limit}&7, &7TOWN &6{town_limit}" playerinfo-ui-claim-level="&eМин./Макс. уровень региона&f : &a{level}" playerinfo-ui-claim-size-limit="&eОграничения по размеру региона&f : &a{limit}" - playerinfo-ui-claim-total="&eВсего регионов&f : &a{amount}" + playerinfo-ui-claim-total="&eВсего регионов&f : &a{amount} &7(&6{block_amount}&7 blocks used)" playerinfo-ui-economy-block-available-purchase="&eДоступно блоков региона для покупки&f : &a{amount}" playerinfo-ui-economy-block-cost="&eЦена покупки блока региона&f : &a{amount} за блок" playerinfo-ui-economy-block-sell-return="&eЦена продажи блока региона&f : &a{amount} за блок" - playerinfo-ui-last-active="&eВ последний раз активен&f : {date}" + playerinfo-ui-last-active="&eВ последний раз активен&f : &7{date}" playerinfo-ui-tax-current-rate="&eТекущий размер налога на регионы&f : &a{rate}" playerinfo-ui-tax-global-claim-rate="&eОбщий размер налога на регионы&f : &a{rate}" playerinfo-ui-tax-global-town-rate="&eОбщий размер налога на города&f : &a{rate}" playerinfo-ui-tax-total="&eОбщий размер налогов&f : &a{amount}" - playerinfo-ui-title="&bИнформация об игроке" + playerinfo-ui-title="&bИнформация об игроке &f[&6{name}&f]" playerinfo-ui-uuid="&eUUID&f : &7{id}" playerinfo-ui-world="&eМир&f : &7{name}" plugin-command-not-found="&cКоманда '&a{command}&c' для плагина &b{id}&c не найдена." diff --git a/gradle.properties b/gradle.properties index e0dca32..8c64643 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ name=GriefDefender group=com.griefdefender url=https://github.com/bloodmc/GriefDefender -version=1.4.5 +version=1.4.6 apiVersion=1.0.0-20200528.202302-24 # Bukkit adapterVersion=1.16.1-20200628.024544-5 diff --git a/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java b/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java index b6c7e1c..55a3417 100644 --- a/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java +++ b/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java @@ -107,6 +107,8 @@ import com.griefdefender.command.CommandClaimUnban; import com.griefdefender.command.CommandClaimWorldEdit; import com.griefdefender.command.CommandDebug; +import com.griefdefender.command.CommandGDBlockTransfer; +import com.griefdefender.command.CommandGDConfirm; import com.griefdefender.command.CommandGDReload; import com.griefdefender.command.CommandGDVersion; import com.griefdefender.command.CommandGiveBlocks; @@ -830,6 +832,8 @@ public void registerBaseCommands() { manager.registerCommand(new CommandClaimWorldEdit()); manager.registerCommand(new CommandContainerTrust()); manager.registerCommand(new CommandDebug()); + manager.registerCommand(new CommandGDBlockTransfer()); + manager.registerCommand(new CommandGDConfirm()); manager.registerCommand(new CommandGDReload()); manager.registerCommand(new CommandGDVersion()); manager.registerCommand(new CommandGiveBlocks()); diff --git a/sponge/src/main/java/com/griefdefender/cache/MessageCache.java b/sponge/src/main/java/com/griefdefender/cache/MessageCache.java index be76e54..d2f562b 100644 --- a/sponge/src/main/java/com/griefdefender/cache/MessageCache.java +++ b/sponge/src/main/java/com/griefdefender/cache/MessageCache.java @@ -128,6 +128,7 @@ public static MessageCache getInstance() { public Component COMMAND_PET_TRANSFER_READY; public Component COMMAND_PET_TRANSFER_CANCEL; public Component COMMAND_WORLDEDIT_MISSING; + public Component CONFIRM_NOT_FOUND; public Component CREATE_CANCEL; public Component CREATE_CUBOID_DISABLED; public Component CREATE_OVERLAP; @@ -145,6 +146,8 @@ public static MessageCache getInstance() { public Component ECONOMY_BLOCK_NOT_AVAILABLE; public Component ECONOMY_BLOCK_ONLY_BUY; public Component ECONOMY_BLOCK_ONLY_SELL; + public Component ECONOMY_BLOCK_TRANSFER_CANCEL; + public Component ECONOMY_BLOCK_TRANSFER_WARNING; public Component ECONOMY_CLAIM_NOT_FOR_SALE; public Component ECONOMY_CLAIM_RENT_CANCEL_CONFIRMATION; public Component ECONOMY_CLAIM_RENT_RESTORE_CANCEL_CONFIRMATION; @@ -153,6 +156,7 @@ public static MessageCache getInstance() { public Component ECONOMY_CLAIM_RENT_OWNER_NOT_RENTING; public Component ECONOMY_CLAIM_SALE_CANCEL_CONFIRMATION; public Component ECONOMY_CLAIM_SALE_CANCELLED; + public Component ECONOMY_MODE_NOT_ENABLED; public Component ECONOMY_NOT_INSTALLED; public Component ECONOMY_SIGN_RENT_DAYS_LEFT; public Component ECONOMY_SIGN_RENT_DESCRIPTION; @@ -177,6 +181,8 @@ public static MessageCache getInstance() { public Component FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS; public Component FLAG_DESCRIPTION_CUSTOM_END_CRYSTAL_USE; public Component FLAG_DESCRIPTION_CUSTOM_ENDERMAN_GRIEF; + public Component FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE; + public Component FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_EXP_DROP; public Component FLAG_DESCRIPTION_CUSTOM_FALL_ENTITY_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_FALL_PLAYER_DAMAGE; @@ -211,6 +217,7 @@ public static MessageCache getInstance() { public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_ITEM_PICKUP; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_FROM; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_TO; + public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE; public Component FLAG_DESCRIPTION_CUSTOM_PISTON_ITEM_SPAWN; public Component FLAG_DESCRIPTION_CUSTOM_PISTON_USE; public Component FLAG_DESCRIPTION_CUSTOM_PLAYER_PORTAL_USE; @@ -420,7 +427,6 @@ public static MessageCache getInstance() { public Component PERMISSION_PLAYER_VIEW_OTHERS; public Component PERMISSION_TAX; public Component PERMISSION_VISUAL_CLAIMS_NEARBY; - public Component PLAYERINFO_UI_TITLE; public Component PLUGIN_EVENT_CANCEL; public Component PLUGIN_RELOAD; public Component PVP_CLAIM_NOT_ALLOWED; @@ -579,6 +585,7 @@ public void loadCache() { COMMAND_PET_TRANSFER_READY = MessageStorage.MESSAGE_DATA.getMessage("command-pet-transfer-ready"); COMMAND_PET_TRANSFER_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("command-pet-transfer-cancel"); COMMAND_WORLDEDIT_MISSING = MessageStorage.MESSAGE_DATA.getMessage("command-worldedit-missing"); + CONFIRM_NOT_FOUND = MessageStorage.MESSAGE_DATA.getMessage("confirm-not-found"); CREATE_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("create-cancel"); CREATE_CUBOID_DISABLED = MessageStorage.MESSAGE_DATA.getMessage("create-cuboid-disabled"); CREATE_OVERLAP = MessageStorage.MESSAGE_DATA.getMessage("create-overlap"); @@ -596,6 +603,8 @@ public void loadCache() { ECONOMY_BLOCK_NOT_AVAILABLE = MessageStorage.MESSAGE_DATA.getMessage("economy-block-not-available"); ECONOMY_BLOCK_ONLY_BUY = MessageStorage.MESSAGE_DATA.getMessage("economy-block-only-buy"); ECONOMY_BLOCK_ONLY_SELL = MessageStorage.MESSAGE_DATA.getMessage("economy-block-only-sell"); + ECONOMY_BLOCK_TRANSFER_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("economy-block-transfer-cancel"); + ECONOMY_BLOCK_TRANSFER_WARNING = MessageStorage.MESSAGE_DATA.getMessage("economy-block-transfer-warning"); ECONOMY_CLAIM_NOT_FOR_SALE = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-not-for-sale"); ECONOMY_CLAIM_RENT_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-cancel-confirmation"); ECONOMY_CLAIM_RENT_RESTORE_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-restore-cancel-confirmation"); @@ -604,6 +613,7 @@ public void loadCache() { ECONOMY_CLAIM_RENT_OWNER_NOT_RENTING = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-rent-owner-not-renting"); ECONOMY_CLAIM_SALE_CANCEL_CONFIRMATION = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-sale-cancel-confirmation"); ECONOMY_CLAIM_SALE_CANCELLED = MessageStorage.MESSAGE_DATA.getMessage("economy-claim-sale-cancelled"); + ECONOMY_MODE_NOT_ENABLED = MessageStorage.MESSAGE_DATA.getMessage("economy-mode-not-enabled"); ECONOMY_NOT_INSTALLED = MessageStorage.MESSAGE_DATA.getMessage("economy-not-installed"); ECONOMY_SIGN_RENT_DESCRIPTION = MessageStorage.MESSAGE_DATA.getMessage("economy-sign-rent-description"); ECONOMY_SIGN_RENT_FOOTER = MessageStorage.MESSAGE_DATA.getMessage("economy-sign-rent-footer"); @@ -627,6 +637,8 @@ public void loadCache() { FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-damage-animals"); FLAG_DESCRIPTION_CUSTOM_END_CRYSTAL_USE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-endcrystal-use"); FLAG_DESCRIPTION_CUSTOM_ENDERMAN_GRIEF = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-enderman-grief"); + FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-entity-armorstand-damage"); + FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-entity-itemframe-damage"); FLAG_DESCRIPTION_CUSTOM_EXP_DROP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-exp-drop"); FLAG_DESCRIPTION_CUSTOM_FALL_ENTITY_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-fall-entity-damage"); FLAG_DESCRIPTION_CUSTOM_FALL_PLAYER_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-fall-player-damage"); @@ -664,6 +676,7 @@ public void loadCache() { FLAG_DESCRIPTION_CUSTOM_PLAYER_PORTAL_USE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-portal-use"); FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_FROM = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-teleport-from"); FLAG_DESCRIPTION_CUSTOM_PLAYER_TELEPORT_TO = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-teleport-to"); + FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-player-villager-damage"); FLAG_DESCRIPTION_CUSTOM_PVP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-pvp"); FLAG_DESCRIPTION_CUSTOM_RIDE = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-ride"); FLAG_DESCRIPTION_CUSTOM_SLEEP = MessageStorage.MESSAGE_DATA.getMessage("flag-description-custom-sleep"); @@ -869,7 +882,6 @@ public void loadCache() { PERMISSION_PLAYER_VIEW_OTHERS = MessageStorage.MESSAGE_DATA.getMessage("permission-player-view-others"); PERMISSION_TAX = MessageStorage.MESSAGE_DATA.getMessage("permission-tax"); PERMISSION_VISUAL_CLAIMS_NEARBY = MessageStorage.MESSAGE_DATA.getMessage("permission-visual-claims-nearby"); - PLAYERINFO_UI_TITLE = MessageStorage.MESSAGE_DATA.getMessage("playerinfo-ui-title"); PLUGIN_EVENT_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("plugin-event-cancel"); PLUGIN_RELOAD = MessageStorage.MESSAGE_DATA.getMessage("plugin-reload"); PVP_CLAIM_NOT_ALLOWED = MessageStorage.MESSAGE_DATA.getMessage("pvp-claim-not-allowed"); diff --git a/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java b/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java index d5bff0e..1d2529d 100644 --- a/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java +++ b/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonAll.java @@ -207,9 +207,16 @@ private static Consumer createConfirmationConsumer(GDPermissionUs final Currency defaultCurrency = GriefDefenderPlugin.getInstance().economyService.get().getDefaultCurrency(); final TransactionResult result = playerAccount.deposit(defaultCurrency, BigDecimal.valueOf(refund), Sponge.getCauseStackManager().getCurrentCause()); if (result.getResult() == ResultType.SUCCESS) { - final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS, ImmutableMap.of( - "amount", TextComponent.of(String.valueOf(refund)))); - GriefDefenderPlugin.sendMessage(player, message); + Component message = null; + if (worldProperties != null) { + message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS_WORLD, ImmutableMap.of( + "world", worldProperties.getWorldName(), + "amount", TextComponent.of(String.valueOf(refund)))); + } else { + message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS, ImmutableMap.of( + "amount", TextComponent.of(String.valueOf(refund)))); + } + TextAdapter.sendComponent(player, message); } } else { int remainingBlocks = playerData.getRemainingClaimBlocks(); diff --git a/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java b/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java index a4b0beb..29e192d 100644 --- a/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java +++ b/sponge/src/main/java/com/griefdefender/command/CommandClaimAbandonWorld.java @@ -80,10 +80,10 @@ public class CommandClaimAbandonWorld extends BaseCommand { @Subcommand("abandon world") @Syntax("[]") public void execute(Player player, @Optional String worldName) { - WorldProperties world = player.getWorld().getProperties(); + WorldProperties worldProperties = player.getWorld().getProperties(); if (worldName != null) { - world = Sponge.getServer().getWorldProperties(worldName).orElse(null); - if (world == null) { + worldProperties = Sponge.getServer().getWorldProperties(worldName).orElse(null); + if (worldProperties == null) { TextAdapter.sendComponent(player, MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_WORLD_NOT_FOUND, ImmutableMap.of("world", worldName))); return; @@ -100,32 +100,41 @@ public void execute(Player player, @Optional String worldName) { } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ABANDON_WORLD_WARNING, ImmutableMap.of( - "world", TextComponent.of(world.getWorldName()))); + "world", TextComponent.of(worldProperties.getWorldName()))); final Component confirmationText = TextComponent.builder() .append(message) .append(TextComponent.builder() .append("\n[") .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) .append("]\n") - .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, world), true))) + .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, worldProperties), true))) .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) .build(); TextAdapter.sendComponent(player, confirmationText); } - private static Consumer createConfirmationConsumer(Player source, WorldProperties world) { + private static Consumer createConfirmationConsumer(Player source, WorldProperties worldProperties) { return confirm -> { - final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(world.getUniqueId()); + final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(worldProperties.getUniqueId()); for (GDPlayerData playerData : claimWorldManager.getPlayerDataMap().values()) { final GDPermissionUser user = playerData.getSubject(); if (user == null) { continue; } + if (playerData.playerID.equals(GriefDefenderPlugin.ADMIN_USER_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.PUBLIC_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.WORLD_USER_UUID)) { + continue; + } Set allowedClaims = new HashSet<>(); final Player player = user.getOnlinePlayer(); for (Claim claim : playerData.getInternalClaims()) { - if (!claim.getWorldUniqueId().equals(world.getUniqueId())) { + if (!claim.getWorldUniqueId().equals(worldProperties.getUniqueId())) { continue; } allowedClaims.add(claim); @@ -168,22 +177,23 @@ private static Consumer createConfirmationConsumer(Player source, final Currency defaultCurrency = GriefDefenderPlugin.getInstance().economyService.get().getDefaultCurrency(); final TransactionResult result = playerAccount.deposit(defaultCurrency, BigDecimal.valueOf(refund), Sponge.getCauseStackManager().getCurrentCause()); - if (result.getResult() == ResultType.SUCCESS) { - final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS, ImmutableMap.of( + if (result.getResult() == ResultType.SUCCESS && player != null) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_ABANDON_SUCCESS_WORLD, ImmutableMap.of( + "world", worldProperties.getWorldName(), "amount", TextComponent.of(String.valueOf(refund)))); - GriefDefenderPlugin.sendMessage(player, message); + TextAdapter.sendComponent(player, message); } - } else { + } else if (player != null) { int remainingBlocks = playerData.getRemainingClaimBlocks(); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ABANDON_SUCCESS_WORLD, ImmutableMap.of( - "world", world.getWorldName(), + "world", worldProperties.getWorldName(), "amount", remainingBlocks)); TextAdapter.sendComponent(player, message); } } } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ABANDON_WORLD_SUCCESS, ImmutableMap.of( - "world", world.getWorldName())); + "world", worldProperties.getWorldName())); TextAdapter.sendComponent(source, message); }; } diff --git a/sponge/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java b/sponge/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java index 4d7056e..49b9507 100644 --- a/sponge/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java +++ b/sponge/src/main/java/com/griefdefender/command/CommandClaimSellBlocks.java @@ -34,18 +34,12 @@ import com.google.common.collect.ImmutableMap; import com.griefdefender.GDPlayerData; import com.griefdefender.GriefDefenderPlugin; -import com.griefdefender.api.claim.ClaimResultType; import com.griefdefender.cache.MessageCache; -import com.griefdefender.claim.GDClaimResult; import com.griefdefender.configuration.MessageStorage; import com.griefdefender.permission.GDPermissions; import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.adapter.spongeapi.TextAdapter; -import net.kyori.text.format.TextColor; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.event.CauseStackManager; import org.spongepowered.api.service.economy.Currency; import org.spongepowered.api.service.economy.account.Account; import org.spongepowered.api.service.economy.transaction.ResultType; @@ -62,12 +56,15 @@ public class CommandClaimSellBlocks extends BaseCommand { @Syntax("[]") @Subcommand("sell blocks") public void execute(Player player, @Optional Integer blockCount) { - final boolean economyMode = GriefDefenderPlugin.getInstance().isEconomyModeEnabled(); // if economy is disabled, don't do anything if (!GriefDefenderPlugin.getInstance().economyService.isPresent()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().ECONOMY_NOT_INSTALLED); return; } + if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_NOT_AVAILABLE_ECONOMY); + return; + } final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); if (playerData.getEconomyClaimBlockReturn() <= 0) { @@ -89,11 +86,11 @@ public void execute(Player player, @Optional Integer blockCount) { return; } - int availableBlocks = economyMode ? playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks() : playerData.getInternalRemainingClaimBlocks(); + int availableBlocks = playerData.getInternalRemainingClaimBlocks(); if (blockCount == null) { final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_PURCHASE_COST, ImmutableMap.of( - "amount", playerData.getEconomyClaimBlockReturn(), + "amount", "$" + String.format("%.2f", playerData.getEconomyClaimBlockReturn()), "balance", availableBlocks)); GriefDefenderPlugin.sendMessage(player, message); return; @@ -118,20 +115,6 @@ public void execute(Player player, @Optional Integer blockCount) { return; } - final BigDecimal currentFunds = playerAccount.getBalance(defaultCurrency); - Component message = null; - if (economyMode) { - message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_BLOCK_SALE_CONFIRMATION, - ImmutableMap.of( - "deposit", economyTotalValue, - "balance", String.valueOf("$" + currentFunds), - "amount", playerData.getRemainingClaimBlocks())); - } else { - message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_SALE_CONFIRMATION, - ImmutableMap.of( - "deposit", economyTotalValue, - "amount", playerData.getRemainingClaimBlocks())); - } int bonusBlocks = playerData.getBonusClaimBlocks(); int accruedBlocks = playerData.getAccruedClaimBlocks(); if (bonusBlocks > 0) { @@ -148,6 +131,10 @@ public void execute(Player player, @Optional Integer blockCount) { playerData.setAccruedClaimBlocks(accruedBlocks); } + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_SALE_CONFIRMATION, + ImmutableMap.of( + "deposit", "$" + String.format("%.2f", economyTotalValue), + "amount", playerData.getRemainingClaimBlocks())); GriefDefenderPlugin.sendMessage(player, message); } } diff --git a/sponge/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java b/sponge/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java new file mode 100644 index 0000000..c39dfdc --- /dev/null +++ b/sponge/src/main/java/com/griefdefender/command/CommandGDBlockTransfer.java @@ -0,0 +1,182 @@ +/* + * This file is part of GriefDefender, licensed under the MIT License (MIT). + * + * Copyright (c) bloodmc + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.griefdefender.command; + +import co.aikar.commands.BaseCommand; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Optional; +import co.aikar.commands.annotation.Subcommand; + +import com.google.common.collect.ImmutableMap; +import com.griefdefender.GDPlayerData; +import com.griefdefender.GriefDefenderPlugin; +import com.griefdefender.cache.MessageCache; +import com.griefdefender.cache.PermissionHolderCache; +import com.griefdefender.claim.GDClaimManager; +import com.griefdefender.configuration.MessageStorage; +import com.griefdefender.permission.GDPermissionUser; +import com.griefdefender.permission.GDPermissions; +import com.griefdefender.storage.BaseStorage; +import com.griefdefender.text.action.GDCallbackHolder; + +import net.kyori.text.Component; +import net.kyori.text.TextComponent; +import net.kyori.text.adapter.spongeapi.TextAdapter; +import net.kyori.text.event.ClickEvent; +import net.kyori.text.event.HoverEvent; +import net.kyori.text.format.TextColor; + +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import java.util.function.Consumer; + +import org.spongepowered.api.Sponge; +import org.spongepowered.api.command.CommandSource; +import org.spongepowered.api.service.economy.Currency; +import org.spongepowered.api.service.economy.account.Account; +import org.spongepowered.api.service.economy.transaction.ResultType; +import org.spongepowered.api.service.economy.transaction.TransactionResult; +import org.spongepowered.api.world.storage.WorldProperties; + +@CommandAlias("%griefdefender") +@CommandPermission(GDPermissions.COMMAND_ECONOMY_BLOCK_TRANSFER) +public class CommandGDBlockTransfer extends BaseCommand { + + @CommandAlias("gdblocktransfer") + @Description("Transfers ALL player remaining accrued/bonus claim blocks into currency then sets their accrued and bonus amounts to 0.\nNote: This MUST be used if you are switching from claim blocks system to economy mode.") + @Subcommand("economy blocktransfer") + public void execute(CommandSource source, @Optional Integer blockCount) { + // if economy is disabled, don't do anything + if (!GriefDefenderPlugin.getInstance().economyService.isPresent()) { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_NOT_INSTALLED); + return; + } + if (!GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_MODE_NOT_ENABLED); + return; + } + + final Component confirmationText = TextComponent.builder() + .append(MessageCache.getInstance().ECONOMY_BLOCK_TRANSFER_WARNING) + .append(TextComponent.builder() + .append("\n[") + .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) + .append("]\n") + .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(source, createConfirmationConsumer(source), true))) + .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) + .build(); + TextAdapter.sendComponent(source, confirmationText); + } + + public Consumer createConfirmationConsumer(CommandSource source) { + return confirm -> { + Set playerDataSet = new HashSet<>(); + if (BaseStorage.USE_GLOBAL_PLAYER_STORAGE) { + final UUID worldUniqueId = Sponge.getServer().getDefaultWorld().get().getUniqueId(); + final GDClaimManager claimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(worldUniqueId); + playerDataSet.addAll(claimManager.getPlayerDataMap().values()); + } else { + for (WorldProperties worldProperties : Sponge.getServer().getAllWorldProperties()) { + final GDClaimManager claimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(worldProperties.getUniqueId()); + playerDataSet.addAll(claimManager.getPlayerDataMap().values()); + } + } + + int count = 0; + for (GDPlayerData playerData : playerDataSet) { + final double economyBlockCost = playerData.getEconomyClaimBlockCost(); + if (economyBlockCost <= 0) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.ADMIN_USER_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.PUBLIC_UUID)) { + continue; + } + if (playerData.playerID.equals(GriefDefenderPlugin.WORLD_USER_UUID)) { + continue; + } + + final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(playerData.getUniqueId()); + if (user == null) { + continue; + } + System.out.println("Migrating user " + user.getFriendlyName() + " remaining claimblocks..."); + final Account playerAccount = GriefDefenderPlugin.getInstance().economyService.get().getOrCreateAccount(user.getUniqueId()).orElse(null); + if (playerAccount == null) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_PLAYER_NOT_FOUND, ImmutableMap.of( + "player", user.getFriendlyName())); + GriefDefenderPlugin.sendMessage(source, message); + continue; + } + + int availableBlocks = playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks(); + int totalClaimCost = playerData.getTotalClaimsCost(); + final int remainingBlocks = availableBlocks - totalClaimCost; + if (remainingBlocks <= 0) { + System.out.println("User " + user.getFriendlyName() + " has " + remainingBlocks + " remaining claim blocks. Skipping..."); + continue; + } + + // attempt to compute value and deposit it + double economyTotalValue = economyBlockCost * remainingBlocks; + final Currency defaultCurrency = GriefDefenderPlugin.getInstance().economyService.get().getDefaultCurrency(); + final TransactionResult result = playerAccount.deposit(defaultCurrency, BigDecimal.valueOf(economyTotalValue), Sponge.getCauseStackManager().getCurrentCause()); + if (result.getResult() != ResultType.SUCCESS) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_DEPOSIT_ERROR, ImmutableMap.of( + "reason", result.getResult())); + GriefDefenderPlugin.sendMessage(source, message); + continue; + } + + final double balance = playerAccount.getBalance(GriefDefenderPlugin.getInstance().economyService.get().getDefaultCurrency()).doubleValue(); + Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_BLOCK_SALE_CONFIRMATION, + ImmutableMap.of( + "deposit", "$" + String.format("%.2f", economyTotalValue), + "balance", "$" + String.format("%.2f", balance), + "amount", playerData.getRemainingClaimBlocks())); + playerData.setAccruedClaimBlocks(0); + playerData.setBonusClaimBlocks(0); + if (user.getOnlinePlayer() != null) { + GriefDefenderPlugin.sendMessage(user.getOnlinePlayer(), message); + } + count++; + } + if (count > 0) { + final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_BLOCK_TRANSFER_SUCCESS, + ImmutableMap.of( + "count", count)); + GriefDefenderPlugin.sendMessage(source, message); + } else { + GriefDefenderPlugin.sendMessage(source, MessageCache.getInstance().ECONOMY_BLOCK_TRANSFER_CANCEL); + } + }; + } +} diff --git a/sponge/src/main/java/com/griefdefender/command/CommandGDConfirm.java b/sponge/src/main/java/com/griefdefender/command/CommandGDConfirm.java new file mode 100644 index 0000000..bc78a61 --- /dev/null +++ b/sponge/src/main/java/com/griefdefender/command/CommandGDConfirm.java @@ -0,0 +1,59 @@ +/* + * This file is part of GriefDefender, licensed under the MIT License (MIT). + * + * Copyright (c) bloodmc + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.griefdefender.command; + +import co.aikar.commands.BaseCommand; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Subcommand; +import net.kyori.text.TextComponent; +import net.kyori.text.adapter.spongeapi.TextAdapter; + +import com.griefdefender.permission.GDPermissions; +import com.griefdefender.text.action.GDCallbackHolder; + +import java.util.function.Consumer; + +import org.spongepowered.api.command.CommandSource; +import org.spongepowered.api.entity.living.player.Player; + +@CommandAlias("%griefdefender") +@CommandPermission(GDPermissions.COMMAND_CONFIRM) +public class CommandGDConfirm extends BaseCommand { + + @CommandAlias("gdconfirm") + @Description("Alternate way to confirm chat confirmations.") + @Subcommand("confirm") + public void execute(Player player) { + + final Consumer callback = GDCallbackHolder.getInstance().getConfirmationForPlayer(player); + if (callback != null) { + callback.accept(player); + } else { + TextAdapter.sendComponent(player, TextComponent.of("No confirmation found.")); + } + } +} diff --git a/sponge/src/main/java/com/griefdefender/command/CommandPlayerInfo.java b/sponge/src/main/java/com/griefdefender/command/CommandPlayerInfo.java index 4b98a96..f322fa7 100644 --- a/sponge/src/main/java/com/griefdefender/command/CommandPlayerInfo.java +++ b/sponge/src/main/java/com/griefdefender/command/CommandPlayerInfo.java @@ -74,7 +74,7 @@ public class CommandPlayerInfo extends BaseCommand { @CommandCompletion("@gdplayers @gddummy") - @CommandAlias("playerinfo") + @CommandAlias("gdplayerinfo|playerinfo") @Description("Gets information about a player.") @Syntax("[| ]") @Subcommand("player info") @@ -159,59 +159,54 @@ public void execute(CommandSource src, @Optional String[] args) throws InvalidCo final Component economyBlockAvailablePurchaseText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_AVAILABLE_PURCHASE, ImmutableMap.of("amount", String.valueOf(playerData.getRemainingClaimBlocks()))); final Component economyBlockCostText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_COST, - ImmutableMap.of("amount", String.valueOf("$" + playerData.getInternalEconomyBlockCost()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getInternalEconomyBlockCost()))); final Component economyBlockSellReturnText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ECONOMY_BLOCK_SELL_RETURN, - ImmutableMap.of("amount", String.valueOf("$" + playerData.getEconomyClaimBlockReturn()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getEconomyClaimBlockReturn()))); final Component minMaxLevelText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_LEVEL, ImmutableMap.of("level", String.valueOf(playerData.getMinClaimLevel() + "-" + playerData.getMaxClaimLevel()))); final Component abandonRatioText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_ABANDON_RETURN_RATIO, ImmutableMap.of("ratio", String.valueOf(playerData.getAbandonedReturnRatio(ClaimTypes.BASIC)))); final Component totalTaxText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_TAX_TOTAL, - ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks()))); + ImmutableMap.of("amount", "$" + String.format("%.2f", playerData.getTotalTax()))); final Component totalBlockText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_BLOCK_TOTAL, - ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks()))); + ImmutableMap.of("amount", String.valueOf(playerData.getInitialClaimBlocks() + playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks()))); final Component totalClaimableChunkText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CHUNK_TOTAL, ImmutableMap.of("amount", String.valueOf(Math.round(claimableChunks * 100.0)/100.0))); final Component totalClaimText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_TOTAL, - ImmutableMap.of("amount", String.valueOf(claimList.size()))); + ImmutableMap.of("amount", claimList.size(), + "block_amount", playerData.getTotalClaimsCost())); List claimsTextList = Lists.newArrayList(); claimsTextList.add(uuidText); claimsTextList.add(worldText); claimsTextList.add(sizeLimitText); - claimsTextList.add(initialBlockText); - claimsTextList.add(accruedBlockText); - claimsTextList.add(maxAccruedBlockText); - claimsTextList.add(bonusBlockText); - if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { - claimsTextList.add(economyBlockAvailablePurchaseText); - claimsTextList.add(economyBlockCostText); - claimsTextList.add(economyBlockSellReturnText); - } else { - claimsTextList.add(remainingBlockText); - } - claimsTextList.add(minMaxLevelText); - claimsTextList.add(abandonRatioText); final int townLimit = playerData.getCreateClaimLimit(ClaimTypes.TOWN); final int basicLimit = playerData.getCreateClaimLimit(ClaimTypes.BASIC); final int subLimit = playerData.getCreateClaimLimit(ClaimTypes.SUBDIVISION); String townLimitText = townLimit < 0 ? "∞" : String.valueOf(townLimit); String basicLimitText = basicLimit < 0 ? "∞" : String.valueOf(basicLimit); String subLimitText = subLimit < 0 ? "∞" : String.valueOf(subLimit); - - Component claimCreateLimits = TextComponent.builder("") - .append("TOWN", TextColor.GRAY) - .append(" : ") - .append(townLimitText, TextColor.GREEN) - .append(" BASIC", TextColor.GRAY) - .append(" : ") - .append(basicLimitText, TextColor.GREEN) - .append(" SUB", TextColor.GRAY) - .append(" : ") - .append(subLimitText, TextColor.GREEN) - .build(); + Component claimCreateLimits = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_CLAIM_CREATION_LIMIT, + ImmutableMap.of("basic_limit", basicLimitText, + "sub_limit", subLimitText, + "town_limit", townLimitText)); claimsTextList.add(claimCreateLimits); - if (GriefDefenderPlugin.getActiveConfig(playerData.worldUniqueId).getConfig().economy.taxSystem) { + claimsTextList.add(initialBlockText); + claimsTextList.add(accruedBlockText); + claimsTextList.add(bonusBlockText); + claimsTextList.add(totalBlockText); + if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) { + claimsTextList.add(economyBlockCostText); + claimsTextList.add(economyBlockSellReturnText); + claimsTextList.add(economyBlockAvailablePurchaseText); + } else { + claimsTextList.add(remainingBlockText); + } + claimsTextList.add(maxAccruedBlockText); + claimsTextList.add(minMaxLevelText); + claimsTextList.add(abandonRatioText); + + if (GriefDefenderPlugin.getActiveConfig(worldProperties.getUniqueId()).getConfig().economy.taxSystem) { Component townTaxRate = TextComponent.builder("") .append("TOWN", TextColor.GRAY) .append(" : ") @@ -250,7 +245,6 @@ public void execute(CommandSource src, @Optional String[] args) throws InvalidCo claimsTextList.add(globalClaimTaxText); claimsTextList.add(totalTaxText); } - claimsTextList.add(totalBlockText); claimsTextList.add(totalClaimableChunkText); claimsTextList.add(totalClaimText); JoinData joinData = user.getOfflinePlayer().getOrCreate(JoinData.class).orElse(null); @@ -267,8 +261,10 @@ public void execute(CommandSource src, @Optional String[] args) throws InvalidCo } } + final Component title = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PLAYERINFO_UI_TITLE, + ImmutableMap.of("name", playerData.getName())); PaginationList.Builder paginationBuilder = PaginationList.builder() - .title(MessageCache.getInstance().PLAYERINFO_UI_TITLE).padding(TextComponent.of(" ").decoration(TextDecoration.STRIKETHROUGH, true)).contents(claimsTextList); + .title(title).padding(TextComponent.of(" ").decoration(TextDecoration.STRIKETHROUGH, true)).contents(claimsTextList); paginationBuilder.sendTo(src); } } diff --git a/sponge/src/main/java/com/griefdefender/configuration/MessageStorage.java b/sponge/src/main/java/com/griefdefender/configuration/MessageStorage.java index 3a4c5c2..b1a6ecd 100644 --- a/sponge/src/main/java/com/griefdefender/configuration/MessageStorage.java +++ b/sponge/src/main/java/com/griefdefender/configuration/MessageStorage.java @@ -185,6 +185,7 @@ public class MessageStorage { public static final String ECONOMY_BLOCK_PURCHASE_LIMIT = "economy-block-purchase-limit"; public static final String ECONOMY_BLOCK_SALE_CONFIRMATION = "economy-block-sale-confirmation"; public static final String ECONOMY_BLOCK_SELL_ERROR = "economy-block-sell-error"; + public static final String ECONOMY_BLOCK_TRANSFER_SUCCESS = "economy-block-transfer-success"; public static final String ECONOMY_CLAIM_ABANDON_SUCCESS = "economy-claim-abandon-success"; public static final String ECONOMY_CLAIM_ABANDON_SUCCESS_WORLD = "economy-claim-abandon-success-world"; public static final String ECONOMY_CLAIM_BUY_CANCELLED = "economy-claim-buy-cancelled"; @@ -218,6 +219,7 @@ public class MessageStorage { public static final String ECONOMY_CLAIM_SALE_CONFIRMED = "economy-claim-sale-confirmed"; public static final String ECONOMY_CLAIM_SALE_INVALID_PRICE = "economy-claim-sale-invalid-price"; public static final String ECONOMY_CLAIM_SOLD = "economy-claim-sold"; + public static final String ECONOMY_DEPOSIT_ERROR = "economy-deposit-error"; public static final String ECONOMY_MODE_BLOCK_SALE_CONFIRMATION = "economy-mode-block-sale-confirmation"; public static final String ECONOMY_MODE_BLOCK_COST_NOT_SET = "economy-mode-block-cost-not-set"; public static final String ECONOMY_MODE_RESIZE_SUCCESS_2D = "economy-mode-resize-success-2d"; @@ -286,6 +288,7 @@ public class MessageStorage { public static final String PLAYERINFO_UI_ABANDON_RETURN_RATIO = "playerinfo-ui-abandon-return-ratio"; public static final String PLAYERINFO_UI_BLOCK_ACCRUED = "playerinfo-ui-block-accrued"; public static final String PLAYERINFO_UI_BLOCK_BONUS = "playerinfo-ui-block-bonus"; + public static final String PLAYERINFO_UI_CLAIM_CREATION_LIMIT = "playerinfo-ui-claim-creation-limit"; public static final String PLAYERINFO_UI_CLAIM_LEVEL = "playerinfo-ui-claim-level"; public static final String PLAYERINFO_UI_CLAIM_SIZE_LIMIT = "playerinfo-ui-claim-size-limit"; public static final String PLAYERINFO_UI_BLOCK_INITIAL = "playerinfo-ui-block-initial"; @@ -302,6 +305,7 @@ public class MessageStorage { public static final String PLAYERINFO_UI_TAX_GLOBAL_CLAIM_RATE = "playerinfo-ui-tax-global-claim-rate"; public static final String PLAYERINFO_UI_TAX_GLOBAL_TOWN_RATE = "playerinfo-ui-tax-global-town-rate"; public static final String PLAYERINFO_UI_TAX_TOTAL = "playerinfo-ui-tax-total"; + public static final String PLAYERINFO_UI_TITLE = "playerinfo-ui-title"; public static final String PLAYERINFO_UI_UUID = "playerinfo-ui-uuid"; public static final String PLAYERINFO_UI_WORLD = "playerinfo-ui-world"; public static final String PLUGIN_COMMAND_NOT_FOUND = "plugin-command-not-found"; diff --git a/sponge/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java b/sponge/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java index f2b2a79..784f077 100644 --- a/sponge/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java +++ b/sponge/src/main/java/com/griefdefender/configuration/category/EconomyCategory.java @@ -36,7 +36,7 @@ public class EconomyCategory extends ConfigCategory { @Setting(value = "economy-mode", comment = "Uses economy instead of player claim blocks for claim creation." + "\nIf true, disables the claim block system in favor of economy." + "\nNote: Using this mode disables the '/buyblocks' command as claim creation will pull funds directly from a player's economy balance." - + "\nNote: If players have existing claimblocks from past configurations, they can use the '/sellblocks' command to convert remainder to currency.") + + "\nNote: If players have existing claimblocks from past configurations, an admin must use the '/ecomigrateblocks' command to convert remainder to currency.") public boolean economyMode = false; @Setting(value = "use-claim-block-task", comment = "Claim blocks earned will be converted to economy based on 'claim-block-cost'." + "\n(Default: false)\nNote: This setting can only be used if 'economy-mode' is true.") diff --git a/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java b/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java index 6e3f09f..b6db94f 100644 --- a/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java +++ b/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java @@ -492,10 +492,6 @@ public boolean protectEntity(Event event, Entity targetEntity, Cause cause, Dama playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(targetEntity.getWorld(), player.getUniqueId()); } - if (NMSUtil.getInstance().isEntityMonster(targetEntity)) { - return false; - } - GDClaim claim = null; if (playerData != null) { claim = this.dataStore.getClaimAtPlayer(playerData, targetEntity.getLocation()); @@ -514,6 +510,9 @@ public boolean protectEntity(Event event, Entity targetEntity, Cause cause, Dama if (GDPermissionManager.getInstance().getFinalPermission(event, targetEntity.getLocation(), claim, Flags.ENTITY_DAMAGE, source, targetEntity, user, trustType, true) == Tristate.FALSE) { return true; } + if (NMSUtil.getInstance().isEntityMonster(targetEntity)) { + return false; + } // allow trusted users to attack entities within claim if (!(targetEntity instanceof Player) && claim.isUserTrusted(user, TrustTypes.ACCESSOR)) { @@ -576,8 +575,10 @@ public boolean protectEntity(Event event, Entity targetEntity, Cause cause, Dama } } - if (GDPermissionManager.getInstance().getFinalPermission(event, targetEntity.getLocation(), claim, Flags.ENTITY_DAMAGE, attacker, targetEntity, user, trustType, true) == Tristate.FALSE) { - return true; + if (source != attacker) { + if (GDPermissionManager.getInstance().getFinalPermission(event, targetEntity.getLocation(), claim, Flags.ENTITY_DAMAGE, attacker, targetEntity, user, trustType, true) == Tristate.FALSE) { + return true; + } } return false; diff --git a/sponge/src/main/java/com/griefdefender/migrator/GPBukkitMigrator.java b/sponge/src/main/java/com/griefdefender/migrator/GPBukkitMigrator.java index d0d7e07..88d1d6d 100644 --- a/sponge/src/main/java/com/griefdefender/migrator/GPBukkitMigrator.java +++ b/sponge/src/main/java/com/griefdefender/migrator/GPBukkitMigrator.java @@ -475,6 +475,9 @@ private static void migratePlayerData(World world) { GriefDefenderPlugin.getInstance().getLogger().info("Migrating " + files.length + " player data files..."); for (int i = 0; i < files.length; i++) { final File file = files[i]; + if (file.getName().endsWith("ignore")) { + continue; + } GriefDefenderPlugin.getInstance().getLogger().info("Migrating playerdata " + file.getName() + "..."); UUID uuid = null; try { diff --git a/sponge/src/main/java/com/griefdefender/permission/GDPermissions.java b/sponge/src/main/java/com/griefdefender/permission/GDPermissions.java index 89b5c82..4cb806c 100644 --- a/sponge/src/main/java/com/griefdefender/permission/GDPermissions.java +++ b/sponge/src/main/java/com/griefdefender/permission/GDPermissions.java @@ -91,6 +91,7 @@ public class GDPermissions { public static final String CLAIM_SHOW_TUTORIAL = "griefdefender.user.claim.show-tutorial"; public static final String VISUALIZE_CLAIMS = "griefdefender.user.claim.visualize.base"; public static final String VISUALIZE_CLAIMS_NEARBY = "griefdefender.user.claim.visualize.nearby"; + public static final String COMMAND_CONFIRM = "griefdefender.user.command.confirm"; public static final String COMMAND_PLAYER_INFO_BASE = "griefdefender.user.command.info.base"; public static final String COMMAND_PLAYER_INFO_OTHERS = "griefdefender.user.command.info.others"; public static final String COMMAND_VERSION = "griefdefender.user.command.version"; @@ -154,6 +155,7 @@ public class GDPermissions { public static final String COMMAND_DELETE_CLAIM_BASE = "griefdefender.admin.claim.command.delete.base"; public static final String COMMAND_DELETE_CLAIMS = "griefdefender.admin.claim.command.delete-claims"; public static final String COMMAND_DELETE_ADMIN_CLAIMS = "griefdefender.admin.command.delete-admin-claims"; + public static final String COMMAND_ECONOMY_BLOCK_TRANSFER = "griefdefender.admin.command.block-transfer"; public static final String COMMAND_SET_ACCRUED_CLAIM_BLOCKS = "griefdefender.admin.command.set-accrued-claim-blocks"; public static final String COMMAND_RESTORE_CLAIM = "griefdefender.admin.command.restore-claim.base"; public static final String COMMAND_RESTORE_NATURE = "griefdefender.admin.command.restore-nature.base"; diff --git a/sponge/src/main/java/com/griefdefender/permission/flag/FlagContexts.java b/sponge/src/main/java/com/griefdefender/permission/flag/FlagContexts.java index 4c9b82f..01a9e42 100644 --- a/sponge/src/main/java/com/griefdefender/permission/flag/FlagContexts.java +++ b/sponge/src/main/java/com/griefdefender/permission/flag/FlagContexts.java @@ -65,19 +65,17 @@ public class FlagContexts { // Targets public static final Context TARGET_AIR = new Context(ContextKeys.TARGET, "minecraft:air"); + public static final Context TARGET_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armor_stand"); public static final Context TARGET_BED = new Context(ContextKeys.TARGET, "minecraft:bed"); public static final Context TARGET_BOAT = new Context(ContextKeys.TARGET, "minecraft:boat"); public static final Context TARGET_CHEST = new Context(ContextKeys.TARGET, "minecraft:chest"); public static final Context TARGET_CHORUS_FRUIT = new Context(ContextKeys.TARGET, "minecraft:chorus_fruit"); - public static final Context TARGET_ENDERPEARL = new Context(ContextKeys.TARGET, "minecraft:enderpearl"); - public static final Context TARGET_ENTITY_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armorstand"); - public static final Context TARGET_ENTITY_ENDER_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:endercrystal"); + public static final Context TARGET_ENDERPEARL = new Context(ContextKeys.TARGET, "minecraft:ender_pearl"); + public static final Context TARGET_END_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:end_crystal"); public static final Context TARGET_FARMLAND = new Context(ContextKeys.TARGET, "minecraft:farmland"); public static final Context TARGET_FLINTANDSTEEL = new Context(ContextKeys.TARGET, "minecraft:flint_and_steel"); public static final Context TARGET_GRASS= new Context(ContextKeys.TARGET, "minecraft:grass"); public static final Context TARGET_HANGING = new Context(ContextKeys.TARGET, "#hanging"); - public static final Context TARGET_ITEM_ARMOR_STAND = new Context(ContextKeys.TARGET, "minecraft:armor_stand"); - public static final Context TARGET_ITEM_END_CRYSTAL = new Context(ContextKeys.TARGET, "minecraft:end_crystal"); public static final Context TARGET_ITEM_FRAME = new Context(ContextKeys.TARGET, "minecraft:item_frame"); public static final Context TARGET_LAVA_BUCKET = new Context(ContextKeys.TARGET, "minecraft:lava_bucket"); public static final Context TARGET_MINECART = new Context(ContextKeys.TARGET, "minecraft:minecart"); @@ -98,6 +96,7 @@ public class FlagContexts { public static final Context TARGET_TYPE_CROP = new Context(ContextKeys.TARGET, "#crops"); public static final Context TARGET_TYPE_AMBIENT = new Context(ContextKeys.TARGET, "#ambient"); public static final Context TARGET_TYPE_AQUATIC = new Context(ContextKeys.TARGET, "#aquatic"); + public static final Context TARGET_TYPE_FOOD = new Context(ContextKeys.TARGET, "#food"); public static final Context TARGET_TYPE_MONSTER = new Context(ContextKeys.TARGET, "#monster"); public static final Context TARGET_TYPE_MUSHROOM = new Context(ContextKeys.TARGET, "#mushroom"); public static final Context TARGET_TYPE_PORTAL = new Context(ContextKeys.TARGET, "#portal"); diff --git a/sponge/src/main/java/com/griefdefender/permission/flag/GDFlag.java b/sponge/src/main/java/com/griefdefender/permission/flag/GDFlag.java index 02a9d05..9f58a85 100644 --- a/sponge/src/main/java/com/griefdefender/permission/flag/GDFlag.java +++ b/sponge/src/main/java/com/griefdefender/permission/flag/GDFlag.java @@ -88,7 +88,6 @@ public boolean getDefaultClaimTypeValue(ClaimType type) { case "block-place" : case "collide-block" : case "collide-entity" : - case "entity-damage" : case "explosion-block" : case "explosion-entity" : case "interact-block-primary" : @@ -97,7 +96,6 @@ public boolean getDefaultClaimTypeValue(ClaimType type) { case "interact-inventory" : case "liquid-flow" : case "projectile-impact-block" : - case "projectile-impact-entity" : return false; default : return true; diff --git a/sponge/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java b/sponge/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java index 36d6240..dea0f72 100644 --- a/sponge/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java +++ b/sponge/src/main/java/com/griefdefender/registry/FlagDefinitionRegistryModule.java @@ -137,7 +137,7 @@ public void registerDefaults() { flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ITEM_ARMOR_STAND); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); flagData = new ArrayList<>(); flagData.add(flagDataBuilder .reset() @@ -146,7 +146,7 @@ public void registerDefaults() { .build()); flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ENTITY_ARMOR_STAND); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); flagData.add(flagDataBuilder .reset() .flag(Flags.ENTITY_DAMAGE) @@ -219,7 +219,7 @@ public void registerDefaults() { flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ITEM_END_CRYSTAL); + flagContexts.add(FlagContexts.TARGET_END_CRYSTAL); flagData = new ArrayList<>(); flagData.add(flagDataBuilder .reset() @@ -228,7 +228,7 @@ public void registerDefaults() { .build()); flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); - flagContexts.add(FlagContexts.TARGET_ENTITY_ENDER_CRYSTAL); + flagContexts.add(FlagContexts.TARGET_END_CRYSTAL); flagData.add(flagDataBuilder .reset() .flag(Flags.ENTITY_DAMAGE) @@ -251,6 +251,56 @@ public void registerDefaults() { .flagData(flagData) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_ARMOR_STAND); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("entity-armorstand-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_ENTITY_ARMORSTAND_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_ITEM_FRAME); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("entity-itemframe-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_ENTITY_ITEMFRAME_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + this.registerCustomType( definitionBuilder .reset() @@ -508,7 +558,7 @@ public void registerDefaults() { .reset() .name("piston-use") .admin(true) - .context(new Context(ContextKeys.CLAIM, "claim")) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) .defaultValue(Tristate.FALSE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PISTON_USE) .group("admin") @@ -563,6 +613,19 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_PLAYER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -572,11 +635,7 @@ public void registerDefaults() { .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PLAYER_DAMAGE) .group("admin") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .context(FlagContexts.TARGET_PLAYER) - .build()) + .flagData(flagData) .build()); flagContexts = new HashSet<>(); @@ -767,9 +826,46 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.SOURCE_PLAYER); + flagContexts.add(FlagContexts.TARGET_VILLAGER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); + this.registerCustomType( + definitionBuilder + .reset() + .name("player-villager-damage") + .admin(true) + .context(ClaimContexts.USER_DEFAULT_CONTEXT) + .defaultValue(Tristate.FALSE) + .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PLAYER_VILLAGER_DAMAGE) + .group("admin") + .flagData(flagData) + .build()); + flagContexts = new HashSet<>(); flagContexts.add(FlagContexts.SOURCE_PLAYER); flagContexts.add(FlagContexts.TARGET_PLAYER); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -779,11 +875,7 @@ public void registerDefaults() { .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_PVP) .group("admin") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .contexts(flagContexts) - .build()) + .flagData(flagData) .build()); this.registerCustomType( @@ -879,10 +971,10 @@ public void registerDefaults() { this.registerCustomType( definitionBuilder .reset() - .name("wither-entity-break") + .name("wither-entity-damage") .admin(true) .context(ClaimContexts.USER_DEFAULT_CONTEXT) - .defaultValue(Tristate.FALSE) + .defaultValue(Tristate.TRUE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_WITHER_ENTITY_DAMAGE) .group("admin") .flagData(flagDataBuilder @@ -978,6 +1070,19 @@ public void registerDefaults() { .build()) .build()); + flagContexts = new HashSet<>(); + flagContexts.add(FlagContexts.TARGET_TYPE_ANIMAL); + flagData = new ArrayList<>(); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.ENTITY_DAMAGE) + .contexts(flagContexts) + .build()); + flagData.add(flagDataBuilder + .reset() + .flag(Flags.PROJECTILE_IMPACT_ENTITY) + .contexts(flagContexts) + .build()); this.registerCustomType( definitionBuilder .reset() @@ -987,11 +1092,7 @@ public void registerDefaults() { .defaultValue(Tristate.FALSE) .description(MessageCache.getInstance().FLAG_DESCRIPTION_CUSTOM_DAMAGE_ANIMALS) .group("user") - .flagData(flagDataBuilder - .reset() - .flag(Flags.ENTITY_DAMAGE) - .context(FlagContexts.TARGET_TYPE_ANIMAL) - .build()) + .flagData(flagData) .build()); this.registerCustomType( @@ -1011,7 +1112,7 @@ public void registerDefaults() { .build()); definitionContexts = new HashSet<>(); - definitionContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT); + definitionContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT); definitionContexts.add(OWNER_OVERRIDE_CONTEXT); flagData = new ArrayList<>(); flagData.add(flagDataBuilder diff --git a/sponge/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java b/sponge/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java index a0d4fed..012acb3 100644 --- a/sponge/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java +++ b/sponge/src/main/java/com/griefdefender/text/action/GDCallbackHolder.java @@ -88,6 +88,17 @@ public Consumer getCallbackForUUID(UUID id) { return consumer; } + @Nullable + public Consumer getConfirmationForPlayer(Player player) { + Consumer consumer = null; + final UUID callbackUniqueId = confirmConsumerMap.get(player.getUniqueId()); + if (callbackUniqueId != null) { + consumer = reverseMap.remove(callbackUniqueId); + confirmConsumerMap.remove(player.getUniqueId()); + } + return consumer; + } + public String createCallbackRunCommand(Consumer consumer) { return this.createCallbackRunCommand(null, consumer, false); }