mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Allow to set the Respawn priority in config.
This commit is contained in:
parent
435219bab6
commit
02b25120e8
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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"));
|
||||
|
Loading…
Reference in New Issue
Block a user