From 47e163b20433a3a2da6dd91c506211cf5264a3fb Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 11 Feb 2019 22:52:19 -0500 Subject: [PATCH] Add configurable lang strings for Parties, fixes #673 --- .../quests/listeners/PartiesListener.java | 20 ++++++++++++------- .../quests/prompts/CreateStagePrompt.java | 4 ++-- .../blackvein/quests/prompts/ItemsPrompt.java | 4 ++-- .../blackvein/quests/prompts/MobsPrompt.java | 12 +++++------ .../blackvein/quests/prompts/NPCsPrompt.java | 2 +- src/main/resources/strings.yml | 11 +++++----- 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/main/java/me/blackvein/quests/listeners/PartiesListener.java b/src/main/java/me/blackvein/quests/listeners/PartiesListener.java index 2b7989e46..fb118abcb 100644 --- a/src/main/java/me/blackvein/quests/listeners/PartiesListener.java +++ b/src/main/java/me/blackvein/quests/listeners/PartiesListener.java @@ -2,6 +2,7 @@ package me.blackvein.quests.listeners; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -10,32 +11,37 @@ import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostDelet import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent; import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent; +import me.blackvein.quests.util.Lang; + public class PartiesListener implements Listener { - //TODO add configurable strings @EventHandler public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) { - Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID()).sendMessage(ChatColor.YELLOW + "Players added to this party may perform quests together!"); + Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID()).sendMessage(ChatColor.YELLOW + Lang.get("questPartiesCreate")); } @EventHandler public void onPartyDeleteEvent(BukkitPartiesPartyPostDeleteEvent event) { - Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID()).sendMessage(ChatColor.RED + "The quest party was disbanded."); + Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID()).sendMessage(ChatColor.RED + Lang.get("questPartiesDelete")); } @EventHandler public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) { if (event.isInvited()) { - Bukkit.getServer().getPlayer(event.getInviter()).sendMessage(ChatColor.GREEN + event.getPartyPlayer().getName() + " can now perform quests with you!"); + Player i = Bukkit.getServer().getPlayer(event.getInviter()); + i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("", i.getName())); } - Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()).sendMessage(ChatColor.GREEN + "You can now perform quests with " + event.getParty().getName() + "."); + Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()); + p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("", p.getName())); } @EventHandler public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) { if (event.isKicked()) { - Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID()).sendMessage(ChatColor.RED + event.getPartyPlayer().getName() + " can no longer perform quests with you."); + Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID()); + k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("", k.getName())); } - Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()).sendMessage(ChatColor.RED + "You can no longer perform quests with " + event.getParty().getName() + "."); + Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()); + p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("", p.getName())); } } diff --git a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java index c8d71c7a6..15438a45a 100644 --- a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java @@ -483,8 +483,8 @@ public class CreateStagePrompt extends FixedSetPrompt { String text = ChatColor.GOLD + "- " + Lang.get("stageEditorReachLocs") + " -\n"; if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetLocations") + " (" + Lang.get("noneSet") + ")\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("stageEditorNoLocationsSet") + ")\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("stageEditorNoLocationsSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); } else { diff --git a/src/main/java/me/blackvein/quests/prompts/ItemsPrompt.java b/src/main/java/me/blackvein/quests/prompts/ItemsPrompt.java index 725a04250..e9b48d789 100644 --- a/src/main/java/me/blackvein/quests/prompts/ItemsPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/ItemsPrompt.java @@ -119,8 +119,8 @@ public class ItemsPrompt extends FixedSetPrompt { String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n"; if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetEnchantments") + " (" + Lang.get("noneSet") + ")\n"; - text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("stageEditorNoEnchantmentsSet") + ")\n"; - text += ChatColor.GRAY + "3 - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("stageEditorNoEnchantmentsSet") + ")\n"; + text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n"; + text += ChatColor.GRAY + "3 - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); } else { diff --git a/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java b/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java index 20343602c..d0d03fe00 100644 --- a/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java @@ -126,10 +126,10 @@ public class MobsPrompt extends FixedSetPrompt { String text = ChatColor.GOLD + "- " + Lang.get("stageEditorKillMobs") + " -\n"; if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n"; - text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; + text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); } else { @@ -501,7 +501,7 @@ public class MobsPrompt extends FixedSetPrompt { String text = ChatColor.GOLD + "- " + Lang.get("stageEditorTameMobs") + " -\n"; if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n"; - text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; + text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); } else { @@ -658,7 +658,7 @@ public class MobsPrompt extends FixedSetPrompt { String text = ChatColor.GOLD + "- " + Lang.get("stageEditorShearSheep") + " -\n"; if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n"; - text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("stageEditorNoColorsSet") + ")\n"; + text += ChatColor.GRAY + "2 - " + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); } else { diff --git a/src/main/java/me/blackvein/quests/prompts/NPCsPrompt.java b/src/main/java/me/blackvein/quests/prompts/NPCsPrompt.java index dfec2c966..89d4bd7e7 100644 --- a/src/main/java/me/blackvein/quests/prompts/NPCsPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/NPCsPrompt.java @@ -141,7 +141,7 @@ public class NPCsPrompt extends FixedSetPrompt { if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) { text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n"; - text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("stageEditorNoItemsSet") + ")\n"; + text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n"; if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) { text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n"; } else { diff --git a/src/main/resources/strings.yml b/src/main/resources/strings.yml index 56dbeb4ab..fec4af668 100644 --- a/src/main/resources/strings.yml +++ b/src/main/resources/strings.yml @@ -73,6 +73,12 @@ questEditorEnterNPCStart: "Enter NPC ID, , " questEditorEnterBlockStart: "Right-click on a block to use as a start point, , , " questEditorEnterInitialEvent: "Enter an Event name, , " questRequiredNoneSet: "Required, none set" +questPartiesCreate: "Players added to this party may perform quests together!" +questPartiesDelete: "The quest party was disbanded." +questPartiesInvite: " can now perform quests with you!" +questPartiesJoin: "You can now perform quests with ." +questPartiesKicked: " can no longer perform quests with you." +questPartiesLeave: "You can no longer perform quests with ." questWGSetRegion: "Set Region" questWGNotInstalled: "WorldGuard not installed" questWGPrompt: "Enter WorldGuard region, , " @@ -261,11 +267,6 @@ stageEditorNoKillLocations: "You must set kill locations first!" stageEditorNoBlockSelected: "You must select a block first." stageEditorNoColors: "You must set colors first!" stageEditorNoLocations: "You must set locations first!" -stageEditorNoEnchantmentsSet: "No enchantments set" -stageEditorNoItemsSet: "No items set" -stageEditorNoMobTypesSet: "No mob types set" -stageEditorNoLocationsSet: "No locations set" -stageEditorNoColorsSet: "No colors set" stageEditorListNotSameSize: "The block names list and the amounts list are not the same size!" stageEditorEnchantmentNotSameSize: "The enchantments list, the item id list and the enchant amount list are not the same size!" stageEditorDeliveriesNotSameSize: "The item list and the NPC list are not equal in size!"