enabled PermissionsBukkit/mChat & SuperPerms support.

This commit is contained in:
Sleaker 2011-09-18 01:19:35 -07:00
parent 7c2e3a0c55
commit 7dfc283e47
2 changed files with 24 additions and 4 deletions

View File

@ -33,7 +33,9 @@ import net.milkbowl.vault.permission.Permission;
import net.milkbowl.vault.permission.plugins.Permission_GroupManager; import net.milkbowl.vault.permission.plugins.Permission_GroupManager;
import net.milkbowl.vault.permission.plugins.Permission_Permissions2; import net.milkbowl.vault.permission.plugins.Permission_Permissions2;
import net.milkbowl.vault.permission.plugins.Permission_Permissions3; import net.milkbowl.vault.permission.plugins.Permission_Permissions3;
import net.milkbowl.vault.permission.plugins.Permission_PermissionsBukkit;
import net.milkbowl.vault.permission.plugins.Permission_PermissionsEx; import net.milkbowl.vault.permission.plugins.Permission_PermissionsEx;
import net.milkbowl.vault.permission.plugins.Permission_SuperPerms;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -132,15 +134,24 @@ public class Vault extends JavaPlugin {
// Try to load PermissionsEx // Try to load PermissionsEx
if (packageExists(new String[] { "ru.tehkode.permissions.bukkit.PermissionsEx" })) { if (packageExists(new String[] { "ru.tehkode.permissions.bukkit.PermissionsEx" })) {
Permission ePerms = new Permission_PermissionsEx(this); Permission ePerms = new Permission_PermissionsEx(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, ePerms, this, ServicePriority.Normal); getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, ePerms, this, ServicePriority.High);
log.info(String.format("[%s][Permission] PermissionsEx found: %s", getDescription().getName(), ePerms.isEnabled() ? "Loaded" : "Waiting")); log.info(String.format("[%s][Permission] PermissionsEx found: %s", getDescription().getName(), ePerms.isEnabled() ? "Loaded" : "Waiting"));
} else { } else {
log.info(String.format("[%s][Permission] PermissionsEx not found.", getDescription().getName())); log.info(String.format("[%s][Permission] PermissionsEx not found.", getDescription().getName()));
} }
//Try loading PermissionsBukkit
if (packageExists(new String[] {"com.platymuus.bukkit.permissions.PermissionsPlugin"} )) {
Permission pPerms = new Permission_PermissionsBukkit(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, pPerms, this, ServicePriority.High);
log.info(String.format("[%s][Permission] PermissionsBukkit found: %s", getDescription().getName(), pPerms.isEnabled() ? "Loaded" : "Waiting"));
} else {
log.info(String.format("[%s][Permission] PermissionsBukkit not found.", getDescription().getName()));
}
// Try to load GroupManager // Try to load GroupManager
if (packageExists(new String[] { "org.anjocaido.groupmanager.GroupManager" })) { if (packageExists(new String[] { "org.anjocaido.groupmanager.GroupManager" })) {
Permission gPerms = new Permission_GroupManager(this); Permission gPerms = new Permission_GroupManager(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, gPerms, this, ServicePriority.Normal); getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, gPerms, this, ServicePriority.High);
log.info(String.format("[%s][Permission] GroupManager found: %s", getDescription().getName(), gPerms.isEnabled() ? "Loaded" : "Waiting")); log.info(String.format("[%s][Permission] GroupManager found: %s", getDescription().getName(), gPerms.isEnabled() ? "Loaded" : "Waiting"));
} else { } else {
log.info(String.format("[%s][Permission] GroupManager not found.", getDescription().getName())); log.info(String.format("[%s][Permission] GroupManager not found.", getDescription().getName()));
@ -149,7 +160,7 @@ public class Vault extends JavaPlugin {
// Try to load Permissions 3 (Yeti) // Try to load Permissions 3 (Yeti)
if (packageExists(new String[] { "com.nijiko.permissions.ModularControl" })) { if (packageExists(new String[] { "com.nijiko.permissions.ModularControl" })) {
Permission nPerms = new Permission_Permissions3(this); Permission nPerms = new Permission_Permissions3(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, nPerms, this, ServicePriority.Low); getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, nPerms, this, ServicePriority.Normal);
log.info(String.format("[%s][Permission] Permissions 3 (Yeti) found: %s", getDescription().getName(), nPerms.isEnabled() ? "Loaded" : "Waiting")); log.info(String.format("[%s][Permission] Permissions 3 (Yeti) found: %s", getDescription().getName(), nPerms.isEnabled() ? "Loaded" : "Waiting"));
} else { } else {
log.info(String.format("[%s][Permission] Permissions 3 (Yeti) not found.", getDescription().getName())); log.info(String.format("[%s][Permission] Permissions 3 (Yeti) not found.", getDescription().getName()));
@ -158,11 +169,14 @@ public class Vault extends JavaPlugin {
// Try to load Permissions 2 (Phoenix) // Try to load Permissions 2 (Phoenix)
if (packageExists(new String[] { "com.nijiko.permissions.Control" })) { if (packageExists(new String[] { "com.nijiko.permissions.Control" })) {
Permission oPerms = new Permission_Permissions2(this); Permission oPerms = new Permission_Permissions2(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Lowest); getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Low);
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting")); log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting"));
} else { } else {
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) not found.", getDescription().getName())); log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) not found.", getDescription().getName()));
} }
Permission perms = new Permission_SuperPerms(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, perms, this, ServicePriority.Lowest);
} }

View File

@ -23,6 +23,7 @@ import java.util.logging.Logger;
import net.milkbowl.vault.permission.Permission; import net.milkbowl.vault.permission.Permission;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginDisableEvent;
@ -270,6 +271,11 @@ public class Permission_Permissions3 extends Permission {
@Override @Override
public boolean playerHas(String worldName, String playerName, String permission) { public boolean playerHas(String worldName, String playerName, String permission) {
Player p = plugin.getServer().getPlayer(playerName);
if (p != null) {
if (p.hasPermission(permission))
return true;
}
return this.perms.has(worldName, playerName, permission); return this.perms.has(worldName, playerName, permission);
} }