diff options
author | md_5 <md_5@bigpond.com> | 2012-04-14 15:21:42 +1000 |
---|---|---|
committer | md_5 <md_5@bigpond.com> | 2012-04-14 15:21:42 +1000 |
commit | 34f5c19f997bd4c5480bacc83ecd674a5bc4cb26 (patch) | |
tree | 4a3183610cc6930245f484080b4ad33e3e0563cd | |
parent | 602bd5b0d4eb3123a15ef894574ee236319603b4 (diff) | |
download | Essentials-34f5c19f997bd4c5480bacc83ecd674a5bc4cb26.tar Essentials-34f5c19f997bd4c5480bacc83ecd674a5bc4cb26.tar.gz Essentials-34f5c19f997bd4c5480bacc83ecd674a5bc4cb26.tar.lz Essentials-34f5c19f997bd4c5480bacc83ecd674a5bc4cb26.tar.xz Essentials-34f5c19f997bd4c5480bacc83ecd674a5bc4cb26.zip |
Add option to disable jails entirely.
6 files changed, 30 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 5a82a9fb1..8a7643b68 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -232,8 +232,11 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvents(worldListener, this); //TODO: Check if this should be here, and not above before reload() - jails = new Jails(this); - confList.add(jails); + if (settings.isJailsEnabled()) + { + jails = new Jails(this); + confList.add(jails); + } pm.registerEvents(tntListener, this); @@ -428,9 +431,16 @@ public class Essentials extends JavaPlugin implements IEssentials } @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 diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index 83c2e7325..1b38d0dfe 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -37,7 +37,7 @@ public interface IEssentials extends Plugin BukkitScheduler getScheduler(); - IJails getJails(); + IJails getJails() throws UnsupportedOperationException; Warps getWarps(); diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 2c07ccd58..ea0354602 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -173,4 +173,6 @@ public interface ISettings extends IConf long getTeleportInvulnerability(); boolean isTeleportInvulnerability(); + + boolean isJailsEnabled(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index c4b19601f..0e36782be 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -780,4 +780,10 @@ public class Settings implements ISettings { return teleportInvulnerability; } + + @Override + public boolean isJailsEnabled() + { + return config.getBoolean("enable-jails", true); + } } diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java index 0ea692cc9..befed005f 100644 --- a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java @@ -172,6 +172,9 @@ public class MetricsStarter implements Runnable metrics.start(); } + catch (UnsupportedOperationException ex) + { + } catch (Exception ex) { metricsError(ex); diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 70433b5b0..3227322a8 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -44,6 +44,9 @@ change-displayname: true # Don't forget to remove the # infront of the line #add-prefix-suffix: false +# Whether or not jails are activated +enable-jails: true + # The delay, in seconds, required between /home, /tp, etc. teleport-cooldown: 0 @@ -584,7 +587,7 @@ newbies: # 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. spawnpoint: newbies - + # Do we want to give users anything on first join? Set to '' to disable # This kit will be given reguardless of cost, and permissions. #kit: '' |