diff options
author | snowleo <schneeleo@gmail.com> | 2011-11-21 02:55:26 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-11-21 02:55:26 +0100 |
commit | 220d68f375bd117587c91f9478434eee517a33d7 (patch) | |
tree | 6344f983d195a4c8d091afffc9d2f8bdbca929bb /EssentialsXMPP | |
parent | 19f5a2340d9fdb3902f5c388f463fd569943db07 (diff) | |
download | Essentials-220d68f375bd117587c91f9478434eee517a33d7.tar Essentials-220d68f375bd117587c91f9478434eee517a33d7.tar.gz Essentials-220d68f375bd117587c91f9478434eee517a33d7.tar.lz Essentials-220d68f375bd117587c91f9478434eee517a33d7.tar.xz Essentials-220d68f375bd117587c91f9478434eee517a33d7.zip |
Switch to the new I18n class and format cleanup of all classes
Diffstat (limited to 'EssentialsXMPP')
6 files changed, 24 insertions, 21 deletions
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())); } } } |