diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 4090bf4da..25e861b35 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -317,7 +317,8 @@ import java.util.zip.ZipInputStream; e.printStackTrace(); } - PlotSquared.log(Captions.PREFIX + Captions.ENABLED.f(IMP.getPluginName())); + PlotSquared.log(Captions.PREFIX + Captions + .format(Captions.ENABLED.getTranslated(), IMP.getPluginName())); } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index 355dbc32a..d3148370c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -218,11 +218,12 @@ public class Auto extends SubCommand { sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + if (!Permissions.hasPermission(player, + Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)); + Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)); return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java index 2c13ee016..a10e83aca 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java @@ -11,7 +11,6 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @@ -59,7 +58,8 @@ public class Claim extends SubCommand { "non-existent: " + schematic); } if (!Permissions - .hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + .hasPermission(player, Captions + .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 8ec105c88..bfe3cc4c9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -40,8 +40,9 @@ public class FlagCmd extends SubCommand { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { key = key.toLowerCase(); value = value.toLowerCase(); - String perm = - Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()); + String perm = Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), + value.toLowerCase()); if (flag instanceof IntegerFlag && MathMan.isInteger(value)) { try { int numeric = Integer.parseInt(value); @@ -52,9 +53,9 @@ public class FlagCmd extends SubCommand { Settings.Limit.MAX_PLOTS; final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric; if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); } return result; } @@ -65,13 +66,14 @@ public class FlagCmd extends SubCommand { final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag; Set parsedBlocks = blockListFlag.parseValue(value); for (final BlockType block : parsedBlocks) { - final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), block.toString().toLowerCase()); + final String permission = Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), block.toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); return false; } } @@ -79,8 +81,9 @@ public class FlagCmd extends SubCommand { } final boolean result = Permissions.hasPermission(player, perm); if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), + value.toLowerCase())); } return result; } @@ -196,11 +199,13 @@ public class FlagCmd extends SubCommand { "/plot flag remove [values]"); return false; } - if (!Permissions.hasPermission(player, - Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) { + if (!Permissions.hasPermission(player, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase()))) { if (args.length != 3) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase())); return false; } for (String entry : args[2].split(",")) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index d8a1f3962..a3d8855ec 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -32,8 +32,10 @@ import java.util.concurrent.CompletableFuture; switch (arg0) { case "add": case "check": - if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) { - Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0)); + if (!Permissions.hasPermission(player, + Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0))) { + Captions.NO_PERMISSION.send(player, + Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0)); return CompletableFuture.completedFuture(false); } if (args.length > 2) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index 2b70e48e5..8230922c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -137,9 +137,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(world)); + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(world)); @@ -161,9 +162,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(world)); + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); @@ -308,9 +310,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(args[0])); + .hasPermission(player, Captions + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0])); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(args[0])); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 8106b81b9..438086b43 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -50,10 +50,11 @@ import java.util.stream.IntStream; for (String component : components) { if (component.equalsIgnoreCase(args[0])) { - if (!Permissions.hasPermission(player, - Captions.PERMISSION_SET_COMPONENT.f(component))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_COMPONENT.f(component)); + if (!Permissions.hasPermission(player, Captions + .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), + component)); return false; } if (args.length < 2) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index 8b746c624..8ec4bee2c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -18,18 +18,20 @@ public abstract class SetCommand extends SubCommand { } if (!plot.hasOwner()) { if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_ADMIN_COMMAND.f(getFullId())); + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } } if (!plot.isOwner(player.getUUID())) { if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_ADMIN_COMMAND.f(getFullId())); + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 4a876314b..be175260b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -774,10 +774,6 @@ public enum Captions { } } - @Deprecated public String f(final Object... args) { - return format(getTranslated(), args); - } - @Override public String toString() { return this.translatedString; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index 84891a1af..059f20559 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -612,7 +612,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (getMeta("teleportOnLogin", true)) { teleport(location); sendMessage( - Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + Captions.format(Captions.TELEPORTED_TO_PLOT.getTranslated()) + + " (quitLoc) (" + plotX + "," + plotZ + ")"); } }); @@ -623,7 +624,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { teleport(location); - sendMessage(Captions.TELEPORTED_TO_PLOT.f() + sendMessage(Captions.format( + Captions.TELEPORTED_TO_PLOT.getTranslated()) + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index 21b06cf9b..da6b4e4e8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -87,7 +87,7 @@ public abstract class EventUtil { .getArea() instanceof SinglePlotArea)) { TaskManager.runTask(() -> plot.teleportPlayer(player)); MainUtil.sendMessage(player, - Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot + Captions.format(Captions.TELEPORTED_TO_ROAD.getTranslated()) + " (on-login) " + "(" + plot.getId().x + ";" + plot .getId().y + ")"); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index 93faabe87..38db9b9f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -81,7 +81,8 @@ import java.util.Map; @NonNull final String key, @NonNull final String block) { final BlockBucket bucket = this.blockToBucket(block); this.setString(section, key, bucket); - PlotSquared.log(Captions.LEGACY_CONFIG_REPLACED.f(block, bucket.toString())); + PlotSquared.log(Captions + .format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString())); } private void convertBlockList(@NonNull final ConfigurationSection section, @@ -89,8 +90,9 @@ import java.util.Map; final BlockState[] blocks = this.splitBlockList(blockList); final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); - PlotSquared.log( - Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString())); + PlotSquared.log(Captions + .format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks), + bucket.toString())); } private String plotBlockArrayString(@NonNull final BlockState[] blocks) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index b224e201a..15abc1bd6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -789,7 +789,9 @@ public class MainUtil { value = df.format(value); } flags.append(prefix) - .append(Captions.PLOT_FLAG_LIST.f(entry.getKey().getName(), value)); + .append(Captions + .format(Captions.PLOT_FLAG_LIST.getTranslated(), entry.getKey().getName(), + value)); prefix = ", "; } }