mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 10:01:49 +01:00
Move to switch statement (Java 7 sugar)
This commit is contained in:
parent
65fc8a9c41
commit
c03765803c
@ -3,6 +3,7 @@ package com.earth2me.essentials.perm;
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
|
||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -10,8 +11,8 @@ import org.bukkit.plugin.Plugin;
|
||||
public class GroupManagerHandler extends AbstractVaultHandler {
|
||||
private final transient GroupManager groupManager;
|
||||
|
||||
public GroupManagerHandler(final Plugin permissionsPlugin) {
|
||||
groupManager = ((GroupManager) permissionsPlugin);
|
||||
public GroupManagerHandler() {
|
||||
groupManager = ((GroupManager) Bukkit.getPluginManager().getPlugin("GroupManager"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,18 +110,25 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
if (!(handler instanceof AbstractVaultHandler)) {
|
||||
AbstractVaultHandler vaultHandler;
|
||||
// No switch statements for Strings, this is Java 6
|
||||
if (enabledPermsPlugin.equals("PermissionsEx")) {
|
||||
vaultHandler = new PermissionsExHandler();
|
||||
} else if (enabledPermsPlugin.equals("GroupManager")) {
|
||||
vaultHandler = new GroupManagerHandler(pluginManager.getPlugin(enabledPermsPlugin));
|
||||
} else if (enabledPermsPlugin.equals("SimplyPerms")) {
|
||||
vaultHandler = new SimplyPermsHandler();
|
||||
} else if (enabledPermsPlugin.equals("Privileges")) {
|
||||
vaultHandler = new PrivilegesHandler();
|
||||
} else if (enabledPermsPlugin.equals("bPermissions")) {
|
||||
vaultHandler = new BPermissions2Handler();
|
||||
} else {
|
||||
vaultHandler = new GenericVaultHandler();
|
||||
switch (enabledPermsPlugin) {
|
||||
case "PermissionsEx":
|
||||
vaultHandler = new PermissionsExHandler();
|
||||
break;
|
||||
case "GroupManager":
|
||||
vaultHandler = new GroupManagerHandler();
|
||||
break;
|
||||
case "SimplyPerms":
|
||||
vaultHandler = new SimplyPermsHandler();
|
||||
break;
|
||||
case "Privileges":
|
||||
vaultHandler = new PrivilegesHandler();
|
||||
break;
|
||||
case "bPermissions":
|
||||
vaultHandler = new BPermissions2Handler();
|
||||
break;
|
||||
default:
|
||||
vaultHandler = new GenericVaultHandler();
|
||||
break;
|
||||
}
|
||||
if (enabledPermsPlugin.equals("")) {
|
||||
enabledPermsPlugin = "generic";
|
||||
|
@ -68,7 +68,6 @@ public class SpawnerUtil {
|
||||
}
|
||||
|
||||
public EntityType getEntityType(ItemStack is) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
if (useMeta) {
|
||||
BlockStateMeta bsm = (BlockStateMeta) is.getItemMeta();
|
||||
CreatureSpawner bs = (CreatureSpawner) bsm.getBlockState();
|
||||
|
Loading…
Reference in New Issue
Block a user