diff --git a/src/net/milkbowl/vault/Vault.java b/src/net/milkbowl/vault/Vault.java index 87982f4..2bc9266 100644 --- a/src/net/milkbowl/vault/Vault.java +++ b/src/net/milkbowl/vault/Vault.java @@ -74,6 +74,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.server.PluginEnableEvent; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.ServicesManager; @@ -279,7 +280,7 @@ public class Vault extends JavaPlugin { private void hookChat (String name, Class hookClass, ServicePriority priority, String...packages) { try { if (packagesExists(packages)) { - Chat chat = hookClass.getConstructor(Vault.class, Permission.class).newInstance(this, perms); + Chat chat = hookClass.getConstructor(Plugin.class, Permission.class).newInstance(this, perms); sm.register(Chat.class, chat, this, priority); log.info(String.format("[%s][Chat] %s found: %s", getDescription().getName(), name, chat.isEnabled() ? "Loaded" : "Waiting")); } @@ -291,7 +292,7 @@ public class Vault extends JavaPlugin { private void hookEconomy (String name, Class hookClass, ServicePriority priority, String...packages) { try { if (packagesExists(packages)) { - Economy econ = hookClass.getConstructor(Vault.class).newInstance(this); + Economy econ = hookClass.getConstructor(Plugin.class).newInstance(this); sm.register(Economy.class, econ, this, priority); log.info(String.format("[%s][Economy] %s found: %s", getDescription().getName(), name, econ.isEnabled() ? "Loaded" : "Waiting")); } @@ -303,7 +304,7 @@ public class Vault extends JavaPlugin { private void hookPermission (String name, Class hookClass, ServicePriority priority, String...packages) { try { if (packagesExists(packages)) { - Permission perms = hookClass.getConstructor(Vault.class).newInstance(this); + Permission perms = hookClass.getConstructor(Plugin.class).newInstance(this); sm.register(Permission.class, perms, this, priority); log.info(String.format("[%s][Permission] %s found: %s", getDescription().getName(), name, perms.isEnabled() ? "Loaded" : "Waiting")); } diff --git a/src/net/milkbowl/vault/permission/Permission.java b/src/net/milkbowl/vault/permission/Permission.java index 746d7c5..f62b141 100644 --- a/src/net/milkbowl/vault/permission/Permission.java +++ b/src/net/milkbowl/vault/permission/Permission.java @@ -17,13 +17,12 @@ package net.milkbowl.vault.permission; import java.util.logging.Logger; -import net.milkbowl.vault.Vault; - import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; +import org.bukkit.plugin.Plugin; /** * The main Permission API - allows for group and player based permission tests @@ -32,7 +31,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo; public abstract class Permission { protected static final Logger log = Logger.getLogger("Minecraft"); - protected Vault plugin = null; + protected Plugin plugin = null; /** * Gets name of permission method diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_DroxPerms.java b/src/net/milkbowl/vault/permission/plugins/Permission_DroxPerms.java index a11d6de..56da400 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_DroxPerms.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_DroxPerms.java @@ -2,15 +2,10 @@ package net.milkbowl.vault.permission.plugins; import java.util.ArrayList; -import org.bukkit.entity.Player; - -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; -import de.hydrox.bukkit.DroxPerms.DroxPerms; -import de.hydrox.bukkit.DroxPerms.DroxPermsAPI; - import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -18,12 +13,15 @@ import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.Plugin; +import de.hydrox.bukkit.DroxPerms.DroxPerms; +import de.hydrox.bukkit.DroxPerms.DroxPermsAPI; + public class Permission_DroxPerms extends Permission { private final String name = "DroxPerms"; private DroxPermsAPI API; - public Permission_DroxPerms(Vault plugin) { + public Permission_DroxPerms(Plugin plugin) { this.plugin = plugin; // Load Plugin in case it was loaded before diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java b/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java index 63e5fc1..b088652 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.anjocaido.groupmanager.GroupManager; @@ -44,7 +43,7 @@ public class Permission_GroupManager extends Permission { private final String name = "GroupManager"; private GroupManager groupManager; - public Permission_GroupManager(Vault plugin) { + public Permission_GroupManager(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java b/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java index 8a61865..6eeb668 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java @@ -18,7 +18,6 @@ package net.milkbowl.vault.permission.plugins; import java.util.HashSet; import java.util.Set; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -43,7 +42,7 @@ public class Permission_Permissions3 extends Permission { private ModularControl perms; private Permissions permission = null; - public Permission_Permissions3(Vault plugin) { + public Permission_Permissions3(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsBukkit.java b/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsBukkit.java index be6f4f7..bb8acec 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsBukkit.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsBukkit.java @@ -18,7 +18,6 @@ package net.milkbowl.vault.permission.plugins; import java.util.ArrayList; import java.util.List; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -38,7 +37,7 @@ public class Permission_PermissionsBukkit extends Permission { private final String name = "PermissionsBukkit"; private PermissionsPlugin perms = null; - public Permission_PermissionsBukkit(Vault plugin) { + public Permission_PermissionsBukkit(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsEx.java b/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsEx.java index 8d22bb8..52226ae 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsEx.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_PermissionsEx.java @@ -15,7 +15,6 @@ */ package net.milkbowl.vault.permission.plugins; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -36,7 +35,7 @@ public class Permission_PermissionsEx extends Permission { private final String name = "PermissionsEx"; private PermissionsEx permission = null; - public Permission_PermissionsEx(Vault plugin) { + public Permission_PermissionsEx(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_Privileges.java b/src/net/milkbowl/vault/permission/plugins/Permission_Privileges.java index c88e551..18bb025 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_Privileges.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_Privileges.java @@ -3,7 +3,6 @@ package net.milkbowl.vault.permission.plugins; import net.krinsoft.privileges.Privileges; import net.krinsoft.privileges.groups.Group; import net.krinsoft.privileges.groups.GroupManager; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -20,11 +19,10 @@ import org.bukkit.plugin.Plugin; public class Permission_Privileges extends Permission { private final String name = ""; - private final Vault plugin; private GroupManager perms; private Privileges privs; - public Permission_Privileges(Vault plugin) { + public Permission_Privileges(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin); // Load service in case it was loaded before diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_SimplyPerms.java b/src/net/milkbowl/vault/permission/plugins/Permission_SimplyPerms.java index aa6b5b3..a3b5614 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_SimplyPerms.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_SimplyPerms.java @@ -22,7 +22,6 @@ import java.util.Map; import net.crystalyx.bukkit.simplyperms.SimplyAPI; import net.crystalyx.bukkit.simplyperms.SimplyPlugin; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -38,7 +37,7 @@ public class Permission_SimplyPerms extends Permission{ private final String name = "SimplyPerms"; private SimplyAPI perms; - public Permission_SimplyPerms(Vault plugin) { + public Permission_SimplyPerms(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin); // Load service in case it was loaded before diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java b/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java index cc73d20..b4389b9 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -42,6 +41,20 @@ public class Permission_Starburst extends Permission { private StarburstPlugin perms; private final String name = "Starburst"; + public Permission_Starburst(Plugin plugin) { + this.plugin = plugin; + Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); + + // Load Plugin in case it was loaded before + if (perms == null) { + Plugin p = plugin.getServer().getPluginManager().getPlugin("Starburst"); + if (p != null) { + perms = (StarburstPlugin) p; + log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); + } + } + } + public class PermissionServerListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) @@ -66,20 +79,6 @@ public class Permission_Starburst extends Permission { } } - public Permission_Starburst(Vault plugin) { - this.plugin = plugin; - Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); - - // Load Plugin in case it was loaded before - if (perms == null) { - Plugin p = plugin.getServer().getPluginManager().getPlugin("Starburst"); - if (p != null) { - perms = (StarburstPlugin) p; - log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); - } - } - } - @Override public String[] getGroups() { String[] s = new String[perms.getGroupManager().getDefaultGroupSet().getGroups().size()]; diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_SuperPerms.java b/src/net/milkbowl/vault/permission/plugins/Permission_SuperPerms.java index 540cee7..3e80b44 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_SuperPerms.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_SuperPerms.java @@ -15,16 +15,16 @@ */ package net.milkbowl.vault.permission.plugins; -import org.bukkit.entity.Player; - -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + public class Permission_SuperPerms extends Permission { private final String name = "SuperPerms"; - public Permission_SuperPerms(Vault plugin) { + public Permission_SuperPerms(Plugin plugin) { this.plugin = plugin; } diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions.java b/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions.java index 9ea9cbe..b96d261 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions.java @@ -17,7 +17,6 @@ package net.milkbowl.vault.permission.plugins; import java.util.List; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -38,7 +37,7 @@ public class Permission_bPermissions extends Permission { private final String name = "bPermissions"; private WorldPermissionsManager perms; - public Permission_bPermissions(Vault plugin) { + public Permission_bPermissions(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions2.java b/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions2.java index 540dbea..23a30f9 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions2.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_bPermissions2.java @@ -18,7 +18,6 @@ package net.milkbowl.vault.permission.plugins; import java.util.HashSet; import java.util.Set; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -40,7 +39,7 @@ public class Permission_bPermissions2 extends Permission { private final String name = "bPermissions2"; private boolean hooked = false; - public Permission_bPermissions2(Vault plugin) { + public Permission_bPermissions2(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_zPermissions.java b/src/net/milkbowl/vault/permission/plugins/Permission_zPermissions.java index 1f0d3be..6de80d0 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_zPermissions.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_zPermissions.java @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -31,6 +30,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; +import org.bukkit.plugin.Plugin; import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService; public class Permission_zPermissions extends Permission { @@ -39,7 +39,7 @@ public class Permission_zPermissions extends Permission { private ZPermissionsService service; private final ConsoleCommandSender ccs; - public Permission_zPermissions(Vault plugin) { + public Permission_zPermissions(Plugin plugin) { this.plugin = plugin; ccs = Bukkit.getServer().getConsoleSender(); Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin);