mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-06 06:37:28 +02:00
Allow to set the Respawn priority in config.
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
|
|
||||||
|
|
||||||
public interface ISettings extends IConf
|
public interface ISettings extends IConf
|
||||||
@@ -148,4 +149,6 @@ public interface ISettings extends IConf
|
|||||||
boolean registerBackInListener();
|
boolean registerBackInListener();
|
||||||
|
|
||||||
public boolean getDisableItemPickupWhileAfk();
|
public boolean getDisableItemPickupWhileAfk();
|
||||||
|
|
||||||
|
public Priority getRespawnPriority();
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import java.util.*;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getInt("oversized-stacksize", 64);
|
return config.getInt("oversized-stacksize", 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultStackSize()
|
public int getDefaultStackSize()
|
||||||
{
|
{
|
||||||
@@ -566,7 +567,7 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("world-teleport-permissions", false);
|
return config.getBoolean("world-teleport-permissions", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean registerBackInListener()
|
public boolean registerBackInListener()
|
||||||
{
|
{
|
||||||
@@ -578,4 +579,31 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("disable-item-pickup-while-afk", true);
|
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.
|
# Set to "none" if you want to use the spawn point of the world.
|
||||||
spawnpoint: newbies
|
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.
|
# End of File <-- No seriously, you're done with configuration.
|
||||||
|
@@ -38,7 +38,7 @@ public class EssentialsSpawn extends JavaPlugin
|
|||||||
ess.addReloadListener(spawns);
|
ess.addReloadListener(spawns);
|
||||||
|
|
||||||
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, 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);
|
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
|
||||||
|
|
||||||
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||||
|
Reference in New Issue
Block a user