From 0a8f6b94bba8659c97913e587674fa6c6e6be18c Mon Sep 17 00:00:00 2001 From: cnaude Date: Sun, 11 Nov 2012 19:48:34 -0700 Subject: [PATCH] Added permissions option. --- src/config.yml | 3 ++- src/net/spoothie/chairs/Chairs.java | 3 ++- src/net/spoothie/chairs/EventListener.java | 6 ++++-- src/plugin.yml | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/config.yml b/src/config.yml index f1a6efa..b2ffda5 100644 --- a/src/config.yml +++ b/src/config.yml @@ -27,4 +27,5 @@ sneaking: true max-chair-width: 3 sign-check: false distance: 2 -sitting-height: 0.7 \ No newline at end of file +sitting-height: 0.7 +permissions: true \ No newline at end of file diff --git a/src/net/spoothie/chairs/Chairs.java b/src/net/spoothie/chairs/Chairs.java index 0062e8b..84dcc9a 100644 --- a/src/net/spoothie/chairs/Chairs.java +++ b/src/net/spoothie/chairs/Chairs.java @@ -13,7 +13,7 @@ public class Chairs extends JavaPlugin { public List allowedBlocks = new ArrayList(); public Material item; - public boolean sneaking, autorotate, signcheck; + public boolean sneaking, autorotate, signcheck, permissions; public double sittingheight, distance; public int maxchairwidth; private File pluginFolder; @@ -61,6 +61,7 @@ public class Chairs extends JavaPlugin { sittingheight = getConfig().getDouble("sitting-height"); distance = getConfig().getDouble("distance"); maxchairwidth = getConfig().getInt("max-chair-width"); + permissions = getConfig().getBoolean("permissions"); for (String type : getConfig().getStringList("allowed-blocks")) { allowedBlocks.add(Material.getMaterial(type)); diff --git a/src/net/spoothie/chairs/EventListener.java b/src/net/spoothie/chairs/EventListener.java index aad3857..09e0d7f 100644 --- a/src/net/spoothie/chairs/EventListener.java +++ b/src/net/spoothie/chairs/EventListener.java @@ -53,8 +53,10 @@ public class EventListener implements Listener { } // Permissions Check - if (!player.hasPermission("chairs.sit")) { - return; + if (plugin.permissions) { + if (!player.hasPermission("chairs.sit")) { + return; + } } // Check if player is sitting. diff --git a/src/plugin.yml b/src/plugin.yml index f857a02..078438c 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,7 +1,7 @@ name: Chairs -version: 1.5a +version: 1.5b description: Let players sit on stairs and slabs. -author: spoothie +authors: spoothie, cnaude main: net.spoothie.chairs.Chairs commands: chairs: