diff options
author | snowleo <schneeleo@gmail.com> | 2011-12-14 16:31:08 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-12-14 16:31:08 +0100 |
commit | 0155bcedb7f00726d0b2f14e612a5342322a8278 (patch) | |
tree | a490495781c26b553f719dda2b70ece6889a3605 /EssentialsSpawn | |
parent | 9ab2fe54fcea6565bdfc29aa3e3c60cb07adf1b2 (diff) | |
download | Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.gz Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.lz Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.tar.xz Essentials-0155bcedb7f00726d0b2f14e612a5342322a8278.zip |
Updated all modules to new api, some settings are still missing
Diffstat (limited to 'EssentialsSpawn')
5 files changed, 24 insertions, 19 deletions
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 |