diff options
Diffstat (limited to 'EssentialsXMPP')
8 files changed, 22 insertions, 19 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java index bb81d8ec0..c4702b969 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java @@ -14,7 +14,7 @@ public class Commandsetxmpp extends EssentialsCommand } @Override - protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException { if (args.length < 1) { diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java index d78782f12..84d207e8c 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java @@ -16,7 +16,7 @@ public class Commandxmpp extends EssentialsCommand } @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException { if (args.length < 2) { diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java index c42049b22..4f276c3b9 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java @@ -16,7 +16,7 @@ public class Commandxmppspy extends EssentialsCommand } @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException { if (args.length < 1) { diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index 212275738..17e2bb136 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -68,7 +68,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public void setAddress(final Player user, final String address) throws Exception + public void setAddress(final Player user, final String address) { final String username = user.getName().toLowerCase(); instance.users.setAddress(username, address); @@ -81,7 +81,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public boolean toggleSpy(final Player user) throws Exception + public boolean toggleSpy(final Player user) { final String username = user.getName().toLowerCase(); final boolean spy = !instance.users.isSpy(username); diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java index a64bd17af..47966aee0 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java @@ -50,6 +50,7 @@ class EssentialsXMPPPlayerListener extends PlayerListener } catch (Exception ex) { + // Ignore exceptions } } } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java index 8716d6b1b..c3509827f 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java @@ -17,8 +17,8 @@ public interface IEssentialsXMPP void sendMessage(final String address, final String message); - void setAddress(final Player user, final String address) throws Exception; + void setAddress(final Player user, final String address); - boolean toggleSpy(final Player user) throws Exception; + boolean toggleSpy(final Player user); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java index 878a6b28e..bce2277d5 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java @@ -27,7 +27,7 @@ public class UserManager implements IConf return users.getBoolean(username.toLowerCase() + "." + SPY, false); } - public void setSpy(final String username, boolean spy) throws Exception + public void setSpy(final String username, final boolean spy) { setUser(username.toLowerCase(), getAddress(username), spy); } @@ -37,7 +37,7 @@ public class UserManager implements IConf return users.getString(username.toLowerCase() + "." + ADDRESS, null); } - public void setAddress(final String username, final String address) throws Exception + public void setAddress(final String username, final String address) { setUser(username.toLowerCase(), address, isSpy(username)); } @@ -47,7 +47,7 @@ public class UserManager implements IConf return spyusers; } - private void setUser(String username, String address, boolean spy) throws Exception + private void setUser(final String username, final String address, final boolean spy) { final Map<String, Object> userdata = new HashMap<String, Object>(); userdata.put(ADDRESS, address); diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index c92365c44..028c283b9 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -101,15 +101,15 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager final String serviceName = config.getString("xmpp.servicename", server); final String xmppuser = config.getString("xmpp.user"); final String password = config.getString("xmpp.password"); - final ConnectionConfiguration cc = new ConnectionConfiguration(server, port, serviceName); - final StringBuilder sb = new StringBuilder(); - sb.append("Connecting to xmpp server ").append(server).append(":").append(port); - sb.append(" as user ").append(xmppuser).append("."); - LOGGER.log(Level.INFO, sb.toString()); - cc.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false)); - cc.setSendPresence(true); - cc.setReconnectionAllowed(true); - connection = new XMPPConnection(cc); + final ConnectionConfiguration connConf = new ConnectionConfiguration(server, port, serviceName); + final StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("Connecting to xmpp server ").append(server).append(":").append(port); + stringBuilder.append(" as user ").append(xmppuser).append("."); + LOGGER.log(Level.INFO, stringBuilder.toString()); + connConf.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false)); + connConf.setSendPresence(true); + connConf.setReconnectionAllowed(true); + connection = new XMPPConnection(connConf); try { connection.connect(); @@ -208,11 +208,13 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager @Override public void flush() { + // Ignore this } @Override public void close() throws SecurityException { + // Ignore this } private void startChat(final String address) throws XMPPException |