Add option to disable jails entirely.

This commit is contained in:
md_5 2012-04-14 15:21:42 +10:00
parent 602bd5b0d4
commit 34f5c19f99
6 changed files with 30 additions and 6 deletions

View file

@ -232,8 +232,11 @@ public class Essentials extends JavaPlugin implements IEssentials
pm.registerEvents(worldListener, this); pm.registerEvents(worldListener, this);
//TODO: Check if this should be here, and not above before reload() //TODO: Check if this should be here, and not above before reload()
jails = new Jails(this); if (settings.isJailsEnabled())
confList.add(jails); {
jails = new Jails(this);
confList.add(jails);
}
pm.registerEvents(tntListener, this); pm.registerEvents(tntListener, this);
@ -428,9 +431,16 @@ public class Essentials extends JavaPlugin implements IEssentials
} }
@Override @Override
public IJails getJails() public IJails getJails() throws UnsupportedOperationException
{ {
return jails; if (jails == null)
{
throw new UnsupportedOperationException("Jails are not enabled in your configuration");
}
else
{
return jails;
}
} }
@Override @Override

View file

@ -37,7 +37,7 @@ public interface IEssentials extends Plugin
BukkitScheduler getScheduler(); BukkitScheduler getScheduler();
IJails getJails(); IJails getJails() throws UnsupportedOperationException;
Warps getWarps(); Warps getWarps();

View file

@ -173,4 +173,6 @@ public interface ISettings extends IConf
long getTeleportInvulnerability(); long getTeleportInvulnerability();
boolean isTeleportInvulnerability(); boolean isTeleportInvulnerability();
boolean isJailsEnabled();
} }

View file

@ -780,4 +780,10 @@ public class Settings implements ISettings
{ {
return teleportInvulnerability; return teleportInvulnerability;
} }
@Override
public boolean isJailsEnabled()
{
return config.getBoolean("enable-jails", true);
}
} }

View file

@ -171,6 +171,9 @@ public class MetricsStarter implements Runnable
metrics.start(); metrics.start();
}
catch (UnsupportedOperationException ex)
{
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -44,6 +44,9 @@ change-displayname: true
# Don't forget to remove the # infront of the line # Don't forget to remove the # infront of the line
#add-prefix-suffix: false #add-prefix-suffix: false
# Whether or not jails are activated
enable-jails: true
# The delay, in seconds, required between /home, /tp, etc. # The delay, in seconds, required between /home, /tp, etc.
teleport-cooldown: 0 teleport-cooldown: 0
@ -584,7 +587,7 @@ newbies:
# When we spawn for the first time, which spawnpoint do we use? # When we spawn for the first time, which spawnpoint do we use?
# 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
# Do we want to give users anything on first join? Set to '' to disable # Do we want to give users anything on first join? Set to '' to disable
# This kit will be given reguardless of cost, and permissions. # This kit will be given reguardless of cost, and permissions.
#kit: '' #kit: ''