Allow to set the Respawn priority in config.

This commit is contained in:
snowleo 2011-12-07 15:09:22 +01:00
parent 435219bab6
commit 02b25120e8
4 changed files with 40 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
public interface ISettings extends IConf
@ -148,4 +149,6 @@ public interface ISettings extends IConf
boolean registerBackInListener();
public boolean getDisableItemPickupWhileAfk();
public Priority getRespawnPriority();
}

View File

@ -7,6 +7,7 @@ import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.inventory.ItemStack;
@ -86,7 +87,7 @@ public class Settings implements ISettings
{
return config.getInt("oversized-stacksize", 64);
}
@Override
public int getDefaultStackSize()
{
@ -566,7 +567,7 @@ public class Settings implements ISettings
{
return config.getBoolean("world-teleport-permissions", false);
}
@Override
public boolean registerBackInListener()
{
@ -578,4 +579,31 @@ public class Settings implements ISettings
{
return config.getBoolean("disable-item-pickup-while-afk", true);
}
@Override
public Priority getRespawnPriority()
{
String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH);
if ("lowest".equals(priority))
{
return Priority.Lowest;
}
if ("low".equals(priority))
{
return Priority.Low;
}
if ("normal".equals(priority))
{
return Priority.Normal;
}
if ("high".equals(priority))
{
return Priority.High;
}
if ("highest".equals(priority))
{
return Priority.Highest;
}
return Priority.Normal;
}
}

View File

@ -514,7 +514,7 @@ protect:
############################################################
# +------------------------------------------------------+ #
# | New Players | #
# | Essentials Spawn / New Players | #
# +------------------------------------------------------+ #
############################################################
@ -529,4 +529,9 @@ newbies:
# Set to "none" if you want to use the spawn point of the world.
spawnpoint: newbies
# Set this to lowest, if you want Multiverse to handle the respawning
# Set this to normal, if you want EssentialsSpawn to handle the respawning
# Set this to highest, if you want to force EssentialsSpawn to handle the respawning
respawn-listener-priority: normal
# End of File <-- No seriously, you're done with configuration.

View File

@ -38,7 +38,7 @@ public class EssentialsSpawn extends JavaPlugin
ess.addReloadListener(spawns);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));