diff options
Diffstat (limited to 'EssentialsSpawn/src/com')
4 files changed, 17 insertions, 24 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java index 036276770..d0383bd4a 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java @@ -8,7 +8,7 @@ import com.earth2me.essentials.commands.EssentialsCommand; public class Commandsetspawn extends EssentialsCommand { @Override - public void run(final IUser user, final String[] args) throws Exception + public void run(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 b70a522fb..07532653c 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java @@ -13,7 +13,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandspawn extends EssentialsCommand { @Override - public void run(final IUser user, final String[] args) throws Exception + public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { final Trade charge = new Trade(commandName, ess); charge.isAffordableFor(user); @@ -34,7 +34,7 @@ public class Commandspawn extends EssentialsCommand } @Override - protected void run(final CommandSender sender, final String[] args) throws Exception + protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index 8cbd57c31..2e4b5eaa6 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -9,7 +9,6 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -38,12 +37,12 @@ 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, spawns.getRespawnPriority(), this); - pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); + pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, spawns.getRespawnPriority(), this); LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index a345b3f30..08bb4d739 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -29,13 +29,16 @@ public class EssentialsSpawnPlayerListener extends PlayerListener public void onPlayerRespawn(final PlayerRespawnEvent event) { final IUser user = ess.getUser(event.getPlayer()); - + boolean respawnAtHome = false; - ISettings settings = ess.getSettings(); + final ISettings settings = ess.getSettings(); settings.acquireReadLock(); - try { + try + { respawnAtHome = ess.getSettings().getData().getCommands().getHome().isRespawnAtHome(); - } finally { + } + finally + { settings.unlock(); } if (respawnAtHome) @@ -62,24 +65,15 @@ public class EssentialsSpawnPlayerListener extends PlayerListener public void onPlayerJoin(final PlayerJoinEvent event) { final IUser user = ess.getUser(event.getPlayer()); - user.acquireReadLock(); - try - { - if (!user.getData().isNewplayer() || user.getBedSpawnLocation() != null) - { - return; - } - user.acquireWriteLock(); - user.getData().setNewplayer(false); - } - finally + if (user.hasPlayedBefore()) { - user.unlock(); + return; } + if (spawns.getNewbieSpawn() != null) { - ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user)); + ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L); } if (spawns.getAnnounceNewPlayers()) @@ -103,7 +97,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { try { - Location spawn = spawns.getNewbieSpawn(); + final Location spawn = spawns.getNewbieSpawn(); if (spawn != null) { user.getTeleport().now(spawn, false, TeleportCause.PLUGIN); |