swapped the wrong ones. This should standardize constructors properly.

This commit is contained in:
Sleaker 2012-06-30 09:57:54 -07:00
parent 140b906dc4
commit 716a784e20
14 changed files with 39 additions and 51 deletions

View File

@ -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<? extends Chat> 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<? extends Economy> 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<? extends Permission> 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"));
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()];

View File

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

View File

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

View File

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

View File

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