Bukkit Permission system

New config setting: use-bukkit-permissions
This commit is contained in:
snowleo 2011-07-18 00:30:39 +02:00
parent 29a15dfe18
commit cc31fbed8e
6 changed files with 65 additions and 9 deletions

View file

@ -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 "";
}
}

View file

@ -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;

View file

@ -128,4 +128,6 @@ public interface ISettings extends IConf
boolean changeDisplayName();
boolean isPlayerCommand(String string);
public boolean useBukkitPermissions();
}

View file

@ -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.");
}
}

View file

@ -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);
}
}

View file

@ -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 | #