summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src/com/earth2me
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java6
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java6
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java17
3 files changed, 18 insertions, 11 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
index a19fa3d9a..4f997a14e 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.spawn;
import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.commands.EssentialsCommand;
@@ -17,9 +18,10 @@ public class Commandsetspawn extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
+ final IEssentials ess = Essentials.getStatic();
charge(user);
- String group = args.length > 0 ? getFinalArg(args, 0) : "default";
- Essentials.getSpawn().setSpawn(user.getLocation(), group);
+ final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
+ ess.getSpawn().setSpawn(user.getLocation(), group);
user.sendMessage(Util.format("spawnSet", group));
}
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index f36b284e3..88a7c477b 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Charge;
import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand;
@@ -17,8 +18,9 @@ public class Commandspawn extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
- Charge charge = new Charge(this);
+ final IEssentials ess = Essentials.getStatic();
+ final Charge charge = new Charge(this.getName(), ess);
charge.isAffordableFor(user);
- user.getTeleport().respawn(Essentials.getSpawn(), charge);
+ user.getTeleport().respawn(ess.getSpawn(), charge);
}
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index ace8cd50b..e1e804e58 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
@@ -16,11 +17,12 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerRespawn(PlayerRespawnEvent event)
{
- User user = Essentials.getStatic().getUser(event.getPlayer());
+ final IEssentials ess = Essentials.getStatic();
+ final User user = ess.getUser(event.getPlayer());
try
{
- if (Essentials.getStatic().getSettings().getRespawnAtHome())
+ if (ess.getSettings().getRespawnAtHome())
{
Location home = user.getHome(user.getLocation());
if (home == null) {
@@ -33,7 +35,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
catch (Throwable ex)
{
}
- Location spawn = Essentials.getSpawn().getSpawn(user.getGroup());
+ Location spawn = ess.getSpawn().getSpawn(user.getGroup());
if (spawn == null) {
return;
}
@@ -43,7 +45,8 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
- User user = Essentials.getStatic().getUser(event.getPlayer());
+ final IEssentials ess = Essentials.getStatic();
+ final User user = ess.getUser(event.getPlayer());
if (!user.isNew())
{
@@ -51,14 +54,14 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
}
user.setNew(false);
try {
- user.getTeleport().now(Essentials.getSpawn().getSpawn(Essentials.getStatic().getSettings().getNewbieSpawn()));
+ user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
}
- if (Essentials.getStatic().getSettings().getAnnounceNewPlayers())
+ if (ess.getSettings().getAnnounceNewPlayers())
{
- Essentials.getStatic().broadcastMessage(user.getName(), Essentials.getStatic().getSettings().getAnnounceNewPlayerFormat(user));
+ ess.broadcastMessage(user.getName(), ess.getSettings().getAnnounceNewPlayerFormat(user));
}
}
}