summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java2
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java12
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java8
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java6
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java6
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java2
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java26
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java14
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java8
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java12
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java6
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java4
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java10
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java11
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java12
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java6
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java4
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java11
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java10
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java10
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java10
23 files changed, 106 insertions, 88 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index 25ce85cc8..265322255 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.chat;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.api.IEssentials;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index 2d6e1ae4e..349cc7e28 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -2,9 +2,9 @@ package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.Trade;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IUser;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Location;
@@ -53,7 +53,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
}
}
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (!isAffordableFor(user, command))
{
event.setCancelled(true);
@@ -106,7 +106,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
return true;
}
- protected void sendLocalChat(final User sender, final long radius, final PlayerChatEvent event)
+ protected void sendLocalChat(final IUser sender, final long radius, final PlayerChatEvent event)
{
event.setCancelled(true);
logger.info(_("localFormat", sender.getName(), event.getMessage()));
@@ -116,9 +116,9 @@ public abstract class EssentialsChatPlayer extends PlayerListener
for (Player onlinePlayer : server.getOnlinePlayers())
{
String type = "[L]";
- final User user = ess.getUser(onlinePlayer);
+ final IUser user = ess.getUser(onlinePlayer);
//TODO: remove reference to op
- if (user.isIgnoredPlayer(sender.getName()) && !sender.isOp())
+ if (user.isIgnoringPlayer(sender.getName()) && !sender.isOp())
{
continue;
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
index 22989d4f9..d2098f4a6 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerChatEvent;
@@ -37,7 +37,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
/**
* This file should handle charging the user for the action before returning control back
*/
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
try
{
@@ -45,7 +45,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
}
catch (ChargeException e)
{
- ess.showError(user, e, charge);
+ ess.getCommandHandler().showCommandError(user, charge, e);
event.setCancelled(true);
return;
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
index de5757951..80b725d28 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.chat;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
@@ -28,7 +28,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
/**
* This listener should apply the general chat formatting only...then return control back the event handler
*/
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (user.isAuthorized("essentials.chat.color"))
{
event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
index 4e3cbefc0..34aba2be0 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.chat;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
@@ -48,7 +48,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
return;
}
radius *= radius;
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (event.getMessage().length() > 0 && chatType.length() > 0)
{
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
index e0ca6cd7c..f9436d7f0 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.geoip;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.api.IEssentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
index ee187c2aa..5a33fecc9 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
@@ -2,9 +2,9 @@ package com.earth2me.essentials.geoip;
import com.earth2me.essentials.EssentialsConf;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IConf;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IReload;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import com.maxmind.geoip.Location;
import com.maxmind.geoip.LookupService;
import com.maxmind.geoip.regionName;
@@ -21,7 +21,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
-public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf
+public class EssentialsGeoIPPlayerListener extends PlayerListener implements IReload
{
LookupService ls = null;
private static final Logger logger = Logger.getLogger("Minecraft");
@@ -36,13 +36,13 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
this.dataFolder = dataFolder;
this.config = new EssentialsConf(new File(dataFolder, "config.yml"));
config.setTemplateName("/config.yml", EssentialsGeoIP.class);
- reloadConfig();
+ onReload();
}
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
- User u = ess.getUser(event.getPlayer());
+ IUser u = ess.getUser(event.getPlayer());
if (u.isAuthorized("essentials.geoip.hide"))
{
return;
@@ -73,13 +73,21 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
if (config.getBoolean("show-on-whois", true))
{
- u.setGeoLocation(sb.toString());
+ u.acquireWriteLock();
+ try
+ {
+ u.getData().setGeolocation(sb.toString());
+ }
+ finally
+ {
+ u.unlock();
+ }
}
if (config.getBoolean("show-on-login", true) && !u.isHidden())
{
for (Player player : event.getPlayer().getServer().getOnlinePlayers())
{
- User user = ess.getUser(player);
+ IUser user = ess.getUser(player);
if (user.isAuthorized("essentials.geoip.show"))
{
user.sendMessage(_("geoipJoinFormat", u.getDisplayName(), sb.toString()));
@@ -89,7 +97,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
}
@Override
- public final void reloadConfig()
+ public final void onReload()
{
config.load();
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
index 569123cd5..7f9ec44e4 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
-import com.earth2me.essentials.IConf;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IReload;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.protect.data.ProtectedBlockMemory;
import com.earth2me.essentials.protect.data.ProtectedBlockMySQL;
import com.earth2me.essentials.protect.data.ProtectedBlockSQLite;
@@ -45,7 +45,7 @@ public class EssentialsConnect
return ess;
}
- public void alert(final User user, final String item, final String type)
+ public void alert(final IUser user, final String item, final String type)
{
final Location loc = user.getLocation();
final String warnMessage = _("alertFormat", user.getName(), type, item,
@@ -54,7 +54,7 @@ public class EssentialsConnect
LOGGER.log(Level.WARNING, warnMessage);
for (Player p : ess.getServer().getOnlinePlayers())
{
- final User alertUser = ess.getUser(p);
+ final IUser alertUser = ess.getUser(p);
if (alertUser.isAuthorized("essentials.protect.alerts"))
{
alertUser.sendMessage(warnMessage);
@@ -63,10 +63,10 @@ public class EssentialsConnect
}
- private class ProtectReloader implements IConf
+ private class ProtectReloader implements IReload
{
@Override
- public void reloadConfig()
+ public void onReload()
{
if (protect.getStorage() != null)
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index 03ad19cb4..f30de1d81 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.protect.data.IProtectedBlock;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +31,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
{
@@ -228,7 +228,7 @@ public class EssentialsProtectBlockListener extends BlockListener
{
return;
}
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 89167b2b9..41b4a69a5 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.protect;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.craftbukkit.FakeExplosion;
import java.util.Locale;
import org.bukkit.Material;
@@ -39,7 +39,7 @@ public class EssentialsProtectEntityListener extends EntityListener
return;
}
- final User user = ess.getUser(target);
+ final IUser user = target instanceof Player ? ess.getUser((Player)target) : null;
if (event instanceof EntityDamageByBlockEvent)
{
final DamageCause cause = event.getCause();
@@ -77,7 +77,7 @@ public class EssentialsProtectEntityListener extends EntityListener
{
final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
final Entity eAttack = edEvent.getDamager();
- final User attacker = ess.getUser(eAttack);
+ final IUser attacker = eAttack instanceof Player ? ess.getUser((Player)eAttack) : null;
// PVP Settings
if (target instanceof Player && eAttack instanceof Player
@@ -134,7 +134,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|| (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
&& prot.getSettingBool(ProtectConfig.disable_pvp)
&& (!user.isAuthorized("essentials.protect.pvp")
- || !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
+ || !ess.getUser((Player)((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
{
event.setCancelled(true);
return;
@@ -299,7 +299,7 @@ public class EssentialsProtectEntityListener extends EntityListener
{
return;
}
- final User user = ess.getUser(event.getTarget());
+ final IUser user = ess.getUser((Player)event.getTarget());
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index ad7831a53..a3f13a428 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.block.Action;
@@ -26,7 +26,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
public void onPlayerInteract(final PlayerInteractEvent event)
{
// Do not return if cancelled, because the interact event has 2 cancelled states.
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (event.hasItem()
&& (event.getItem().getType() == Material.WATER_BUCKET
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
index c6c89a20d..b9b2a70d5 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import org.bukkit.Server;
@@ -14,7 +14,7 @@ public class Commandsetspawn extends EssentialsCommand
}
@Override
- public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
+ public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
{
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
((SpawnStorage)module).setSpawn(user.getLocation(), group);
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index 6335d6c69..5b95a8e66 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -2,7 +2,7 @@ package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Location;
@@ -19,13 +19,13 @@ public class Commandspawn extends EssentialsCommand
}
@Override
- public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
+ public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
{
- final User otherUser = getPlayer(server, args, 0);
+ final IUser otherUser = getPlayer(server, args, 0);
respawn(otherUser, null);
if (!otherUser.equals(user))
{
@@ -46,13 +46,13 @@ public class Commandspawn extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- final User user = getPlayer(server, args, 0);
+ final IUser user = getPlayer(server, args, 0);
respawn(user, null);
user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
sender.sendMessage(_("teleporting"));
}
- private void respawn (final User user, final Trade charge) throws Exception {
+ private void respawn (final IUser user, final Trade charge) throws Exception {
final SpawnStorage spawns = (SpawnStorage)this.module;
final Location spawn = spawns.getSpawn(user.getGroup());
user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND);
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
index c4cd7c727..7eb62238a 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
@@ -1,8 +1,10 @@
package com.earth2me.essentials.spawn;
+import com.earth2me.essentials.EssentialsCommandHandler;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.IEssentialsModule;
+import com.earth2me.essentials.api.ICommandHandler;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IEssentialsModule;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
@@ -19,6 +21,7 @@ public class EssentialsSpawn extends JavaPlugin
private static final Logger LOGGER = Bukkit.getLogger();
private transient IEssentials ess;
private transient SpawnStorage spawns;
+ private transient ICommandHandler commandHandler;
public void onEnable()
{
@@ -36,6 +39,8 @@ public class EssentialsSpawn extends JavaPlugin
spawns = new SpawnStorage(ess);
ess.addReloadListener(spawns);
+
+ commandHandler = new EssentialsCommandHandler(EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns, ess);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
@@ -52,6 +57,6 @@ public class EssentialsSpawn extends JavaPlugin
public boolean onCommand(final CommandSender sender, final Command command,
final String commandLabel, final String[] args)
{
- return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns);
+ return commandHandler.handleCommand(sender, command, commandLabel, args);
}
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 530a00faa..4c4a60997 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -1,8 +1,8 @@
package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -27,7 +27,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (ess.getSettings().getRespawnAtHome())
{
@@ -52,7 +52,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
if (!user.isNew() || user.getBedSpawnLocation() != null)
{
@@ -73,9 +73,9 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
private class NewPlayerTeleport implements Runnable
{
- private final transient User user;
+ private final transient IUser user;
- public NewPlayerTeleport(final User user)
+ public NewPlayerTeleport(final IUser user)
{
this.user = user;
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
index 088ee9052..61304fbf4 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.spawn;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.IEssentialsModule;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IEssentialsModule;
import com.earth2me.essentials.settings.Spawns;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import java.io.File;
@@ -17,7 +17,7 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
public SpawnStorage(final IEssentials ess)
{
super(ess, Spawns.class);
- reloadConfig();
+ onReload();
}
@Override
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
index e0bf9827c..2de521baf 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.xmpp;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
@@ -14,7 +14,7 @@ public class Commandsetxmpp extends EssentialsCommand
}
@Override
- protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
+ protected void run(final Server server, final IUser 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 e7dd01670..a336bba55 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java
@@ -31,7 +31,7 @@ public class Commandxmpp extends EssentialsCommand
else
{
final String message = getFinalArg(args, 1);
- final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
+ final String senderName = sender instanceof Player ? ess.getUser((Player)sender).getDisplayName() : Console.NAME;
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
{
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
index bcbbfa17d..cf7fb1814 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
@@ -1,8 +1,10 @@
package com.earth2me.essentials.xmpp;
+import com.earth2me.essentials.EssentialsCommandHandler;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.IUser;
+import com.earth2me.essentials.api.ICommandHandler;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
@@ -23,6 +25,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
private transient UserManager users;
private transient XMPPManager xmpp;
private transient IEssentials ess;
+ private transient ICommandHandler commandHandler;
public static IEssentialsXMPP getInstance()
{
@@ -56,6 +59,8 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
+
+ commandHandler = new EssentialsCommandHandler(EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", ess);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@@ -73,7 +78,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
@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.", null);
+ return commandHandler.handleCommand(sender, command, commandLabel, args);
}
@Override
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
index 47966aee0..1bf672515 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
@@ -1,7 +1,7 @@
package com.earth2me.essentials.xmpp;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IEssentials;
+import com.earth2me.essentials.api.IUser;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
@@ -21,21 +21,21 @@ class EssentialsXMPPPlayerListener extends PlayerListener
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
}
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
}
@Override
public void onPlayerQuit(final PlayerQuitEvent event)
{
- final User user = ess.getUser(event.getPlayer());
+ final IUser user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game");
}
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
index 0635ca131..83851d055 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
@@ -1,6 +1,6 @@
package com.earth2me.essentials.xmpp;
-import com.earth2me.essentials.IUser;
+import com.earth2me.essentials.api.IUser;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
index 85ef50949..c8df2fcb3 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
@@ -1,12 +1,12 @@
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.EssentialsConf;
-import com.earth2me.essentials.IConf;
+import com.earth2me.essentials.api.IReload;
import java.io.File;
import java.util.*;
-public class UserManager implements IConf
+public class UserManager implements IReload
{
private final transient EssentialsConf users;
private final transient List<String> spyusers = new ArrayList<String>();
@@ -16,7 +16,7 @@ public class UserManager implements IConf
public UserManager(final File folder)
{
users = new EssentialsConf(new File(folder, "users.yml"));
- reloadConfig();
+ onReload();
}
public final boolean isSpy(final String username)
@@ -65,11 +65,11 @@ public class UserManager implements IConf
userdata.put(SPY, spy);
users.setProperty(username, userdata);
users.save();
- reloadConfig();
+ onReload();
}
@Override
- public final void reloadConfig()
+ public final void onReload()
{
users.load();
spyusers.clear();
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
index 72bdb113d..95d4c4620 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
@@ -2,8 +2,8 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.EssentialsConf;
-import com.earth2me.essentials.IConf;
-import com.earth2me.essentials.IUser;
+import com.earth2me.essentials.api.IReload;
+import com.earth2me.essentials.api.IUser;
import java.io.File;
import java.util.*;
import java.util.logging.Handler;
@@ -18,7 +18,7 @@ import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils;
-public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf
+public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IReload
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient EssentialsConf config;
@@ -39,7 +39,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
this.parent = parent;
config = new EssentialsConf(new File(parent.getDataFolder(), "config.yml"));
config.setTemplateName("/config.yml", EssentialsXMPP.class);
- reloadConfig();
+ onReload();
}
public boolean sendMessage(final String address, final String message)
@@ -166,7 +166,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
}
@Override
- public final void reloadConfig()
+ public final void onReload()
{
LOGGER.removeHandler(this);
config.load();