Tested locale system and confirmed working.

Made a few minor tweaks and added debug.
This commit is contained in:
tastybento 2017-07-06 08:31:10 -07:00
parent f03b5f5246
commit 0f66b92af5
3 changed files with 53 additions and 61 deletions

View File

@ -37,7 +37,7 @@ general:
errors:
no-permission: "You don't have permission to execute this command."
use-in-game: "This command is only available in game."
# TODO: These are legacy strings and should be converted to a better format but will do for now
acidBottle: "Acid Bottle"
acidBucket: "Acid Bucket"
@ -282,8 +282,6 @@ expel:
notonisland: "Player is not trespassing on your island!"
notyourself: "You cannot expel yourself!"
success: "You expelled [name]!"
general:
success: "Success!"
invite:
errorCantJoinIsland: "You couldn't join the island, maybe it's full."
errorCoolDown: "You can invite that player again in [time] minutes"
@ -308,53 +306,57 @@ island:
cannotTeleport: "You cannot teleport when falling!"
donate: "Welcome to A SkyBlock by tastybento"
donatecolor: "aqua"
errorCouldNotCreateIsland: "Could not create your Island. Please contact a server moderator."
errorInvalidPlayer: "That player is invalid or does not have an island!"
errorLevelNotReady: "Can't use that command right now! Try again in a few seconds."
errorYouDoNotHavePermission: "You do not have permission to use that command!"
helpAcceptReject: "accept or reject an invitation."
helpChallenges: "/challenges: &fshow challenges"
helpColor: "&e"
helpControlPanel: "open the island GUI."
helpExpel: "force a player from your island."
helpInvite: "invite a player to join your island."
helpIsland: "start an island, or teleport to your island."
helpIslandSpawn: "go to spawn."
helpKick: "remove a team player from your island."
helpLeave: "leave another player's island."
helpLevel: "calculate your island level"
helpLevelPlayer: "see another player's island level."
helpLock: "Locks island so visitors cannot enter it"
helpMakeLeader: "transfer the island to <player>."
helpName: "Set a name for your island"
helpResetName: "reset your island name."
helpRestart: "restart your island and remove the old one."
helpSelectLanguage: "Select Language"
helpSetHome: "set your teleport point for /[label]."
helpSettings: "see island protection and game settings"
helpTeam: "view your team information."
helpTeleport: "teleport to your island."
helpTop: "see the top ranked islands."
helpValue: "see island level value of block in hand"
helpWarp: "Warp to <player>'s welcome sign."
helpWarps: "Lists all available welcome-sign warps."
error:
CouldNotCreateIsland: "Could not create your Island. Please contact a server moderator."
InvalidPlayer: "That player is invalid or does not have an island!"
LevelNotReady: "Can't use that command right now! Try again in a few seconds."
YouDoNotHavePermission: "You do not have permission to use that command!"
YouAlreadyHaveAnIsland: "You already have an island!"
help:
AcceptReject: "accept or reject an invitation."
Challenges: "/challenges: &fshow challenges"
Color: "&e"
ControlPanel: "open the island GUI."
Expel: "force a player from your island."
Invite: "invite a player to join your island."
Island: "start an island, or teleport to your island."
IslandSpawn: "go to spawn."
Kick: "remove a team player from your island."
Leave: "leave another player's island."
Level: "calculate your island level"
LevelPlayer: "see another player's island level."
Lock: "Locks island so visitors cannot enter it"
MakeLeader: "transfer the island to <player>."
Name: "Set a name for your island"
ResetName: "reset your island name."
Restart: "restart your island and remove the old one."
SelectLanguage: "Select Language"
SetHome: "set your teleport point for /[label]."
Settings: "see island protection and game settings"
Team: "view your team information."
Teleport: "teleport to your island."
Top: "see the top ranked islands."
Value: "see island level value of block in hand"
Warp: "Warp to <player>'s welcome sign."
Warps: "Lists all available welcome-sign warps."
islandDeletedLifeboats: "Island deleted! Head to the lifeboats!"
islandLevelis: "Island level is"
new: "Creating a new island for you..."
requiredPointsToNextLevel: "You need [points] more points to reach level [next]!"
resetConfirm: "Type /[label] confirm within [seconds] seconds to delete your island and restart!"
resetMustRemovePlayers: "You must remove all players from your island before you can restart it (/[label] kick <player>). See a list of players currently part of your island using /[label] team."
resetNoMore: "No more resets are allowed for your island!"
resetOnlyOwner: "Only the owner may restart this island. Leave this island in order to start your own (/[label] leave)."
resetPleaseWait: "Please wait, generating new island"
resetsLeft: "Resets left"
resetTo: "Cleared reset limit"
resetWait: "You have to wait [time] seconds before you can do that again."
resetYouHave: "You have [number] resets left."
reset:
Confirm: "Type /[label] confirm within [seconds] seconds to delete your island and restart!"
MustRemovePlayers: "You must remove all players from your island before you can restart it (/[label] kick <player>). See a list of players currently part of your island using /[label] team."
NoMore: "No more resets are allowed for your island!"
OnlyOwner: "Only the owner may restart this island. Leave this island in order to start your own (/[label] leave)."
PleaseWait: "Please wait, generating new island"
Left: "Resets left"
To: "Cleared reset limit"
Wait: "You have to wait [time] seconds before you can do that again."
YouHave: "You have [number] resets left."
subtitle: "by tastybento"
subtitlecolor: "blue"
teleport: "Teleporting you to your island. (/[label] help for more info)"
title: "A SkyBlock"
title: "BSkyBlock"
titlecolor: "gold"
unlimited: "Unlimited"
url: ""

View File

@ -62,20 +62,6 @@ public class IslandCommand extends BSBCommand{
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
Util.sendMessage(sender, ChatColor.GOLD + "About " + ChatColor.GREEN + plugin.getDescription().getName() + ChatColor.GOLD + " v" + ChatColor.AQUA + plugin.getDescription().getVersion() + ChatColor.GOLD + ":");
Util.sendMessage(sender, ChatColor.GOLD + "This plugin is free software: you can redistribute");
Util.sendMessage(sender, ChatColor.GOLD + "it and/or modify it under the terms of the GNU");
Util.sendMessage(sender, ChatColor.GOLD + "General Public License as published by the Free");
Util.sendMessage(sender, ChatColor.GOLD + "Software Foundation, either version 3 of the License,");
Util.sendMessage(sender, ChatColor.GOLD + "or (at your option) any later version.");
Util.sendMessage(sender, ChatColor.GOLD + "This plugin is distributed in the hope that it");
Util.sendMessage(sender, ChatColor.GOLD + "will be useful, but WITHOUT ANY WARRANTY; without");
Util.sendMessage(sender, ChatColor.GOLD + "even the implied warranty of MERCHANTABILITY or");
Util.sendMessage(sender, ChatColor.GOLD + "FITNESS FOR A PARTICULAR PURPOSE. See the");
Util.sendMessage(sender, ChatColor.GOLD + "GNU General Public License for more details.");
Util.sendMessage(sender, ChatColor.GOLD + "You should have received a copy of the GNU");
Util.sendMessage(sender, ChatColor.GOLD + "General Public License along with this plugin.");
Util.sendMessage(sender, ChatColor.GOLD + "If not, see <http://www.gnu.org/licenses/>.");
Util.sendMessage(sender, ChatColor.GOLD + "Souce code is available on GitHub.");
Util.sendMessage(sender, ChatColor.GOLD + "(c) 2014 - 2017 by Tastybento & Poslovitch");
}
@ -166,7 +152,7 @@ public class IslandCommand extends BSBCommand{
Schematic schematic = plugin.getSchematics().getSchematic("default");
plugin.getIslands().newIsland(player, schematic);
} else {
player.sendMessage(ChatColor.RED + "You already have an island!");
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).get("island.error.YouAlreadyHaveAnIsland"));
}
}
}

View File

@ -54,15 +54,19 @@ public class BSBLocale {
*/
public String get(String reference) {
// TODO: add placeholder conversion?
plugin.getLogger().info("DEBUG: default lang = " + Settings.defaultLanguage);
plugin.getLogger().info("DEBUG: this locale = " + languageTag);
plugin.getLogger().info("DEBUG: reference = " + reference);
//plugin.getLogger().info("DEBUG: default lang = " + Settings.defaultLanguage);
//plugin.getLogger().info("DEBUG: this locale = " + languageTag);
//plugin.getLogger().info("DEBUG: reference = " + reference);
if (rb.containsKey(reference)) {
//plugin.getLogger().info("DEBUG: contains key");
return ChatColor.translateAlternateColorCodes('&', rb.getString(reference));
} else if (!Settings.defaultLanguage.equals(languageTag)){
//plugin.getLogger().info("DEBUG: try default");
// Try default lang
return plugin.getLocale().get(reference);
}
plugin.getLogger().severe(reference + " not found in " + languageTag + " or default lang " + Settings.defaultLanguage);
plugin.getLogger().info("DEBUG: " + rb.keySet().toString());
return "";
}