summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/nbproject/project.properties4
-rw-r--r--Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/Backup.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/DescParseTickFormat.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java45
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsConf.java25
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java29
-rw-r--r--Essentials/src/com/earth2me/essentials/I18n.java31
-rw-r--r--Essentials/src/com/earth2me/essentials/ItemDb.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/Jail.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/JailPlayerListener.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/ManagedFile.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/Mob.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java122
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/Trade.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java29
-rw-r--r--Essentials/src/com/earth2me/essentials/UserData.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/UserMap.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java245
-rw-r--r--Essentials/src/com/earth2me/essentials/Warps.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/Worth.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/api/Economy.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandafk.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandback.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbackup.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbalance.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbanip.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandburn.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandcompass.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddepth.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandessentials.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandext.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgc.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgive.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgod.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandheal.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhelp.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandignore.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditem.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandjump.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkick.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkickall.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkill.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkit.java36
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandlightning.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandlist.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmail.java26
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandme.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmsg.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmute.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnick.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnuke.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpay.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandping.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java24
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandptime.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandr.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrealname.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrepair.java21
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandseen.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsell.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsethome.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawner.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java38
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsudo.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandthunder.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtime.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtop.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpa.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtree.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunban.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandweather.java21
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwhois.java26
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworld.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworth.java51
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Method.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Methods.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Chat.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Commands.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Groups.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/God.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Kit.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java38
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBalance.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBuy.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignFree.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignGameMode.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignHeal.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignMail.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignProtection.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTime.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignWeather.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/TextInput.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/TextPager.java17
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java16
-rw-r--r--Essentials/test/com/earth2me/essentials/StorageTest.java8
-rw-r--r--Essentials/test/com/earth2me/essentials/UtilTest.java18
-rw-r--r--EssentialsChat/nbproject/project.properties2
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java10
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java12
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java3
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java10
-rw-r--r--EssentialsGeoIP/nbproject/project.properties2
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java11
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java25
-rw-r--r--EssentialsGeoIP/src/com/maxmind/geoip/DatabaseInfo.java4
-rw-r--r--EssentialsGeoIP/src/com/maxmind/geoip/LookupService.java4
-rw-r--r--EssentialsProtect/nbproject/project.properties2
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java12
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java15
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java23
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java20
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java4
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java11
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java4
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java9
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java94
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java54
-rw-r--r--EssentialsSpawn/nbproject/project.properties2
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java6
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java2
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java7
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java4
-rw-r--r--EssentialsUpdate/nbproject/project.properties37
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java10
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java9
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java4
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java6
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java4
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java6
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java10
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java5
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java7
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java6
-rwxr-xr-xEssentialsUpdate/src/org/jibble/pircbot/InputThread.java4
-rwxr-xr-xEssentialsUpdate/src/org/jibble/pircbot/OutputThread.java3
-rwxr-xr-xEssentialsUpdate/src/org/jibble/pircbot/PircBot.java13
-rwxr-xr-xEssentialsUpdate/src/org/jibble/pircbot/User.java6
-rw-r--r--EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java1
-rw-r--r--EssentialsXMPP/nbproject/project.properties2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java3
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java15
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java18
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java5
207 files changed, 1246 insertions, 1305 deletions
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index a1d94089e..3710d86d8 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -29,7 +29,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
-auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*;static *
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -38,7 +38,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
-auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateStaticImports=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java
index 1ec545b69..257d9a165 100644
--- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java
@@ -31,7 +31,7 @@ public class AlternativeCommandsHandler
return;
}
final List<Command> commands = PluginCommandYamlParser.parse(plugin);
- final String pluginName = plugin.getDescription().getName().toLowerCase();
+ final String pluginName = plugin.getDescription().getName().toLowerCase(Locale.ENGLISH);
for (Command command : commands)
{
@@ -39,18 +39,18 @@ public class AlternativeCommandsHandler
final List<String> labels = new ArrayList<String>(pc.getAliases());
labels.add(pc.getName());
- PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase());
+ PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH));
if (reg == null)
{
- reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase());
+ reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH));
}
for (String label : labels)
{
- List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase());
+ List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase(Locale.ENGLISH));
if (plugincommands == null)
{
plugincommands = new ArrayList<PluginCommand>();
- altcommands.put(label.toLowerCase(), plugincommands);
+ altcommands.put(label.toLowerCase(Locale.ENGLISH), plugincommands);
}
boolean found = false;
for (PluginCommand pc2 : plugincommands)
diff --git a/Essentials/src/com/earth2me/essentials/Backup.java b/Essentials/src/com/earth2me/essentials/Backup.java
index 1527991b9..ada36c9d7 100644
--- a/Essentials/src/com/earth2me/essentials/Backup.java
+++ b/Essentials/src/com/earth2me/essentials/Backup.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -60,7 +61,7 @@ public class Backup implements Runnable
{
return;
}
- LOGGER.log(Level.INFO, Util.i18n("backupStarted"));
+ LOGGER.log(Level.INFO, _("backupStarted"));
final CommandSender cs = server.getConsoleSender();
server.dispatchCommand(cs, "save-all");
server.dispatchCommand(cs, "save-off");
@@ -68,7 +69,7 @@ public class Backup implements Runnable
ess.scheduleAsyncDelayedTask(
new Runnable()
{
- @Override
+ @Override
public void run()
{
try
@@ -110,7 +111,7 @@ public class Backup implements Runnable
ess.scheduleSyncDelayedTask(
new Runnable()
{
- @Override
+ @Override
public void run()
{
server.dispatchCommand(cs, "save-on");
@@ -123,7 +124,7 @@ public class Backup implements Runnable
}
}
active = false;
- LOGGER.log(Level.INFO, Util.i18n("backupFinished"));
+ LOGGER.log(Level.INFO, _("backupFinished"));
}
});
}
diff --git a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java
index acdfbb291..bf3037e59 100644
--- a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java
+++ b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -71,7 +72,7 @@ public final class DescParseTickFormat
public static long parse(String desc) throws NumberFormatException
{
// Only look at alphanumeric and lowercase and : for 24:00
- desc = desc.toLowerCase().replaceAll("[^A-Za-z0-9:]", "");
+ desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^A-Za-z0-9:]", "");
// Detect ticks format
try
@@ -132,7 +133,7 @@ public final class DescParseTickFormat
throw new NumberFormatException();
}
- desc = desc.toLowerCase().replaceAll("[^0-9]", "");
+ desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", "");
if (desc.length() != 4)
{
@@ -155,7 +156,7 @@ public final class DescParseTickFormat
int hours = 0;
int minutes = 0;
- desc = desc.toLowerCase().replaceAll("[^0-9]", "");
+ desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", "");
if (desc.length() > 4)
{
@@ -184,12 +185,12 @@ public final class DescParseTickFormat
{
throw new NumberFormatException();
}
-
+
if (desc.endsWith("pm") && hours != 12)
{
hours += 12;
}
-
+
if (desc.endsWith("am") && hours == 12)
{
hours -= 12;
@@ -230,7 +231,7 @@ public final class DescParseTickFormat
// --------------------------------------------
public static String format(final long ticks)
{
- return Util.format("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks));
+ return _("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks));
}
public static String formatTicks(final long ticks)
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 4c0783d21..ebdf84af4 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -1,22 +1,23 @@
/*
* Essentials - a bukkit plugin
* Copyright (C) 2011 Essentials Team
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.Economy;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.IEssentialsCommand;
@@ -71,6 +72,7 @@ public class Essentials extends JavaPlugin implements IEssentials
private transient AlternativeCommandsHandler alternativeCommandsHandler;
private transient UserMap userMap;
private transient ExecuteTimer execTimer;
+ private transient I18n i18n;
@Override
public ISettings getSettings()
@@ -89,10 +91,13 @@ public class Essentials extends JavaPlugin implements IEssentials
{
throw new IOException();
}
- LOGGER.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
+ i18n = new I18n(this);
+ i18n.onEnable();
+ LOGGER.log(Level.INFO, _("usingTempFolderForTesting"));
LOGGER.log(Level.INFO, dataFolder.toString());
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
settings = new Settings(this);
+ i18n.updateLocale("en");
userMap = new UserMap(this);
permissionsHandler = new PermissionsHandler(this, false);
Economy.setEss(this);
@@ -103,6 +108,9 @@ public class Essentials extends JavaPlugin implements IEssentials
{
execTimer = new ExecuteTimer();
execTimer.start();
+ i18n = new I18n(this);
+ i18n.onEnable();
+ execTimer.mark("I18n1");
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
upgrade.beforeSettings();
execTimer.mark("Upgrade");
@@ -112,7 +120,7 @@ public class Essentials extends JavaPlugin implements IEssentials
execTimer.mark("Settings");
upgrade.afterSettings();
execTimer.mark("Upgrade2");
- Util.updateLocale(settings.getLocale(), this);
+ i18n.updateLocale(settings.getLocale());
userMap = new UserMap(this);
confList.add(userMap);
execTimer.mark("Init(Usermap)");
@@ -135,7 +143,7 @@ public class Essentials extends JavaPlugin implements IEssentials
if (plugin.getDescription().getName().startsWith("Essentials")
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
{
- LOGGER.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
+ LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
}
}
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
@@ -144,12 +152,12 @@ public class Essentials extends JavaPlugin implements IEssentials
final int versionNumber = Integer.parseInt(versionMatch.group(4));
if (versionNumber < BUKKIT_VERSION)
{
- LOGGER.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
+ LOGGER.log(Level.WARNING, _("notRecommendedBukkit"));
}
}
else
{
- LOGGER.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
+ LOGGER.log(Level.INFO, _("bukkitFormatChanged"));
LOGGER.log(Level.INFO, getServer().getVersion());
LOGGER.log(Level.INFO, getServer().getBukkitVersion());
}
@@ -218,7 +226,7 @@ public class Essentials extends JavaPlugin implements IEssentials
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
Economy.setEss(this);
execTimer.mark("RegListeners");
- LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
+ LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
final String timeroutput = execTimer.end();
if (getSettings().isDebug())
{
@@ -229,6 +237,7 @@ public class Essentials extends JavaPlugin implements IEssentials
@Override
public void onDisable()
{
+ i18n.onDisable();
Economy.setEss(null);
Trade.closeLog();
}
@@ -244,7 +253,7 @@ public class Essentials extends JavaPlugin implements IEssentials
execTimer.mark("Reload(" + iConf.getClass().getSimpleName() + ")");
}
- Util.updateLocale(settings.getLocale(), this);
+ i18n.updateLocale(settings.getLocale());
}
@Override
@@ -282,7 +291,7 @@ public class Essentials extends JavaPlugin implements IEssentials
final List<String> mail = user.getMails();
if (mail != null && !mail.isEmpty())
{
- user.sendMessage(Util.format("youHaveNewMail", mail.size()));
+ user.sendMessage(_("youHaveNewMail", mail.size()));
}
}
@@ -300,16 +309,16 @@ public class Essentials extends JavaPlugin implements IEssentials
}
catch (Exception ex)
{
- sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
- LOGGER.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
+ sender.sendMessage(_("commandNotLoaded", commandLabel));
+ LOGGER.log(Level.SEVERE, _("commandNotLoaded", commandLabel), ex);
return true;
}
// Check authorization
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
{
- LOGGER.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
- user.sendMessage(Util.i18n("noAccessCommand"));
+ LOGGER.log(Level.WARNING, _("deniedAccessCommand", user.getName()));
+ user.sendMessage(_("noAccessCommand"));
return true;
}
@@ -344,7 +353,7 @@ public class Essentials extends JavaPlugin implements IEssentials
}
catch (Throwable ex)
{
- LOGGER.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
+ LOGGER.log(Level.SEVERE, _("commandFailed", commandLabel), ex);
return true;
}
}
@@ -352,8 +361,8 @@ public class Essentials extends JavaPlugin implements IEssentials
@Override
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel)
{
- sender.sendMessage(Util.format("errorWithMessage", exception.getMessage()));
- final LogRecord logRecord = new LogRecord(Level.WARNING, Util.format("errorCallingCommand", commandLabel));
+ sender.sendMessage(_("errorWithMessage", exception.getMessage()));
+ final LogRecord logRecord = new LogRecord(Level.WARNING, _("errorCallingCommand", commandLabel));
logRecord.setThrown(exception);
if (getSettings().isDebug())
{
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
index edd3aad6b..512b9c60a 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
@@ -38,7 +39,7 @@ public class EssentialsConf extends Configuration
{
if (!configFile.getParentFile().mkdirs())
{
- LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
+ LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
}
}
// This will delete files where the first character is 0. In most cases they are broken.
@@ -81,22 +82,22 @@ public class EssentialsConf extends Configuration
{
if (templateName != null)
{
- LOGGER.log(Level.INFO, Util.format("creatingConfigFromTemplate", configFile.toString()));
+ LOGGER.log(Level.INFO, _("creatingConfigFromTemplate", configFile.toString()));
createFromTemplate();
}
else
{
try
{
- LOGGER.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
+ LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
if (!configFile.createNewFile())
{
- LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
+ LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
}
}
catch (IOException ex)
{
- LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex);
+ LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
}
}
}
@@ -126,7 +127,7 @@ public class EssentialsConf extends Configuration
istr = resourceClass.getResourceAsStream(templateName);
if (istr == null)
{
- LOGGER.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
+ LOGGER.log(Level.SEVERE, _("couldNotFindTemplate", templateName));
return;
}
ostr = new FileOutputStream(configFile);
@@ -141,7 +142,7 @@ public class EssentialsConf extends Configuration
}
catch (IOException ex)
{
- LOGGER.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex);
+ LOGGER.log(Level.SEVERE, _("failedToWriteConfig", configFile.toString()), ex);
}
finally
{
@@ -165,7 +166,7 @@ public class EssentialsConf extends Configuration
}
catch (IOException ex)
{
- LOGGER.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex);
+ LOGGER.log(Level.SEVERE, _("failedToCloseConfig", configFile.toString()), ex);
}
}
}
@@ -201,7 +202,7 @@ public class EssentialsConf extends Configuration
final World world = server.getWorld(worldName);
if (world == null)
{
- throw new Exception(Util.i18n("invalidWorld"));
+ throw new Exception(_("invalidWorld"));
}
return new Location(world,
getDouble((path == null ? "" : path + ".") + "x", 0),
@@ -226,8 +227,10 @@ public class EssentialsConf extends Configuration
return new ItemStack(
Material.valueOf(getString(path + ".type", "AIR")),
getInt(path + ".amount", 1),
- (short)getInt(path + ".damage", 0)/*,
- (byte)getInt(path + ".data", 0)*/);
+ (short)getInt(path + ".damage", 0)/*
+ * ,
+ * (byte)getInt(path + ".data", 0)
+ */);
}
public void setProperty(final String path, final ItemStack stack)
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index f1bcd34f2..37c66d2ef 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.entity.Entity;
@@ -77,7 +78,7 @@ public class EssentialsEntityListener extends EntityListener
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
user.setLastLocation();
- user.sendMessage(Util.i18n("backAfterDeath"));
+ user.sendMessage(_("backAfterDeath"));
}
if (!ess.getSettings().areDeathMessagesEnabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index e09eb9679..a4961ac20 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
@@ -8,6 +9,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
@@ -50,8 +52,8 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.isMuted())
{
event.setCancelled(true);
- user.sendMessage(Util.i18n("playerMuted"));
- LOGGER.info(Util.format("mutedUserSpeaks", user.getName()));
+ user.sendMessage(_("playerMuted"));
+ LOGGER.info(_("mutedUserSpeaks", user.getName()));
}
final Iterator<Player> it = event.getRecipients().iterator();
while (it.hasNext())
@@ -136,7 +138,7 @@ public class EssentialsPlayerListener extends PlayerListener
rt.gc();
mem = rt.freeMemory() - mem;
mem /= 1024 * 1024;
- LOGGER.log(Level.INFO, Util.format("freedMemory", mem));
+ LOGGER.log(Level.INFO, _("freedMemory", mem));
}
catch (InterruptedException ex)
{
@@ -184,11 +186,11 @@ public class EssentialsPlayerListener extends PlayerListener
final List<String> mail = user.getMails();
if (mail.isEmpty())
{
- user.sendMessage(Util.i18n("noNewMail"));
+ user.sendMessage(_("noNewMail"));
}
else
{
- user.sendMessage(Util.format("youHaveNewMail", mail.size()));
+ user.sendMessage(_("youHaveNewMail", mail.size()));
}
}
}
@@ -212,13 +214,13 @@ public class EssentialsPlayerListener extends PlayerListener
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
{
final String banReason = user.getBanReason();
- event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : Util.i18n("defaultBanReason"));
+ event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : _("defaultBanReason"));
return;
}
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
{
- event.disallow(Result.KICK_FULL, Util.i18n("serverFull"));
+ event.disallow(Result.KICK_FULL, _("serverFull"));
return;
}
event.allow();
@@ -271,7 +273,7 @@ public class EssentialsPlayerListener extends PlayerListener
{
final User user = ess.getUser(event.getPlayer());
user.setHome();
- user.sendMessage(Util.i18n("homeSetToBed"));
+ user.sendMessage(_("homeSetToBed"));
}
catch (Throwable ex)
{
@@ -365,7 +367,7 @@ public class EssentialsPlayerListener extends PlayerListener
return;
}
final User user = ess.getUser(event.getPlayer());
- final String cmd = event.getMessage().toLowerCase().split(" ")[0].replace("/", "").toLowerCase();
+ final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
final List<String> commands = Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email");
if (commands.contains(cmd))
{
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
index 9127ec61b..9070e25ac 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.math.BigInteger;
import java.security.DigestInputStream;
@@ -67,19 +68,19 @@ public class EssentialsUpgrade
}
catch (Throwable e)
{
- LOGGER.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
+ LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
}
}
private void moveMotdRulesToFile(String name)
{
- if (doneFile.getBoolean("move"+name+"ToFile", false))
+ if (doneFile.getBoolean("move" + name + "ToFile", false))
{
return;
}
try
{
- final File file = new File(ess.getDataFolder(), name+".txt");
+ final File file = new File(ess.getDataFolder(), name + ".txt");
if (file.exists())
{
return;
@@ -106,12 +107,12 @@ public class EssentialsUpgrade
}
writer.close();
}
- doneFile.setProperty("move"+name+"ToFile", true);
+ doneFile.setProperty("move" + name + "ToFile", true);
doneFile.save();
}
catch (Throwable e)
{
- LOGGER.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
+ LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
}
}
@@ -161,11 +162,11 @@ public class EssentialsUpgrade
{
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup"))))
{
- throw new Exception(Util.i18n("configFileMoveError"));
+ throw new Exception(_("configFileMoveError"));
}
if (!tempFile.renameTo(file))
{
- throw new Exception(Util.i18n("configFileRenameError"));
+ throw new Exception(_("configFileRenameError"));
}
}
else
@@ -220,7 +221,7 @@ public class EssentialsUpgrade
((Number)vals.get(3)).floatValue(),
((Number)vals.get(4)).floatValue());
- final String worldName = world.getName().toLowerCase();
+ final String worldName = world.getName().toLowerCase(Locale.ENGLISH);
if (worldName != null && !worldName.isEmpty())
{
config.removeProperty("home");
@@ -347,7 +348,7 @@ public class EssentialsUpgrade
{
continue;
}
- worldName = loc.getWorld().getName().toLowerCase();
+ worldName = loc.getWorld().getName().toLowerCase(Locale.ENGLISH);
if (worldName != null && !worldName.isEmpty())
{
config.setProperty("homes." + worldName, loc);
@@ -493,7 +494,7 @@ public class EssentialsUpgrade
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
{
- throw new Exception(Util.format("fileRenameError", filename));
+ throw new Exception(_("fileRenameError", filename));
}
}
catch (Exception ex)
@@ -541,7 +542,7 @@ public class EssentialsUpgrade
ess.getWarps().setWarp(name, loc);
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
{
- throw new Exception(Util.format("fileRenameError", "warps.txt"));
+ throw new Exception(_("fileRenameError", "warps.txt"));
}
}
}
@@ -585,17 +586,17 @@ public class EssentialsUpgrade
final File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename);
if (!listOfFiles[i].renameTo(tmpFile))
{
- LOGGER.log(Level.WARNING, Util.format("userdataMoveError", filename, sanitizedFilename));
+ LOGGER.log(Level.WARNING, _("userdataMoveError", filename, sanitizedFilename));
continue;
}
if (newFile.exists())
{
- LOGGER.log(Level.WARNING, Util.format("duplicatedUserdata", filename, sanitizedFilename));
+ LOGGER.log(Level.WARNING, _("duplicatedUserdata", filename, sanitizedFilename));
continue;
}
if (!tmpFile.renameTo(newFile))
{
- LOGGER.log(Level.WARNING, Util.format("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
+ LOGGER.log(Level.WARNING, _("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
}
}
doneFile.setProperty("sanitizeAllUserFilenames", true);
diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java
index bef8764b1..9511a0f96 100644
--- a/Essentials/src/com/earth2me/essentials/I18n.java
+++ b/Essentials/src/com/earth2me/essentials/I18n.java
@@ -18,16 +18,30 @@ public class I18n
private static final String MESSAGES = "messages";
private final transient Locale defaultLocale = Locale.getDefault();
private transient Locale currentLocale = defaultLocale;
- private transient ResourceBundle customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
- private transient ResourceBundle localeBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
- private final transient ResourceBundle defaultBundle = ResourceBundle.getBundle(MESSAGES, Locale.ENGLISH);
+ private transient ResourceBundle customBundle;
+ private transient ResourceBundle localeBundle;
+ private final transient ResourceBundle defaultBundle;
private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
+ private final transient IEssentials ess;
- public I18n()
+ public I18n(final IEssentials ess)
+ {
+ this.ess = ess;
+ customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
+ localeBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
+ defaultBundle = ResourceBundle.getBundle(MESSAGES, Locale.ENGLISH);
+ }
+
+ public void onEnable()
{
instance = this;
}
+ public void onDisable()
+ {
+ instance = null;
+ }
+
public Locale getCurrentLocale()
{
return currentLocale;
@@ -77,7 +91,7 @@ public class I18n
return messageFormat.format(objects);
}
- public void updateLocale(final String loc, final IEssentials ess)
+ public void updateLocale(final String loc)
{
if (loc == null || loc.isEmpty())
{
@@ -101,14 +115,9 @@ public class I18n
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
}
- public static String lowerCase(final String input)
- {
- return input == null ? null : input.toLowerCase(Locale.ENGLISH);
- }
-
public static String capitalCase(final String input)
{
- return input == null || input.length() == 0
+ return input == null || input.length() == 0
? input
: input.toUpperCase(Locale.ENGLISH).charAt(0)
+ input.toLowerCase(Locale.ENGLISH).substring(1);
diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java
index e978a312d..cbdca198d 100644
--- a/Essentials/src/com/earth2me/essentials/ItemDb.java
+++ b/Essentials/src/com/earth2me/essentials/ItemDb.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@@ -24,8 +26,9 @@ public class ItemDb implements IConf
public void reloadConfig()
{
final List<String> lines = file.getLines();
-
- if (lines.isEmpty()) {
+
+ if (lines.isEmpty())
+ {
return;
}
@@ -34,7 +37,7 @@ public class ItemDb implements IConf
for (String line : lines)
{
- line = line.trim().toLowerCase();
+ line = line.trim().toLowerCase(Locale.ENGLISH);
if (line.length() > 0 && line.charAt(0) == '#')
{
continue;
@@ -48,14 +51,14 @@ public class ItemDb implements IConf
final int numeric = Integer.parseInt(parts[1]);
- durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
- items.put(parts[0].toLowerCase(), numeric);
+ durabilities.put(parts[0].toLowerCase(Locale.ENGLISH), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
+ items.put(parts[0].toLowerCase(Locale.ENGLISH), numeric);
}
}
public ItemStack get(final String id, final int quantity) throws Exception
{
- final ItemStack retval = get(id.toLowerCase());
+ final ItemStack retval = get(id.toLowerCase(Locale.ENGLISH));
retval.setAmount(quantity);
return retval;
}
@@ -76,12 +79,12 @@ public class ItemDb implements IConf
}
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
{
- itemname = id.split("[:+',;.]")[0].toLowerCase();
+ itemname = id.split("[:+',;.]")[0].toLowerCase(Locale.ENGLISH);
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
}
else
{
- itemname = id.toLowerCase();
+ itemname = id.toLowerCase(Locale.ENGLISH);
}
if (itemname != null)
@@ -101,14 +104,14 @@ public class ItemDb implements IConf
}
else
{
- throw new Exception(Util.format("unknownItemName", id));
+ throw new Exception(_("unknownItemName", id));
}
}
final Material mat = Material.getMaterial(itemid);
if (mat == null)
{
- throw new Exception(Util.format("unknownItemId", itemid));
+ throw new Exception(_("unknownItemId", itemid));
}
final ItemStack retval = new ItemStack(mat);
retval.setAmount(ess.getSettings().getDefaultStackSize());
diff --git a/Essentials/src/com/earth2me/essentials/Jail.java b/Essentials/src/com/earth2me/essentials/Jail.java
index 3ccfcb337..fbbb4376e 100644
--- a/Essentials/src/com/earth2me/essentials/Jail.java
+++ b/Essentials/src/com/earth2me/essentials/Jail.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.List;
+import java.util.Locale;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.event.block.BlockBreakEvent;
@@ -25,18 +27,18 @@ public class Jail extends BlockListener implements IConf
public void setJail(Location loc, String jailName) throws Exception
{
- config.setProperty(jailName.toLowerCase(), loc);
+ config.setProperty(jailName.toLowerCase(Locale.ENGLISH), loc);
config.save();
}
public Location getJail(String jailName) throws Exception
{
- if (jailName == null || config.getProperty(jailName.toLowerCase()) == null)
+ if (jailName == null || config.getProperty(jailName.toLowerCase(Locale.ENGLISH)) == null)
{
- throw new Exception(Util.i18n("jailNotExist"));
+ throw new Exception(_("jailNotExist"));
}
- Location loc = config.getLocation(jailName.toLowerCase(), ess.getServer());
+ Location loc = config.getLocation(jailName.toLowerCase(Locale.ENGLISH), ess.getServer());
return loc;
}
@@ -51,7 +53,7 @@ public class Jail extends BlockListener implements IConf
public void delJail(String jail) throws Exception
{
- config.removeProperty(jail.toLowerCase());
+ config.removeProperty(jail.toLowerCase(Locale.ENGLISH));
config.save();
}
diff --git a/Essentials/src/com/earth2me/essentials/JailPlayerListener.java b/Essentials/src/com/earth2me/essentials/JailPlayerListener.java
index c801780fe..ed632b1ad 100644
--- a/Essentials/src/com/earth2me/essentials/JailPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/JailPlayerListener.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.player.*;
@@ -55,9 +56,9 @@ public class JailPlayerListener extends PlayerListener
}
catch (Exception ex)
{
- LOGGER.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
+ LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
}
- user.sendMessage(Util.i18n("jailMessage"));
+ user.sendMessage(_("jailMessage"));
}
@Override
@@ -72,9 +73,9 @@ public class JailPlayerListener extends PlayerListener
}
catch (Exception ex)
{
- LOGGER.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
+ LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
}
- u.sendMessage(Util.i18n("jailMessage"));
+ u.sendMessage(_("jailMessage"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/ManagedFile.java b/Essentials/src/com/earth2me/essentials/ManagedFile.java
index 9176024ae..a1918fa20 100644
--- a/Essentials/src/com/earth2me/essentials/ManagedFile.java
+++ b/Essentials/src/com/earth2me/essentials/ManagedFile.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.math.BigInteger;
import java.security.DigestInputStream;
@@ -45,7 +46,7 @@ public class ManagedFile
}
catch (IOException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, Util.i18n("itemsCsvNotLoaded"), ex);
+ Bukkit.getLogger().log(Level.SEVERE, _("itemsCsvNotLoaded"), ex);
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java
index b8c7388fd..e9b269218 100644
--- a/Essentials/src/com/earth2me/essentials/Mob.java
+++ b/Essentials/src/com/earth2me/essentials/Mob.java
@@ -1,6 +1,8 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -61,7 +63,7 @@ public enum Mob
{
for (Mob mob : Mob.values())
{
- hashMap.put(mob.name.toLowerCase(), mob);
+ hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob);
}
}
@@ -71,7 +73,7 @@ public enum Mob
final LivingEntity entity = player.getWorld().spawnCreature(loc, this.bukkitType);
if (entity == null)
{
- logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"));
+ logger.log(Level.WARNING, _("unableToSpawnMob"));
throw new MobException();
}
return entity;
@@ -98,7 +100,7 @@ public enum Mob
public static Mob fromName(final String name)
{
- return hashMap.get(name.toLowerCase());
+ return hashMap.get(name.toLowerCase(Locale.ENGLISH));
}
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index d5706e136..d8c871b5b 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.UUID;
import lombok.Delegate;
@@ -27,7 +27,7 @@ public class OfflinePlayer implements Player
private Location location = new Location(null, 0, 0, 0, 0, 0);
private World world;
private UUID uniqueId = UUID.randomUUID();
- @Delegate(types=org.bukkit.OfflinePlayer.class)
+ @Delegate(types = org.bukkit.OfflinePlayer.class)
private final org.bukkit.OfflinePlayer base;
public OfflinePlayer(final String name, final IEssentials ess)
@@ -179,25 +179,25 @@ public class OfflinePlayer implements Player
@Override
public int getRemainingAir()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setRemainingAir(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaximumAir()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setMaximumAir(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
@@ -209,73 +209,73 @@ public class OfflinePlayer implements Player
@Override
public void setSneaking(boolean bln)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void updateInventory()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void chat(String string)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public double getEyeHeight()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public double getEyeHeight(boolean bln)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Block getTargetBlock(HashSet<Byte> hs, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getFireTicks()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaxFireTicks()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setFireTicks(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void remove()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
@@ -286,252 +286,252 @@ public class OfflinePlayer implements Player
public Vector getMomentum()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
public void setMomentum(Vector vector)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setVelocity(Vector vector)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Vector getVelocity()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void damage(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void damage(int i, Entity entity)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Location getEyeLocation()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendRawMessage(String string)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Location getCompassTarget()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaximumNoDamageTicks()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setMaximumNoDamageTicks(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getLastDamage()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setLastDamage(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getNoDamageTicks()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setNoDamageTicks(int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean teleport(Location lctn)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean teleport(Entity entity)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Entity getPassenger()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean setPassenger(Entity entity)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isEmpty()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean eject()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void saveData()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void loadData()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isSleeping()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getSleepTicks()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isDead()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public float getFallDistance()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setFallDistance(float f)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setSleepingIgnored(boolean bln)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isSleepingIgnored()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void awardAchievement(Achievement a)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, Material mtrl)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void playNote(Location lctn, byte b, byte b1)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendBlockChange(Location lctn, Material mtrl, byte b)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendBlockChange(Location lctn, int i, byte b)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setLastDamageCause(EntityDamageEvent ede)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public EntityDamageEvent getLastDamageCause()
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void playEffect(Location lctn, Effect effect, int i)
{
- throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
+ throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
@@ -646,7 +646,7 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
-
+
@Override
public void sendMap(MapView mv)
{
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index d3cc96f73..b004925e6 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -111,7 +113,7 @@ public class Settings implements ISettings
}
return true;
}
- return config.getBoolean("disable-" + label.toLowerCase(), false);
+ return config.getBoolean("disable-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
@@ -131,7 +133,7 @@ public class Settings implements ISettings
}
return true;
}
- return config.getBoolean("restrict-" + label.toLowerCase(), false);
+ return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
@@ -161,7 +163,7 @@ public class Settings implements ISettings
}
return true;
}
- return config.getBoolean("override-" + name.toLowerCase(), false);
+ return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
}
@Override
@@ -360,7 +362,7 @@ public class Settings implements ISettings
}
catch (Exception ex)
{
- logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist"));
+ logger.log(Level.SEVERE, _("unknownItemInList", itemName, "item-spawn-blacklist"));
}
}
return epItemSpwn;
@@ -377,9 +379,8 @@ public class Settings implements ISettings
{
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
}
-
private boolean debug = false;
-
+
@Override
public boolean isDebug()
{
@@ -447,7 +448,7 @@ public class Settings implements ISettings
}
catch (Exception ex)
{
- logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, configName));
+ logger.log(Level.SEVERE, _("unknownItemInList", itemName, configName));
}
}
return list;
@@ -506,13 +507,13 @@ public class Settings implements ISettings
{
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
}
-
+
@Override
public boolean disablePrefix()
{
return config.getBoolean("disablePrefix", false);
}
-
+
@Override
public boolean disableSuffix()
{
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index 8c6b2c671..94371fdde 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import java.util.Calendar;
import java.util.GregorianCalendar;
@@ -93,7 +94,7 @@ public class Teleport implements Runnable
try
{
cooldown(false);
- user.sendMessage(Util.i18n("teleportationCommencing"));
+ user.sendMessage(_("teleportationCommencing"));
try
{
@@ -110,7 +111,7 @@ public class Teleport implements Runnable
}
catch (Exception ex)
{
- user.sendMessage(Util.format("cooldownWithMessage", ex.getMessage()));
+ user.sendMessage(_("cooldownWithMessage", ex.getMessage()));
}
}
}
@@ -130,7 +131,7 @@ public class Teleport implements Runnable
{
Location loc = ess.getWarps().getWarp(warp);
teleport(new Target(loc), chargeFor);
- user.sendMessage(Util.format("warpingTo", warp));
+ user.sendMessage(_("warpingTo", warp));
}
public void cooldown(boolean check) throws Exception
@@ -145,7 +146,7 @@ public class Teleport implements Runnable
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass"))
{
- throw new Exception(Util.format("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
+ throw new Exception(_("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
}
}
// if justCheck is set, don't update lastTeleport; we're just checking
@@ -166,7 +167,7 @@ public class Teleport implements Runnable
ess.getServer().getScheduler().cancelTask(teleTimer);
if (notifyUser)
{
- user.sendMessage(Util.i18n("pendingTeleportCancelled"));
+ user.sendMessage(_("pendingTeleportCancelled"));
}
}
finally
@@ -214,7 +215,7 @@ public class Teleport implements Runnable
Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
- user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
+ user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
initTimer((long)(delay * 1000.0), target, chargeFor);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java
index 69f6478f7..7d2480660 100644
--- a/Essentials/src/com/earth2me/essentials/Trade.java
+++ b/Essentials/src/com/earth2me/essentials/Trade.java
@@ -1,10 +1,12 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -50,13 +52,13 @@ public class Trade
&& getMoney() > 0
&& !user.isAuthorized("essentials.eco.loan"))
{
- throw new ChargeException(Util.i18n("notEnoughMoney"));
+ throw new ChargeException(_("notEnoughMoney"));
}
if (getItemStack() != null
&& !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
{
- throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
+ throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
}
if (command != null && !command.isEmpty()
@@ -66,7 +68,7 @@ public class Trade
&& 0 < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command)
&& !user.isAuthorized("essentials.eco.loan"))
{
- throw new ChargeException(Util.i18n("notEnoughMoney"));
+ throw new ChargeException(_("notEnoughMoney"));
}
}
@@ -108,7 +110,7 @@ public class Trade
final double mon = user.getMoney();
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
{
- throw new ChargeException(Util.i18n("notEnoughMoney"));
+ throw new ChargeException(_("notEnoughMoney"));
}
user.takeMoney(getMoney());
}
@@ -116,7 +118,7 @@ public class Trade
{
if (!InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
{
- throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
+ throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
}
InventoryWorkaround.removeItem(user.getInventory(), true, getItemStack());
user.updateInventory();
@@ -129,7 +131,7 @@ public class Trade
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
{
- throw new ChargeException(Util.i18n("notEnoughMoney"));
+ throw new ChargeException(_("notEnoughMoney"));
}
user.takeMoney(cost);
}
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index 8a5dd3138..7a4534cc7 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.register.payment.Method;
import java.util.Calendar;
@@ -82,7 +83,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
{
- throw new Exception(Util.format("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
+ throw new Exception(_("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
}
}
setLastHealTimestamp(now.getTimeInMillis());
@@ -101,10 +102,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() + value);
- sendMessage(Util.format("addedToAccount", Util.formatCurrency(value, ess)));
+ sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
if (initiator != null)
{
- initiator.sendMessage(Util.format("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
+ initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
}
}
@@ -118,12 +119,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value);
- sendMessage(Util.format("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
- reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
+ sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
+ reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
}
else
{
- throw new Exception(Util.i18n("notEnoughMoney"));
+ throw new Exception(_("notEnoughMoney"));
}
}
@@ -140,10 +141,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() - value);
- sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value, ess)));
+ sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
if (initiator != null)
{
- initiator.sendMessage(Util.format("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
+ initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
}
}
@@ -412,7 +413,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
setJailTimeout(0);
setJailed(false);
- sendMessage(Util.i18n("haveBeenReleased"));
+ sendMessage(_("haveBeenReleased"));
setJail(null);
try
{
@@ -432,7 +433,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
{
setMuteTimeout(0);
- sendMessage(Util.i18n("canTalkAgain"));
+ sendMessage(_("canTalkAgain"));
setMuted(false);
return true;
}
@@ -458,7 +459,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
setAfk(false);
if (broadcast && !isHidden())
{
- ess.broadcastMessage(this, Util.format("userIsNotAway", getDisplayName()));
+ ess.broadcastMessage(this, _("userIsNotAway", getDisplayName()));
}
}
lastActivity = System.currentTimeMillis();
@@ -470,7 +471,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis()
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
{
- final String kickReason = Util.format("autoAfkKickReason", autoafkkick / 60.0);
+ final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
kickPlayer(kickReason);
@@ -479,7 +480,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
final User user = ess.getUser(player);
if (user.isAuthorized("essentials.kick.notify"))
{
- player.sendMessage(Util.format("playerKicked", Console.NAME, getName(), kickReason));
+ player.sendMessage(_("playerKicked", Console.NAME, getName(), kickReason));
}
}
}
@@ -489,7 +490,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
setAfk(true);
if (!isHidden())
{
- ess.broadcastMessage(this, Util.format("userIsAway", getDisplayName()));
+ ess.broadcastMessage(this, _("userIsAway", getDisplayName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java
index 54bb31cdc..404c557ea 100644
--- a/Essentials/src/com/earth2me/essentials/UserData.java
+++ b/Essentials/src/com/earth2me/essentials/UserData.java
@@ -1,10 +1,7 @@
package com.earth2me.essentials;
import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -503,18 +500,18 @@ public abstract class UserData extends PlayerExtension implements IConf
public boolean isIgnoredPlayer(String name)
{
- return ignoredPlayers.contains(name.toLowerCase());
+ return ignoredPlayers.contains(name.toLowerCase(Locale.ENGLISH));
}
public void setIgnoredPlayer(String name, boolean set)
{
if (set)
{
- ignoredPlayers.add(name.toLowerCase());
+ ignoredPlayers.add(name.toLowerCase(Locale.ENGLISH));
}
else
{
- ignoredPlayers.remove(name.toLowerCase());
+ ignoredPlayers.remove(name.toLowerCase(Locale.ENGLISH));
}
setIgnoredPlayers(ignoredPlayers);
}
@@ -669,7 +666,6 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("timestamps.login", time);
config.save();
}
-
private long lastLogout;
private long _getLastLogout()
@@ -688,7 +684,6 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("timestamps.logout", time);
config.save();
}
-
private String lastLoginAddress;
private String _getLastLoginAddress()
@@ -707,7 +702,6 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("ipAddress", address);
config.save();
}
-
private boolean afk;
private boolean getAfk()
@@ -856,13 +850,13 @@ public abstract class UserData extends PlayerExtension implements IConf
public Long getKitTimestamp(final String name)
{
- final Number num = (Number)kitTimestamps.get(name.toLowerCase());
+ final Number num = (Number)kitTimestamps.get(name.toLowerCase(Locale.ENGLISH));
return num == null ? null : num.longValue();
}
public void setKitTimestamp(final String name, final long time)
{
- kitTimestamps.put(name.toLowerCase(), time);
+ kitTimestamps.put(name.toLowerCase(Locale.ENGLISH), time);
config.setProperty("timestamps.kits", kitTimestamps);
config.save();
}
diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java
index dc6d310e6..3de18080a 100644
--- a/Essentials/src/com/earth2me/essentials/UserMap.java
+++ b/Essentials/src/com/earth2me/essentials/UserMap.java
@@ -6,6 +6,7 @@ import com.google.common.cache.CacheLoader;
import com.google.common.collect.ConcurrentHashMultiset;
import java.io.File;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
@@ -47,7 +48,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
continue;
}
final String name = string.substring(0, string.length() - 4);
- keys.add(name.toLowerCase());
+ keys.add(name.toLowerCase(Locale.ENGLISH));
}
}
});
@@ -55,14 +56,14 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public boolean userExists(final String name)
{
- return keys.contains(name.toLowerCase());
+ return keys.contains(name.toLowerCase(Locale.ENGLISH));
}
public User getUser(final String name) throws NullPointerException
{
try
{
- return users.get(name.toLowerCase());
+ return users.get(name.toLowerCase(Locale.ENGLISH));
}
catch (ExecutionException ex)
{
@@ -77,7 +78,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
if (player.getName().equalsIgnoreCase(name))
{
- keys.add(name.toLowerCase());
+ keys.add(name.toLowerCase(Locale.ENGLISH));
return new User(player, ess);
}
}
@@ -85,7 +86,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
final File userFile = new File(userFolder, Util.sanitizeFileName(name) + ".yml");
if (userFile.exists())
{
- keys.add(name.toLowerCase());
+ keys.add(name.toLowerCase(Locale.ENGLISH));
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
@@ -99,8 +100,8 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public void removeUser(final String name)
{
- keys.remove(name.toLowerCase());
- users.invalidate(name.toLowerCase());
+ keys.remove(name.toLowerCase(Locale.ENGLISH));
+ users.invalidate(name.toLowerCase(Locale.ENGLISH));
}
public Set<User> getAllUsers()
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index a710b6240..56a8e0334 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -1,13 +1,9 @@
package com.earth2me.essentials;
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
+import static com.earth2me.essentials.I18n._;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
-import java.text.MessageFormat;
import java.util.*;
-import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -27,7 +23,7 @@ public class Util
public static String sanitizeFileName(String name)
{
- return name.toLowerCase().replaceAll("[^a-z0-9]", "_");
+ return name.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]", "_");
}
public static String formatDateDiff(long date)
@@ -43,7 +39,7 @@ public class Util
boolean future = false;
if (toDate.equals(fromDate))
{
- return Util.i18n("now");
+ return _("now");
}
if (toDate.after(fromDate))
{
@@ -62,18 +58,18 @@ public class Util
};
String[] names = new String[]
{
- Util.i18n("year"),
- Util.i18n("years"),
- Util.i18n("month"),
- Util.i18n("months"),
- Util.i18n("day"),
- Util.i18n("days"),
- Util.i18n("hour"),
- Util.i18n("hours"),
- Util.i18n("minute"),
- Util.i18n("minutes"),
- Util.i18n("second"),
- Util.i18n("seconds")
+ _("year"),
+ _("years"),
+ _("month"),
+ _("months"),
+ _("day"),
+ _("days"),
+ _("hour"),
+ _("hours"),
+ _("minute"),
+ _("minutes"),
+ _("second"),
+ _("seconds")
};
for (int i = 0; i < types.length; i++)
{
@@ -173,7 +169,7 @@ public class Util
}
if (!found)
{
- throw new Exception(Util.i18n("illegalDate"));
+ throw new Exception(_("illegalDate"));
}
Calendar c = new GregorianCalendar();
if (years > 0)
@@ -206,12 +202,12 @@ public class Util
}
return c.getTimeInMillis();
}
-
// The player can stand inside these materials
private static final Set<Integer> AIR_MATERIALS = new HashSet<Integer>();
private static final HashSet<Byte> AIR_MATERIALS_TARGET = new HashSet<Byte>();
-
- static {
+
+ static
+ {
AIR_MATERIALS.add(Material.AIR.getId());
AIR_MATERIALS.add(Material.SAPLING.getId());
AIR_MATERIALS.add(Material.POWERED_RAIL.getId());
@@ -221,7 +217,7 @@ public class Util
AIR_MATERIALS.add(Material.YELLOW_FLOWER.getId());
AIR_MATERIALS.add(Material.RED_ROSE.getId());
AIR_MATERIALS.add(Material.BROWN_MUSHROOM.getId());
- AIR_MATERIALS.add(Material.RED_MUSHROOM.getId());
+ AIR_MATERIALS.add(Material.RED_MUSHROOM.getId());
AIR_MATERIALS.add(Material.TORCH.getId());
AIR_MATERIALS.add(Material.REDSTONE_WIRE.getId());
AIR_MATERIALS.add(Material.SEEDS.getId());
@@ -233,19 +229,19 @@ public class Util
AIR_MATERIALS.add(Material.LEVER.getId());
AIR_MATERIALS.add(Material.STONE_PLATE.getId());
AIR_MATERIALS.add(Material.IRON_DOOR_BLOCK.getId());
- AIR_MATERIALS.add(Material.WOOD_PLATE.getId());
+ AIR_MATERIALS.add(Material.WOOD_PLATE.getId());
AIR_MATERIALS.add(Material.REDSTONE_TORCH_OFF.getId());
AIR_MATERIALS.add(Material.REDSTONE_TORCH_ON.getId());
AIR_MATERIALS.add(Material.STONE_BUTTON.getId());
- AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId());
+ AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId());
AIR_MATERIALS.add(Material.DIODE_BLOCK_OFF.getId());
- AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId());
+ AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId());
AIR_MATERIALS.add(Material.TRAP_DOOR.getId());
AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId());
AIR_MATERIALS.add(Material.MELON_STEM.getId());
AIR_MATERIALS.add(Material.VINE.getId());
//TODO: Add 1.9 materials
-
+
for (Integer integer : AIR_MATERIALS)
{
AIR_MATERIALS_TARGET.add(integer.byteValue());
@@ -253,26 +249,28 @@ public class Util
AIR_MATERIALS_TARGET.add((byte)Material.WATER.getId());
AIR_MATERIALS_TARGET.add((byte)Material.STATIONARY_WATER.getId());
}
-
- public static Location getTarget(final LivingEntity entity) throws Exception {
+
+ public static Location getTarget(final LivingEntity entity) throws Exception
+ {
final Block block = entity.getTargetBlock(AIR_MATERIALS_TARGET, 300);
- if (block == null) {
+ if (block == null)
+ {
throw new Exception("Not targeting a block");
}
return block.getLocation();
}
-
+
public static Location getSafeDestination(final Location loc) throws Exception
{
if (loc == null || loc.getWorld() == null)
{
- throw new Exception(Util.i18n("destinationNotSet"));
+ throw new Exception(_("destinationNotSet"));
}
final World world = loc.getWorld();
int x = loc.getBlockX();
int y = (int)Math.round(loc.getY());
int z = loc.getBlockZ();
-
+
while (isBlockAboveAir(world, x, y, z))
{
y -= 1;
@@ -300,7 +298,7 @@ public class Util
x += 1;
if (x - 32 > loc.getBlockX())
{
- throw new Exception(Util.i18n("holeInFloor"));
+ throw new Exception(_("holeInFloor"));
}
}
}
@@ -349,175 +347,11 @@ public class Util
return Math.round(d * 100.0) / 100.0;
}
- public static Locale getCurrentLocale()
- {
- return currentLocale;
- }
-
-
- private static class ConfigClassLoader extends ClassLoader
- {
- private final transient File dataFolder;
- private final transient ClassLoader cl;
- private final transient IEssentials ess;
-
- public ConfigClassLoader(final ClassLoader cl, final IEssentials ess)
- {
- this.ess = ess;
- this.dataFolder = ess.getDataFolder();
- this.cl = cl;
- }
-
- @Override
- public URL getResource(final String string)
- {
- final File file = new File(dataFolder, string);
- if (file.exists())
- {
- try
- {
- return file.toURI().toURL();
- }
- catch (MalformedURLException ex)
- {
- return cl.getResource(string);
- }
- }
- return cl.getResource(string);
- }
-
- @Override
- public synchronized void clearAssertionStatus()
- {
- cl.clearAssertionStatus();
- }
-
- @Override
- public InputStream getResourceAsStream(final String string)
- {
- final File file = new File(dataFolder, string);
- if (file.exists())
- {
- BufferedReader br = null;
- try
- {
- br = new BufferedReader(new FileReader(file));
- final String version = br.readLine();
-
- if (version == null || !version.equals("#version: " + ess.getDescription().getVersion()))
- {
- logger.log(Level.WARNING, String.format("Translation file %s is not updated for Essentials version. Will use default.", file));
- return cl.getResourceAsStream(string);
- }
- return new FileInputStream(file);
- }
- catch (IOException ex)
- {
- return cl.getResourceAsStream(string);
- }
- finally
- {
- if (br != null)
- {
- try
- {
- br.close();
- }
- catch (IOException ex)
- {
- }
- }
- }
- }
- return cl.getResourceAsStream(string);
- }
-
- @Override
- public Enumeration<URL> getResources(final String string) throws IOException
- {
- return cl.getResources(string);
- }
-
- @Override
- public Class<?> loadClass(final String string) throws ClassNotFoundException
- {
- return cl.loadClass(string);
- }
-
- @Override
- public synchronized void setClassAssertionStatus(final String string, final boolean bln)
- {
- cl.setClassAssertionStatus(string, bln);
- }
-
- @Override
- public synchronized void setDefaultAssertionStatus(final boolean bln)
- {
- cl.setDefaultAssertionStatus(bln);
- }
-
- @Override
- public synchronized void setPackageAssertionStatus(final String string, final boolean bln)
- {
- cl.setPackageAssertionStatus(string, bln);
- }
- }
- private static final Locale defaultLocale = Locale.getDefault();
- private static Locale currentLocale = defaultLocale;
- private static ResourceBundle bundle = ResourceBundle.getBundle("messages", defaultLocale);
- private static ResourceBundle defaultBundle = ResourceBundle.getBundle("messages", Locale.US);
-
- public static String i18n(String string)
- {
- try
- {
- return bundle.getString(string);
- }
- catch (MissingResourceException ex)
- {
- logger.log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), bundle.getLocale().toString()), ex);
- return defaultBundle.getString(string);
- }
- }
-
- public static String format(String string, Object... objects)
- {
- MessageFormat mf = new MessageFormat(i18n(string));
- return mf.format(objects);
- }
-
- public static void updateLocale(String loc, IEssentials ess)
- {
- if (loc == null || loc.isEmpty())
- {
- return;
- }
- String[] parts = loc.split("[_\\.]");
- if (parts.length == 1)
- {
- currentLocale = new Locale(parts[0]);
- }
- if (parts.length == 2)
- {
- currentLocale = new Locale(parts[0], parts[1]);
- }
- if (parts.length == 3)
- {
- currentLocale = new Locale(parts[0], parts[1], parts[2]);
- }
- logger.log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
- bundle = ResourceBundle.getBundle("messages", currentLocale, new ConfigClassLoader(Util.class.getClassLoader(), ess));
- if (!bundle.keySet().containsAll(defaultBundle.keySet()))
- {
- logger.log(Level.WARNING, String.format("Translation file %s does not contain all translation keys.", currentLocale.toString()));
- }
- }
-
public static String joinList(Object... list)
{
return joinList(", ", list);
}
-
+
public static String joinList(String seperator, Object... list)
{
StringBuilder buf = new StringBuilder();
@@ -527,14 +361,14 @@ public class Util
{
buf.append(seperator);
}
-
- if(each instanceof List)
+
+ if (each instanceof List)
{
buf.append(joinList(seperator, ((List)each).toArray()));
}
else
{
- try
+ try
{
buf.append(each.toString());
}
@@ -546,9 +380,4 @@ public class Util
}
return buf.toString();
}
-
- public static String capitalCase(String s)
- {
- return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
- }
}
diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java
index fd532e211..57326b54a 100644
--- a/Essentials/src/com/earth2me/essentials/Warps.java
+++ b/Essentials/src/com/earth2me/essentials/Warps.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
@@ -47,7 +48,7 @@ public class Warps implements IConf
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
if (conf == null)
{
- throw new Exception(Util.i18n("warpNotExist"));
+ throw new Exception(_("warpNotExist"));
}
return conf.getLocation(null, server);
}
@@ -61,7 +62,7 @@ public class Warps implements IConf
File confFile = new File(warpsFolder, filename + ".yml");
if (confFile.exists())
{
- throw new Exception(Util.i18n("similarWarpExist"));
+ throw new Exception(_("similarWarpExist"));
}
conf = new EssentialsConf(confFile);
warpPoints.put(new StringIgnoreCase(name), conf);
@@ -76,11 +77,11 @@ public class Warps implements IConf
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
if (conf == null)
{
- throw new Exception(Util.i18n("warpNotExist"));
+ throw new Exception(_("warpNotExist"));
}
if (!conf.getFile().delete())
{
- throw new Exception(Util.i18n("warpDeleteError"));
+ throw new Exception(_("warpDeleteError"));
}
warpPoints.remove(new StringIgnoreCase(name));
}
@@ -109,7 +110,7 @@ public class Warps implements IConf
}
catch (Exception ex)
{
- logger.log(Level.WARNING, Util.format("loadWarpError", filename), ex);
+ logger.log(Level.WARNING, _("loadWarpError", filename), ex);
}
}
}
@@ -129,7 +130,7 @@ public class Warps implements IConf
@Override
public int hashCode()
{
- return getString().toLowerCase().hashCode();
+ return getString().toLowerCase(Locale.ENGLISH).hashCode();
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/Worth.java b/Essentials/src/com/earth2me/essentials/Worth.java
index e79f22444..b597bd3e8 100644
--- a/Essentials/src/com/earth2me/essentials/Worth.java
+++ b/Essentials/src/com/earth2me/essentials/Worth.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials;
import java.io.File;
+import java.util.Locale;
import java.util.logging.Logger;
import org.bukkit.inventory.ItemStack;
@@ -19,7 +20,7 @@ public class Worth implements IConf
public double getPrice(ItemStack itemStack)
{
- String itemname = itemStack.getType().toString().toLowerCase().replace("_", "");
+ String itemname = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
double result;
result = config.getDouble("worth." + itemname + "." + itemStack.getDurability(), Double.NaN);
if (Double.isNaN(result))
@@ -41,12 +42,12 @@ public class Worth implements IConf
{
if (itemStack.getType().getData() == null)
{
- config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", ""), price);
+ config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), price);
}
else
{
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
- config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", "") + "." + itemStack.getDurability(), price);
+ config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "") + "." + itemStack.getDurability(), price);
}
config.removeProperty("worth-" + itemStack.getTypeId());
config.save();
diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java
index b0a267345..1d45c8df9 100644
--- a/Essentials/src/com/earth2me/essentials/api/Economy.java
+++ b/Essentials/src/com/earth2me/essentials/api/Economy.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.EssentialsConf;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -59,7 +60,7 @@ public final class Economy
{
if (!config.delete())
{
- logger.log(Level.WARNING, Util.format("deleteFileError", config));
+ logger.log(Level.WARNING, _("deleteFileError", config));
}
ess.getUserMap().removeUser(name);
}
diff --git a/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java b/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java
index 8bead2076..f21bf98cc 100644
--- a/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java
+++ b/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java
@@ -1,13 +1,12 @@
package com.earth2me.essentials.api;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
+
public class NoLoanPermittedException extends Exception
{
-
public NoLoanPermittedException()
{
- super(Util.i18n("negativeBalanceError"));
+ super(_("negativeBalanceError"));
}
-
}
diff --git a/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java b/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java
index f48bd0856..531d9ead6 100644
--- a/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java
+++ b/Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java
@@ -1,13 +1,12 @@
package com.earth2me.essentials.api;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
+
public class UserDoesNotExistException extends Exception
{
-
public UserDoesNotExistException(String name)
{
- super(Util.format("userDoesNotExist", name));
+ super(_("userDoesNotExist", name));
}
-
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
index 437318c09..a1c83606c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -33,19 +33,19 @@ public class Commandafk extends EssentialsCommand
{
if (!user.toggleAfk())
{
- //user.sendMessage(Util.i18n("markedAsNotAway"));
+ //user.sendMessage(_("markedAsNotAway"));
if (!user.isHidden())
{
- ess.broadcastMessage(user, Util.format("userIsNotAway", user.getDisplayName()));
+ ess.broadcastMessage(user, _("userIsNotAway", user.getDisplayName()));
}
user.updateActivity(false);
}
else
{
- //user.sendMessage(Util.i18n("markedAsAway"));
+ //user.sendMessage(_("markedAsAway"));
if (!user.isHidden())
{
- ess.broadcastMessage(user, Util.format("userIsAway", user.getDisplayName()));
+ ess.broadcastMessage(user, _("userIsAway", user.getDisplayName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
index fa57f7a29..67698598a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -18,7 +18,7 @@ public class Commandback extends EssentialsCommand
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.sendMessage(Util.i18n("backUsageMsg"));
+ user.sendMessage(_("backUsageMsg"));
user.getTeleport().back(charge);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java
index 3498d6cdf..32c8c9e80 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Backup;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -22,6 +22,6 @@ public class Commandbackup extends EssentialsCommand
throw new Exception();
}
backup.run();
- sender.sendMessage(Util.i18n("backupStarted"));
+ sender.sendMessage(_("backupStarted"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
index 988ec6b7f..58f164ad6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -20,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- sender.sendMessage(Util.format("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
+ sender.sendMessage(_("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
}
@Override
@@ -31,6 +32,6 @@ public class Commandbalance extends EssentialsCommand
|| user.isAuthorized("essentials.balance.other"))
? user
: getPlayer(server, args, 0, true)).getMoney();
- user.sendMessage(Util.format("balance", Util.formatCurrency(bal, ess)));
+ user.sendMessage(_("balance", Util.formatCurrency(bal, ess)));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
index 1a3c7324c..838e27628 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.*;
@@ -49,7 +50,7 @@ public class Commandbalancetop extends EssentialsCommand
}
});
int count = 0;
- sender.sendMessage(Util.format("balanceTop", max));
+ sender.sendMessage(_("balanceTop", max));
for (Map.Entry<User, Double> entry : sortedEntries)
{
if (count == max)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 2091ac4cd..d39419686 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -29,7 +29,7 @@ public class Commandban extends EssentialsCommand
if (sender instanceof Player
&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
{
- sender.sendMessage(Util.i18n("banExempt"));
+ sender.sendMessage(_("banExempt"));
return;
}
}
@@ -37,7 +37,7 @@ public class Commandban extends EssentialsCommand
{
if (user.isAuthorized("essentials.ban.exempt"))
{
- sender.sendMessage(Util.i18n("banExempt"));
+ sender.sendMessage(_("banExempt"));
return;
}
}
@@ -50,7 +50,7 @@ public class Commandban extends EssentialsCommand
}
else
{
- banReason = Util.i18n("defaultBanReason");
+ banReason = _("defaultBanReason");
}
user.setBanned(true);
user.kickPlayer(banReason);
@@ -61,7 +61,7 @@ public class Commandban extends EssentialsCommand
final User player = ess.getUser(onlinePlayer);
if (player.isAuthorized("essentials.ban.notify"))
{
- onlinePlayer.sendMessage(Util.format("playerBanned", senderName, user.getName(), banReason));
+ onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
index 05cd0aa3e..5459bd8fc 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -26,17 +26,17 @@ public class Commandbanip extends EssentialsCommand
if (player == null)
{
ess.getServer().banIP(args[0]);
- sender.sendMessage(Util.i18n("banIpAddress"));
+ sender.sendMessage(_("banIpAddress"));
}
else
{
final String ipAddress = player.getLastLoginAddress();
if (ipAddress.length() == 0)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
ess.getServer().banIP(player.getLastLoginAddress());
- sender.sendMessage(Util.i18n("banIpAddress"));
+ sender.sendMessage(_("banIpAddress"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
index f1dc4c7b4..78d557934 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Location;
@@ -36,11 +37,11 @@ public class Commandbigtree extends EssentialsCommand
final boolean success = user.getWorld().generateTree(safeLocation, tree);
if (success)
{
- user.sendMessage(Util.i18n("bigTreeSuccess"));
+ user.sendMessage(_("bigTreeSuccess"));
}
else
{
- throw new Exception(Util.i18n("bigTreeFailure"));
+ throw new Exception(_("bigTreeFailure"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java
index 258741ad4..95bb967c6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -20,6 +20,6 @@ public class Commandbroadcast extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- ess.broadcastMessage(null, Util.format("broadcast", getFinalArg(args, 0)));
+ ess.broadcastMessage(null, _("broadcast", getFinalArg(args, 0)));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
index 5c35c7486..5d8d38ce7 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,7 +24,7 @@ public class Commandburn extends EssentialsCommand
for (Player p : server.matchPlayer(args[0]))
{
p.setFireTicks(Integer.parseInt(args[1]) * 20);
- sender.sendMessage(Util.format("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
+ sender.sendMessage(_("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
index a60f8960f..ef2502b9b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -31,11 +31,11 @@ public class Commandclearinventory extends EssentialsCommand
for (Player p : online)
{
p.getInventory().clear();
- user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
+ user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
return;
}
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
else
{
@@ -43,18 +43,18 @@ public class Commandclearinventory extends EssentialsCommand
if (p != null)
{
p.getInventory().clear();
- user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
+ user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
else
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
}
}
else
{
user.getInventory().clear();
- user.sendMessage(Util.i18n("inventoryCleared"));
+ user.sendMessage(_("inventoryCleared"));
}
}
@@ -75,11 +75,11 @@ public class Commandclearinventory extends EssentialsCommand
for (Player p : online)
{
p.getInventory().clear();
- sender.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
+ sender.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
return;
}
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
else
{
@@ -87,11 +87,11 @@ public class Commandclearinventory extends EssentialsCommand
if (u != null)
{
u.getInventory().clear();
- sender.sendMessage(Util.format("inventoryClearedOthers", u.getDisplayName()));
+ sender.sendMessage(_("inventoryClearedOthers", u.getDisplayName()));
}
else
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
index 31cfea6a0..25f8c34f6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -53,6 +53,6 @@ public class Commandcompass extends EssentialsCommand
{
dir = "N";
}
- user.sendMessage(Util.format("compassBearing", dir, bearing));
+ user.sendMessage(_("compassBearing", dir, bearing));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
index a213c4f0e..0e8918d9e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -38,7 +39,7 @@ public class Commanddelhome extends EssentialsCommand
}
name = expandedArgs[0];
}
- user.delHome(name.toLowerCase());
- sender.sendMessage(Util.format("deleteHome", name));
+ user.delHome(name.toLowerCase(Locale.ENGLISH));
+ sender.sendMessage(_("deleteHome", name));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java
index ebede7e00..5b8e5d720 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -20,6 +20,6 @@ public class Commanddeljail extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
ess.getJail().delJail(args[0]);
- sender.sendMessage(Util.format("deleteJail", args[0]));
+ sender.sendMessage(_("deleteJail", args[0]));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java
index 115637827..5eab72b33 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -20,6 +20,6 @@ public class Commanddelwarp extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
ess.getWarps().delWarp(args[0]);
- sender.sendMessage(Util.format("deleteWarp", args[0]));
+ sender.sendMessage(_("deleteWarp", args[0]));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java b/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java
index f6de7c674..6c4fa2647 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -18,15 +18,15 @@ public class Commanddepth extends EssentialsCommand
final int depth = user.getLocation().getBlockY() - 63;
if (depth > 0)
{
- user.sendMessage(Util.format("depthAboveSea", depth));
+ user.sendMessage(_("depthAboveSea", depth));
}
else if (depth < 0)
{
- user.sendMessage(Util.format("depthBelowSea", (-depth)));
+ user.sendMessage(_("depthBelowSea", (-depth)));
}
else
{
- user.sendMessage(Util.i18n("depth"));
+ user.sendMessage(_("depth"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
index 88524020d..cc541299d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
@@ -108,7 +108,7 @@ public class Commandessentials extends EssentialsCommand
return;
}
ess.reload();
- sender.sendMessage(Util.format("essentialsReload", ess.getDescription().getVersion()));
+ sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion()));
}
private void stopTune()
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java
index 44a464430..3855e7b68 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -31,7 +31,7 @@ public class Commandext extends EssentialsCommand
if (args.length < 1)
{
user.setFireTicks(0);
- user.sendMessage(Util.i18n("extinguish"));
+ user.sendMessage(_("extinguish"));
return;
}
@@ -43,7 +43,7 @@ public class Commandext extends EssentialsCommand
for (Player matchPlayer : server.matchPlayer(name))
{
matchPlayer.setFireTicks(0);
- sender.sendMessage(Util.format("extinguishOthers", matchPlayer.getDisplayName()));
+ sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
index f8cfdf81c..821692464 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.GameMode;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -36,7 +37,7 @@ public class Commandgamemode extends EssentialsCommand
}
user.setGameMode(user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
- user.sendMessage(Util.format("gameMode", Util.i18n(user.getGameMode().toString().toLowerCase()), user.getDisplayName()));
+ user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
}
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String name)
@@ -50,9 +51,7 @@ public class Commandgamemode extends EssentialsCommand
}
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
- sender.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
+ sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
}
}
-
-
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java
index 24de3b04c..9429bc5a8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -16,16 +16,16 @@ public class Commandgc extends EssentialsCommand
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
- sender.sendMessage(Util.format("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
- sender.sendMessage(Util.format("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
- sender.sendMessage(Util.format("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
-
+ sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
+ sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
+ sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
+
for (World w : server.getWorlds())
{
sender.sendMessage(
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
- + w.getLoadedChunks().length + Util.i18n("gcchunks")
- + w.getEntities().size() + Util.i18n("gcentities"));
+ + w.getLoadedChunks().length + _("gcchunks")
+ + w.getEntities().size() + _("gcentities"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
index 0bf45d900..ebda30dd5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
+import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Server;
@@ -27,7 +28,7 @@ public class Commandgive extends EssentialsCommand
final ItemStack stack = ess.getItemDb().get(args[1]);
- final String itemname = stack.getType().toString().toLowerCase().replace("_", "");
+ final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (sender instanceof Player
&& (ess.getSettings().permissionBasedItemSpawn()
? (!ess.getUser(sender).isAuthorized("essentials.give.item-all")
@@ -49,7 +50,7 @@ public class Commandgive extends EssentialsCommand
}
final User giveTo = getPlayer(server, args, 0);
- final String itemName = stack.getType().toString().toLowerCase().replace('_', ' ');
+ final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
giveTo.getInventory().addItem(stack);
giveTo.updateInventory();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java
index 67f8b4086..9506e48b5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -34,7 +34,7 @@ public class Commandgod extends EssentialsCommand
return;
}
- user.sendMessage(Util.format("godMode", (user.toggleGodModeEnabled()? Util.i18n("enabled") : Util.i18n("disabled"))));
+ user.sendMessage(_("godMode", (user.toggleGodModeEnabled() ? _("enabled") : _("disabled"))));
}
private void godOtherPlayers(final Server server, final CommandSender sender, final String name)
@@ -47,8 +47,8 @@ public class Commandgod extends EssentialsCommand
continue;
}
final boolean enabled = player.toggleGodModeEnabled();
- player.sendMessage(Util.format("godMode", (enabled ? Util.i18n("enabled") : Util.i18n("disabled"))));
- sender.sendMessage(Util.format("godMode",Util.format(enabled ? "godEnabledFor": "godDisabledFor", matchPlayer.getDisplayName())));
+ player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled"))));
+ sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName())));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
index 89962b01d..02b8ed30c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -35,7 +35,7 @@ public class Commandheal extends EssentialsCommand
}
user.setHealth(20);
user.setFoodLevel(20);
- user.sendMessage(Util.i18n("heal"));
+ user.sendMessage(_("heal"));
}
@Override
@@ -54,7 +54,7 @@ public class Commandheal extends EssentialsCommand
final List<Player> players = server.matchPlayer(name);
if (players.isEmpty())
{
- sender.sendMessage(Util.i18n("playerNotFound"));
+ sender.sendMessage(_("playerNotFound"));
return;
}
for (Player p : players)
@@ -64,7 +64,7 @@ public class Commandheal extends EssentialsCommand
continue;
}
p.setHealth(20);
- sender.sendMessage(Util.format("healOther", p.getDisplayName()));
+ sender.sendMessage(_("healOther", p.getDisplayName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
index 6420bb196..3ee7d9804 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.BufferedReader;
@@ -8,6 +9,7 @@ import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.bukkit.Server;
@@ -40,7 +42,7 @@ public class Commandhelp extends EssentialsCommand
{
if (args.length > 0)
{
- match = args[0].toLowerCase();
+ match = args[0].toLowerCase(Locale.ENGLISH);
page = Integer.parseInt(args[args.length - 1]);
if (args.length == 1)
{
@@ -53,20 +55,20 @@ public class Commandhelp extends EssentialsCommand
{
if (args.length == 1)
{
- match = args[0].toLowerCase();
+ match = args[0].toLowerCase(Locale.ENGLISH);
}
}
final List<String> lines = getHelpLines(user, match);
if (lines.isEmpty())
{
- throw new Exception(Util.i18n("noHelpFound"));
+ throw new Exception(_("noHelpFound"));
}
final int start = (page - 1) * 9;
final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
- user.sendMessage(Util.format("helpPages", page, pages));
+ user.sendMessage(_("helpPages", page, pages));
for (int i = start; i < lines.size() && i < start + 9; i++)
{
user.sendMessage(lines.get(i));
@@ -76,7 +78,7 @@ public class Commandhelp extends EssentialsCommand
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
- sender.sendMessage(Util.i18n("helpConsole"));
+ sender.sendMessage(_("helpConsole"));
}
@SuppressWarnings("CallToThreadDumpStack")
@@ -101,7 +103,8 @@ public class Commandhelp extends EssentialsCommand
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
- if (line == null) {
+ if (line == null)
+ {
break;
}
retval.add(line.replace('&', '§'));
@@ -122,15 +125,15 @@ public class Commandhelp extends EssentialsCommand
{
final PluginDescriptionFile desc = p.getDescription();
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
- pluginName = p.getDescription().getName().toLowerCase();
+ pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH);
for (Entry<String, HashMap<String, Object>> k : cmds.entrySet())
{
try
{
if ((!match.equalsIgnoreCase(""))
- && (!k.getKey().toLowerCase().contains(match))
+ && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match))
&& (!(k.getValue().get(DESCRIPTION) instanceof String
- && ((String)k.getValue().get(DESCRIPTION)).toLowerCase().contains(match)))
+ && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match)))
&& (!pluginName.contains(match)))
{
continue;
@@ -223,7 +226,7 @@ public class Commandhelp extends EssentialsCommand
{
if (!reported)
{
- logger.log(Level.WARNING, Util.format("commandHelpFailedForPlugin", pluginName), ex);
+ logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginName), ex);
}
reported = true;
continue;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
index 2f92f07d3..f558a1b52 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@@ -22,7 +22,7 @@ public class Commandhelpop extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final String message = Util.format("helpOp", user.getDisplayName(), getFinalArg(args, 0));
+ final String message = _("helpOp", user.getDisplayName(), getFinalArg(args, 0));
logger.log(Level.INFO, message);
for (Player onlinePlayer : server.getOnlinePlayers())
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index e6bbddbd4..1c0591bee 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
+import java.util.Locale;
import org.bukkit.Server;
@@ -40,7 +42,7 @@ public class Commandhome extends EssentialsCommand
}
try
{
- user.getTeleport().home(player, homeName.toLowerCase(), charge);
+ user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge);
}
catch (NotEnoughArgumentsException e)
{
@@ -51,7 +53,7 @@ public class Commandhome extends EssentialsCommand
}
else if (homes.isEmpty())
{
- throw new Exception(player == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer"));
+ throw new Exception(player == user ? _("noHomeSet") : _("noHomeSetPlayer"));
}
else if (homes.size() == 1 && player.equals(user))
{
@@ -59,7 +61,7 @@ public class Commandhome extends EssentialsCommand
}
else
{
- user.sendMessage(Util.format("homes", Util.joinList(homes)));
+ user.sendMessage(_("homes", Util.joinList(homes)));
}
}
throw new NoChargeException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
index 57c68105a..93dd029a8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
@@ -1,13 +1,12 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
public class Commandignore extends EssentialsCommand
{
-
public Commandignore()
{
super("ignore");
@@ -25,25 +24,24 @@ public class Commandignore extends EssentialsCommand
{
player = getPlayer(server, args, 0);
}
- catch(NoSuchFieldException ex)
+ catch (NoSuchFieldException ex)
{
player = ess.getOfflineUser(args[0]);
}
if (player == null)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
final String name = player.getName();
- if (user.isIgnoredPlayer(name)) {
+ if (user.isIgnoredPlayer(name))
+ {
user.setIgnoredPlayer(name, false);
- user.sendMessage(Util.format("unignorePlayer", player.getName()));
+ user.sendMessage(_("unignorePlayer", player.getName()));
}
else
{
user.setIgnoredPlayer(name, true);
- user.sendMessage(Util.format("ignorePlayer", player.getName()));
+ user.sendMessage(_("ignorePlayer", player.getName()));
}
}
-
-
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
index 0decb00bf..1f5c32faa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.Arrays;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -31,7 +31,7 @@ public class Commandinvsee extends EssentialsCommand
{
invUser.getInventory().setContents(user.getSavedInventory());
user.setSavedInventory(null);
- user.sendMessage(Util.i18n("invRestored"));
+ user.sendMessage(_("invRestored"));
throw new NoChargeException();
}
@@ -41,15 +41,17 @@ public class Commandinvsee extends EssentialsCommand
}
ItemStack[] invUserStack = invUser.getInventory().getContents();
final int userStackLength = user.getInventory().getContents().length;
- if (invUserStack.length < userStackLength) {
+ if (invUserStack.length < userStackLength)
+ {
invUserStack = Arrays.copyOf(invUserStack, userStackLength);
}
- if (invUserStack.length > userStackLength) {
- throw new Exception(Util.i18n("invBigger"));
+ if (invUserStack.length > userStackLength)
+ {
+ throw new Exception(_("invBigger"));
}
user.getInventory().setContents(invUserStack);
- user.sendMessage(Util.format("invSee", invUser.getDisplayName()));
- user.sendMessage(Util.i18n("invSeeHelp"));
+ user.sendMessage(_("invSee", invUser.getDisplayName()));
+ user.sendMessage(_("invSeeHelp"));
throw new NoChargeException();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
index 35b3c09ae..3bd35353a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -23,7 +24,7 @@ public class Commanditem extends EssentialsCommand
}
final ItemStack stack = ess.getItemDb().get(args[0]);
- final String itemname = stack.getType().toString().toLowerCase().replace("_", "");
+ final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn()
? (!user.isAuthorized("essentials.itemspawn.item-all")
&& !user.isAuthorized("essentials.itemspawn.item-" + itemname)
@@ -31,7 +32,7 @@ public class Commanditem extends EssentialsCommand
: (!user.isAuthorized("essentials.itemspawn.exempt")
&& !user.canSpawnItem(stack.getTypeId())))
{
- throw new Exception(Util.format("cantSpawnItem", itemname));
+ throw new Exception(_("cantSpawnItem", itemname));
}
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
@@ -41,11 +42,11 @@ public class Commanditem extends EssentialsCommand
if (stack.getType() == Material.AIR)
{
- throw new Exception(Util.format("cantSpawnItem", "Air"));
+ throw new Exception(_("cantSpawnItem", "Air"));
}
- final String displayName = stack.getType().toString().toLowerCase().replace('_', ' ');
- user.sendMessage(Util.format("itemSpawn", stack.getAmount(), displayName));
+ final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
+ user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
user.getInventory().addItem(stack);
user.updateInventory();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
index 41648a14f..93ce45fd4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.TargetBlock;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -34,7 +34,7 @@ public class Commandjump extends EssentialsCommand
}
catch (NullPointerException ex)
{
- throw new Exception(Util.i18n("jumpError"), ex);
+ throw new Exception(_("jumpError"), ex);
}
final Trade charge = new Trade(this.getName(), ess);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
index 5e54424aa..ae5db48fb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -26,18 +26,18 @@ public class Commandkick extends EssentialsCommand
final User user = getPlayer(server, args, 0);
if (user.isAuthorized("essentials.kick.exempt"))
{
- throw new Exception(Util.i18n("kickExempt"));
+ throw new Exception(_("kickExempt"));
}
- final String kickReason = args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault");
+ final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
user.kickPlayer(kickReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
- for(Player onlinePlayer : server.getOnlinePlayers())
+ for (Player onlinePlayer : server.getOnlinePlayers())
{
User player = ess.getUser(onlinePlayer);
- if(player.isAuthorized("essentials.kick.notify"))
+ if (player.isAuthorized("essentials.kick.notify"))
{
- onlinePlayer.sendMessage(Util.format("playerKicked", senderName, user.getName(), kickReason));
+ onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
index bc294fe71..6d97b6af9 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,7 +24,7 @@ public class Commandkickall extends EssentialsCommand
}
else
{
- onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : Util.i18n("kickDefault"));
+ onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : _("kickDefault"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
index 5f7650aed..e56f9d67b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -32,7 +32,7 @@ public class Commandkill extends EssentialsCommand
}
matchPlayer.setHealth(0);
- sender.sendMessage(Util.format("kill", matchPlayer.getDisplayName()));
+ sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
index 31515b1e7..f1aad4394 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -27,36 +28,36 @@ public class Commandkit extends EssentialsCommand
final StringBuilder list = new StringBuilder();
for (String kiteItem : kits.keySet())
{
- if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase()))
+ if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
{
list.append(" ").append(kiteItem);
}
}
if (list.length() > 0)
{
- user.sendMessage(Util.format("kits", list.toString()));
+ user.sendMessage(_("kits", list.toString()));
}
else
{
- user.sendMessage(Util.i18n("noKits"));
+ user.sendMessage(_("noKits"));
}
}
catch (Exception ex)
{
- user.sendMessage(Util.i18n("kitError"));
+ user.sendMessage(_("kitError"));
}
}
else
{
try
{
- final String kitName = args[0].toLowerCase();
+ final String kitName = args[0].toLowerCase(Locale.ENGLISH);
final Object kit = ess.getSettings().getKit(kitName);
List<String> items;
if (!user.isAuthorized("essentials.kit." + kitName))
{
- user.sendMessage(Util.format("noKitPermission", "essentials.kit." + kitName));
+ user.sendMessage(_("noKitPermission", "essentials.kit." + kitName));
return;
}
@@ -69,20 +70,23 @@ public class Commandkit extends EssentialsCommand
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
final Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, -(int)delay);
- c.add(Calendar.MILLISECOND, -(int)((delay*1000.0)%1000.0));
+ c.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
final long mintime = c.getTimeInMillis();
final Long lastTime = user.getKitTimestamp(kitName);
- if (lastTime == null || lastTime < mintime) {
+ if (lastTime == null || lastTime < mintime)
+ {
final Calendar now = new GregorianCalendar();
user.setKitTimestamp(kitName, now.getTimeInMillis());
- } else {
+ }
+ else
+ {
final Calendar future = new GregorianCalendar();
future.setTimeInMillis(lastTime);
future.add(Calendar.SECOND, (int)delay);
- future.add(Calendar.MILLISECOND, (int)((delay*1000.0)%1000.0));
- user.sendMessage(Util.format("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
+ future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
+ user.sendMessage(_("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
return;
}
}
@@ -109,7 +113,7 @@ public class Commandkit extends EssentialsCommand
final int id = Material.getMaterial(Integer.parseInt(parts[0])).getId();
final int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
final short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
- final HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
+ final HashMap<Integer, ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
for (ItemStack itemStack : overfilled.values())
{
user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
@@ -118,7 +122,7 @@ public class Commandkit extends EssentialsCommand
}
if (spew)
{
- user.sendMessage(Util.i18n("kitInvFull"));
+ user.sendMessage(_("kitInvFull"));
}
try
{
@@ -128,12 +132,12 @@ public class Commandkit extends EssentialsCommand
{
user.sendMessage(ex.getMessage());
}
- user.sendMessage(Util.format("kitGive", kitName));
+ user.sendMessage(_("kitGive", kitName));
}
catch (Exception ex)
{
- user.sendMessage(Util.i18n("kitError2"));
- user.sendMessage(Util.i18n("kitErrorHelp"));
+ user.sendMessage(_("kitError2"));
+ user.sendMessage(_("kitErrorHelp"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java
index d2cc53b77..582f048a1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -31,19 +31,20 @@ public class Commandlightning extends EssentialsCommand
if (server.matchPlayer(args[0]).isEmpty())
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
for (Player matchPlayer : server.matchPlayer(args[0]))
{
- sender.sendMessage(Util.format("lightningUse", matchPlayer.getDisplayName()));
+ sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation());
- if (!ess.getUser(matchPlayer).isGodModeEnabled()) {
+ if (!ess.getUser(matchPlayer).isGodModeEnabled())
+ {
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
}
if (ess.getSettings().warnOnSmite())
{
- matchPlayer.sendMessage(Util.i18n("lightningSmited"));
+ matchPlayer.sendMessage(_("lightningSmited"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
index feb92719d..549f6efac 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.*;
import org.bukkit.ChatColor;
import org.bukkit.Server;
@@ -117,7 +117,7 @@ public class Commandlist extends EssentialsCommand
Collections.sort(users);
final StringBuilder onlineUsers = new StringBuilder();
- onlineUsers.append(Util.i18n("connectedPlayers"));
+ onlineUsers.append(_("connectedPlayers"));
boolean first = true;
for (User user : users)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
index 3914c5a5d..d02e5a13a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Server;
@@ -25,21 +25,21 @@ public class Commandmail extends EssentialsCommand
final List<String> mail = user.getMails();
if (mail.isEmpty())
{
- user.sendMessage(Util.i18n("noMail"));
+ user.sendMessage(_("noMail"));
throw new NoChargeException();
}
for (String messages : mail)
{
user.sendMessage(messages);
}
- user.sendMessage(Util.i18n("mailClear"));
+ user.sendMessage(_("mailClear"));
return;
}
if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
{
if (!user.isAuthorized("essentials.mail.send"))
{
- throw new Exception(Util.i18n("noMailSendPerm"));
+ throw new Exception(_("noMailSendPerm"));
}
Player player = server.getPlayer(args[1]);
@@ -54,19 +54,19 @@ public class Commandmail extends EssentialsCommand
}
if (u == null)
{
- throw new Exception(Util.format("playerNeverOnServer", args[1]));
+ throw new Exception(_("playerNeverOnServer", args[1]));
}
if (!u.isIgnoredPlayer(user.getName()))
{
u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2));
}
- user.sendMessage(Util.i18n("mailSent"));
+ user.sendMessage(_("mailSent"));
return;
}
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
{
user.setMails(null);
- user.sendMessage(Util.i18n("mailCleared"));
+ user.sendMessage(_("mailCleared"));
return;
}
throw new NotEnoughArgumentsException();
@@ -77,11 +77,11 @@ public class Commandmail extends EssentialsCommand
{
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
{
- throw new Exception(Util.format("onlyPlayers", commandLabel + " read"));
+ throw new Exception(_("onlyPlayers", commandLabel + " read"));
}
else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
{
- throw new Exception(Util.format("onlyPlayers", commandLabel + " clear"));
+ throw new Exception(_("onlyPlayers", commandLabel + " clear"));
}
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
{
@@ -97,10 +97,10 @@ public class Commandmail extends EssentialsCommand
}
if (u == null)
{
- throw new Exception(Util.format("playerNeverOnServer", args[1]));
+ throw new Exception(_("playerNeverOnServer", args[1]));
}
u.addMail("Server: " + getFinalArg(args, 2));
- sender.sendMessage(Util.i18n("mailSent"));
+ sender.sendMessage(_("mailSent"));
return;
}
else if (args.length >= 2)
@@ -118,10 +118,10 @@ public class Commandmail extends EssentialsCommand
}
if (u == null)
{
- throw new Exception(Util.format("playerNeverOnServer", args[0]));
+ throw new Exception(_("playerNeverOnServer", args[0]));
}
u.addMail("Server: " + getFinalArg(args, 1));
- sender.sendMessage(Util.i18n("mailSent"));
+ sender.sendMessage(_("mailSent"));
return;
}
throw new NotEnoughArgumentsException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java
index 10f542e4a..7ae87251d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -17,7 +17,7 @@ public class Commandme extends EssentialsCommand
{
if (user.isMuted())
{
- throw new Exception(Util.i18n("voiceSilenced"));
+ throw new Exception(_("voiceSilenced"));
}
if (args.length < 1)
@@ -31,6 +31,6 @@ public class Commandme extends EssentialsCommand
message = message.replaceAll("&([0-9a-f])", "§$1");
}
- ess.broadcastMessage(user, Util.format("action", user.getDisplayName(), message));
+ ess.broadcastMessage(user, _("action", user.getDisplayName(), message));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
index 5042af458..34754ec9c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -30,21 +30,21 @@ public class Commandmsg extends EssentialsCommand
User user = ess.getUser(sender);
if (user.isMuted())
{
- throw new Exception(Util.i18n("voiceSilenced"));
+ throw new Exception(_("voiceSilenced"));
}
}
String message = getFinalArg(args, 1);
- String translatedMe = Util.i18n("me");
+ String translatedMe = _("me");
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
{
- sender.sendMessage(Util.format("msgFormat", translatedMe, Console.NAME, message));
+ sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message));
CommandSender cs = Console.getCommandSender(server);
- cs.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
+ cs.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(cs);
Console.getConsoleReplyTo().setReplyTo(sender);
return;
@@ -54,7 +54,7 @@ public class Commandmsg extends EssentialsCommand
if (matches.isEmpty())
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
int i = 0;
@@ -68,18 +68,18 @@ public class Commandmsg extends EssentialsCommand
}
if (i == matches.size())
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
for (Player p : matches)
{
- sender.sendMessage(Util.format("msgFormat", translatedMe, p.getDisplayName(), message));
+ sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
final User u = ess.getUser(p);
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
{
continue;
}
- p.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
+ p.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(p));
ess.getUser(p).setReplyTo(sender);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
index 002bac7fb..3e70cc507 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -24,7 +25,7 @@ public class Commandmute extends EssentialsCommand
final User player = getPlayer(server, args, 0, true);
if (!player.isMuted() && player.isAuthorized("essentials.mute.exempt"))
{
- throw new Exception(Util.i18n("muteExempt"));
+ throw new Exception(_("muteExempt"));
}
long muteTimestamp = 0;
if (args.length > 1)
@@ -37,14 +38,14 @@ public class Commandmute extends EssentialsCommand
sender.sendMessage(
muted
? (muteTimestamp > 0
- ? Util.format("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp))
- : Util.format("mutedPlayer", player.getDisplayName()))
- : Util.format("unmutedPlayer", player.getDisplayName()));
+ ? _("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp))
+ : _("mutedPlayer", player.getDisplayName()))
+ : _("unmutedPlayer", player.getDisplayName()));
player.sendMessage(
muted
? (muteTimestamp > 0
- ? Util.format("playerMutedFor", Util.formatDateDiff(muteTimestamp))
- : Util.i18n("playerMuted"))
- : Util.i18n("playerUnmuted"));
+ ? _("playerMutedFor", Util.formatDateDiff(muteTimestamp))
+ : _("playerMuted"))
+ : _("playerUnmuted"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
index fa46cf3d4..d4610f26c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -23,16 +24,16 @@ public class Commandnick extends EssentialsCommand
}
if (!ess.getSettings().changeDisplayName())
{
- throw new Exception(Util.i18n("nickDisplayName"));
+ throw new Exception(_("nickDisplayName"));
}
if (args.length > 1)
{
if (!user.isAuthorized("essentials.nick.others"))
{
- throw new Exception(Util.i18n("nickOthersPermission"));
+ throw new Exception(_("nickOthersPermission"));
}
setNickname(server, getPlayer(server, args, 0), args[1]);
- user.sendMessage(Util.i18n("nickChanged"));
+ user.sendMessage(_("nickChanged"));
return;
}
setNickname(server, user, args[0]);
@@ -47,23 +48,23 @@ public class Commandnick extends EssentialsCommand
}
if (!ess.getSettings().changeDisplayName())
{
- throw new Exception(Util.i18n("nickDisplayName"));
+ throw new Exception(_("nickDisplayName"));
}
setNickname(server, getPlayer(server, args, 0), args[1]);
- sender.sendMessage(Util.i18n("nickChanged"));
+ sender.sendMessage(_("nickChanged"));
}
private void setNickname(final Server server, final User target, final String nick) throws Exception
{
if (nick.matches("[^a-zA-Z_0-9]"))
{
- throw new Exception(Util.i18n("nickNamesAlpha"));
+ throw new Exception(_("nickNamesAlpha"));
}
else if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
{
target.setNickname(null);
target.setDisplayNick();
- target.sendMessage(Util.i18n("nickNoMore"));
+ target.sendMessage(_("nickNoMore"));
}
else
{
@@ -74,18 +75,18 @@ public class Commandnick extends EssentialsCommand
{
continue;
}
- String dn = p.getDisplayName().toLowerCase();
- String n = p.getName().toLowerCase();
- String nk = formattedNick.toLowerCase();
+ String dn = p.getDisplayName().toLowerCase(Locale.ENGLISH);
+ String n = p.getName().toLowerCase(Locale.ENGLISH);
+ String nk = formattedNick.toLowerCase(Locale.ENGLISH);
if (nk.equals(dn) || nk.equals(n))
{
- throw new Exception(Util.i18n("nickInUse"));
+ throw new Exception(_("nickInUse"));
}
}
target.setNickname(formattedNick);
target.setDisplayNick();
- target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
+ target.sendMessage(_("nickSet", target.getDisplayName() + "§7."));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
index 9aa4f8ac0..df497a352 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
@@ -22,7 +22,7 @@ public class Commandnuke extends EssentialsCommand
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException
{
List<Player> targets;
- if (args.length > 0)
+ if (args.length > 0)
{
targets = new ArrayList<Player>();
int pos = 0;
@@ -34,14 +34,15 @@ public class Commandnuke extends EssentialsCommand
}
else
{
- targets = Arrays.asList(server.getOnlinePlayers());
+ targets = Arrays.asList(server.getOnlinePlayers());
}
ess.getTNTListener().enable();
for (Player player : targets)
{
- if (player == null) {
+ if (player == null)
+ {
continue;
- }
+ }
player.sendMessage("May death rain upon them");
final Location loc = player.getLocation();
final World world = loc.getWorld();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java
index 8359da67a..23ca5c465 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@@ -34,9 +34,10 @@ public class Commandpay extends EssentialsCommand
user.payUser(u, amount);
foundUser = true;
}
-
- if(foundUser == false) {
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+
+ if (foundUser == false)
+ {
+ throw new NoSuchFieldException(_("playerNotFound"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java
index de11adb7b..1fad701b2 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -15,6 +15,6 @@ public class Commandping extends EssentialsCommand
@Override
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
{
- player.sendMessage(Util.i18n("pong"));
+ player.sendMessage(_("pong"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java
index b99266b13..b442d4db8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -22,20 +24,20 @@ public class Commandpowertool extends EssentialsCommand
String command = getFinalArg(args, 0);
// check to see if this is a clear all command
- if(command != null && command.equalsIgnoreCase("c:"))
+ if (command != null && command.equalsIgnoreCase("c:"))
{
user.clearAllPowertools();
- user.sendMessage(Util.i18n("powerToolClearAll"));
+ user.sendMessage(_("powerToolClearAll"));
return;
}
final ItemStack itemStack = user.getItemInHand();
if (itemStack == null || itemStack.getType() == Material.AIR)
{
- throw new Exception(Util.i18n("powerToolAir"));
+ throw new Exception(_("powerToolAir"));
}
- final String itemName = itemStack.getType().toString().toLowerCase().replaceAll("_", " ");
+ final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " ");
List<String> powertools = user.getPowertool(itemStack);
if (command != null && !command.isEmpty())
{
@@ -43,11 +45,11 @@ public class Commandpowertool extends EssentialsCommand
{
if (powertools == null || powertools.isEmpty())
{
- throw new Exception(Util.format("powerToolListEmpty", itemName));
+ throw new Exception(_("powerToolListEmpty", itemName));
}
else
{
- user.sendMessage(Util.format("powerToolList", Util.joinList(powertools), itemName));
+ user.sendMessage(_("powerToolList", Util.joinList(powertools), itemName));
}
return;
}
@@ -58,11 +60,11 @@ public class Commandpowertool extends EssentialsCommand
command = command.substring(2);
if (!powertools.contains(command))
{
- throw new Exception(Util.format("powerToolNoSuchCommandAssigned", command, itemName));
+ throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName));
}
powertools.remove(command);
- user.sendMessage(Util.format("powerToolRemove", command, itemName));
+ user.sendMessage(_("powerToolRemove", command, itemName));
}
catch (Exception e)
{
@@ -77,7 +79,7 @@ public class Commandpowertool extends EssentialsCommand
command = command.substring(2);
if (powertools.contains(command))
{
- throw new Exception(Util.format("powerToolAlreadySet", command, itemName));
+ throw new Exception(_("powerToolAlreadySet", command, itemName));
}
}
else if (powertools != null && !powertools.isEmpty())
@@ -91,7 +93,7 @@ public class Commandpowertool extends EssentialsCommand
}
powertools.add(command);
- user.sendMessage(Util.format("powerToolAttach", Util.joinList(powertools), itemName));
+ user.sendMessage(_("powerToolAttach", Util.joinList(powertools), itemName));
}
}
else
@@ -100,7 +102,7 @@ public class Commandpowertool extends EssentialsCommand
{
powertools.clear();
}
- user.sendMessage(Util.format("powerToolRemoveAll", itemName));
+ user.sendMessage(_("powerToolRemoveAll", itemName));
}
user.setPowertool(itemStack, powertools);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
index af51f2628..c8b737dfa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -15,15 +15,13 @@ public class Commandpowertooltoggle extends EssentialsCommand
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- if(!user.hasPowerTools())
+ if (!user.hasPowerTools())
{
- user.sendMessage(Util.i18n("noPowerTools"));
+ user.sendMessage(_("noPowerTools"));
return;
- }
+ }
user.sendMessage(user.togglePowerToolsEnabled()
- ? Util.i18n("powerToolsEnabled")
- : Util.i18n("powerToolsDisabled"));
+ ? _("powerToolsEnabled")
+ : _("powerToolsDisabled"));
}
-
-
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
index 8f06086af..b16cbdc34 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.DescParseTickFormat;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.*;
import org.bukkit.Server;
import org.bukkit.World;
@@ -48,7 +48,7 @@ public class Commandptime extends EssentialsCommand
User user = ess.getUser(sender);
if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others"))
{
- user.sendMessage(Util.i18n("pTimeOthersPermission"));
+ user.sendMessage(_("pTimeOthersPermission"));
return;
}
@@ -93,25 +93,25 @@ public class Commandptime extends EssentialsCommand
{
if (users.size() > 1)
{
- sender.sendMessage(Util.format("pTimePlayers"));
+ sender.sendMessage(_("pTimePlayers"));
}
for (User user : users)
{
if (user.getPlayerTimeOffset() == 0)
{
- sender.sendMessage(Util.format("pTimeNormal", user.getName()));
+ sender.sendMessage(_("pTimeNormal", user.getName()));
}
else
{
String time = DescParseTickFormat.format(user.getPlayerTime());
if (!user.isPlayerTimeRelative())
{
- sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time));
+ sender.sendMessage(_("pTimeCurrentFixed", user.getName(), time));
}
else
{
- sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time));
+ sender.sendMessage(_("pTimeCurrent", user.getName(), time));
}
}
}
@@ -162,18 +162,18 @@ public class Commandptime extends EssentialsCommand
// Inform the sender of the change
if (ticks == null)
{
- sender.sendMessage(Util.format("pTimeReset", msg.toString()));
+ sender.sendMessage(_("pTimeReset", msg.toString()));
}
else
{
String time = DescParseTickFormat.format(ticks);
if (!relative)
{
- sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString()));
+ sender.sendMessage(_("pTimeSetFixed", time, msg.toString()));
}
else
{
- sender.sendMessage(Util.format("pTimeSet", time, msg.toString()));
+ sender.sendMessage(_("pTimeSet", time, msg.toString()));
}
}
}
@@ -225,7 +225,7 @@ public class Commandptime extends EssentialsCommand
// We failed to understand the world target...
else
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
return users;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java
index 6a864ce35..c53ef1bf0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -32,10 +32,10 @@ public class Commandr extends EssentialsCommand
if (target == null)
{
- throw new Exception(Util.i18n("foreverAlone"));
+ throw new Exception(_("foreverAlone"));
}
- sender.sendMessage(Util.format("msgFormat", Util.i18n("me"), targetName, message));
+ sender.sendMessage(_("msgFormat", _("me"), targetName, message));
if (target instanceof Player)
{
User u = ess.getUser(target);
@@ -44,7 +44,7 @@ public class Commandr extends EssentialsCommand
return;
}
}
- target.sendMessage(Util.format("msgFormat", senderName, Util.i18n("me"), message));
+ target.sendMessage(_("msgFormat", senderName, _("me"), message));
replyTo.setReplyTo(target);
if (target != sender)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
index 291c5b93d..d3d82860d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -22,7 +23,7 @@ public class Commandrealname extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- final String whois = args[0].toLowerCase();
+ final String whois = args[0].toLowerCase(Locale.ENGLISH);
for (Player p : server.getOnlinePlayers())
{
final User u = ess.getUser(p);
@@ -30,14 +31,14 @@ public class Commandrealname extends EssentialsCommand
{
continue;
}
- final String displayName = ChatColor.stripColor(u.getDisplayName()).toLowerCase();
+ final String displayName = ChatColor.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH);
if (!whois.equals(displayName)
&& !displayName.equals(ChatColor.stripColor(ess.getSettings().getNicknamePrefix()) + whois)
&& !whois.equalsIgnoreCase(u.getName()))
{
continue;
}
- sender.sendMessage(u.getDisplayName() + " " + Util.i18n("is") + " " + u.getName());
+ sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
index 9bbcd790d..50c6ac7af 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
@@ -1,8 +1,10 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.*;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -28,9 +30,9 @@ public class Commandrepair extends EssentialsCommand
final ItemStack item = user.getItemInHand();
if (item == null)
{
- throw new Exception(Util.i18n("repairInvalidType"));
+ throw new Exception(_("repairInvalidType"));
}
- final String itemName = item.getType().toString().toLowerCase();
+ final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
charge.isAffordableFor(user);
@@ -39,24 +41,25 @@ public class Commandrepair extends EssentialsCommand
charge.charge(user);
- user.sendMessage(Util.format("repair", itemName.replace('_', ' ')));
+ user.sendMessage(_("repair", itemName.replace('_', ' ')));
}
else if (args[0].equalsIgnoreCase("all"))
{
final List<String> repaired = new ArrayList<String>();
repairItems(user.getInventory().getContents(), user, repaired);
- if (user.isAuthorized("essentials.repair.armor")) {
+ if (user.isAuthorized("essentials.repair.armor"))
+ {
repairItems(user.getInventory().getArmorContents(), user, repaired);
}
if (repaired.isEmpty())
{
- throw new Exception(Util.format("repairNone"));
+ throw new Exception(_("repairNone"));
}
else
{
- user.sendMessage(Util.format("repair", Util.joinList(repaired)));
+ user.sendMessage(_("repair", Util.joinList(repaired)));
}
}
@@ -71,12 +74,12 @@ public class Commandrepair extends EssentialsCommand
final Material material = Material.getMaterial(item.getTypeId());
if (material.isBlock() || material.getMaxDurability() < 0)
{
- throw new Exception(Util.i18n("repairInvalidType"));
+ throw new Exception(_("repairInvalidType"));
}
if (item.getDurability() == 0)
{
- throw new Exception(Util.i18n("repairAlreadyFixed"));
+ throw new Exception(_("repairAlreadyFixed"));
}
item.setDurability((short)0);
@@ -90,7 +93,7 @@ public class Commandrepair extends EssentialsCommand
{
continue;
}
- final String itemName = item.getType().toString().toLowerCase();
+ final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
try
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
index c355f5aff..391ed36b3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -23,16 +24,16 @@ public class Commandseen extends EssentialsCommand
try
{
User u = getPlayer(server, args, 0);
- sender.sendMessage(Util.format("seenOnline",u.getDisplayName(), Util.formatDateDiff(u.getLastLogin())));
+ sender.sendMessage(_("seenOnline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogin())));
}
catch (NoSuchFieldException e)
{
User u = ess.getOfflineUser(args[0]);
if (u == null)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
- sender.sendMessage(Util.format("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout())));
+ sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout())));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
index e28ae8dd1..9ca622aef 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.InventoryWorkaround;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import java.util.Locale;
import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.Server;
@@ -76,7 +78,7 @@ public class Commandsell extends EssentialsCommand
{
if (is == null || is.getType() == Material.AIR)
{
- throw new Exception(Util.i18n("itemSellAir"));
+ throw new Exception(_("itemSellAir"));
}
int id = is.getTypeId();
int amount = 0;
@@ -94,11 +96,11 @@ public class Commandsell extends EssentialsCommand
if (Double.isNaN(worth))
{
- throw new Exception(Util.i18n("itemCannotBeSold"));
+ throw new Exception(_("itemCannotBeSold"));
}
if (requireStack && !stack)
{
- throw new Exception(Util.i18n("itemMustBeStacked"));
+ throw new Exception(_("itemMustBeStacked"));
}
@@ -137,9 +139,9 @@ public class Commandsell extends EssentialsCommand
{
if (!isBulkSell)
{
- user.sendMessage(Util.i18n("itemNotEnough1"));
- user.sendMessage(Util.i18n("itemNotEnough2"));
- throw new Exception(Util.i18n("itemNotEnough3"));
+ user.sendMessage(_("itemNotEnough1"));
+ user.sendMessage(_("itemNotEnough2"));
+ throw new Exception(_("itemNotEnough3"));
}
else
{
@@ -152,8 +154,8 @@ public class Commandsell extends EssentialsCommand
user.updateInventory();
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
user.giveMoney(worth * amount);
- user.sendMessage(Util.format("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(), Util.formatCurrency(worth, ess)));
- logger.log(Level.INFO, Util.format("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
+ user.sendMessage(_("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth, ess)));
+ logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
index 77b18aa31..6d05e4e3e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.Server;
@@ -29,18 +30,19 @@ public class Commandsethome extends EssentialsCommand
if (user.isAuthorized("essentials.sethome.multiple"))
{
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
- || (user.getHomes().contains(args[0].toLowerCase())))
+ || (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
{
- user.setHome(args[0].toLowerCase());
+ user.setHome(args[0].toLowerCase(Locale.ENGLISH));
}
else
{
- throw new Exception(Util.format("maxHomes", ess.getSettings().getHomeLimit(user)));
+ throw new Exception(_("maxHomes", ess.getSettings().getHomeLimit(user)));
}
}
- else {
- throw new Exception(Util.format("maxHomes", 1));
+ else
+ {
+ throw new Exception(_("maxHomes", 1));
}
}
else
@@ -54,9 +56,9 @@ public class Commandsethome extends EssentialsCommand
}
if (usersHome == null)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
- String name = args[1].toLowerCase();
+ String name = args[1].toLowerCase(Locale.ENGLISH);
if (!user.isAuthorized("essentials.sethome.multiple"))
{
name = "home";
@@ -69,7 +71,7 @@ public class Commandsethome extends EssentialsCommand
{
user.setHome();
}
- user.sendMessage(Util.i18n("homeSet"));
+ user.sendMessage(_("homeSet"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java
index aeac10d4b..506829ad9 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -11,7 +11,7 @@ public class Commandsetjail extends EssentialsCommand
{
super("setjail");
}
-
+
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
@@ -20,7 +20,7 @@ public class Commandsetjail extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
ess.getJail().setJail(user.getLocation(), args[0]);
- user.sendMessage(Util.format("jailSet",args[0]));
-
+ user.sendMessage(_("jailSet", args[0]));
+
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java
index 1c8cb2caa..77bbee7c0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -23,6 +23,6 @@ public class Commandsetwarp extends EssentialsCommand
Location loc = user.getLocation();
ess.getWarps().setWarp(args[0], loc);
- user.sendMessage(Util.format("warpSet", args[0]));
+ user.sendMessage(_("warpSet", args[0]));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java
index a8889fc09..3f80fddf1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -23,6 +23,6 @@ public class Commandsetworth extends EssentialsCommand
ItemStack stack = ess.getItemDb().get(args[0]);
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
- user.sendMessage(Util.i18n("worthSet"));
+ user.sendMessage(_("worthSet"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
index 8e95e8237..b7ce4edcb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
@@ -1,10 +1,10 @@
package com.earth2me.essentials.commands;
+
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
-
public class Commandsocialspy extends EssentialsCommand
{
public Commandsocialspy()
@@ -15,6 +15,6 @@ public class Commandsocialspy extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
- user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? Util.i18n("enabled") : Util.i18n("disabled")));
+ user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? _("enabled") : _("disabled")));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
index cbec7955d..dba77b5b4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
@@ -28,7 +28,7 @@ public class Commandspawner extends EssentialsCommand
final Block target = user.getTarget().getTargetBlock();
if (target.getType() != Material.MOB_SPAWNER)
{
- throw new Exception(Util.i18n("mobSpawnTarget"));
+ throw new Exception(_("mobSpawnTarget"));
}
try
@@ -39,15 +39,15 @@ public class Commandspawner extends EssentialsCommand
mob = Mob.fromName(name);
if (mob == null)
{
- user.sendMessage(Util.i18n("invalidMob"));
+ user.sendMessage(_("invalidMob"));
return;
}
((CreatureSpawner)target.getState()).setCreatureType(mob.getType());
- user.sendMessage(Util.format("setSpawner", mob.name));
+ user.sendMessage(_("setSpawner", mob.name));
}
catch (Throwable ex)
{
- throw new Exception(Util.i18n("mobSpawnError"), ex);
+ throw new Exception(_("mobSpawnError"), ex);
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 1e5682beb..f3f5ce2ef 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Mob.MobException;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import java.util.Locale;
import java.util.Random;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@@ -58,18 +60,18 @@ public class Commandspawnmob extends EssentialsCommand
mob = Mob.fromName(mobType);
if (mob == null)
{
- throw new Exception(Util.i18n("invalidMob"));
+ throw new Exception(_("invalidMob"));
}
- if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
+ if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
final Block block = Util.getTarget(user).getBlock();
if (block == null)
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
Location loc = block.getLocation();
Location sloc = Util.getSafeDestination(loc);
@@ -79,7 +81,7 @@ public class Commandspawnmob extends EssentialsCommand
}
catch (MobException e)
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
if (mountType != null)
@@ -87,13 +89,13 @@ public class Commandspawnmob extends EssentialsCommand
mobMount = Mob.fromName(mountType);
if (mobMount == null)
{
- user.sendMessage(Util.i18n("invalidMob"));
+ user.sendMessage(_("invalidMob"));
return;
}
- if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
+ if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH)))
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
try
{
@@ -101,7 +103,7 @@ public class Commandspawnmob extends EssentialsCommand
}
catch (MobException e)
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
spawnedMob.setPassenger(spawnedMount);
}
@@ -120,7 +122,7 @@ public class Commandspawnmob extends EssentialsCommand
if (mobCount > serverLimit)
{
mobCount = serverLimit;
- user.sendMessage(Util.i18n("mobSpawnLimit"));
+ user.sendMessage(_("mobSpawnLimit"));
}
try
@@ -136,7 +138,7 @@ public class Commandspawnmob extends EssentialsCommand
}
catch (MobException e)
{
- throw new Exception(Util.i18n("unableToSpawnMob"));
+ throw new Exception(_("unableToSpawnMob"));
}
spawnedMob.setPassenger(spawnedMount);
}
@@ -149,24 +151,24 @@ public class Commandspawnmob extends EssentialsCommand
changeMobData(mobMount.name, spawnedMount, mountData, user);
}
}
- user.sendMessage(args[1] + " " + mob.name.toLowerCase() + mob.suffix + " " + Util.i18n("spawned"));
+ user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
}
catch (MobException e1)
{
- throw new Exception(Util.i18n("unableToSpawnMob"), e1);
+ throw new Exception(_("unableToSpawnMob"), e1);
}
catch (NumberFormatException e2)
{
- throw new Exception(Util.i18n("numberRequired"), e2);
+ throw new Exception(_("numberRequired"), e2);
}
catch (NullPointerException np)
{
- throw new Exception(Util.i18n("soloMob"), np);
+ throw new Exception(_("soloMob"), np);
}
}
else
{
- user.sendMessage(mob.name + " " + Util.i18n("spawned"));
+ user.sendMessage(mob.name + " " + _("spawned"));
}
}
@@ -180,7 +182,7 @@ public class Commandspawnmob extends EssentialsCommand
}
catch (Exception e)
{
- throw new Exception(Util.i18n("slimeMalformedSize"), e);
+ throw new Exception(_("slimeMalformedSize"), e);
}
}
if ("Sheep".equalsIgnoreCase(type))
@@ -199,7 +201,7 @@ public class Commandspawnmob extends EssentialsCommand
}
catch (Exception e)
{
- throw new Exception(Util.i18n("sheepMalformedColor"), e);
+ throw new Exception(_("sheepMalformedColor"), e);
}
}
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
index eb0934b6a..7f758ad2e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
@@ -24,7 +24,8 @@ public class Commandsudo extends EssentialsCommand
final User user = getPlayer(server, args, 0, false);
final String command = args[1];
final String[] arguments = new String[args.length - 2];
- if (arguments.length > 0) {
+ if (arguments.length > 0)
+ {
System.arraycopy(args, 2, arguments, 0, args.length - 2);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
index ec99dd712..aa2ed5567 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -16,8 +16,8 @@ public class Commandsuicide extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
user.setHealth(0);
- user.sendMessage(Util.i18n("suicideMessage"));
+ user.sendMessage(_("suicideMessage"));
ess.broadcastMessage(user,
- Util.format("suicideSuccess", user.getDisplayName()));
+ _("suicideSuccess", user.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
index eaabdaa68..144d19d15 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -29,7 +30,7 @@ public class Commandtempban extends EssentialsCommand
if (sender instanceof Player
&& !ess.getUser(sender).isAuthorized("essentials.tempban.offline"))
{
- sender.sendMessage(Util.i18n("tempbanExempt"));
+ sender.sendMessage(_("tempbanExempt"));
return;
}
}
@@ -37,26 +38,26 @@ public class Commandtempban extends EssentialsCommand
{
if (user.isAuthorized("essentials.tempban.exempt"))
{
- sender.sendMessage(Util.i18n("tempbanExempt"));
+ sender.sendMessage(_("tempbanExempt"));
return;
}
}
final String time = getFinalArg(args, 1);
final long banTimestamp = Util.parseDateDiff(time, true);
- final String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
+ final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp));
user.setBanReason(banReason);
user.setBanTimeout(banTimestamp);
user.setBanned(true);
user.kickPlayer(banReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
-
- for(Player onlinePlayer : server.getOnlinePlayers())
+
+ for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
- if(player.isAuthorized("essentials.ban.notify"))
+ if (player.isAuthorized("essentials.ban.notify"))
{
- onlinePlayer.sendMessage(Util.format("playerBanned", senderName, user.getName(), banReason));
+ onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java
index 678eebafd..3cb60e6e3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.World;
@@ -28,13 +28,13 @@ public class Commandthunder extends EssentialsCommand
world.setThundering(setThunder ? true : false);
world.setThunderDuration(Integer.parseInt(args[1]) * 20);
- user.sendMessage(Util.format("thunderDuration", (setThunder ? Util.i18n("enabled") : Util.i18n("disabled")), Integer.parseInt(args[1])));
-
+ user.sendMessage(_("thunderDuration", (setThunder ? _("enabled") : _("disabled")), Integer.parseInt(args[1])));
+
}
else
{
world.setThundering(setThunder ? true : false);
- user.sendMessage(Util.format("thunder", setThunder ? Util.i18n("enabled") : Util.i18n("disabled")));
+ user.sendMessage(_("thunder", setThunder ? _("enabled") : _("disabled")));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java
index 4535e5fe2..c49f34fbd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.DescParseTickFormat;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.*;
import org.bukkit.Server;
import org.bukkit.World;
@@ -37,7 +37,7 @@ public class Commandtime extends EssentialsCommand
final User user = ess.getUser(sender);
if (user != null && !user.isAuthorized("essentials.time.set"))
{
- user.sendMessage(Util.i18n("timeSetPermission"));
+ user.sendMessage(_("timeSetPermission"));
return;
}
@@ -69,7 +69,7 @@ public class Commandtime extends EssentialsCommand
for (World world : worlds)
{
- sender.sendMessage(Util.format("timeWorldCurrent", world.getName(), DescParseTickFormat.format(world.getTime())));
+ sender.sendMessage(_("timeWorldCurrent", world.getName(), DescParseTickFormat.format(world.getTime())));
}
}
@@ -97,7 +97,7 @@ public class Commandtime extends EssentialsCommand
output.append(world.getName());
}
- sender.sendMessage(Util.format("timeWorldSet", DescParseTickFormat.format(ticks), output.toString()));
+ sender.sendMessage(_("timeWorldSet", DescParseTickFormat.format(ticks), output.toString()));
}
/**
@@ -136,7 +136,7 @@ public class Commandtime extends EssentialsCommand
// We failed to understand the world target...
else
{
- throw new Exception(Util.i18n("invalidWorld"));
+ throw new Exception(_("invalidWorld"));
}
return worlds;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
index 61edd2054..323836ffb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -32,7 +33,7 @@ public class Commandtogglejail extends EssentialsCommand
if (sender instanceof Player
&& !ess.getUser(sender).isAuthorized("essentials.togglejail.offline"))
{
- sender.sendMessage(Util.i18n("mayNotJail"));
+ sender.sendMessage(_("mayNotJail"));
return;
}
}
@@ -40,7 +41,7 @@ public class Commandtogglejail extends EssentialsCommand
{
if (player.isAuthorized("essentials.jail.exempt"))
{
- sender.sendMessage(Util.i18n("mayNotJail"));
+ sender.sendMessage(_("mayNotJail"));
return;
}
}
@@ -54,7 +55,7 @@ public class Commandtogglejail extends EssentialsCommand
ess.getJail().getJail(args[1]);
}
player.setJailed(true);
- player.sendMessage(Util.i18n("userJailed"));
+ player.sendMessage(_("userJailed"));
player.setJail(null);
player.setJail(args[1]);
long timeDiff = 0;
@@ -65,14 +66,14 @@ public class Commandtogglejail extends EssentialsCommand
player.setJailTimeout(timeDiff);
}
sender.sendMessage((timeDiff > 0
- ? Util.format("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
- : Util.format("playerJailed", player.getName())));
+ ? _("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
+ : _("playerJailed", player.getName())));
return;
}
if (args.length >= 2 && player.isJailed() && !args[1].equalsIgnoreCase(player.getJail()))
{
- sender.sendMessage(Util.format("jailAlreadyIncarcerated", player.getJail()));
+ sender.sendMessage(_("jailAlreadyIncarcerated", player.getJail()));
return;
}
@@ -81,7 +82,7 @@ public class Commandtogglejail extends EssentialsCommand
final String time = getFinalArg(args, 2);
final long timeDiff = Util.parseDateDiff(time, true);
player.setJailTimeout(timeDiff);
- sender.sendMessage(Util.format("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
+ sender.sendMessage(_("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
return;
}
@@ -93,13 +94,13 @@ public class Commandtogglejail extends EssentialsCommand
}
player.setJailed(false);
player.setJailTimeout(0);
- player.sendMessage(Util.format("jailReleasedPlayerNotify"));
+ player.sendMessage(_("jailReleasedPlayerNotify"));
player.setJail(null);
if (!(player.getBase() instanceof OfflinePlayer))
{
player.getTeleport().back();
}
- sender.sendMessage(Util.format("jailReleased", player.getName()));
+ sender.sendMessage(_("jailReleased", player.getName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
index 99f665184..5cd9376cd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -21,6 +21,6 @@ public class Commandtop extends EssentialsCommand
final int topZ = user.getLocation().getBlockZ();
final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
- user.sendMessage(Util.i18n("teleportTop"));
+ user.sendMessage(_("teleportTop"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index c93f05a29..ac3991060 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -27,9 +27,9 @@ public class Commandtp extends EssentialsCommand
final User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
- throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
+ throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
- user.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.getTeleport().teleport(player, charge);
@@ -40,13 +40,13 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception("You need access to /tpohere to teleport other players.");
}
- user.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
target.getTeleport().now(toPlayer, false);
- target.sendMessage(Util.format("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
+ target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
break;
- }
+ }
}
@Override
@@ -57,10 +57,10 @@ public class Commandtp extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- sender.sendMessage(Util.i18n("teleporting"));
+ sender.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
target.getTeleport().now(toPlayer, false);
- target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
+ target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
index c9f41f4d8..5b810e611 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -23,15 +23,15 @@ public class Commandtpa extends EssentialsCommand
User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
- throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
+ throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
if (!player.isIgnoredPlayer(user.getName()))
{
player.requestTeleport(user, false);
- player.sendMessage(Util.format("teleportRequest", user.getDisplayName()));
- player.sendMessage(Util.i18n("typeTpaccept"));
- player.sendMessage(Util.i18n("typeTpdeny"));
+ player.sendMessage(_("teleportRequest", user.getDisplayName()));
+ player.sendMessage(_("typeTpaccept"));
+ player.sendMessage(_("typeTpdeny"));
}
- user.sendMessage(Util.format("requestSent", player.getDisplayName()));
+ user.sendMessage(_("requestSent", player.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
index 59d66da3e..7a5d078f3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -33,7 +33,7 @@ public class Commandtpaall extends EssentialsCommand
private void teleportAAllPlayers(final Server server, final CommandSender sender, final User user)
{
- sender.sendMessage(Util.i18n("teleportAAll"));
+ sender.sendMessage(_("teleportAAll"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
@@ -48,8 +48,8 @@ public class Commandtpaall extends EssentialsCommand
try
{
player.requestTeleport(user, true);
- player.sendMessage(Util.format("teleportHereRequest", user.getDisplayName()));
- player.sendMessage(Util.i18n("typeTpaccept"));
+ player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
+ player.sendMessage(_("typeTpaccept"));
}
catch (Exception ex)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 350640087..164a1afad 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -23,7 +23,7 @@ public class Commandtpaccept extends EssentialsCommand
|| target.getBase() instanceof OfflinePlayer
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
{
- throw new Exception(Util.i18n("noPendingRequest"));
+ throw new Exception(_("noPendingRequest"));
}
final Trade charge = new Trade(this.getName(), ess);
@@ -35,8 +35,8 @@ public class Commandtpaccept extends EssentialsCommand
{
charge.isAffordableFor(target);
}
- user.sendMessage(Util.i18n("requestAccepted"));
- target.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName()));
+ user.sendMessage(_("requestAccepted"));
+ target.sendMessage(_("requestAcceptedFrom", user.getDisplayName()));
if (user.isTeleportRequestHere())
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
index 3f120037b..751fc628c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -23,11 +23,11 @@ public class Commandtpahere extends EssentialsCommand
final User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
- throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
+ throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
player.requestTeleport(user, true);
- player.sendMessage(Util.format("teleportHereRequest", user.getDisplayName()));
- player.sendMessage(Util.i18n("typeTpaccept"));
- user.sendMessage(Util.format("requestSent", player.getDisplayName()));
+ player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
+ player.sendMessage(_("typeTpaccept"));
+ user.sendMessage(_("requestSent", player.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
index a9ccb91e3..d3b8917aa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -33,7 +33,7 @@ public class Commandtpall extends EssentialsCommand
private void teleportAllPlayers(Server server, CommandSender sender, User user)
{
- sender.sendMessage(Util.i18n("teleportAll"));
+ sender.sendMessage(_("teleportAll"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java
index b8de959ee..92bba1054 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -18,11 +18,11 @@ public class Commandtpdeny extends EssentialsCommand
final User player = user.getTeleportRequest();
if (player == null)
{
- throw new Exception(Util.i18n("noPendingRequest"));
+ throw new Exception(_("noPendingRequest"));
}
- user.sendMessage(Util.i18n("requestDenied"));
- player.sendMessage(Util.format("requestDeniedFrom", user.getDisplayName()));
+ user.sendMessage(_("requestDenied"));
+ player.sendMessage(_("requestDeniedFrom", user.getDisplayName()));
user.requestTeleport(null, false);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
index 121e06c2a..ecfb6b6a6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -19,11 +19,11 @@ public class Commandtphere extends EssentialsCommand
final User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
- throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
+ throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
player.getTeleport().teleport(user, new Trade(this.getName(), ess));
- user.sendMessage(Util.i18n("teleporting"));
- player.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
+ player.sendMessage(_("teleporting"));
throw new NoChargeException();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index 2411bae6e..d225725be 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -26,18 +26,18 @@ public class Commandtpo extends EssentialsCommand
// Check if user is offline
if (player.getBase() instanceof OfflinePlayer)
{
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
// Verify permission
if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
{
user.getTeleport().now(player, false);
- user.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
}
else
{
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
index 2e58ae3a0..0a6bc5180 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -27,18 +27,18 @@ public class Commandtpohere extends EssentialsCommand
// Check if user is offline
if (player.getBase() instanceof OfflinePlayer)
{
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
// Verify permission
if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
{
player.getTeleport().now(user, false);
- user.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
}
else
{
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
index 5b2ee2890..7aa0e66f8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -26,15 +26,17 @@ public class Commandtppos extends EssentialsCommand
final int y = Integer.parseInt(args[1]);
final int z = Integer.parseInt(args[2]);
final Location location = new Location(user.getWorld(), x, y, z);
- if (args.length > 3) {
+ if (args.length > 3)
+ {
location.setYaw(Float.parseFloat(args[3]));
}
- if (args.length > 4) {
+ if (args.length > 4)
+ {
location.setPitch(Float.parseFloat(args[4]));
}
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.sendMessage(Util.i18n("teleporting"));
+ user.sendMessage(_("teleporting"));
user.getTeleport().teleport(location, charge);
throw new NoChargeException();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
index c42862514..1fc4c2aa4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -16,7 +16,7 @@ public class Commandtptoggle extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
user.sendMessage(user.toggleTeleportEnabled()
- ? Util.i18n("teleportationEnabled")
- : Util.i18n("teleportationDisabled"));
+ ? _("teleportationEnabled")
+ : _("teleportationDisabled"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
index bec23d834..538611972 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Location;
@@ -38,17 +39,17 @@ public class Commandtree extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
-
+
final Location loc = Util.getTarget(user);
final Location safeLocation = Util.getSafeDestination(loc);
final boolean success = user.getWorld().generateTree(safeLocation, tree);
if (success)
{
- user.sendMessage(Util.i18n("treeSpawned"));
+ user.sendMessage(_("treeSpawned"));
}
else
{
- user.sendMessage(Util.i18n("treeFailure"));
+ user.sendMessage(_("treeFailure"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
index ac6818c80..8bc3ad068 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -25,11 +25,11 @@ public class Commandunban extends EssentialsCommand
{
final User player = getPlayer(server, args, 0, true);
player.setBanned(false);
- sender.sendMessage(Util.i18n("unbannedPlayer"));
+ sender.sendMessage(_("unbannedPlayer"));
}
catch (NoSuchFieldException e)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
index ea2c88f78..2c1d06f39 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -21,6 +21,6 @@ public class Commandunbanip extends EssentialsCommand
}
ess.getServer().unbanIP(args[0]);
- sender.sendMessage(Util.i18n("unbannedIP"));
+ sender.sendMessage(_("unbannedIP"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
index 93e6235dc..8891036c6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
@@ -1,9 +1,10 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.InventoryWorkaround;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
+import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
@@ -59,12 +60,12 @@ public class Commandunlimited extends EssentialsCommand
private String getList(final User target)
{
final StringBuilder output = new StringBuilder();
- output.append(Util.i18n("unlimitedItems")).append(" ");
+ output.append(_("unlimitedItems")).append(" ");
boolean first = true;
final List<Integer> items = target.getUnlimited();
if (items.isEmpty())
{
- output.append(Util.i18n("none"));
+ output.append(_("none"));
}
for (Integer integer : items)
{
@@ -73,7 +74,7 @@ public class Commandunlimited extends EssentialsCommand
output.append(", ");
}
first = false;
- final String matname = Material.getMaterial(integer).toString().toLowerCase().replace("_", "");
+ final String matname = Material.getMaterial(integer).toString().toLowerCase(Locale.ENGLISH).replace("_", "");
output.append(matname);
}
@@ -85,7 +86,7 @@ public class Commandunlimited extends EssentialsCommand
final ItemStack stack = ess.getItemDb().get(item, 1);
stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2));
- final String itemname = stack.getType().toString().toLowerCase().replace("_", "");
+ final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn()
&& (!user.isAuthorized("essentials.unlimited.item-all")
&& !user.isAuthorized("essentials.unlimited.item-" + itemname)
@@ -93,7 +94,7 @@ public class Commandunlimited extends EssentialsCommand
&& !((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET)
&& user.isAuthorized("essentials.unlimited.item-bucket"))))
{
- throw new Exception(Util.format("unlimitedItemPermission", itemname));
+ throw new Exception(_("unlimitedItemPermission", itemname));
}
String message = "disableUnlimited";
@@ -110,9 +111,9 @@ public class Commandunlimited extends EssentialsCommand
if (user != target)
{
- user.sendMessage(Util.format(message, itemname, target.getDisplayName()));
+ user.sendMessage(_(message, itemname, target.getDisplayName()));
}
- target.sendMessage(Util.format(message, itemname, target.getDisplayName()));
+ target.sendMessage(_(message, itemname, target.getDisplayName()));
target.setUnlimited(stack, enableUnlimited);
return true;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index 81207b740..b15af349d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -27,7 +28,7 @@ public class Commandwarp extends EssentialsCommand
{
if (!user.isAuthorized("essentials.warp.list"))
{
- throw new Exception(Util.i18n("warpListPermission"));
+ throw new Exception(_("warpListPermission"));
}
warpList(user, args);
throw new NoChargeException();
@@ -40,7 +41,7 @@ public class Commandwarp extends EssentialsCommand
otherUser = ess.getUser(server.getPlayer(args[1]));
if (otherUser == null)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
throw new NoChargeException();
@@ -61,7 +62,7 @@ public class Commandwarp extends EssentialsCommand
User otherUser = ess.getUser(server.getPlayer(args[1]));
if (otherUser == null)
{
- throw new Exception(Util.i18n("playerNotFound"));
+ throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
throw new NoChargeException();
@@ -73,7 +74,7 @@ public class Commandwarp extends EssentialsCommand
final Warps warps = ess.getWarps();
if (warps.isEmpty())
{
- throw new Exception(Util.i18n("noWarpsDefined"));
+ throw new Exception(_("noWarpsDefined"));
}
final List<String> warpNameList = new ArrayList<String>(warps.getWarpNames());
@@ -100,11 +101,12 @@ public class Commandwarp extends EssentialsCommand
if (warpNameList.size() > WARPS_PER_PAGE)
{
- sender.sendMessage(Util.format("warpsCount", warpNameList.size(), page, (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE)));
+ sender.sendMessage(_("warpsCount", warpNameList.size(), page, (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE)));
sender.sendMessage(warpList);
}
- else {
- sender.sendMessage(Util.format("warps", warpList));
+ else
+ {
+ sender.sendMessage(_("warps", warpList));
}
}
@@ -119,7 +121,7 @@ public class Commandwarp extends EssentialsCommand
user.getTeleport().warp(name, charge);
return;
}
- throw new Exception(Util.i18n("warpUsePermission"));
+ throw new Exception(_("warpUsePermission"));
}
user.getTeleport().warp(name, charge);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java
index 2af6f8abf..bb1fc0927 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -13,9 +13,8 @@ public class Commandweather extends EssentialsCommand
{
super("weather");
}
-
- //TODO: Remove duplication
+ //TODO: Remove duplication
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
@@ -32,15 +31,15 @@ public class Commandweather extends EssentialsCommand
world.setStorm(isStorm ? true : false);
world.setWeatherDuration(Integer.parseInt(args[1]) * 20);
user.sendMessage(isStorm
- ? Util.format("weatherStormFor", world.getName(), args[1])
- : Util.format("weatherSunFor", world.getName(), args[1]));
+ ? _("weatherStormFor", world.getName(), args[1])
+ : _("weatherSunFor", world.getName(), args[1]));
}
else
{
world.setStorm(isStorm ? true : false);
user.sendMessage(isStorm
- ? Util.format("weatherStorm", world.getName())
- : Util.format("weatherSun", world.getName()));
+ ? _("weatherStorm", world.getName())
+ : _("weatherSun", world.getName()));
}
}
@@ -64,15 +63,15 @@ public class Commandweather extends EssentialsCommand
world.setStorm(isStorm ? true : false);
world.setWeatherDuration(Integer.parseInt(args[2]) * 20);
sender.sendMessage(isStorm
- ? Util.format("weatherStormFor", world.getName(), args[2])
- : Util.format("weatherSunFor", world.getName(), args[2]));
+ ? _("weatherStormFor", world.getName(), args[2])
+ : _("weatherSunFor", world.getName(), args[2]));
}
else
{
world.setStorm(isStorm ? true : false);
sender.sendMessage(isStorm
- ? Util.format("weatherStorm", world.getName())
- : Util.format("weatherSun", world.getName()));
+ ? _("weatherStorm", world.getName())
+ : _("weatherSun", world.getName()));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java
index c99503eef..c5d10a2e8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -34,7 +36,7 @@ public class Commandwhois extends EssentialsCommand
{
showhidden = true;
}
- final String whois = args[0].toLowerCase();
+ final String whois = args[0].toLowerCase(Locale.ENGLISH);
final int prefixLength = ChatColor.stripColor(ess.getSettings().getNicknamePrefix()).length();
for (Player onlinePlayer : server.getOnlinePlayers())
{
@@ -51,25 +53,25 @@ public class Commandwhois extends EssentialsCommand
continue;
}
sender.sendMessage("");
- sender.sendMessage(Util.format("whoisIs", user.getDisplayName(), user.getName()));
- sender.sendMessage(Util.format("whoisHealth", user.getHealth()));
- sender.sendMessage(Util.format("whoisOP", (user.isOp() ? Util.i18n("true") : Util.i18n("false"))));
- sender.sendMessage(Util.format("whoisGod", (user.isGodModeEnabled() ? Util.i18n("true") : Util.i18n("false"))));
- sender.sendMessage(Util.format("whoisGamemode", Util.i18n(user.getGameMode().toString().toLowerCase())));
- sender.sendMessage(Util.format("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
+ sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName()));
+ sender.sendMessage(_("whoisHealth", user.getHealth()));
+ sender.sendMessage(_("whoisOP", (user.isOp() ? _("true") : _("false"))));
+ sender.sendMessage(_("whoisGod", (user.isGodModeEnabled() ? _("true") : _("false"))));
+ sender.sendMessage(_("whoisGamemode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH))));
+ sender.sendMessage(_("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
if (!ess.getSettings().isEcoDisabled())
{
- sender.sendMessage(Util.format("whoisMoney", Util.formatCurrency(user.getMoney(), ess)));
+ sender.sendMessage(_("whoisMoney", Util.formatCurrency(user.getMoney(), ess)));
}
sender.sendMessage(user.isAfk()
- ? Util.i18n("whoisStatusAway")
- : Util.i18n("whoisStatusAvailable"));
- sender.sendMessage(Util.format("whoisIPAddress", user.getAddress().getAddress().toString()));
+ ? _("whoisStatusAway")
+ : _("whoisStatusAvailable"));
+ sender.sendMessage(_("whoisIPAddress", user.getAddress().getAddress().toString()));
final String location = user.getGeoLocation();
if (location != null
&& (sender instanceof Player ? ess.getUser(sender).isAuthorized("essentials.geoip.show") : true))
{
- sender.sendMessage(Util.format("whoisGeoLocation", location));
+ sender.sendMessage(_("whoisGeoLocation", location));
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
index ba742188e..7380b23ae 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.commands;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -24,7 +24,7 @@ public class Commandworld extends EssentialsCommand
if (args.length < 1)
{
World nether = null;
-
+
final List<World> worlds = server.getWorlds();
for (World world2 : worlds)
@@ -46,9 +46,9 @@ public class Commandworld extends EssentialsCommand
world = ess.getWorld(getFinalArg(args, 0));
if (world == null)
{
- user.sendMessage(Util.i18n("invalidWorld"));
- user.sendMessage(Util.format("possibleWorlds", server.getWorlds().size() - 1));
- user.sendMessage(Util.i18n("typeWorldName"));
+ user.sendMessage(_("invalidWorld"));
+ user.sendMessage(_("possibleWorlds", server.getWorlds().size() - 1));
+ user.sendMessage(_("typeWorldName"));
throw new NoChargeException();
}
}
@@ -62,7 +62,8 @@ public class Commandworld extends EssentialsCommand
{
factor = 1.0 / 8.0;
}
- else {
+ else
+ {
factor = 1.0;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
index d88fb4e68..586b31873 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
@@ -1,8 +1,9 @@
package com.earth2me.essentials.commands;
-
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
@@ -43,21 +44,21 @@ public class Commandworth extends EssentialsCommand
final double worth = ess.getWorth().getPrice(iStack);
if (Double.isNaN(worth))
{
- throw new Exception(Util.i18n("itemCannotBeSold"));
+ throw new Exception(_("itemCannotBeSold"));
}
user.sendMessage(iStack.getDurability() != 0
- ? Util.format("worthMeta",
- iStack.getType().toString().toLowerCase().replace("_", ""),
- iStack.getDurability(),
- Util.formatCurrency(worth * amount, ess),
- amount,
- Util.formatCurrency(worth, ess))
- : Util.format("worth",
- iStack.getType().toString().toLowerCase().replace("_", ""),
- Util.formatCurrency(worth * amount, ess),
- amount,
- Util.formatCurrency(worth, ess)));
+ ? _("worthMeta",
+ iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
+ iStack.getDurability(),
+ Util.formatCurrency(worth * amount, ess),
+ amount,
+ Util.formatCurrency(worth, ess))
+ : _("worth",
+ iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
+ Util.formatCurrency(worth * amount, ess),
+ amount,
+ Util.formatCurrency(worth, ess)));
}
@Override
@@ -87,21 +88,21 @@ public class Commandworth extends EssentialsCommand
final double worth = ess.getWorth().getPrice(iStack);
if (Double.isNaN(worth))
{
- throw new Exception(Util.i18n("itemCannotBeSold"));
+ throw new Exception(_("itemCannotBeSold"));
}
sender.sendMessage(iStack.getDurability() != 0
- ? Util.format("worthMeta",
- iStack.getType().toString().toLowerCase().replace("_", ""),
- iStack.getDurability(),
- Util.formatCurrency(worth * amount, ess),
- amount,
- Util.formatCurrency(worth, ess))
- : Util.format("worth",
- iStack.getType().toString().toLowerCase().replace("_", ""),
- Util.formatCurrency(worth * amount, ess),
- amount,
- Util.formatCurrency(worth, ess)));
+ ? _("worthMeta",
+ iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
+ iStack.getDurability(),
+ Util.formatCurrency(worth * amount, ess),
+ amount,
+ Util.formatCurrency(worth, ess))
+ : _("worth",
+ iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
+ Util.formatCurrency(worth * amount, ess),
+ amount,
+ Util.formatCurrency(worth, ess)));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
index f52a06e29..63717fcae 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
@@ -1,6 +1,10 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.*;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.OfflinePlayer;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Server;
@@ -48,7 +52,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
{
if (!getOffline && (user.getBase() instanceof OfflinePlayer || user.isHidden()))
{
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
return user;
}
@@ -70,7 +74,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
return userMatch;
}
}
- throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ throw new NoSuchFieldException(_("playerNotFound"));
}
@Override
@@ -95,7 +99,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
- throw new Exception(Util.format("onlyPlayers", commandLabel));
+ throw new Exception(_("onlyPlayers", commandLabel));
}
public static String getFinalArg(final String[] args, final int start)
diff --git a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java
index 870797453..f16d3059c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java
@@ -16,6 +16,6 @@ public interface IEssentialsCommand
void run(Server server, CommandSender sender, String commandLabel, Command cmd, String[] args)
throws Exception;
-
+
void setEssentials(IEssentials ess);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java
index 615a556b9..9513fc934 100644
--- a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java
+++ b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java
@@ -1,15 +1,15 @@
package com.earth2me.essentials.commands;
-public class NotEnoughArgumentsException extends Exception {
+public class NotEnoughArgumentsException extends Exception
+{
public NotEnoughArgumentsException()
{
super();
}
-
+
public NotEnoughArgumentsException(final Throwable ex)
{
super(ex);
}
-
}
diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java
index 232cb04b4..b0f8e90c6 100644
--- a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java
@@ -12,6 +12,7 @@ public class BPermissionsHandler implements IPermissionsHandler
{
private final transient WorldPermissionsManager wpm;
private final transient InfoReader info;
+
public BPermissionsHandler()
{
wpm = Permissions.getWorldPermissionsManager();
@@ -51,13 +52,13 @@ public class BPermissionsHandler implements IPermissionsHandler
}
return groups.contains(group);
}
-
+
@Override
public boolean canBuild(final Player base, final String group)
{
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
}
-
+
@Override
public String getPrefix(final Player base)
{
diff --git a/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java b/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java
index d9da43ae8..8fd375eae 100644
--- a/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.perm;
-
import java.util.Arrays;
import java.util.List;
import org.anjocaido.groupmanager.GroupManager;
diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java
index 4062a162c..5d8e62232 100644
--- a/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java
@@ -88,7 +88,7 @@ public class PermissionsExHandler implements IPermissionsHandler
{
return null;
}
-
+
return user.getSuffix(base.getWorld().getName());
}
}
diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
index ab69d9fe4..8c16aab7a 100644
--- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
@@ -99,7 +99,7 @@ public class PermissionsHandler implements IPermissionsHandler
public void checkPermissions()
{
final PluginManager pluginManager = plugin.getServer().getPluginManager();
-
+
final Plugin permExPlugin = pluginManager.getPlugin("PermissionsEx");
if (permExPlugin != null && permExPlugin.isEnabled())
{
@@ -121,7 +121,7 @@ public class PermissionsHandler implements IPermissionsHandler
}
return;
}
-
+
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
if (GMplugin != null && GMplugin.isEnabled())
{
@@ -132,7 +132,7 @@ public class PermissionsHandler implements IPermissionsHandler
}
return;
}
-
+
final Plugin permBukkitPlugin = pluginManager.getPlugin("PermissionsBukkit");
if (permBukkitPlugin != null && permBukkitPlugin.isEnabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Method.java b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
index ea4477077..a942667e8 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Method.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
@@ -13,15 +13,15 @@ import org.bukkit.plugin.Plugin;
public interface Method
{
/**
- * Encodes the Plugin into an Object disguised as the Plugin.
- * If you want the original Plugin Class you must cast it to the correct
- * Plugin, to do so you have to verify the name and or version then cast.
+ * Encodes the Plugin into an Object disguised as the Plugin. If you want the original Plugin Class you must cast it
+ * to the correct Plugin, to do so you have to verify the name and or version then cast.
*
* <pre>
* if(method.getName().equalsIgnoreCase("iConomy"))
* iConomy plugin = ((iConomy)method.getPlugin());</pre>
- *
- * @return <code>Object</code>
+ *
+ * @return
+ * <code>Object</code>
* @see #getName()
* @see #getVersion()
*/
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
index dc9a23e13..32acc0442 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.register.payment;
-
import java.util.HashSet;
import java.util.Set;
import org.bukkit.plugin.Plugin;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
index 4c4b2721a..c3b71d4e3 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
import com.earth2me.essentials.register.payment.Method;
import cosine.boseconomy.BOSEconomy;
import org.bukkit.plugin.Plugin;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
index f96c286fa..d21ea6244 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
import com.earth2me.essentials.register.payment.Method;
import cosine.boseconomy.BOSEconomy;
import org.bukkit.plugin.Plugin;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
index ddef3c6fd..87d633b5c 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
@@ -1,7 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
-
import com.earth2me.essentials.register.payment.Method;
import me.ashtheking.currency.Currency;
import me.ashtheking.currency.CurrencyList;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
index aaa3153c0..52fb36e15 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
@@ -1,7 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
-
import com.earth2me.essentials.register.payment.Method;
import com.nijiko.coelho.iConomy.iConomy;
import com.nijiko.coelho.iConomy.system.Account;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
index c0ddeed83..3b2fb2f6d 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
@@ -1,7 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
-
import com.earth2me.essentials.register.payment.Method;
import com.iConomy.iConomy;
import com.iConomy.system.Account;
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
index 9ebe08d39..1a2950847 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
@@ -1,7 +1,5 @@
package com.earth2me.essentials.register.payment.methods;
-
-
import com.earth2me.essentials.register.payment.Method;
import com.iCo6.iConomy;
import com.iCo6.system.Account;
diff --git a/Essentials/src/com/earth2me/essentials/settings/Chat.java b/Essentials/src/com/earth2me/essentials/settings/Chat.java
index 7c02c0e88..d20d1dc68 100644
--- a/Essentials/src/com/earth2me/essentials/settings/Chat.java
+++ b/Essentials/src/com/earth2me/essentials/settings/Chat.java
@@ -12,13 +12,11 @@ public class Chat extends StorageObject
{
@Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.")
private String nicknamePrefix = "~";
-
@Comment("Disable this if you have any other plugin, that modifies the displayname of a user.")
private boolean changeDisplayname = true;
-
private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}";
-
- @Comment({
+ @Comment(
+ {
"If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.",
"Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.",
"Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)",
@@ -26,7 +24,6 @@ public class Chat extends StorageObject
"You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
})
private int localRadius = 0;
-
@Comment("Set the default chat format here, it will be overwritten by group specific chat formats.")
private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}";
}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Commands.java b/Essentials/src/com/earth2me/essentials/settings/Commands.java
index 64a218476..ed4c3595b 100644
--- a/Essentials/src/com/earth2me/essentials/settings/Commands.java
+++ b/Essentials/src/com/earth2me/essentials/settings/Commands.java
@@ -34,7 +34,6 @@ public class Commands extends StorageObject
"If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
})
private List<String> overwritten = new ArrayList<String>();
-
@ListType
@Comment("Disabled commands will be completelly unavailable on the server.")
private List<String> disabled = new ArrayList<String>();
diff --git a/Essentials/src/com/earth2me/essentials/settings/Groups.java b/Essentials/src/com/earth2me/essentials/settings/Groups.java
index 06565d376..64b391300 100644
--- a/Essentials/src/com/earth2me/essentials/settings/Groups.java
+++ b/Essentials/src/com/earth2me/essentials/settings/Groups.java
@@ -11,8 +11,9 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class Groups extends StorageObject
-{
- public Groups() {
+{
+ public Groups()
+ {
GroupOptions defaultOptions = new GroupOptions();
groups.put("default", defaultOptions);
}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/God.java b/Essentials/src/com/earth2me/essentials/settings/commands/God.java
index 7740eaab1..3b38b70b0 100644
--- a/Essentials/src/com/earth2me/essentials/settings/commands/God.java
+++ b/Essentials/src/com/earth2me/essentials/settings/commands/God.java
@@ -5,8 +5,9 @@ import com.earth2me.essentials.storage.StorageObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
+
@Data
-@EqualsAndHashCode(callSuper=false)
+@EqualsAndHashCode(callSuper = false)
public class God extends StorageObject
{
@Comment("Turn off god mode when people exit")
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java b/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java
index 59b0b9a82..bd7c15eab 100644
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java
+++ b/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java
@@ -13,7 +13,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
public class Kit extends StorageObject
{
-
public Kit()
{
final KitObject kit = new KitObject();
@@ -21,8 +20,6 @@ public class Kit extends StorageObject
kit.setItems(Arrays.asList("277 1,278 1,279 1".split(",")));
kits.put("tools", kit);
}
-
-
@MapType(KitObject.class)
- private Map<String,KitObject> kits = new HashMap<String, KitObject>();
+ private Map<String, KitObject> kits = new HashMap<String, KitObject>();
}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java b/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java
index 510857247..b70bd0abf 100644
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java
+++ b/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.storage.StorageObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
+
@Data
@EqualsAndHashCode(callSuper = false)
public class Lightning extends StorageObject
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java b/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java
index 771da32d1..3c338b443 100644
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.storage.StorageObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
+
@Data
@EqualsAndHashCode(callSuper = false)
public class Spawnmob extends StorageObject
diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
index e8bdd2b76..aaf040c02 100644
--- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
+++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials.signs;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.*;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -26,14 +28,14 @@ public class EssentialsSign
{
final ISign sign = new EventSign(event);
final User user = ess.getUser(event.getPlayer());
- if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".create")
- || user.isAuthorized("essentials.signs.create." + signName.toLowerCase())))
+ if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".create")
+ || user.isAuthorized("essentials.signs.create." + signName.toLowerCase(Locale.ENGLISH))))
{
// Return true, so other plugins can use the same sign title, just hope
// they won't change it to §1[Signname]
return true;
}
- sign.setLine(0, Util.format("signFormatFail", this.signName));
+ sign.setLine(0, _("signFormatFail", this.signName));
try
{
final boolean ret = onSignCreate(sign, user, getUsername(user), ess);
@@ -57,12 +59,12 @@ public class EssentialsSign
public String getSuccessName()
{
- return Util.format("signFormatSuccess", this.signName);
+ return _("signFormatSuccess", this.signName);
}
public String getTemplateName()
{
- return Util.format("signFormatTemplate", this.signName);
+ return _("signFormatTemplate", this.signName);
}
private String getUsername(final User user)
@@ -76,8 +78,8 @@ public class EssentialsSign
final User user = ess.getUser(player);
try
{
- return (user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".use")
- || user.isAuthorized("essentials.signs.use." + signName.toLowerCase()))
+ return (user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".use")
+ || user.isAuthorized("essentials.signs.use." + signName.toLowerCase(Locale.ENGLISH)))
&& onSignInteract(sign, user, getUsername(user), ess);
}
catch (ChargeException ex)
@@ -98,8 +100,8 @@ public class EssentialsSign
final User user = ess.getUser(player);
try
{
- return (user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".break")
- || user.isAuthorized("essentials.signs.break." + signName.toLowerCase()))
+ return (user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".break")
+ || user.isAuthorized("essentials.signs.break." + signName.toLowerCase(Locale.ENGLISH)))
&& onSignBreak(sign, user, getUsername(user), ess);
}
catch (SignException ex)
@@ -173,7 +175,7 @@ public class EssentialsSign
}
return false;
}
-
+
public boolean onBlockBreak(final Block block, final IEssentials ess)
{
return true;
@@ -188,7 +190,7 @@ public class EssentialsSign
{
return true;
}
-
+
public boolean onBlockIgnite(final Block block, final IEssentials ess)
{
return true;
@@ -285,7 +287,7 @@ public class EssentialsSign
final int amount = Math.min(getIntegerPositive(sign.getLine(amountIndex)), item.getType().getMaxStackSize() * player.getInventory().getSize());
if (item.getTypeId() == 0 || amount < 1)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
item.setAmount(amount);
return new Trade(item, ess);
@@ -307,7 +309,7 @@ public class EssentialsSign
final int quantity = getInteger(line);
if (quantity < 1)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
return quantity;
}
@@ -351,7 +353,7 @@ public class EssentialsSign
final double quantity = getDouble(line);
if (Math.round(quantity * 100.0) < 1.0)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
return quantity;
}
@@ -378,7 +380,7 @@ public class EssentialsSign
final String line = sign.getLine(index).trim();
if (line.isEmpty())
{
- return new Trade(signName.toLowerCase() + "sign", ess);
+ return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess);
}
final Double money = getMoney(line);
@@ -387,15 +389,15 @@ public class EssentialsSign
final String[] split = line.split("[ :]+", 2);
if (split.length != 2)
{
- throw new SignException(Util.i18n("invalidCharge"));
+ throw new SignException(_("invalidCharge"));
}
final int quantity = getIntegerPositive(split[0]);
- final String item = split[1].toLowerCase();
+ final String item = split[1].toLowerCase(Locale.ENGLISH);
if (item.equalsIgnoreCase("times"))
{
sign.setLine(index, (quantity - decrement) + " times");
- return new Trade(signName.toLowerCase() + "sign", ess);
+ return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess);
}
else
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java
index 3b961eef6..0b7328ba5 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.signs;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
public class SignBalance extends EssentialsSign
@@ -15,7 +15,7 @@ public class SignBalance extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
- player.sendMessage(Util.format("balance", player.getMoney()));
+ player.sendMessage(_("balance", player.getMoney()));
return true;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
index b99f92b65..aa4e41426 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
@@ -27,7 +27,8 @@ public class SignBuy extends EssentialsSign
final Trade items = getTrade(sign, 1, 2, player, ess);
final Trade charge = getTrade(sign, 3, ess);
charge.isAffordableFor(player);
- if (!items.pay(player, false)) {
+ if (!items.pay(player, false))
+ {
throw new ChargeException("Inventory full");
}
charge.charge(player);
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
index eee813c7b..09bdbeea5 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
@@ -69,5 +69,5 @@ public class SignEntityListener extends EntityListener
return;
}
}
- }
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
index 56efffb65..3293f6467 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
@@ -1,6 +1,10 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.InventoryWorkaround;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
import net.minecraft.server.InventoryPlayer;
import org.bukkit.Material;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
@@ -27,10 +31,10 @@ public class SignFree extends EssentialsSign
final ItemStack item = getItemStack(sign.getLine(1), 1, ess);
if (item.getType() == Material.AIR)
{
- throw new SignException(Util.format("cantSpawnItem", "Air"));
+ throw new SignException(_("cantSpawnItem", "Air"));
}
- item.setAmount(item.getType().getMaxStackSize()*9*4);
+ item.setAmount(item.getType().getMaxStackSize() * 9 * 4);
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(player.getHandle()));
inv.clear();
InventoryWorkaround.addItem(inv, true, item);
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
index f8fdeb20d..37a9fb1b8 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
@@ -1,6 +1,11 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
+import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
+import java.util.Locale;
import org.bukkit.GameMode;
@@ -25,7 +30,7 @@ public class SignGameMode extends EssentialsSign
charge.isAffordableFor(player);
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
- player.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
+ player.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
charge.charge(player);
return true;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java
index a1c80e268..be8b7ba1d 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java
@@ -1,6 +1,10 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
+import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
public class SignHeal extends EssentialsSign
@@ -25,7 +29,7 @@ public class SignHeal extends EssentialsSign
player.setHealth(20);
player.setFoodLevel(20);
player.setFireTicks(0);
- player.sendMessage(Util.i18n("youAreHealed"));
+ player.sendMessage(_("youAreHealed"));
charge.charge(player);
return true;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignMail.java b/Essentials/src/com/earth2me/essentials/signs/SignMail.java
index 1c3d162c4..b220fb2f5 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignMail.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignMail.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.signs;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.List;
@@ -19,14 +19,14 @@ public class SignMail extends EssentialsSign
final List<String> mail = player.getMails();
if (mail.isEmpty())
{
- player.sendMessage(Util.i18n("noNewMail"));
+ player.sendMessage(_("noNewMail"));
return false;
}
for (String s : mail)
{
player.sendMessage(s);
}
- player.sendMessage(Util.i18n("markMailAsRead"));
+ player.sendMessage(_("markMailAsRead"));
return true;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
index 856831b58..e82759655 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
@@ -1,10 +1,11 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
+import java.util.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -41,7 +42,7 @@ public class SignProtection extends EssentialsSign
return true;
}
}
- player.sendMessage(Util.i18n("signProtectInvalidLocation"));
+ player.sendMessage(_("signProtectInvalidLocation"));
return false;
}
@@ -255,7 +256,7 @@ public class SignProtection extends EssentialsSign
if ((state == SignProtectionState.ALLOWED || state == SignProtectionState.NOT_ALLOWED)
&& !player.isAuthorized("essentials.signs.protection.override"))
{
- player.sendMessage(Util.format("noPlacePermission", block.getType().toString().toLowerCase()));
+ player.sendMessage(_("noPlacePermission", block.getType().toString().toLowerCase(Locale.ENGLISH)));
return false;
}
}
@@ -280,7 +281,7 @@ public class SignProtection extends EssentialsSign
}
- player.sendMessage(Util.format("noAccessPermission", block.getType().toString().toLowerCase()));
+ player.sendMessage(_("noAccessPermission", block.getType().toString().toLowerCase(Locale.ENGLISH)));
return false;
}
@@ -303,7 +304,7 @@ public class SignProtection extends EssentialsSign
}
- player.sendMessage(Util.format("noDestroyPermission", block.getType().toString().toLowerCase()));
+ player.sendMessage(_("noDestroyPermission", block.getType().toString().toLowerCase(Locale.ENGLISH)));
return false;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java
index 071b61be1..7c4cfcd54 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java
@@ -9,7 +9,6 @@ import com.earth2me.essentials.commands.Commandspawnmob;
public class SignSpawnmob extends EssentialsSign
{
-
public SignSpawnmob()
{
super("Spawnmob");
@@ -30,7 +29,8 @@ public class SignSpawnmob extends EssentialsSign
charge.isAffordableFor(player);
Commandspawnmob command = new Commandspawnmob();
command.setEssentials(ess);
- String[] args = new String[] {
+ String[] args = new String[]
+ {
sign.getLine(2), sign.getLine(1)
};
try
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTime.java b/Essentials/src/com/earth2me/essentials/signs/SignTime.java
index 054ffde0c..99c579ff4 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTime.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTime.java
@@ -1,6 +1,10 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
+import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
public class SignTime extends EssentialsSign
@@ -25,7 +29,7 @@ public class SignTime extends EssentialsSign
sign.setLine(1, "§2Night");
return true;
}
- throw new SignException(Util.i18n("onlyDayNight"));
+ throw new SignException(_("onlyDayNight"));
}
@Override
@@ -48,6 +52,6 @@ public class SignTime extends EssentialsSign
charge.charge(player);
return true;
}
- throw new SignException(Util.i18n("onlyDayNight"));
+ throw new SignException(_("onlyDayNight"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index ed7ef4db0..c2f3eb8e4 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.signs;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.*;
import org.bukkit.inventory.ItemStack;
@@ -41,7 +42,7 @@ public class SignTrade extends EssentialsSign
{
if (store == null)
{
- throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
+ throw new SignException(_("tradeSignEmptyOwner"), e);
}
}
Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
@@ -146,7 +147,7 @@ public class SignTrade extends EssentialsSign
amount -= amount % money;
if (amount < 0.01 || money < 0.01)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
return;
@@ -159,7 +160,7 @@ public class SignTrade extends EssentialsSign
final ItemStack item = getItemStack(split[1], amount, ess);
if (amount < 1 || item.getTypeId() == 0)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
String newline = amount + " " + split[1] + ":0";
if ((newline + amount).length() > 15)
@@ -178,12 +179,12 @@ public class SignTrade extends EssentialsSign
amount -= amount % stackamount;
if (amount < 1 || stackamount < 1 || item.getTypeId() == 0)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
sign.setLine(index, stackamount + " " + split[1] + ":" + amount);
return;
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
protected final Trade getTrade(final ISign sign, final int index, final boolean fullAmount, final boolean notEmpty, final IEssentials ess) throws SignException
@@ -208,7 +209,7 @@ public class SignTrade extends EssentialsSign
}
catch (SignException e)
{
- throw new SignException(Util.i18n("tradeSignEmpty"));
+ throw new SignException(_("tradeSignEmpty"));
}
}
@@ -220,12 +221,12 @@ public class SignTrade extends EssentialsSign
amount -= amount % stackamount;
if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0))
{
- throw new SignException(Util.i18n("tradeSignEmpty"));
+ throw new SignException(_("tradeSignEmpty"));
}
item.setAmount(fullAmount ? amount : stackamount);
return new Trade(item, ess);
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
@@ -295,6 +296,6 @@ public class SignTrade extends EssentialsSign
sign.setLine(index, newline);
return;
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWeather.java b/Essentials/src/com/earth2me/essentials/signs/SignWeather.java
index 8af788961..559fcc2e3 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignWeather.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignWeather.java
@@ -1,6 +1,10 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.*;
+import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.Trade;
+import com.earth2me.essentials.User;
public class SignWeather extends EssentialsSign
@@ -25,7 +29,7 @@ public class SignWeather extends EssentialsSign
sign.setLine(1, "§2Storm");
return true;
}
- throw new SignException(Util.i18n("onlySunStorm"));
+ throw new SignException(_("onlySunStorm"));
}
@Override
@@ -46,7 +50,6 @@ public class SignWeather extends EssentialsSign
charge.charge(player);
return true;
}
- throw new SignException(Util.i18n("onlySunStorm"));
+ throw new SignException(_("onlySunStorm"));
}
}
-
diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
index ce99a8093..b25c30d51 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
@@ -4,10 +4,7 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -50,7 +47,7 @@ public class TextInput implements IText
}
if (line.length() > 0 && line.charAt(0) == '#')
{
- bookmarks.put(line.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), lineNumber);
+ bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§').replace("§§", "&"));
}
lines.add(line.replace('&', '§').replace("§§", "&"));
diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
index 786ca96bd..0a33e537a 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
@@ -1,7 +1,8 @@
package com.earth2me.essentials.textreader;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.bukkit.command.CommandSender;
@@ -44,7 +45,7 @@ public class TextPager
if (showHeader)
{
int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
- sender.sendMessage(Util.format("infoPages", page, pages));
+ sender.sendMessage(_("infoPages", page, pages));
}
for (int i = start; i < lines.size() && i < start + 9; i++)
{
@@ -61,7 +62,7 @@ public class TextPager
{
return;
}
- sender.sendMessage(Util.i18n("infoChapter"));
+ sender.sendMessage(_("infoChapter"));
final StringBuilder sb = new StringBuilder();
boolean first = true;
for (String string : chapters)
@@ -102,7 +103,7 @@ public class TextPager
if (showHeader)
{
int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
- sender.sendMessage(Util.format("infoPages", page, pages));
+ sender.sendMessage(_("infoPages", page, pages));
}
for (int i = start; i < end && i < start + 9; i++)
{
@@ -125,12 +126,12 @@ public class TextPager
}
}
- if (!bookmarks.containsKey(pageStr.toLowerCase()))
+ if (!bookmarks.containsKey(pageStr.toLowerCase(Locale.ENGLISH)))
{
- sender.sendMessage(Util.i18n("infoUnknownChapter"));
+ sender.sendMessage(_("infoUnknownChapter"));
return;
}
- final int chapterstart = bookmarks.get(pageStr.toLowerCase()) + 1;
+ final int chapterstart = bookmarks.get(pageStr.toLowerCase(Locale.ENGLISH)) + 1;
int chapterend;
for (chapterend = chapterstart; chapterend < lines.size(); chapterend++)
{
@@ -146,7 +147,7 @@ public class TextPager
{
final int page = chapterpage + 1;
final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
- sender.sendMessage(Util.format("infoChapterPages", pageStr, page, pages));
+ sender.sendMessage(_("infoChapterPages", pageStr, page, pages));
}
for (int i = start; i < chapterend && i < start + 9; i++)
{
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 34e60bed4..0cea89bdc 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -2,20 +2,12 @@ package com.earth2me.essentials;
import com.avaje.ebean.config.ServerConfig;
import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.logging.Logger;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.World;
import org.bukkit.World.Environment;
-import org.bukkit.WorldCreator;
+import org.bukkit.*;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
@@ -469,8 +461,8 @@ public class FakeServer implements Server
@Override
public org.bukkit.OfflinePlayer getOfflinePlayer(final String string)
{
- return new org.bukkit.OfflinePlayer() {
-
+ return new org.bukkit.OfflinePlayer()
+ {
@Override
public boolean isOnline()
{
diff --git a/Essentials/test/com/earth2me/essentials/StorageTest.java b/Essentials/test/com/earth2me/essentials/StorageTest.java
index 9ee5883e9..ada3d703a 100644
--- a/Essentials/test/com/earth2me/essentials/StorageTest.java
+++ b/Essentials/test/com/earth2me/essentials/StorageTest.java
@@ -1,13 +1,9 @@
package com.earth2me.essentials;
-import junit.framework.TestCase;
import com.earth2me.essentials.settings.Settings;
import com.earth2me.essentials.storage.StorageObject;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.Reader;
+import java.io.*;
+import junit.framework.TestCase;
import org.junit.Test;
diff --git a/Essentials/test/com/earth2me/essentials/UtilTest.java b/Essentials/test/com/earth2me/essentials/UtilTest.java
index 4772b4923..71282a18f 100644
--- a/Essentials/test/com/earth2me/essentials/UtilTest.java
+++ b/Essentials/test/com/earth2me/essentials/UtilTest.java
@@ -30,16 +30,17 @@ public class UtilTest extends TestCase
{
fail("IOException");
}
- Util.updateLocale("en_US", ess);
- }
-
- public void testFDDnow() {
+ }
+
+ public void testFDDnow()
+ {
Calendar c = new GregorianCalendar();
String resp = Util.formatDateDiff(c, c);
assertEquals(resp, "now");
}
-
- public void testFDDfuture() {
+
+ public void testFDDfuture()
+ {
Calendar a, b;
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
b = new GregorianCalendar(2010, 1, 1, 10, 0, 1);
@@ -105,8 +106,9 @@ public class UtilTest extends TestCase
b = new GregorianCalendar(2011, 4, 31, 10, 5, 0);
assertEquals(" 5 minutes", Util.formatDateDiff(a, b));
}
-
- public void testFDDpast() {
+
+ public void testFDDpast()
+ {
Calendar a, b;
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
b = new GregorianCalendar(2010, 1, 1, 9, 59, 59);
diff --git a/EssentialsChat/nbproject/project.properties b/EssentialsChat/nbproject/project.properties
index 0d17cfa30..0ce40b48b 100644
--- a/EssentialsChat/nbproject/project.properties
+++ b/EssentialsChat/nbproject/project.properties
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index c0559ddef..f547f0da0 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.chat;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.Util;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
@@ -32,21 +32,21 @@ public class EssentialsChat extends JavaPlugin
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this);
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
- LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
+ LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
- LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
+ LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
public void onDisable()
{
chatListener.clear();
}
-
+
public void addEssentialsChatListener(final String plugin, final IEssentialsChatListener listener)
{
chatListener.put(plugin, listener);
}
-
+
public IEssentialsChatListener removeEssentialsChatListener(final String plugin)
{
return chatListener.remove(plugin);
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index aeaa38d89..305e13e8a 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -1,14 +1,10 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Location;
@@ -20,10 +16,6 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerListener;
-/**
- *
- * @author Seiji
- */
public abstract class EssentialsChatPlayer extends PlayerListener
{
protected transient IEssentials ess;
@@ -117,7 +109,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
protected void sendLocalChat(final User sender, final long radius, final PlayerChatEvent event)
{
event.setCancelled(true);
- logger.info(Util.format("localFormat", sender.getName(), event.getMessage()));
+ logger.info(_("localFormat", sender.getName(), event.getMessage()));
final Location loc = sender.getLocation();
final World world = loc.getWorld();
final int x = loc.getBlockX();
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
index ba4e63d98..0945fcd93 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -23,8 +23,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
}
/**
- * This listener should apply the general chat formatting only...then return control back
- * the event handler
+ * This listener should apply the general chat formatting only...then return control back the event handler
*/
final User user = ess.getUser(event.getPlayer());
if (user.isAuthorized("essentials.chat.color"))
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
index d726cb569..363e4ca6e 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerChatEvent;
@@ -25,8 +25,8 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
}
/**
- * This file should handle detection of the local chat features...
- * if local chat is enabled, we need to handle it here
+ * This file should handle detection of the local chat features... if local chat is enabled, we need to handle
+ * it here
*/
final User user = ess.getUser(event.getPlayer());
final String chatType = getChatType(event.getMessage());
@@ -56,11 +56,11 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
{
charge(user, command.toString());
event.setMessage(event.getMessage().substring(1));
- event.setFormat(Util.format(format.toString(), event.getFormat()));
+ event.setFormat(_(format.toString(), event.getFormat()));
return;
}
- user.sendMessage(Util.i18n(errorMsg.toString()));
+ user.sendMessage(_(errorMsg.toString()));
event.setCancelled(true);
return;
}
diff --git a/EssentialsGeoIP/nbproject/project.properties b/EssentialsGeoIP/nbproject/project.properties
index cee848726..1b6ef450d 100644
--- a/EssentialsGeoIP/nbproject/project.properties
+++ b/EssentialsGeoIP/nbproject/project.properties
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
index 5a4049a62..6bc0c2022 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.geoip;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
@@ -31,11 +31,12 @@ public class EssentialsGeoIP extends JavaPlugin
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
- if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
- logger.log(Level.WARNING, Util.i18n("versionMismatchAll"));
+ if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
+ {
+ logger.log(Level.WARNING, _("versionMismatchAll"));
}
- logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
-
+ logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
+
logger.log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.");
}
}
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
index 8926f77e8..ee187c2aa 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
@@ -1,18 +1,14 @@
package com.earth2me.essentials.geoip;
import com.earth2me.essentials.EssentialsConf;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import com.maxmind.geoip.Location;
import com.maxmind.geoip.LookupService;
import com.maxmind.geoip.regionName;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
@@ -84,8 +80,9 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
for (Player player : event.getPlayer().getServer().getOnlinePlayers())
{
User user = ess.getUser(player);
- if (user.isAuthorized("essentials.geoip.show")) {
- user.sendMessage(Util.format("geoipJoinFormat", u.getDisplayName(), sb.toString()));
+ if (user.isAuthorized("essentials.geoip.show"))
+ {
+ user.sendMessage(_("geoipJoinFormat", u.getDisplayName(), sb.toString()));
}
}
}
@@ -112,7 +109,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
else
{
- logger.log(Level.SEVERE, Util.i18n("cantFindGeoIpDB"));
+ logger.log(Level.SEVERE, _("cantFindGeoIpDB"));
return;
}
}
@@ -122,7 +119,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
catch (IOException ex)
{
- logger.log(Level.SEVERE, Util.i18n("cantReadGeoIpDB"), ex);
+ logger.log(Level.SEVERE, _("cantReadGeoIpDB"), ex);
}
}
@@ -141,10 +138,10 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
if (url == null || url.isEmpty())
{
- logger.log(Level.SEVERE, Util.i18n("geoIpUrlEmpty"));
+ logger.log(Level.SEVERE, _("geoIpUrlEmpty"));
return;
}
- logger.log(Level.INFO, Util.i18n("downloadingGeoIp"));
+ logger.log(Level.INFO, _("downloadingGeoIp"));
URL downloadUrl = new URL(url);
URLConnection conn = downloadUrl.openConnection();
conn.setConnectTimeout(10000);
@@ -167,12 +164,12 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
catch (MalformedURLException ex)
{
- logger.log(Level.SEVERE, Util.i18n("geoIpUrlInvalid"), ex);
+ logger.log(Level.SEVERE, _("geoIpUrlInvalid"), ex);
return;
}
catch (IOException ex)
{
- logger.log(Level.SEVERE, Util.i18n("connectionFailed"), ex);
+ logger.log(Level.SEVERE, _("connectionFailed"), ex);
}
}
}
diff --git a/EssentialsGeoIP/src/com/maxmind/geoip/DatabaseInfo.java b/EssentialsGeoIP/src/com/maxmind/geoip/DatabaseInfo.java
index dfed516a5..939259ebb 100644
--- a/EssentialsGeoIP/src/com/maxmind/geoip/DatabaseInfo.java
+++ b/EssentialsGeoIP/src/com/maxmind/geoip/DatabaseInfo.java
@@ -20,9 +20,9 @@
package com.maxmind.geoip;
-import java.util.Date;
-import java.text.SimpleDateFormat;
import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
/**
* Encapsulates metadata about the GeoIP database. The database has a date, is a premium or
diff --git a/EssentialsGeoIP/src/com/maxmind/geoip/LookupService.java b/EssentialsGeoIP/src/com/maxmind/geoip/LookupService.java
index 406cda004..19da6c8f5 100644
--- a/EssentialsGeoIP/src/com/maxmind/geoip/LookupService.java
+++ b/EssentialsGeoIP/src/com/maxmind/geoip/LookupService.java
@@ -20,16 +20,16 @@
package com.maxmind.geoip;
+
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.net.InetAddress;
import java.net.Inet6Address;
+import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.StringTokenizer;
-
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
diff --git a/EssentialsProtect/nbproject/project.properties b/EssentialsProtect/nbproject/project.properties
index 22cd70494..d0bbb3ce2 100644
--- a/EssentialsProtect/nbproject/project.properties
+++ b/EssentialsProtect/nbproject/project.properties
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 98daf26cb..897112cb6 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.protect;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import com.earth2me.essentials.protect.data.IProtectedBlock;
import com.earth2me.essentials.protect.data.ProtectedBlockMemory;
import com.earth2me.essentials.protect.data.ProtectedBlockMySQL;
@@ -81,9 +81,9 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
ess.addReloadListener(this);
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
- LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
+ LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
- LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
+ LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@Override
@@ -97,9 +97,9 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
public void alert(final User user, final String item, final String type)
{
final Location loc = user.getLocation();
- final String warnMessage = Util.format("alertFormat", user.getName(), type, item,
- loc.getWorld().getName() + "," + loc.getBlockX() + ","
- + loc.getBlockY() + "," + loc.getBlockZ());
+ final String warnMessage = _("alertFormat", user.getName(), type, item,
+ loc.getWorld().getName() + "," + loc.getBlockX() + ","
+ + loc.getBlockY() + "," + loc.getBlockZ());
LOGGER.log(Level.WARNING, warnMessage);
for (Player p : this.getServer().getOnlinePlayers())
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index db574fe22..a14925ccd 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -1,22 +1,15 @@
package com.earth2me.essentials.protect;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import com.earth2me.essentials.protect.data.IProtectedBlock;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockBurnEvent;
-import org.bukkit.event.block.BlockFromToEvent;
-import org.bukkit.event.block.BlockIgniteEvent;
-import org.bukkit.event.block.BlockListener;
-import org.bukkit.event.block.BlockPistonExtendEvent;
-import org.bukkit.event.block.BlockPistonRetractEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.block.*;
public class EssentialsProtectBlockListener extends BlockListener
@@ -57,7 +50,7 @@ public class EssentialsProtectBlockListener extends BlockListener
if (prot.checkProtectionItems(ProtectConfig.alert_on_placement, id))
{
- prot.alert(user, blockPlaced.getType().toString(), Util.i18n("alertPlaced"));
+ prot.alert(user, blockPlaced.getType().toString(), _("alertPlaced"));
}
final Block below = blockPlaced.getRelative(BlockFace.DOWN);
@@ -255,7 +248,7 @@ public class EssentialsProtectBlockListener extends BlockListener
if (prot.checkProtectionItems(ProtectConfig.alert_on_break, typeId))
{
- prot.alert(user, type.toString(), Util.i18n("alertBroke"));
+ prot.alert(user, type.toString(), _("alertBroke"));
}
final IProtectedBlock storage = prot.getStorage();
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index f901844d2..b0a6b8521 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -14,26 +15,10 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.entity.CreatureType;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.entity.SmallFireball;
-import org.bukkit.entity.TNTPrimed;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.EndermanPickupEvent;
-import org.bukkit.event.entity.EntityDamageByBlockEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityListener;
-import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
-import org.bukkit.event.entity.ExplosionPrimeEvent;
+import org.bukkit.event.entity.*;
public class EssentialsProtectEntityListener extends EntityListener
@@ -315,7 +300,7 @@ public class EssentialsProtectEntityListener extends EntityListener
{
return;
}
- final String creatureName = creature.toString().toLowerCase();
+ final String creatureName = creature.toString().toLowerCase(Locale.ENGLISH);
if (creatureName == null || creatureName.isEmpty())
{
return;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index e39970d06..98daecb97 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -1,14 +1,14 @@
package com.earth2me.essentials.protect;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.User;
+import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
-import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
-import org.bukkit.Material;
-import org.bukkit.event.block.Action;
public class EssentialsProtectPlayerListener extends PlayerListener
@@ -26,10 +26,6 @@ public class EssentialsProtectPlayerListener extends PlayerListener
public void onPlayerInteract(final PlayerInteractEvent event)
{
// Do not return if cancelled, because the interact event has 2 cancelled states.
- /*if (event.isCancelled())
- {
- return;
- }*/
final User user = ess.getUser(event.getPlayer());
if (event.hasItem()
@@ -39,7 +35,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
{
if (ess.getSettings().warnOnBuildDisallow())
{
- user.sendMessage(Util.i18n("buildAlert"));
+ user.sendMessage(_("buildAlert"));
}
event.setCancelled(true);
return;
@@ -49,7 +45,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
{
if (ess.getSettings().warnOnBuildDisallow())
{
- user.sendMessage(Util.i18n("buildAlert"));
+ user.sendMessage(_("buildAlert"));
}
event.setCancelled(true);
return;
@@ -81,13 +77,13 @@ public class EssentialsProtectPlayerListener extends PlayerListener
final String ownerNames = stringBuilder.toString();
if (ownerNames != null && !ownerNames.isEmpty())
{
- user.sendMessage(Util.format("protectionOwner", ownerNames));
+ user.sendMessage(_("protectionOwner", ownerNames));
}
}
if (item != null
&& prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId()))
{
- prot.alert(user, item.getType().toString(), Util.i18n("alertUsed"));
+ prot.alert(user, item.getType().toString(), _("alertUsed"));
}
}
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index 5d93fe0ea..369e988ae 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -62,7 +62,7 @@ public enum ProtectConfig
{
this(configName, null, false, true, false);
}
-
+
private ProtectConfig(final String configName, final String defValueString)
{
this(configName, defValueString, false, false, true);
@@ -110,7 +110,7 @@ public enum ProtectConfig
{
return isString;
}
-
+
public boolean isList()
{
return isList;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
index 271f1c464..755baface 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
@@ -3,13 +3,22 @@ package com.earth2me.essentials.protect.data;
import java.util.List;
import org.bukkit.block.Block;
-public interface IProtectedBlock {
+
+public interface IProtectedBlock
+{
public void clearProtections();
+
public void importProtections(List<OwnedBlock> blocks);
+
public List<OwnedBlock> exportProtections();
+
public void protectBlock(Block block, String playerName);
+
public boolean isProtected(Block block, String playerName);
+
public List<String> getOwners(Block block);
+
public int unprotectBlock(Block block);
+
public void onPluginDeactivation();
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java
index dea124b58..dc28feae8 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java
@@ -1,6 +1,8 @@
package com.earth2me.essentials.protect.data;
-public class OwnedBlock {
+
+public class OwnedBlock
+{
final int x;
final int y;
final int z;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
index 1348b6bc8..876c8a575 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
@@ -1,12 +1,7 @@
package com.earth2me.essentials.protect.data;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
+import java.util.*;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.plugin.Plugin;
@@ -249,5 +244,5 @@ public class ProtectedBlockMemory implements IProtectedBlock
public void onPluginDeactivation()
{
storage.onPluginDeactivation();
- }
+ }
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java
index 8e50ce248..2a0077698 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java
@@ -8,50 +8,59 @@ import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
-public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
- public ProtectedBlockMySQL(String url, String username, String password) throws PropertyVetoException {
+public class ProtectedBlockMySQL extends ProtectedBlockJDBC
+{
+ public ProtectedBlockMySQL(String url, String username, String password) throws PropertyVetoException
+ {
super("com.mysql.jdbc.Driver", url, username, password);
}
-
private static final String QueryCreateTable =
- "CREATE TABLE IF NOT EXISTS `EssentialsProtect` ("
- + "`worldName` varchar(60) NOT NULL,"
- + "`x` int(11) NOT NULL, `y` int(11) NOT NULL, `z` int(11) NOT NULL,"
- + "`playerName` varchar(150) DEFAULT NULL,"
- + "KEY `pos` (`worldName`,`x`,`z`,`y`)"
- + ") ENGINE=MyISAM DEFAULT CHARSET=utf8";
+ "CREATE TABLE IF NOT EXISTS `EssentialsProtect` ("
+ + "`worldName` varchar(60) NOT NULL,"
+ + "`x` int(11) NOT NULL, `y` int(11) NOT NULL, `z` int(11) NOT NULL,"
+ + "`playerName` varchar(150) DEFAULT NULL,"
+ + "KEY `pos` (`worldName`,`x`,`z`,`y`)"
+ + ") ENGINE=MyISAM DEFAULT CHARSET=utf8";
@Override
- protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryCreateTable);
}
-
private static final String QueryUpdateFrom2_0TableCheck =
- "SHOW COLUMNS FROM `EssentialsProtect` LIKE 'id';";
+ "SHOW COLUMNS FROM `EssentialsProtect` LIKE 'id';";
private static final String QueryUpdateFrom2_0Table =
- "ALTER TABLE `EssentialsProtect` "
- + "CHARACTER SET = utf8, ENGINE = MyISAM,"
- + "DROP COLUMN `id`,"
- + "CHANGE COLUMN `playerName` `playerName` VARCHAR(150) NULL AFTER `z`,"
- + "CHANGE COLUMN `worldName` `worldName` VARCHAR(60) NOT NULL,"
- + "ADD INDEX `position` (`worldName` ASC, `x` ASC, `z` ASC, `y` ASC),"
- + "DROP PRIMARY KEY ;";
+ "ALTER TABLE `EssentialsProtect` "
+ + "CHARACTER SET = utf8, ENGINE = MyISAM,"
+ + "DROP COLUMN `id`,"
+ + "CHANGE COLUMN `playerName` `playerName` VARCHAR(150) NULL AFTER `z`,"
+ + "CHANGE COLUMN `worldName` `worldName` VARCHAR(60) NOT NULL,"
+ + "ADD INDEX `position` (`worldName` ASC, `x` ASC, `z` ASC, `y` ASC),"
+ + "DROP PRIMARY KEY ;";
@Override
- protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException
+ {
PreparedStatement testPS = null;
ResultSet testRS = null;
- try {
+ try
+ {
testPS = conn.prepareStatement(QueryUpdateFrom2_0TableCheck);
testRS = testPS.executeQuery();
- if (testRS.first()) {
+ if (testRS.first())
+ {
return conn.prepareStatement(QueryUpdateFrom2_0Table);
- } else {
+ }
+ else
+ {
return conn.prepareStatement("SELECT 1;");
}
- } finally {
- if (testRS != null) {
+ }
+ finally
+ {
+ if (testRS != null)
+ {
try
{
testRS.close();
@@ -61,7 +70,8 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
Logger.getLogger(ProtectedBlockMySQL.class.getName()).log(Level.SEVERE, null, ex);
}
}
- if (testPS != null) {
+ if (testPS != null)
+ {
try
{
testPS.close();
@@ -74,16 +84,18 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
}
}
private static final String QueryDeleteAll = "DELETE FROM EssentialsProtect;";
-
+
@Override
- protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryDeleteAll);
}
private static final String QueryInsert =
- "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
+ "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
@Override
- protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
+ protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryInsert);
ps.setString(1, world);
ps.setInt(2, x);
@@ -93,11 +105,12 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryCountByPlayer =
- "SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
- + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
+ "SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
+ + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
@Override
- protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
+ protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryCountByPlayer);
ps.setString(1, playerName);
ps.setString(2, world);
@@ -107,10 +120,11 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryPlayersByLocation =
- "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
+ "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
@Override
- protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
+ protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -119,10 +133,11 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryDeleteByLocation =
- "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
+ "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
@Override
- protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
+ protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -131,10 +146,11 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryAllBlocks =
- "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
+ "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
@Override
- protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryAllBlocks);
}
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java
index 444c657eb..cf256f1ec 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java
@@ -5,41 +5,45 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
- public ProtectedBlockSQLite(String url) throws PropertyVetoException {
+public class ProtectedBlockSQLite extends ProtectedBlockJDBC
+{
+ public ProtectedBlockSQLite(String url) throws PropertyVetoException
+ {
super("org.sqlite.JDBC", url);
}
-
private static final String QueryCreateTable =
- "CREATE TABLE IF NOT EXISTS EssentialsProtect ("
- + "worldName TEXT ,playerName TEXT, "
- + "x NUMERIC, y NUMERIC, z NUMERIC)";
+ "CREATE TABLE IF NOT EXISTS EssentialsProtect ("
+ + "worldName TEXT ,playerName TEXT, "
+ + "x NUMERIC, y NUMERIC, z NUMERIC)";
@Override
- protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryCreateTable);
}
-
private static final String QueryUpdateFrom2_0Table =
- "CREATE INDEX IF NOT EXISTS position ON EssentialsProtect ("
- + "worldName, x, z, y)";
+ "CREATE INDEX IF NOT EXISTS position ON EssentialsProtect ("
+ + "worldName, x, z, y)";
@Override
- protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryUpdateFrom2_0Table);
}
private static final String QueryDeleteAll = "DELETE FROM EssentialsProtect;";
@Override
- protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryDeleteAll);
}
private static final String QueryInsert =
- "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
+ "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
@Override
- protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
+ protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryInsert);
ps.setString(1, world);
ps.setInt(2, x);
@@ -49,11 +53,12 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryPlayerCountByLocation =
- "SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
- + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
+ "SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
+ + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
@Override
- protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
+ protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryPlayerCountByLocation);
ps.setString(1, playerName);
ps.setString(2, world);
@@ -63,10 +68,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryPlayersByLocation =
- "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
+ "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
@Override
- protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
+ protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -75,10 +81,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryDeleteByLocation =
- "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
+ "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
@Override
- protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
+ protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
+ {
PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -87,10 +94,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryAllBlocks =
- "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
+ "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
@Override
- protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException {
+ protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException
+ {
return conn.prepareStatement(QueryAllBlocks);
}
}
diff --git a/EssentialsSpawn/nbproject/project.properties b/EssentialsSpawn/nbproject/project.properties
index 3157d9b11..16c272f09 100644
--- a/EssentialsSpawn/nbproject/project.properties
+++ b/EssentialsSpawn/nbproject/project.properties
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
index 9ffc1c3f0..33dff8241 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.spawn;
-import org.bukkit.Server;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import com.earth2me.essentials.commands.EssentialsCommand;
+import org.bukkit.Server;
public class Commandsetspawn extends EssentialsCommand
@@ -18,6 +18,6 @@ public class Commandsetspawn extends EssentialsCommand
{
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
ess.getSpawn().setSpawn(user.getLocation(), group);
- user.sendMessage(Util.format("spawnSet", group));
+ user.sendMessage(_("spawnSet", group));
}
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index b3ade7634..f9ea9fa36 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Trade;
-import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand;
+import org.bukkit.Server;
public class Commandspawn extends EssentialsCommand
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
index 1bae3fed3..8ffdb5c97 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
@@ -1,8 +1,7 @@
package com.earth2me.essentials.spawn;
-
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.Command;
@@ -29,9 +28,9 @@ public class EssentialsSpawn extends JavaPlugin
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
- LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
+ LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
- LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
+ LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
public void onDisable()
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 459eee60a..a5d1efba9 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.spawn;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
@@ -71,7 +71,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
}
catch (Exception ex)
{
- Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
+ Logger.getLogger("Minecraft").log(Level.WARNING, _("teleportNewPlayerError"), ex);
}
}
});
diff --git a/EssentialsUpdate/nbproject/project.properties b/EssentialsUpdate/nbproject/project.properties
index 9f758533e..14a032421 100644
--- a/EssentialsUpdate/nbproject/project.properties
+++ b/EssentialsUpdate/nbproject/project.properties
@@ -4,6 +4,43 @@ annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=EssentialsUpdate
application.vendor=essentialsteam
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java b/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java
index 487e372c8..d2cbb8a64 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java
@@ -13,13 +13,15 @@ public abstract class AbstractWorkListener
private final transient Plugin plugin;
private final transient VersionInfo newVersionInfo;
- public final void onWorkAbort() {
+ public final void onWorkAbort()
+ {
onWorkAbort(null);
}
-
+
public abstract void onWorkAbort(String message);
-
- public final void onWorkDone() {
+
+ public final void onWorkDone()
+ {
onWorkDone(null);
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
index ec62566ca..4ed1df602 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
@@ -1,13 +1,6 @@
package com.earth2me.essentials.update;
-import com.earth2me.essentials.update.chat.Command;
-import com.earth2me.essentials.update.chat.ConfigCommand;
-import com.earth2me.essentials.update.chat.ErrorsCommand;
-import com.earth2me.essentials.update.chat.HelpCommand;
-import com.earth2me.essentials.update.chat.IrcBot;
-import com.earth2me.essentials.update.chat.ListCommand;
-import com.earth2me.essentials.update.chat.StartupCommand;
-import com.earth2me.essentials.update.chat.UsernameUtil;
+import com.earth2me.essentials.update.chat.*;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java
index 98dbeb2ef..be6e42ce9 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.update;
-import com.earth2me.essentials.update.UpdateCheck.CheckResult;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -16,7 +15,8 @@ public class EssentialsUpdate extends JavaPlugin
@Override
public void onEnable()
{
- if (!getDataFolder().exists() && !getDataFolder().mkdirs() ) {
+ if (!getDataFolder().exists() && !getDataFolder().mkdirs())
+ {
Bukkit.getLogger().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath());
}
essentialsHelp = new EssentialsHelp(this);
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java b/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java
index b48d95dd2..06b414e93 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java
@@ -1,10 +1,6 @@
package com.earth2me.essentials.update;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
index 95ef5e64e..3d465e2e8 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
@@ -15,8 +15,8 @@ import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.Plugin;
public class UpdateFile
@@ -66,7 +66,7 @@ public class UpdateFile
getFile = new GetFile(UPDATE_URL);
getFile.saveTo(file);
plugin.getConfig().set("lastupdate", System.currentTimeMillis());
- plugin.getConfig().save(new File(plugin.getDataFolder(),"config.yml"));
+ plugin.getConfig().save(new File(plugin.getDataFolder(), "config.yml"));
return true;
}
catch (IOException ex)
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java b/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java
index c34e40ae5..b9cddc38c 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java
@@ -1,10 +1,10 @@
package com.earth2me.essentials.update;
-import org.bukkit.configuration.Configuration;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.bukkit.configuration.Configuration;
public class VersionInfo
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java
index 824383285..7c99d28f6 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java
@@ -1,11 +1,7 @@
package com.earth2me.essentials.update.chat;
import com.earth2me.essentials.update.PastieUpload;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.*;
import java.nio.charset.Charset;
import org.bukkit.plugin.Plugin;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
index 5fda07106..de2c6a830 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
@@ -26,12 +26,16 @@ public class ConfigCommand extends AbstractFileCommand implements Command
do
{
final String line = page.readLine();
- if (line == null) {
+ if (line == null)
+ {
break;
- } else {
+ }
+ else
+ {
input.append(line).append("\n");
}
- } while (true);
+ }
+ while (true);
page.close();
final String message = "Essentials config.yml: " + uploadToPastie(input);
player.sendMessage("§6" + ircBot.getNick() + ": §7" + message);
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
index 7478d81b7..2c85c39fd 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
@@ -26,9 +26,8 @@ public abstract class AbstractState
catch (Exception ex)
{
/*
- * This should never happen.
- * All states that are added to the map automatically,
- * have to have a Constructor that accepts the StateMap.
+ * This should never happen. All states, that are added to the map automatically, have to have a
+ * Constructor that accepts the StateMap.
*/
throw new RuntimeException(ex);
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
index cb88cc642..930a31bda 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
@@ -8,5 +8,5 @@ public class InstallationFinishedEvent extends Event
public InstallationFinishedEvent()
{
super(Type.CUSTOM_EVENT);
- }
+ }
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
index 6db8734e7..6ce926f92 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.update.states;
-import com.earth2me.essentials.update.UpdateCheck;
import com.earth2me.essentials.update.AbstractWorkListener;
+import com.earth2me.essentials.update.UpdateCheck;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java
index 5671275f0..6b48f90be 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java
@@ -8,17 +8,18 @@ public class UpdateOrInstallation extends AbstractState
{
private final transient UpdateCheck updateCheck;
private transient boolean update = false;
-
+
public UpdateOrInstallation(final StateMap stateMap, final UpdateCheck updateCheck)
{
super(stateMap);
this.updateCheck = updateCheck;
}
-
+
@Override
public boolean guessAnswer()
{
- if (getUpdateCheck().isEssentialsInstalled()) {
+ if (getUpdateCheck().isEssentialsInstalled())
+ {
update = true;
}
return update;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java
index 66eeb380d..778f5172f 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java
@@ -1,9 +1,9 @@
package com.earth2me.essentials.update.tasks;
+import com.earth2me.essentials.update.AbstractWorkListener;
import com.earth2me.essentials.update.GetFile;
import com.earth2me.essentials.update.ModuleInfo;
import com.earth2me.essentials.update.VersionInfo;
-import com.earth2me.essentials.update.AbstractWorkListener;
import java.io.File;
import java.net.URL;
import java.util.logging.Level;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java
index 777e42517..3baf86be7 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java
@@ -43,8 +43,8 @@ public class SelfUpdate extends AbstractWorkListener implements Task, Runnable
@Override
public void run()
{
- Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), new Runnable() {
-
+ Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), new Runnable()
+ {
@Override
public void run()
{
@@ -52,6 +52,4 @@ public class SelfUpdate extends AbstractWorkListener implements Task, Runnable
}
});
}
-
-
}
diff --git a/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java b/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java
index 1c30ad815..a24815210 100755
--- a/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java
+++ b/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java
@@ -15,8 +15,8 @@ found at http://www.jibble.org/licenses/
package org.jibble.pircbot;
import java.io.*;
-import java.net.*;
-import java.util.*;
+import java.net.Socket;
+import java.util.StringTokenizer;
/**
* A Thread which reads lines from the IRC server. It then
diff --git a/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java b/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java
index 86ac404d2..7eddee873 100755
--- a/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java
+++ b/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java
@@ -14,8 +14,7 @@ found at http://www.jibble.org/licenses/
package org.jibble.pircbot;
-import java.io.*;
-import java.net.*;
+import java.io.BufferedWriter;
/**
* A Thread which is responsible for sending messages to the IRC server.
diff --git a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java
index a5f049cde..acdf01b46 100755
--- a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java
+++ b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java
@@ -15,7 +15,8 @@ found at http://www.jibble.org/licenses/
package org.jibble.pircbot;
import java.io.*;
-import java.net.*;
+import java.net.InetAddress;
+import java.net.Socket;
import java.util.*;
/**
@@ -2558,7 +2559,7 @@ public abstract class PircBot implements ReplyConstants {
* @see #onUserList(String,User[]) onUserList
*/
public final User[] getUsers(String channel) {
- channel = channel.toLowerCase();
+ channel = channel.toLowerCase(Locale.ENGLISH);
User[] userArray = new User[0];
synchronized (_channels) {
Hashtable users = (Hashtable) _channels.get(channel);
@@ -2631,7 +2632,7 @@ public abstract class PircBot implements ReplyConstants {
* Overwrite the existing entry if it exists.
*/
private final void addUser(String channel, User user) {
- channel = channel.toLowerCase();
+ channel = channel.toLowerCase(Locale.ENGLISH);
synchronized (_channels) {
Hashtable users = (Hashtable) _channels.get(channel);
if (users == null) {
@@ -2647,7 +2648,7 @@ public abstract class PircBot implements ReplyConstants {
* Remove a user from the specified channel in our memory.
*/
private final User removeUser(String channel, String nick) {
- channel = channel.toLowerCase();
+ channel = channel.toLowerCase(Locale.ENGLISH);
User user = new User("", nick);
synchronized (_channels) {
Hashtable users = (Hashtable) _channels.get(channel);
@@ -2695,7 +2696,7 @@ public abstract class PircBot implements ReplyConstants {
* Removes an entire channel from our memory of users.
*/
private final void removeChannel(String channel) {
- channel = channel.toLowerCase();
+ channel = channel.toLowerCase(Locale.ENGLISH);
synchronized (_channels) {
_channels.remove(channel);
}
@@ -2713,7 +2714,7 @@ public abstract class PircBot implements ReplyConstants {
private final void updateUser(String channel, int userMode, String nick) {
- channel = channel.toLowerCase();
+ channel = channel.toLowerCase(Locale.ENGLISH);
synchronized (_channels) {
Hashtable users = (Hashtable) _channels.get(channel);
User newUser = null;
diff --git a/EssentialsUpdate/src/org/jibble/pircbot/User.java b/EssentialsUpdate/src/org/jibble/pircbot/User.java
index cb2bfa051..37f981b19 100755
--- a/EssentialsUpdate/src/org/jibble/pircbot/User.java
+++ b/EssentialsUpdate/src/org/jibble/pircbot/User.java
@@ -13,6 +13,8 @@ found at http://www.jibble.org/licenses/
package org.jibble.pircbot;
+import java.util.Locale;
+
/**
* This class is used to represent a user on an IRC server.
* Instances of this class are returned by the getUsers method
@@ -38,7 +40,7 @@ public class User {
User(String prefix, String nick) {
_prefix = prefix;
_nick = nick;
- _lowerNick = nick.toLowerCase();
+ _lowerNick = nick.toLowerCase(Locale.ENGLISH);
}
@@ -109,7 +111,7 @@ public class User {
* @return true if the nicks are identical (case insensitive).
*/
public boolean equals(String nick) {
- return nick.toLowerCase().equals(_lowerNick);
+ return nick.toLowerCase(Locale.ENGLISH).equals(_lowerNick);
}
diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java b/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java
index 92faade26..024f2248b 100644
--- a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java
+++ b/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java
@@ -4,7 +4,6 @@ import com.earth2me.essentials.update.Version.Type;
import java.util.TreeSet;
import junit.framework.TestCase;
import org.junit.Test;
-import static org.junit.Assert.*;
public class VersionTest extends TestCase
diff --git a/EssentialsXMPP/nbproject/project.properties b/EssentialsXMPP/nbproject/project.properties
index 2e89ab318..802c76227 100644
--- a/EssentialsXMPP/nbproject/project.properties
+++ b/EssentialsXMPP/nbproject/project.properties
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
index 4a14ef730..e0bf9827c 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
@@ -22,6 +22,6 @@ public class Commandsetxmpp extends EssentialsCommand
}
EssentialsXMPP.getInstance().setAddress(user, args[0]);
- user.sendMessage("XMPP address set to "+args[0]);
+ user.sendMessage("XMPP address set to " + args[0]);
}
}
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java
index 632505670..e7dd01670 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java
@@ -33,7 +33,8 @@ public class Commandxmpp extends EssentialsCommand
final String message = getFinalArg(args, 1);
final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
- if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message)) {
+ if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
+ {
sender.sendMessage("§cError sending message.");
}
}
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
index 631d1b21b..06575851d 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
@@ -1,9 +1,10 @@
package com.earth2me.essentials.xmpp;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.IUser;
-import com.earth2me.essentials.Util;
import java.util.List;
+import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.Command;
@@ -22,7 +23,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
private transient UserManager users;
private transient XMPPManager xmpp;
private transient IEssentials ess;
-
+
public static IEssentialsXMPP getInstance()
{
return instance;
@@ -39,7 +40,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
{
LOGGER.log(Level.SEVERE, "Failed to load Essentials before EssentialsXMPP");
}
-
+
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
@@ -53,9 +54,9 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
- LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
+ LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
- LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
+ LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@Override
@@ -73,7 +74,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
@Override
public void setAddress(final Player user, final String address)
{
- final String username = user.getName().toLowerCase();
+ final String username = user.getName().toLowerCase(Locale.ENGLISH);
instance.users.setAddress(username, address);
}
@@ -93,7 +94,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
@Override
public boolean toggleSpy(final Player user)
{
- final String username = user.getName().toLowerCase();
+ final String username = user.getName().toLowerCase(Locale.ENGLISH);
final boolean spy = !instance.users.isSpy(username);
instance.users.setSpy(username, spy);
return spy;
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
index 9734444ad..85ef50949 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
@@ -3,10 +3,7 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.IConf;
import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
public class UserManager implements IConf
@@ -24,26 +21,27 @@ public class UserManager implements IConf
public final boolean isSpy(final String username)
{
- return users.getBoolean(username.toLowerCase() + "." + SPY, false);
+ return users.getBoolean(username.toLowerCase(Locale.ENGLISH) + "." + SPY, false);
}
public void setSpy(final String username, final boolean spy)
{
- setUser(username.toLowerCase(), getAddress(username), spy);
+ setUser(username.toLowerCase(Locale.ENGLISH), getAddress(username), spy);
}
public final String getAddress(final String username)
{
- return users.getString(username.toLowerCase() + "." + ADDRESS, null);
+ return users.getString(username.toLowerCase(Locale.ENGLISH) + "." + ADDRESS, null);
}
-
+
public final String getUserByAddress(final String search)
{
final List<String> usernames = users.getKeys(null);
for (String username : usernames)
{
final String address = users.getString(username + "." + ADDRESS, null);
- if (address != null && search.equalsIgnoreCase(address)) {
+ if (address != null && search.equalsIgnoreCase(address))
+ {
return username;
}
}
@@ -52,7 +50,7 @@ public class UserManager implements IConf
public void setAddress(final String username, final String address)
{
- setUser(username.toLowerCase(), address, isSpy(username));
+ setUser(username.toLowerCase(Locale.ENGLISH), address, isSpy(username));
}
public List<String> getSpyUsers()
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
index a5daa263d..695969378 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
@@ -56,7 +56,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
}
if (chat != null)
{
- if (!connection.isConnected()) {
+ if (!connection.isConnected())
+ {
disconnect();
connect();
}
@@ -90,7 +91,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
break;
default:
final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant()));
- parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message, StringUtils.parseBareAddress(chat.getParticipant()));
+ parent.broadcastMessage(sender, "=" + sender.getDisplayName() + ": " + message, StringUtils.parseBareAddress(chat.getParticipant()));
}
}
}