summaryrefslogtreecommitdiffstats
path: root/EssentialsXMPP/src/com/earth2me/essentials
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsXMPP/src/com/earth2me/essentials')
-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
5 files changed, 22 insertions, 21 deletions
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()));
}
}
}