From 1429529a634c63002ceaa32efc8b4d1013709065 Mon Sep 17 00:00:00 2001 From: Aleksi Lassila Date: Wed, 21 Oct 2020 23:43:10 +0300 Subject: [PATCH] 4.4.0: LOCALES!!! Messages are now more consistent, simple and they can be modified --- src/config.yml | 15 ++- src/me/aleksilassila/islands/Islands.java | 5 + .../islands/commands/IslandCommands.java | 22 ++-- .../commands/IslandManagmentCommands.java | 10 +- .../islands/commands/TrustCommands.java | 32 ++--- .../subcommands/CreateSubcommand.java | 16 +-- .../subcommands/DeleteSubcommand.java | 10 +- .../commands/subcommands/GiveSubcommand.java | 18 +-- .../commands/subcommands/NameSubcommand.java | 12 +- .../subcommands/RecreateSubcommand.java | 22 ++-- .../commands/subcommands/SaveSubcommand.java | 14 +-- .../subcommands/SetSpawnIslandSubcommand.java | 8 +- .../subcommands/SetSpawnSubcommand.java | 8 +- .../subcommands/UnnameSubcommand.java | 10 +- .../islands/generation/IslandGeneration.java | 20 +-- .../islands/listeners/IslandsListener.java | 6 +- .../islands/utils/ChatUtils.java | 16 ++- .../aleksilassila/islands/utils/Messages.java | 116 ++++++------------ src/messages.properties | 53 ++++++++ src/messages_en.properties | 53 ++++++++ src/plugin.yml | 2 +- 21 files changed, 267 insertions(+), 201 deletions(-) create mode 100644 src/messages.properties create mode 100644 src/messages_en.properties diff --git a/src/config.yml b/src/config.yml index c6641ea..bbf3065 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,3 +1,6 @@ +islandsWorldName: world +wildernessWorldName: wilderness + defaultIslandLimit: 2 groupLimits: # Requires vault to work, all limits can be bypassed with islands.bypass.islandLimit staff: 5 @@ -20,10 +23,6 @@ generation: generationDelayInTicks: 0.3 # 2 Will generate 1 row per 2 ticks, 0.5 will generate 2 rows per 1 tick. maxVariationsPerBiome: 5 # Max locations generated for each biome, lower the value to speed up server startup. -disableMobsOnIslands: true -tpCooldownTime: 10 # /home and /visit cooldown after damage. -illegalIslandNames: # Blocked island names. Useful if you want to reserve name for "official" island -# - spawn biomeBlacklist: # These biomes do not get picked up by island generator. - DEEP_OCEAN # Ocean biomes work poorly with islands. - DEEP_WARM_OCEAN @@ -35,6 +34,10 @@ biomeBlacklist: # These biomes do not get picked up by i - MOUNTAINS - GRAVELLY_MOUNTAINS - MODIFIED_GRAVELLY_MOUNTAINS + +disableMobsOnIslands: true +tpCooldownTime: 10 # /home and /visit cooldown after damage. +illegalIslandNames: # Blocked island names. Useful if you want to reserve name for "official" island +# - spawn wildernessCoordinateMultiplier: 4 # Player's x and z coordinates gets multiplied by this value when they jump to wilderness. -islandsWorldName: world -wildernessWorldName: wilderness +locale: en diff --git a/src/me/aleksilassila/islands/Islands.java b/src/me/aleksilassila/islands/Islands.java index 98ed1d0..172e691 100644 --- a/src/me/aleksilassila/islands/Islands.java +++ b/src/me/aleksilassila/islands/Islands.java @@ -12,6 +12,7 @@ import me.aleksilassila.islands.generation.ShapesLoader; import me.aleksilassila.islands.listeners.IslandsListener; import me.aleksilassila.islands.utils.ConfirmItem; +import me.aleksilassila.islands.utils.Messages; import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.utils.UpdateChecker; import net.milkbowl.vault.permission.Permission; @@ -110,6 +111,8 @@ public void onEnable() { new IslandsListener(this); + Messages.getInstance(this); + int pluginId = 8974; new Metrics(this, pluginId); @@ -394,4 +397,6 @@ private void initBiomesCache() { // - /ContainerTrust etc. // - Fix giant trees cutting off from top. // - API ?? + // - Go through messages + // - Explain game styles? } diff --git a/src/me/aleksilassila/islands/commands/IslandCommands.java b/src/me/aleksilassila/islands/commands/IslandCommands.java index 42b0fc7..7e43dff 100644 --- a/src/me/aleksilassila/islands/commands/IslandCommands.java +++ b/src/me/aleksilassila/islands/commands/IslandCommands.java @@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St plugin.confirmations.remove(player.getUniqueId().toString()); if (!player.hasPermission(Permissions.command.visit)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } @@ -53,7 +53,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St } if (!canTeleport(player) && !player.hasPermission(Permissions.bypass.home)) { - player.sendMessage(Messages.error.COOLDOWN(teleportCooldown(player))); + player.sendMessage(Messages.tl("error.COOLDOWN", teleportCooldown(player))); return true; } @@ -62,7 +62,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St if (islandId != null) { player.teleport(plugin.layout.getIslandSpawn(islandId)); } else { - player.sendMessage(Messages.error.ISLAND_NOT_FOUND); + player.sendMessage(Messages.tl("error.ISLAND_NOT_FOUND")); } return true; @@ -88,28 +88,28 @@ public boolean onCommand(CommandSender sender, Command command, String label, St if (args.length == 1 && args[0].equalsIgnoreCase("list") || label.equalsIgnoreCase("homes")) { if (!player.hasPermission(Permissions.command.listHomes)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } List ids = plugin.layout.getIslandIds(player.getUniqueId()); - player.sendMessage(Messages.success.HOMES_FOUND(ids.size())); + player.sendMessage(Messages.tl("success.HOMES_FOUND", ids.size())); for (String islandId : ids) { String name = plugin.getIslandsConfig().getString(islandId + ".name"); String homeNumber = plugin.getIslandsConfig().getString(islandId + ".home"); - player.sendMessage(ChatColor.AQUA + " - " + name + " (" + homeNumber + ")"); + player.sendMessage(Messages.tl("success.HOME_ITEM", name, homeNumber)); } return true; } else { if (!player.hasPermission(Permissions.command.home)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } if (!canTeleport(player) && !player.hasPermission(Permissions.bypass.home)) { - player.sendMessage(Messages.error.COOLDOWN(teleportCooldown(player))); + player.sendMessage(Messages.tl("error.COOLDOWN", teleportCooldown(player))); return true; } @@ -124,7 +124,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St } if (player.getWorld().getName().equals("world_nether") && !player.hasPermission(Permissions.bypass.home)) { - player.sendMessage(Messages.info.IN_OVERWORLD); + player.sendMessage(Messages.tl("info.IN_OVERWORLD")); return true; } @@ -135,7 +135,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St for (int y = playerLocation.getBlockY(); y < player.getWorld().getHighestBlockYAt(playerLocation); y++) { playerLocation.setY(y); if (player.getWorld().getBlockAt(playerLocation).getBlockData().getMaterial().equals(Material.STONE)) { - player.sendMessage(Messages.info.ON_SURFACE); + player.sendMessage(Messages.tl("info.ON_SURFACE")); return true; } } @@ -154,7 +154,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St if (location != null) { player.teleport(location); } else { - player.sendMessage(Messages.error.HOME_NOT_FOUND); + player.sendMessage(Messages.tl("error.HOME_NOT_FOUND")); } return true; diff --git a/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java b/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java index 9ee4567..d7e29cd 100644 --- a/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java +++ b/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java @@ -47,7 +47,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St Player player = (Player) sender; if (!player.hasPermission(Permissions.command.island)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } @@ -69,13 +69,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St Subcommand target = getSubcommand(args[0]); if (target == null) { - player.sendMessage(Messages.error.SUBCOMMAND_NOT_FOUND); + player.sendMessage(Messages.tl("error.SUBCOMMAND_NOT_FOUND")); sendHelp(player); return true; } if (target.getPermission() != null && !player.hasPermission(target.getPermission())) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } @@ -83,12 +83,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St target.onCommand(player, Arrays.copyOfRange(args, 1, args.length), confirmed); return true; } catch (Exception e) { - player.sendMessage(Messages.error.ERROR); + player.sendMessage(Messages.tl("error.ERROR")); return true; } } - player.sendMessage(Messages.info.VERSION_INFO(plugin.getDescription().getVersion())); + player.sendMessage(Messages.tl("info.VERSION_INFO", plugin.getDescription().getVersion())); return true; } diff --git a/src/me/aleksilassila/islands/commands/TrustCommands.java b/src/me/aleksilassila/islands/commands/TrustCommands.java index 6a9c0d9..ad87683 100644 --- a/src/me/aleksilassila/islands/commands/TrustCommands.java +++ b/src/me/aleksilassila/islands/commands/TrustCommands.java @@ -33,13 +33,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St plugin.confirmations.remove(player.getUniqueId().toString()); if (!player.hasPermission(Permissions.command.untrust)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return true; } @@ -53,25 +53,25 @@ public boolean onCommand(CommandSender sender, Command command, String label, St String islandId = plugin.layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (ownerUUID == null || islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return true; } if (!ownerUUID.equals(player.getUniqueId().toString()) && !player.hasPermission(Permissions.bypass.untrust)) { - player.sendMessage(Messages.error.NOT_OWNED); + player.sendMessage(Messages.tl("error.NOT_OWNED")); return true; } Player targetPlayer = Bukkit.getPlayer(args[0]); if (targetPlayer == null) { - player.sendMessage(Messages.error.PLAYER_NOT_FOUND); + player.sendMessage(Messages.tl("error.PLAYER_NOT_FOUND")); return true; } plugin.layout.removeTrusted(islandId, targetPlayer.getUniqueId().toString()); - player.sendMessage(Messages.success.UNTRUSTED); + player.sendMessage(Messages.tl("success.UNTRUSTED")); return true; } @@ -91,7 +91,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St plugin.confirmations.remove(player.getUniqueId().toString()); if (!player.hasPermission(Permissions.command.trust)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } @@ -104,25 +104,25 @@ public boolean onCommand(CommandSender sender, Command command, String label, St String islandId = plugin.layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (ownerUUID == null || islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return true; } if (!ownerUUID.equals(player.getUniqueId().toString()) && !player.hasPermission(Permissions.bypass.trust)) { - player.sendMessage(Messages.error.NOT_OWNED); + player.sendMessage(Messages.tl("error.NOT_OWNED")); return true; } Player targetPlayer = Bukkit.getPlayer(args[0]); if (targetPlayer == null) { - player.sendMessage(Messages.error.PLAYER_NOT_FOUND); + player.sendMessage(Messages.tl("error.PLAYER_NOT_FOUND")); return true; } plugin.layout.addTrusted(islandId, targetPlayer.getUniqueId().toString()); - player.sendMessage(Messages.success.TRUSTED); + player.sendMessage(Messages.tl("success.TRUSTED")); return true; } @@ -142,7 +142,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St plugin.confirmations.remove(player.getUniqueId().toString()); if (!player.hasPermission(Permissions.command.listTrusted)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return true; } @@ -150,22 +150,22 @@ public boolean onCommand(CommandSender sender, Command command, String label, St String islandId = plugin.layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (ownerUUID == null || islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return true; } if (!ownerUUID.equals(player.getUniqueId().toString()) && !player.hasPermission(Permissions.bypass.listTrusted)) { - player.sendMessage(Messages.error.NOT_OWNED); + player.sendMessage(Messages.tl("error.NOT_OWNED")); return true; } List trustedList = plugin.layout.getTrusted(islandId); - player.sendMessage(Messages.info.TRUSTED_INFO(trustedList.size())); + player.sendMessage(Messages.tl("info.TRUSTED_INFO", trustedList.size())); for (String uuid : trustedList) { Player trustedPlayer = Bukkit.getPlayer(UUID.fromString(uuid)); - if (trustedPlayer != null) player.sendMessage(Messages.info.TRUSTED_PLAYER(trustedPlayer.getDisplayName())); + if (trustedPlayer != null) player.sendMessage(Messages.tl("info.TRUSTED_PLAYER", trustedPlayer.getDisplayName())); } return true; diff --git a/src/me/aleksilassila/islands/commands/subcommands/CreateSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/CreateSubcommand.java index a07fc54..707f89f 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/CreateSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/CreateSubcommand.java @@ -34,12 +34,12 @@ public void onCommand(Player player, String[] args, boolean confirmed) { String permissionRequired = plugin.getCreatePermission(islandSize); if (!player.hasPermission(permissionRequired)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return; } if (islandSize < plugin.getSmallestIslandSize() || islandSize + 4 >= layout.islandSpacing) { - player.sendMessage(Messages.error.INVALID_ISLAND_SIZE); + player.sendMessage(Messages.tl("error.INVALID_ISLAND_SIZE")); return; } @@ -74,19 +74,19 @@ public void onCommand(Player player, String[] args, boolean confirmed) { } if (previousIslands >= islandsLimit && !player.hasPermission(Permissions.bypass.create)) { - player.sendMessage(Messages.error.ISLAND_LIMIT); + player.sendMessage(Messages.tl("error.ISLAND_LIMIT")); return; } Biome targetBiome = utils.getTargetBiome(args[0]); if (targetBiome == null) { - player.sendMessage(Messages.error.NO_BIOME_FOUND); + player.sendMessage(Messages.tl("error.NO_BIOME_FOUND")); return; } if (!availableLocations.containsKey(targetBiome)) { - player.sendMessage(Messages.error.NO_LOCATIONS_FOR_BIOME); + player.sendMessage(Messages.tl("error.NO_LOCATIONS_FOR_BIOME")); return; } @@ -95,17 +95,17 @@ public void onCommand(Player player, String[] args, boolean confirmed) { try { islandId = plugin.createNewIsland(targetBiome, islandSize, player); } catch (IllegalArgumentException e) { - player.sendMessage(Messages.error.NO_LOCATIONS_FOR_BIOME); + player.sendMessage(Messages.tl("error.NO_LOCATIONS_FOR_BIOME")); return; } if (islandId == null) { - player.sendMessage(Messages.error.ONGOING_QUEUE_EVENT); + player.sendMessage(Messages.tl("error.ONGOING_QUEUE_EVENT")); return; } - player.sendTitle(Messages.success.ISLAND_GEN_TITLE, Messages.success.ISLAND_GEN_SUBTITLE, 10, 20 * 7, 10); + player.sendTitle(Messages.tl("success.ISLAND_GEN_TITLE"), Messages.tl("success.ISLAND_GEN_SUBTITLE"), 10, 20 * 7, 10); } @Override diff --git a/src/me/aleksilassila/islands/commands/subcommands/DeleteSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/DeleteSubcommand.java index 325b87e..661da77 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/DeleteSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/DeleteSubcommand.java @@ -21,30 +21,30 @@ public DeleteSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } if (!layout.getUUID(islandId).equals(player.getUniqueId().toString()) && !player.hasPermission(Permissions.bypass.delete)) { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); return; } if (!confirmed) { - player.sendMessage(Messages.info.CONFIRM); + player.sendMessage(Messages.tl("info.CONFIRM")); return; } layout.deleteIsland(islandId); - player.sendMessage(Messages.success.DELETED); + player.sendMessage(Messages.tl("success.DELETED")); } @Override diff --git a/src/me/aleksilassila/islands/commands/subcommands/GiveSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/GiveSubcommand.java index df197c3..33a761f 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/GiveSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/GiveSubcommand.java @@ -23,7 +23,7 @@ public GiveSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } @@ -36,7 +36,7 @@ public void onCommand(Player player, String[] args, boolean confirmed) { String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } ConfigurationSection section = plugin.getIslandsConfig().getConfigurationSection(islandId + ".UUID"); @@ -44,7 +44,7 @@ public void onCommand(Player player, String[] args, boolean confirmed) { || player.hasPermission(Permissions.bypass.give)) { if (plugin.getIslandsConfig().getBoolean(islandId + ".public")) { if (!confirmed) { - player.sendMessage(Messages.info.CONFIRM); + player.sendMessage(Messages.tl("info.CONFIRM")); return; } @@ -52,22 +52,22 @@ public void onCommand(Player player, String[] args, boolean confirmed) { Player targetPlayer = Bukkit.getPlayer(args[0]); if (targetPlayer == null) { - player.sendMessage(Messages.error.NO_PLAYER_FOUND); + player.sendMessage(Messages.tl("error.NO_PLAYER_FOUND")); return; } layout.giveIsland(islandId, targetPlayer); - player.sendMessage(Messages.success.OWNER_CHANGED(args[0])); - targetPlayer.sendMessage(Messages.success.ISLAND_RECEIVED(targetPlayer.getName(), args[0])); + player.sendMessage(Messages.tl("success.OWNER_CHANGED", args[0])); + targetPlayer.sendMessage(Messages.tl("success.ISLAND_RECEIVED", targetPlayer.getName(), args[0])); } else { layout.giveIsland(islandId); - player.sendMessage(Messages.success.OWNER_REMOVED); + player.sendMessage(Messages.tl("success.OWNER_REMOVED")); } } else { - player.sendMessage(Messages.error.NOT_PUBLIC); + player.sendMessage(Messages.tl("error.NOT_PUBLIC")); } } else { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); } } diff --git a/src/me/aleksilassila/islands/commands/subcommands/NameSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/NameSubcommand.java index 2c263a1..d2a2724 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/NameSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/NameSubcommand.java @@ -23,7 +23,7 @@ public NameSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } @@ -35,27 +35,27 @@ public void onCommand(Player player, String[] args, boolean confirmed) { String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } if (layout.getUUID(islandId).equals(player.getUniqueId().toString()) || player.hasPermission(Permissions.bypass.name)) { if (layout.getIslandByName(args[0]) != null) { - player.sendMessage(Messages.error.NAME_TAKEN); + player.sendMessage(Messages.tl("error.NAME_TAKEN")); return; } if (plugin.getConfig().getStringList("illegalIslandNames").contains(args[0])) { - player.sendMessage(Messages.error.NAME_BLOCKED); + player.sendMessage(Messages.tl("error.NAME_BLOCKED")); return; } layout.nameIsland(islandId, args[0]); - player.sendMessage(Messages.success.NAME_CHANGED(args[0])); + player.sendMessage(Messages.tl("success.NAME_CHANGED", args[0])); } else { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); } } diff --git a/src/me/aleksilassila/islands/commands/subcommands/RecreateSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/RecreateSubcommand.java index d539ab6..b8b1ad5 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/RecreateSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/RecreateSubcommand.java @@ -37,17 +37,17 @@ public void onCommand(Player player, String[] args, boolean confirmed) { String permissionRequired = plugin.getCreatePermission(islandSize); if (!player.hasPermission(permissionRequired)) { - player.sendMessage(Messages.error.NO_PERMISSION); + player.sendMessage(Messages.tl("error.NO_PERMISSION")); return; } if (islandSize < plugin.getSmallestIslandSize() || islandSize + 4 >= layout.islandSpacing) { - player.sendMessage(Messages.error.INVALID_ISLAND_SIZE); + player.sendMessage(Messages.tl("error.INVALID_ISLAND_SIZE")); return; } if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } @@ -67,28 +67,28 @@ public void onCommand(Player player, String[] args, boolean confirmed) { islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } else if (!layout.getUUID(islandId).equals(player.getUniqueId().toString()) && !player.hasPermission(Permissions.bypass.recreate)) { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); return; } targetBiome = utils.getTargetBiome(args[0]); if (targetBiome == null) { - player.sendMessage(Messages.error.NO_BIOME_FOUND); + player.sendMessage(Messages.tl("error.NO_BIOME_FOUND")); return; } if (!plugin.islandGeneration.biomes.availableLocations.containsKey(targetBiome)) { - player.sendMessage(Messages.error.NO_LOCATIONS_FOR_BIOME); + player.sendMessage(Messages.tl("error.NO_LOCATIONS_FOR_BIOME")); return; } if (!confirmed) { - player.sendMessage(Messages.info.CONFIRM); + player.sendMessage(Messages.tl("info.CONFIRM")); return; } @@ -96,13 +96,13 @@ public void onCommand(Player player, String[] args, boolean confirmed) { boolean success = plugin.recreateIsland(islandId, targetBiome, islandSize, player); if (!success) { - player.sendMessage(Messages.error.ONGOING_QUEUE_EVENT); + player.sendMessage(Messages.tl("error.ONGOING_QUEUE_EVENT")); return; } - player.sendTitle(Messages.success.ISLAND_GEN_TITLE, Messages.success.ISLAND_GEN_SUBTITLE, 10, 20 * 7, 10); + player.sendTitle(Messages.tl("success.ISLAND_GEN_TITLE"), Messages.tl("success.ISLAND_GEN_SUBTITLE"), 10, 20 * 7, 10); } catch (IllegalArgumentException e) { - player.sendMessage(Messages.error.NO_LOCATIONS_FOR_BIOME); + player.sendMessage(Messages.tl("error.NO_LOCATIONS_FOR_BIOME")); } } diff --git a/src/me/aleksilassila/islands/commands/subcommands/SaveSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/SaveSubcommand.java index d5328f0..f9703f2 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/SaveSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/SaveSubcommand.java @@ -23,14 +23,14 @@ public SaveSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } String islandId = plugin.layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } @@ -63,23 +63,23 @@ public void onCommand(Player player, String[] args, boolean confirmed) { file.getParentFile().mkdirs(); if (file.exists()) { - player.sendMessage(Messages.error.ISLAND_SAVE_ERROR(name)); + player.sendMessage(Messages.tl("error.ISLAND_SAVE_ERROR", name)); return; } file.createNewFile(); } catch (IOException e) { - player.sendMessage(Messages.error.ISLAND_SAVE_ERROR(name)); + player.sendMessage(Messages.tl("error.ISLAND_SAVE_ERROR", name)); return; } if (SaveHandler.saveSchematic(file, plugin.islandsWorld, startX, startY, startZ, islandSize, height)) - player.sendMessage(Messages.success.ISLAND_SAVED(name, islandSize, height)); + player.sendMessage(Messages.tl("success.ISLAND_SAVED", name, islandSize, height)); else - player.sendMessage(Messages.error.ISLAND_SAVE_ERROR(name)); + player.sendMessage(Messages.tl("error.ISLAND_SAVE_ERROR", name)); } else { - player.sendMessage(Messages.error.NO_WORLDEDIT); + player.sendMessage(Messages.tl("error.NO_WORLDEDIT")); } } diff --git a/src/me/aleksilassila/islands/commands/subcommands/SetSpawnIslandSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/SetSpawnIslandSubcommand.java index 6e9ab6c..5c81833 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/SetSpawnIslandSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/SetSpawnIslandSubcommand.java @@ -21,21 +21,21 @@ public SetSpawnIslandSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } if (!layout.setSpawnIsland(islandId)) - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); else - player.sendMessage(Messages.success.SPAWN_ISLAND_CHANGED); + player.sendMessage(Messages.tl("success.SPAWN_ISLAND_CHANGED")); } @Override diff --git a/src/me/aleksilassila/islands/commands/subcommands/SetSpawnSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/SetSpawnSubcommand.java index d959cdd..eb45694 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/SetSpawnSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/SetSpawnSubcommand.java @@ -21,14 +21,14 @@ public SetSpawnSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } @@ -36,9 +36,9 @@ public void onCommand(Player player, String[] args, boolean confirmed) { || player.hasPermission(Permissions.bypass.setSpawn)) { layout.setSpawnPoint(islandId, player.getLocation().getBlockX(), player.getLocation().getBlockZ()); - player.sendMessage(Messages.success.SPAWN_POINT_CHANGED); + player.sendMessage(Messages.tl("success.SPAWN_POINT_CHANGED")); } else { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); } } diff --git a/src/me/aleksilassila/islands/commands/subcommands/UnnameSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/UnnameSubcommand.java index 442ca9b..68a25d6 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/UnnameSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/UnnameSubcommand.java @@ -21,7 +21,7 @@ public UnnameSubcommand(Islands plugin) { @Override public void onCommand(Player player, String[] args, boolean confirmed) { if (!player.getWorld().equals(plugin.islandsWorld)) { - player.sendMessage(Messages.error.WRONG_WORLD); + player.sendMessage(Messages.tl("error.WRONG_WORLD")); return; } @@ -33,13 +33,13 @@ public void onCommand(Player player, String[] args, boolean confirmed) { String islandId = layout.getIslandId(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); if (islandId == null) { - player.sendMessage(Messages.error.NOT_ON_ISLAND); + player.sendMessage(Messages.tl("error.NOT_ON_ISLAND")); return; } if (plugin.getIslandsConfig().getInt(islandId + ".home") <= 0 || plugin.getIslandsConfig().getString(islandId + ".UUID") == null) { - player.sendMessage(Messages.error.ISLAND_NO_OWNER); + player.sendMessage(Messages.tl("error.ISLAND_NO_OWNER")); return; } @@ -47,9 +47,9 @@ public void onCommand(Player player, String[] args, boolean confirmed) { || player.hasPermission(Permissions.bypass.unname)) { layout.unnameIsland(islandId); - player.sendMessage(Messages.success.UNNAMED); + player.sendMessage(Messages.tl("success.UNNAMED")); } else { - player.sendMessage(Messages.error.UNAUTHORIZED); + player.sendMessage(Messages.tl("error.UNAUTHORIZED")); } } diff --git a/src/me/aleksilassila/islands/generation/IslandGeneration.java b/src/me/aleksilassila/islands/generation/IslandGeneration.java index ceac0ad..eb7acbd 100644 --- a/src/me/aleksilassila/islands/generation/IslandGeneration.java +++ b/src/me/aleksilassila/islands/generation/IslandGeneration.java @@ -67,7 +67,7 @@ public void addToQueue(CopyTask task) { popFromQueue(task.player.getUniqueId().toString()); queue.add(task); - task.player.sendMessage(Messages.info.QUEUE_STATUS(queue.size())); + task.player.sendMessage(Messages.tl("info.QUEUE_STATUS", queue.size() - 1)); } @Nullable @@ -152,16 +152,16 @@ public void run() { } if (clearingIndex >= plugin.layout.islandSpacing * plugin.layout.islandSpacing) { - player.sendMessage(Messages.success.CLEARING_DONE); + player.sendMessage(Messages.tl("success.CLEARING_DONE")); shouldClearArea = false; break; } else if (clearingIndex == plugin.layout.islandSpacing * plugin.layout.islandSpacing / 4) { - player.sendMessage(Messages.info.CLEARING_STATUS(25)); + player.sendMessage(Messages.tl("info.CLEARING_STATUS", 25)); } else if (clearingIndex == plugin.layout.islandSpacing * plugin.layout.islandSpacing / 2) { - player.sendMessage(Messages.info.CLEARING_STATUS(50)); + player.sendMessage(Messages.tl("info.CLEARING_STATUS", 50)); } else if (clearingIndex == plugin.layout.islandSpacing * plugin.layout.islandSpacing / 4 * 3) { - player.sendMessage(Messages.info.CLEARING_STATUS(75)); + player.sendMessage(Messages.tl("info.CLEARING_STATUS", 75)); } clearingIndex++; @@ -213,23 +213,23 @@ public void run() { // Update lighting plugin.islandsWorld.getChunkAt(targetX + islandSize / 2, targetZ + islandSize / 2); - player.sendMessage(Messages.success.GENERATION_DONE); + player.sendMessage(Messages.tl("success.GENERATION_DONE")); queue.remove(this); if (queue.size() > 0) { CopyTask nextTask = queue.get(0); nextTask.runTaskTimer(plugin, 0, buildDelay); - nextTask.player.sendMessage(Messages.info.GENERATION_STARTED(nextTask.islandSize * nextTask.islandSize / 20.0)); + nextTask.player.sendMessage(Messages.tl("info.GENERATION_STARTED", nextTask.islandSize * nextTask.islandSize / 20.0)); } this.cancel(); break; } else if (index == islandSize * islandSize / 4) { - player.sendMessage(Messages.info.GENERATION_STATUS(25)); + player.sendMessage(Messages.tl("info.GENERATION_STATUS", 25)); } else if (index == islandSize * islandSize / 2) { - player.sendMessage(Messages.info.GENERATION_STATUS(50)); + player.sendMessage(Messages.tl("info.GENERATION_STATUS", 50)); } else if (index == islandSize * islandSize / 4 * 3) { - player.sendMessage(Messages.info.GENERATION_STATUS(75)); + player.sendMessage(Messages.tl("info.GENERATION_STATUS", 75)); } index++; diff --git a/src/me/aleksilassila/islands/listeners/IslandsListener.java b/src/me/aleksilassila/islands/listeners/IslandsListener.java index b7ff24e..c7746c2 100644 --- a/src/me/aleksilassila/islands/listeners/IslandsListener.java +++ b/src/me/aleksilassila/islands/listeners/IslandsListener.java @@ -137,7 +137,7 @@ public void onEntityDamageEvent(EntityDamageByEntityEvent e) { e.setCancelled(true); - e.getDamager().sendMessage(Messages.error.NOT_TRUSTED); + e.getDamager().sendMessage(Messages.tl("error.NOT_TRUSTED")); } } } @@ -160,7 +160,7 @@ public void onPlayerInteract(PlayerInteractEvent event) { event.setCancelled(true); - event.getPlayer().sendMessage(Messages.error.NOT_TRUSTED); + event.getPlayer().sendMessage(Messages.tl("error.NOT_TRUSTED")); } } } @@ -184,7 +184,7 @@ private void onBlockPlace(BlockPlaceEvent event) { event.setCancelled(true); - if (ownerUUID != null) event.getPlayer().sendMessage(Messages.error.NOT_TRUSTED); + if (ownerUUID != null) event.getPlayer().sendMessage(Messages.tl("error.NOT_TRUSTED")); } } diff --git a/src/me/aleksilassila/islands/utils/ChatUtils.java b/src/me/aleksilassila/islands/utils/ChatUtils.java index 3c17a9b..6196c28 100644 --- a/src/me/aleksilassila/islands/utils/ChatUtils.java +++ b/src/me/aleksilassila/islands/utils/ChatUtils.java @@ -5,15 +5,13 @@ public class ChatUtils { public static String pluginTag = ChatColor.GOLD + "[" + ChatColor.DARK_PURPLE + "Islands" + ChatColor.GOLD + "]" + ChatColor.WHITE + " "; - public static String error(String message) { - return pluginTag + ChatColor.RED + message; - } + public static String generateTag = ChatColor.DARK_AQUA + "[" + ChatColor.DARK_GREEN + "Generation" + ChatColor.DARK_AQUA + "]" + ChatColor.GRAY + " "; - public static String success(String message) { - return pluginTag + ChatColor.GREEN + message; - } + public static String generate(String message) { return generateTag + message; } - public static String info(String message) { - return pluginTag + ChatColor.GRAY + message; - } + public static String error(String message) { return ChatColor.RED + message; } + + public static String success(String message) { return ChatColor.GREEN + message; } + + public static String info(String message) { return ChatColor.GRAY + message; } } diff --git a/src/me/aleksilassila/islands/utils/Messages.java b/src/me/aleksilassila/islands/utils/Messages.java index 7c09a7d..6d5b526 100644 --- a/src/me/aleksilassila/islands/utils/Messages.java +++ b/src/me/aleksilassila/islands/utils/Messages.java @@ -1,106 +1,60 @@ package me.aleksilassila.islands.utils; +import me.aleksilassila.islands.Islands; import me.aleksilassila.islands.commands.Subcommand; import org.bukkit.ChatColor; -public class Messages extends ChatUtils { - public static class error { - public static final String UNAUTHORIZED = error("You don't own this island."); - public static final String NOT_PUBLIC = error("The island must be public"); - public static final String NO_PLAYER_FOUND = error("No given player found."); - public static final String NAME_TAKEN = error("That name is already taken."); - public static final String ONGOING_QUEUE_EVENT = error("Wait for your current queue event to finish."); - public static final String NAME_BLOCKED = error("You can't use that name"); - public static final String NO_PERMISSION = error("You don't have permission to use that command."); - public static final String ISLAND_LIMIT = error("You already have maximum amount of islands."); - public static final String WRONG_WORLD = error("You can't use that command in this world."); - public static final String SUBCOMMAND_NOT_FOUND = error("Invalid subcommand."); - public static final String ERROR = "An internal error occurred. Contact staff."; - public static final String NOT_ON_ISLAND = error("You have to be on an island."); - public static final String NOT_OWNED = error("You don't own this island."); - public static final String PLAYER_NOT_FOUND = error("Player not found."); - public static final String ISLAND_NO_OWNER = error("To make an island private, it must have an owner."); - public static final String NO_BIOME_FOUND = error("Biome not found."); - public static final String NO_LOCATIONS_FOR_BIOME = error("No available locations for specified biome."); - public static final String ISLAND_NOT_FOUND = error("404 - Island not found."); - public static final String HOME_NOT_FOUND = error("404 - Home not found :("); - public static final String NOT_TRUSTED = error("You need owner's permission to interact here."); - public static final String INVALID_ISLAND_SIZE = error("Island size exceeds limits."); - public static final String NO_WORLDEDIT = error("No WorldEdit found."); - - public static String COOLDOWN(int remainingTime) { - return error("You took damage recently. You have to wait for " + remainingTime + "s before teleporting."); - } +import java.text.MessageFormat; +import java.util.Locale; +import java.util.Optional; +import java.util.ResourceBundle; - public static String ISLAND_SAVE_ERROR(String name) { - return error("Could not save " + name + ".schem."); - } +public class Messages extends ChatUtils { + public static Messages instance; + private static Islands plugin; - } + private static ResourceBundle bundle; - public static class success { - public static final String DELETED = success("Island deleted successfully. It will be overwritten when someone creates a new island."); - public static final String UNNAMED = success("Island unnamed and made private."); - public static final String ISLAND_GEN_TITLE = ChatColor.GOLD + "Island generation event queued!"; - public static final String ISLAND_GEN_SUBTITLE = ChatColor.GOLD + "Use /home to access your island."; - public static final String UNTRUSTED = success("Player untrusted!"); - public static final String TRUSTED = success("Player trusted!"); - public static final String SPAWN_POINT_CHANGED = success("Island spawn point changed."); - public static final String OWNER_REMOVED = success("Island owner removed."); - public static final String GENERATION_DONE = success("Island generation completed."); - public static final String CLEARING_DONE = success("Island clearing done."); - public static final String SPAWN_ISLAND_CHANGED = success("Global spawn island changed."); - - public static String OWNER_CHANGED(String name) { - return success("Island owner switched to " + name + "."); - } + static String BUNDLE_NAME = "messages"; - public static String NAME_CHANGED(String name) { - return success("Island name changed to " + name + ". Anyone with your island name can now visit it."); - } + public static Messages getInstance(Islands plugin) { + if (instance == null) { + instance = new Messages(); + Messages.plugin = plugin; - public static String ISLAND_RECEIVED(String playerName, String islandName) { - return success("You are now the owner of " + islandName + " island, previously owned by " + playerName + "."); - } + Locale locale = new Locale(Optional.ofNullable(plugin.getConfig().getString("locale")).orElse("en")); + bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale); - public static String HOMES_FOUND(int amount) { - return success("Found " + amount + " home" + (amount == 1 ? "" : "s") + "."); + plugin.getLogger().info("Using " + locale.getDisplayName() + " locales"); } - public static String ISLAND_SAVED(String name, int width, int height) { - return success("Island saved as " + name + ".schem. (" + width + "x" + height + "x" + width + ")"); - } + return instance; } - public static class info { - public static final String CONFIRM = info("Are you sure? Repeat the command to confirm."); - public static final String ON_SURFACE = info("You can only use this command on surface."); - public static final String IN_OVERWORLD = info("You can only use this command in overworld."); - - public static String TRUSTED_INFO(int numberOfPlayers) { - return info("You have trusted " + numberOfPlayers + " player(s)."); + public static String tl(final String string, final Object... objects) { + if (instance == null) { + return ""; } - public static String TRUSTED_PLAYER(String displayName) { - return ChatColor.GRAY + " - " + displayName; - } + return instance.format(string, objects); + } - public static String GENERATION_STARTED(double time) { - return info("Your generation event has been started. It will take approximately " + (int) time + " seconds."); - } + public String format(final String string, final Object... objects) { + String format = bundle.getString(string); + MessageFormat messageFormat; - public static String QUEUE_STATUS(int queueSize) { - return info("Your event has been added to the queue. There are " + (queueSize - 1) + " event(s) before yours."); + try { + messageFormat = new MessageFormat(format); + } catch (final IllegalArgumentException e) { + plugin.getLogger().severe("Invalid Translation key for '" + string + "': " + e.getMessage()); + format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); + messageFormat = new MessageFormat(format); } - public static String GENERATION_STATUS(int status) { - return info("Your generation event is " + status + "% completed."); - } - - public static String CLEARING_STATUS(int status) { - return info("Clearing event " + status + "% completed."); - } + return messageFormat.format(objects); + } + public static class info { public static String VERSION_INFO(String version) { return info("Islands " + version); } diff --git a/src/messages.properties b/src/messages.properties new file mode 100644 index 0000000..e602ce6 --- /dev/null +++ b/src/messages.properties @@ -0,0 +1,53 @@ +error.UNAUTHORIZED=§7[§4§lError§7] §cYou don't own this island. +error.NOT_PUBLIC=§7[§4§lError§7] §cThe island must be public +error.NO_PLAYER_FOUND=§7[§4§lError§7] §cNo given player found. +error.NAME_TAKEN=§7[§4§lError§7] §cThat name is already taken. +error.ONGOING_QUEUE_EVENT=§7[§4§lError§7] §cWait for your current queue event to finish. +error.NAME_BLOCKED=§7[§4§lError§7] §cYou can't use that name +error.NO_PERMISSION=§7[§4§lError§7] §cYou don't have permission to use that command. +error.ISLAND_LIMIT=§7[§4§lError§7] §cYou already have maximum amount of islands. +error.WRONG_WORLD=§7[§4§lError§7] §cYou can't use that command in this world. +error.SUBCOMMAND_NOT_FOUND=§7[§4§lError§7] §cInvalid subcommand. +error.NOT_OWNED=§7[§4§lError§7] §cYou don't own this island. +error.PLAYER_NOT_FOUND=§7[§4§lError§7] §cPlayer not found. +error.ISLAND_NO_OWNER=§7[§4§lError§7] §cTo make an island private, it must have an owner. +error.NO_BIOME_FOUND=§7[§4§lError§7] §cBiome not found. +error.NOT_ON_ISLAND=§7[§4§lError§7] §cYou have to be on an island. +error.NO_LOCATIONS_FOR_BIOME=§7[§4§lError§7] §cNo available locations for specified biome. +error.ISLAND_NOT_FOUND=§7[§4§lError§7] §c404 - Island not found. +error.HOME_NOT_FOUND=§7[§4§lError§7] §c404 - Home not found :( +error.NOT_TRUSTED=§7[§4§lError§7] §cYou need owner's permission to interact here. +error.INVALID_ISLAND_SIZE=§7[§4§lError§7] §cIsland size exceeds limits. +error.NO_WORLDEDIT=§7[§4§lError§7] §cNo WorldEdit found. +error.ERROR=§7[§4§lError§7] §cAn internal error occurred. Contact staff. +error.COOLDOWN=§7[§4§lError§7] §cYou took damage recently. You have to wait for {0}s before teleporting. +error.ISLAND_SAVE_ERROR=§7[§4§lError§7] §cCould not save {0}.schem. + +success.DELETED=§7[§2§lIslands§7] §aIsland deleted successfully. It will be overwritten when someone creates a new island. +success.UNNAMED=§7[§2§lIslands§7] §aIsland unnamed and made private. +success.UNTRUSTED=§7[§2§lIslands§7] §aPlayer untrusted! +success.TRUSTED=§7[§2§lIslands§7] §aPlayer trusted! +success.SPAWN_POINT_CHANGED=§7[§2§lIslands§7] §aIsland spawn point changed. +success.OWNER_REMOVED=§7[§2§lIslands§7] §aIsland owner removed. +success.SPAWN_ISLAND_CHANGED=§7[§2§lIslands§7] §aGlobal spawn island changed. +success.OWNER_CHANGED=§7[§2§lIslands§7] §aIsland owner switched to {0}. +success.NAME_CHANGED=§7[§2§lIslands§7] §aIsland name changed to {0}. Anyone with your island name can now visit it. +success.ISLAND_RECEIVED=§7[§2§lIslands§7] §aYou are now the owner of {0} island, previously owned by {1}. +success.ISLAND_SAVED=§7[§2§lIslands§7] §aIsland saved as {0}.schem. ({1}x{2}x{1}) +success.GENERATION_DONE=§7[§2§lGeneration§7] §aIsland generation completed. +success.CLEARING_DONE=§7[§2§lGeneration§7] §aIsland clearing done. +success.HOMES_FOUND=§aFound {0} home(s). +success.HOME_ITEM=§7 - §f§l{0}§r§7 ({1}) +success.ISLAND_GEN_TITLE=§6Island generation event queued! +success.ISLAND_GEN_SUBTITLE=§6Use /home to access your island. + +info.CONFIRM=§7Are you sure? Repeat the command to confirm. +info.ON_SURFACE=§7You can only use this command on surface. +info.IN_OVERWORLD=§7You can only use this command in overworld. +info.VERSION_INFO=§7Islands {0} +info.TRUSTED_INFO=§7[§2§lIslands§7] You have trusted {0} player(s). +info.TRUSTED_PLAYER=§7 - {0} +info.GENERATION_STARTED=§7[§2§lGeneration§7] Your generation event has been started. It will take approximately {0} seconds. +info.QUEUE_STATUS=§7[§2§lGeneration§7] Your event has been added to the queue. There are {0} event(s) before yours. +info.GENERATION_STATUS=§7[§2§lGeneration§7] Your generation event is {0}% completed. +info.CLEARING_STATUS=§7[§2§lGeneration§7] Clearing event {0}% completed. diff --git a/src/messages_en.properties b/src/messages_en.properties new file mode 100644 index 0000000..e602ce6 --- /dev/null +++ b/src/messages_en.properties @@ -0,0 +1,53 @@ +error.UNAUTHORIZED=§7[§4§lError§7] §cYou don't own this island. +error.NOT_PUBLIC=§7[§4§lError§7] §cThe island must be public +error.NO_PLAYER_FOUND=§7[§4§lError§7] §cNo given player found. +error.NAME_TAKEN=§7[§4§lError§7] §cThat name is already taken. +error.ONGOING_QUEUE_EVENT=§7[§4§lError§7] §cWait for your current queue event to finish. +error.NAME_BLOCKED=§7[§4§lError§7] §cYou can't use that name +error.NO_PERMISSION=§7[§4§lError§7] §cYou don't have permission to use that command. +error.ISLAND_LIMIT=§7[§4§lError§7] §cYou already have maximum amount of islands. +error.WRONG_WORLD=§7[§4§lError§7] §cYou can't use that command in this world. +error.SUBCOMMAND_NOT_FOUND=§7[§4§lError§7] §cInvalid subcommand. +error.NOT_OWNED=§7[§4§lError§7] §cYou don't own this island. +error.PLAYER_NOT_FOUND=§7[§4§lError§7] §cPlayer not found. +error.ISLAND_NO_OWNER=§7[§4§lError§7] §cTo make an island private, it must have an owner. +error.NO_BIOME_FOUND=§7[§4§lError§7] §cBiome not found. +error.NOT_ON_ISLAND=§7[§4§lError§7] §cYou have to be on an island. +error.NO_LOCATIONS_FOR_BIOME=§7[§4§lError§7] §cNo available locations for specified biome. +error.ISLAND_NOT_FOUND=§7[§4§lError§7] §c404 - Island not found. +error.HOME_NOT_FOUND=§7[§4§lError§7] §c404 - Home not found :( +error.NOT_TRUSTED=§7[§4§lError§7] §cYou need owner's permission to interact here. +error.INVALID_ISLAND_SIZE=§7[§4§lError§7] §cIsland size exceeds limits. +error.NO_WORLDEDIT=§7[§4§lError§7] §cNo WorldEdit found. +error.ERROR=§7[§4§lError§7] §cAn internal error occurred. Contact staff. +error.COOLDOWN=§7[§4§lError§7] §cYou took damage recently. You have to wait for {0}s before teleporting. +error.ISLAND_SAVE_ERROR=§7[§4§lError§7] §cCould not save {0}.schem. + +success.DELETED=§7[§2§lIslands§7] §aIsland deleted successfully. It will be overwritten when someone creates a new island. +success.UNNAMED=§7[§2§lIslands§7] §aIsland unnamed and made private. +success.UNTRUSTED=§7[§2§lIslands§7] §aPlayer untrusted! +success.TRUSTED=§7[§2§lIslands§7] §aPlayer trusted! +success.SPAWN_POINT_CHANGED=§7[§2§lIslands§7] §aIsland spawn point changed. +success.OWNER_REMOVED=§7[§2§lIslands§7] §aIsland owner removed. +success.SPAWN_ISLAND_CHANGED=§7[§2§lIslands§7] §aGlobal spawn island changed. +success.OWNER_CHANGED=§7[§2§lIslands§7] §aIsland owner switched to {0}. +success.NAME_CHANGED=§7[§2§lIslands§7] §aIsland name changed to {0}. Anyone with your island name can now visit it. +success.ISLAND_RECEIVED=§7[§2§lIslands§7] §aYou are now the owner of {0} island, previously owned by {1}. +success.ISLAND_SAVED=§7[§2§lIslands§7] §aIsland saved as {0}.schem. ({1}x{2}x{1}) +success.GENERATION_DONE=§7[§2§lGeneration§7] §aIsland generation completed. +success.CLEARING_DONE=§7[§2§lGeneration§7] §aIsland clearing done. +success.HOMES_FOUND=§aFound {0} home(s). +success.HOME_ITEM=§7 - §f§l{0}§r§7 ({1}) +success.ISLAND_GEN_TITLE=§6Island generation event queued! +success.ISLAND_GEN_SUBTITLE=§6Use /home to access your island. + +info.CONFIRM=§7Are you sure? Repeat the command to confirm. +info.ON_SURFACE=§7You can only use this command on surface. +info.IN_OVERWORLD=§7You can only use this command in overworld. +info.VERSION_INFO=§7Islands {0} +info.TRUSTED_INFO=§7[§2§lIslands§7] You have trusted {0} player(s). +info.TRUSTED_PLAYER=§7 - {0} +info.GENERATION_STARTED=§7[§2§lGeneration§7] Your generation event has been started. It will take approximately {0} seconds. +info.QUEUE_STATUS=§7[§2§lGeneration§7] Your event has been added to the queue. There are {0} event(s) before yours. +info.GENERATION_STATUS=§7[§2§lGeneration§7] Your generation event is {0}% completed. +info.CLEARING_STATUS=§7[§2§lGeneration§7] Clearing event {0}% completed. diff --git a/src/plugin.yml b/src/plugin.yml index 3ba44ab..4b694bc 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,5 +1,5 @@ name: Islands -version: 4.3.0 +version: 4.4.0 author: Aleksi Lassila main: me.aleksilassila.islands.Islands api-version: 1.15