mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-05 16:08:14 +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
|
@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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ public class Commandxmpp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ public class Commandxmppspy extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final String username = user.getName().toLowerCase();
|
||||||
instance.users.setAddress(username, address);
|
instance.users.setAddress(username, address);
|
||||||
@ -81,7 +81,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean toggleSpy(final Player user) throws Exception
|
public boolean toggleSpy(final Player user)
|
||||||
{
|
{
|
||||||
final String username = user.getName().toLowerCase();
|
final String username = user.getName().toLowerCase();
|
||||||
final boolean spy = !instance.users.isSpy(username);
|
final boolean spy = !instance.users.isSpy(username);
|
||||||
|
@ -50,6 +50,7 @@ class EssentialsXMPPPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
// Ignore exceptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ public interface IEssentialsXMPP
|
|||||||
|
|
||||||
void sendMessage(final String address, final String message);
|
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);
|
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);
|
setUser(username.toLowerCase(), getAddress(username), spy);
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class UserManager implements IConf
|
|||||||
return users.getString(username.toLowerCase() + "." + ADDRESS, null);
|
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));
|
setUser(username.toLowerCase(), address, isSpy(username));
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class UserManager implements IConf
|
|||||||
return spyusers;
|
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>();
|
final Map<String, Object> userdata = new HashMap<String, Object>();
|
||||||
userdata.put(ADDRESS, address);
|
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 serviceName = config.getString("xmpp.servicename", server);
|
||||||
final String xmppuser = config.getString("xmpp.user");
|
final String xmppuser = config.getString("xmpp.user");
|
||||||
final String password = config.getString("xmpp.password");
|
final String password = config.getString("xmpp.password");
|
||||||
final ConnectionConfiguration cc = new ConnectionConfiguration(server, port, serviceName);
|
final ConnectionConfiguration connConf = new ConnectionConfiguration(server, port, serviceName);
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
sb.append("Connecting to xmpp server ").append(server).append(":").append(port);
|
stringBuilder.append("Connecting to xmpp server ").append(server).append(":").append(port);
|
||||||
sb.append(" as user ").append(xmppuser).append(".");
|
stringBuilder.append(" as user ").append(xmppuser).append(".");
|
||||||
LOGGER.log(Level.INFO, sb.toString());
|
LOGGER.log(Level.INFO, stringBuilder.toString());
|
||||||
cc.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false));
|
connConf.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false));
|
||||||
cc.setSendPresence(true);
|
connConf.setSendPresence(true);
|
||||||
cc.setReconnectionAllowed(true);
|
connConf.setReconnectionAllowed(true);
|
||||||
connection = new XMPPConnection(cc);
|
connection = new XMPPConnection(connConf);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection.connect();
|
connection.connect();
|
||||||
@ -208,11 +208,13 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||||||
@Override
|
@Override
|
||||||
public void flush()
|
public void flush()
|
||||||
{
|
{
|
||||||
|
// Ignore this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws SecurityException
|
public void close() throws SecurityException
|
||||||
{
|
{
|
||||||
|
// Ignore this
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startChat(final String address) throws XMPPException
|
private void startChat(final String address) throws XMPPException
|
||||||
|
Loading…
Reference in New Issue
Block a user