mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-06 21:18:03 +02:00
Don't register jail listeners, if no jails are set.
This commit is contained in:
parent
5b62661404
commit
9d545dcbf1
@ -26,16 +26,17 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Jails> implements IJails
|
public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Jails> implements IJails
|
||||||
{
|
{
|
||||||
private static final transient Logger LOGGER = Bukkit.getLogger();
|
private static final transient Logger LOGGER = Bukkit.getLogger();
|
||||||
|
private static transient boolean enabled = false;
|
||||||
|
|
||||||
public Jails(final IEssentials ess)
|
public Jails(final IEssentials ess)
|
||||||
{
|
{
|
||||||
super(ess, com.earth2me.essentials.settings.Jails.class);
|
super(ess, com.earth2me.essentials.settings.Jails.class);
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
registerListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerListeners()
|
private void registerListeners()
|
||||||
{
|
{
|
||||||
|
enabled = true;
|
||||||
final PluginManager pluginManager = ess.getServer().getPluginManager();
|
final PluginManager pluginManager = ess.getServer().getPluginManager();
|
||||||
final JailBlockListener blockListener = new JailBlockListener();
|
final JailBlockListener blockListener = new JailBlockListener();
|
||||||
final JailPlayerListener playerListener = new JailPlayerListener();
|
final JailPlayerListener playerListener = new JailPlayerListener();
|
||||||
@ -49,6 +50,24 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
return new File(ess.getDataFolder(), "jail.yml");
|
return new File(ess.getDataFolder(), "jail.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRead()
|
||||||
|
{
|
||||||
|
if (enabled == false && getCount() > 0)
|
||||||
|
{
|
||||||
|
registerListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishWrite()
|
||||||
|
{
|
||||||
|
if (enabled == false)
|
||||||
|
{
|
||||||
|
registerListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getJail(final String jailName) throws Exception
|
public Location getJail(final String jailName) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,11 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
|||||||
{
|
{
|
||||||
new StorageObjectDataReader();
|
new StorageObjectDataReader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void finishRead();
|
||||||
|
|
||||||
|
public abstract void finishWrite();
|
||||||
|
|
||||||
public abstract File getStorageFile();
|
public abstract File getStorageFile();
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +105,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
|||||||
public void onFinish()
|
public void onFinish()
|
||||||
{
|
{
|
||||||
unlock();
|
unlock();
|
||||||
|
finishWrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +131,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
|||||||
data = object;
|
data = object;
|
||||||
}
|
}
|
||||||
rwl.writeLock().unlock();
|
rwl.writeLock().unlock();
|
||||||
|
finishRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user