summaryrefslogtreecommitdiffstats
path: root/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java')
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java34
1 files changed, 20 insertions, 14 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
index 631d1b21b..bcbbfa17d 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;
@@ -35,11 +36,16 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
final PluginManager pluginManager = getServer().getPluginManager();
ess = (IEssentials)pluginManager.getPlugin("Essentials");
- if (ess == null)
+ if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
- LOGGER.log(Level.SEVERE, "Failed to load Essentials before EssentialsXMPP");
+ LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
-
+ if (!ess.isEnabled())
+ {
+ this.setEnabled(false);
+ return;
+ }
+
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
@@ -51,29 +57,29 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
- if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
- {
- LOGGER.log(Level.WARNING, Util.i18n("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
public void onDisable()
{
- xmpp.disconnect();
+ if (xmpp != null)
+ {
+ xmpp.disconnect();
+ }
+ instance = null;
}
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args)
{
- return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.");
+ return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", null);
}
@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 +99,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;