mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-31 21:48:31 +01:00
More cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1570 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
0ff89abeee
commit
651b89d97b
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -50,6 +50,7 @@ class EssentialsXMPPPlayerListener extends PlayerListener
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Ignore exceptions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user