diff options
author | snowleo <schneeleo@gmail.com> | 2011-07-18 00:30:39 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-07-18 00:30:39 +0200 |
commit | cc31fbed8e448ed7851584067f7f689cd6daac78 (patch) | |
tree | acb57a3684bc12c829f127b57b4813f57120830b | |
parent | 29a15dfe18913b160a615581c0dec9ab1293f090 (diff) | |
download | Essentials-cc31fbed8e448ed7851584067f7f689cd6daac78.tar Essentials-cc31fbed8e448ed7851584067f7f689cd6daac78.tar.gz Essentials-cc31fbed8e448ed7851584067f7f689cd6daac78.tar.lz Essentials-cc31fbed8e448ed7851584067f7f689cd6daac78.tar.xz Essentials-cc31fbed8e448ed7851584067f7f689cd6daac78.zip |
Bukkit Permission system
New config setting: use-bukkit-permissions
6 files changed, 65 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java new file mode 100644 index 000000000..a352bcb5a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java @@ -0,0 +1,39 @@ +package com.earth2me.essentials; + +import org.bukkit.entity.Player; + + +public class BukkitPermissionsHandler implements IPermissionsHandler +{ + + public String getGroup(Player base) + { + return "default"; + } + + public boolean canBuild(Player base, String group) + { + return true; + } + + public boolean inGroup(Player base, String group) + { + return false; + } + + public boolean hasPermission(Player base, String node) + { + return base.hasPermission(node); + } + + public String getPrefix(Player base) + { + return ""; + } + + public String getSuffix(Player base) + { + return ""; + } + +} diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index de51196a6..9bd0998f8 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -158,7 +158,14 @@ public class Essentials extends JavaPlugin implements IEssentials } else { - this.permissionsHandler = new ConfigPermissionsHandler(this); + if (this.getSettings().useBukkitPermissions()) + { + this.permissionsHandler = new BukkitPermissionsHandler(); + } + else + { + this.permissionsHandler = new ConfigPermissionsHandler(this); + } } final ServerListener serverListener = new EssentialsPluginListener(paymentMethod); @@ -642,7 +649,7 @@ public class Essentials extends JavaPlugin implements IEssentials { return bans; } - + public ItemDb getItemDb() { return itemDb; diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 638f0593a..c53992461 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -128,4 +128,6 @@ public interface ISettings extends IConf boolean changeDisplayName(); boolean isPlayerCommand(String string); + + public boolean useBukkitPermissions(); } diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 1e15c30a0..895e2c4d5 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -521,22 +521,22 @@ public class OfflinePlayer implements Player public boolean isPermissionSet(String string) { - throw new UnsupportedOperationException("Not supported yet."); + return false; } public boolean isPermissionSet(Permission prmsn) { - throw new UnsupportedOperationException("Not supported yet."); + return false; } public boolean hasPermission(String string) { - throw new UnsupportedOperationException("Not supported yet."); + return false; } public boolean hasPermission(Permission prmsn) { - throw new UnsupportedOperationException("Not supported yet."); + return false; } public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln) @@ -566,7 +566,6 @@ public class OfflinePlayer implements Player public void recalculatePermissions() { - throw new UnsupportedOperationException("Not supported yet."); } public Set<PermissionAttachmentInfo> getEffectivePermissions() @@ -576,6 +575,5 @@ public class OfflinePlayer implements Player public void setOp(boolean bln) { - throw new UnsupportedOperationException("Not supported yet."); } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index d63bc7194..9f4bde9e0 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -463,5 +463,9 @@ public class Settings implements ISettings { return config.getBoolean("change-displayname", true); } - + + public boolean useBukkitPermissions() + { + return config.getBoolean("use-bukkit-permissions", false); + } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index d50144956..90f8372cb 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -182,10 +182,16 @@ debug: false # Set the locale for all messages # If you don't set this, the default locale of the server will be used. +# Don't forget to remove the # infront of the line #locale: de_DE #turn off god mode when people exit remove-god-on-disconnect: false + +# Use the permission system of bukkit +# This only works if no other permission plugins are installed +use-bukkit-permissions: false + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # |