mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-28 12:53:04 +00:00
Temporary fix for Spawns and Jails when Worlds are loaded after Essentials.
This will be replaced by BetterLocation fix in 3.0 branch.
This commit is contained in:
parent
6e82419c15
commit
c584d74852
|
@ -49,6 +49,9 @@ import org.bukkit.event.Event.Priority;
|
|||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.world.WorldListener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
@ -243,6 +246,10 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||
pm.registerEvent(Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Lowest, this);
|
||||
pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this);
|
||||
|
||||
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
|
||||
pm.registerEvent(Type.WORLD_LOAD, worldListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Type.WORLD_UNLOAD, worldListener, Priority.Monitor, this);
|
||||
|
||||
//TODO: Check if this should be here, and not above before reload()
|
||||
jails = new Jails(this);
|
||||
confList.add(jails);
|
||||
|
@ -594,4 +601,32 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||
{
|
||||
return i18n;
|
||||
}
|
||||
|
||||
private static class EssentialsWorldListener extends WorldListener implements Runnable {
|
||||
private transient final IEssentials ess;
|
||||
|
||||
public EssentialsWorldListener(IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onWorldLoad(WorldLoadEvent event)
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldUnload(WorldUnloadEvent event)
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
ess.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue