finish updating to new event handling system

This commit is contained in:
Sleaker 2012-01-25 16:06:29 -08:00
parent b2dd574855
commit 50635c1bc0
21 changed files with 230 additions and 313 deletions

View File

@ -31,11 +31,11 @@ import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
public class Economy_3co implements Economy {
@ -44,15 +44,11 @@ public class Economy_3co implements Economy {
private String name = "3co";
private Plugin plugin = null;
private ECO economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_3co(Plugin plugin) {
this.plugin = plugin;
log.log(Level.SEVERE, "3c0 is an extremely outdated plugin and can not be used reliably for economy! You should update to a modern economy plugin!");
economyServerListener = new EconomyServerListener(this);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -151,13 +147,14 @@ public class Economy_3co implements Economy {
return economy.getSingularCurrency();
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_3co economy = null;
public EconomyServerListener(Economy_3co economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("3co");
@ -169,6 +166,7 @@ public class Economy_3co implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("3co")) {

View File

@ -26,13 +26,13 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import cosine.boseconomy.BOSEconomy;
@ -42,18 +42,11 @@ public class Economy_BOSE6 implements Economy {
private String name = "BOSEconomy";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private BOSEconomy economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_BOSE6(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -167,13 +160,14 @@ public class Economy_BOSE6 implements Economy {
return economy.getMoneyName();
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_BOSE6 economy = null;
public EconomyServerListener(Economy_BOSE6 economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
@ -184,7 +178,8 @@ public class Economy_BOSE6 implements Economy {
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("BOSEconomy") && event.getPlugin().getDescription().getVersion().startsWith("0.6")) {

View File

@ -26,13 +26,13 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import cosine.boseconomy.BOSEconomy;
@ -41,18 +41,11 @@ public class Economy_BOSE7 implements Economy {
private String name = "BOSEconomy";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private BOSEconomy economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_BOSE7(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -163,13 +156,14 @@ public class Economy_BOSE7 implements Economy {
return economy.getMoneyName();
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_BOSE7 economy = null;
public EconomyServerListener(Economy_BOSE7 economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
@ -181,6 +175,7 @@ public class Economy_BOSE7 implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("BOSEconomy") && event.getPlugin().getDescription().getVersion().startsWith("0.7")) {

View File

@ -3,40 +3,32 @@ package net.milkbowl.vault.economy.plugins;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import me.greatman.Craftconomy.Account;
import me.greatman.Craftconomy.AccountHandler;
import me.greatman.Craftconomy.Craftconomy;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.bukkit.plugin.java.JavaPlugin;
public class Economy_Craftconomy implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Craftconomy";
private JavaPlugin plugin = null;
private PluginManager pluginManager = null;
protected Craftconomy economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_Craftconomy(JavaPlugin plugin) {
this.plugin = plugin;
this.pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -48,13 +40,14 @@ public class Economy_Craftconomy implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_Craftconomy economy = null;
public EconomyServerListener(Economy_Craftconomy economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy");
@ -66,6 +59,7 @@ public class Economy_Craftconomy implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("Craftconomy")) {

View File

@ -7,32 +7,29 @@ import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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;
public class Economy_CurrencyCore implements Economy {
private Currency currency;
private static final Logger log = Logger.getLogger("Minecraft");
private final Plugin plugin;
private EconomyServerListener economyServerListener = null;
private final String name = "CurrencyCore";
public Economy_CurrencyCore(Plugin plugin) {
this.plugin = plugin;
economyServerListener = new EconomyServerListener(this);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if(currency == null) {
Plugin currencyPlugin = plugin.getServer().getPluginManager().getPlugin("CurrencyCore");
@ -43,7 +40,7 @@ public class Economy_CurrencyCore implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
private Economy_CurrencyCore economy = null;
@ -51,6 +48,7 @@ public class Economy_CurrencyCore implements Economy {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if(this.economy.currency == null) {
Plugin currencyPlugin = plugin.getServer().getPluginManager().getPlugin("CurrencyCore");
@ -61,6 +59,7 @@ public class Economy_CurrencyCore implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (this.economy.currency != null) {
if (event.getPlugin().getDescription().getName().equals("CurrencyCore")) {

View File

@ -4,38 +4,31 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import ca.agnate.EconXP.EconXP;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
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 ca.agnate.EconXP.EconXP;
public class Economy_EconXP implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "EconXP";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private EconXP econ = null;
private EconomyServerListener economyServerListener = null;
public Economy_EconXP(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (econ == null) {
@ -47,13 +40,14 @@ public class Economy_EconXP implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_EconXP economy = null;
public EconomyServerListener(Economy_EconXP economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP");
@ -65,6 +59,7 @@ public class Economy_EconXP implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.econ != null) {
if (event.getPlugin().getDescription().getName().equals("EconXP")) {

View File

@ -27,13 +27,13 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.api.NoLoanPermittedException;
@ -44,18 +44,11 @@ public class Economy_Essentials implements Economy {
private String name = "Essentials Economy";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private Essentials ess = null;
private EconomyServerListener economyServerListener = null;
public Economy_Essentials(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (ess == null) {
@ -175,13 +168,14 @@ public class Economy_Essentials implements Economy {
return new EconomyResponse(amount, balance, type, errorMessage);
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_Essentials economy = null;
public EconomyServerListener(Economy_Essentials economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.ess == null) {
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials");
@ -193,6 +187,7 @@ public class Economy_Essentials implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.ess != null) {
if (event.getPlugin().getDescription().getName().equals("Essentials")) {

View File

@ -6,36 +6,28 @@ import java.util.logging.Logger;
import me.mjolnir.mineconomy.Accounting;
import me.mjolnir.mineconomy.MineConomy;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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;
public class Economy_MineConomy implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "MineConomy";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private MineConomy econ = null;
private EconomyServerListener economyServerListener = null;
public Economy_MineConomy(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (econ == null) {
@ -47,13 +39,14 @@ public class Economy_MineConomy implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_MineConomy economy = null;
public EconomyServerListener(Economy_MineConomy economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy");
@ -65,6 +58,7 @@ public class Economy_MineConomy implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.econ != null) {
if (event.getPlugin().getDescription().getName().equals("MineConomy")) {

View File

@ -23,38 +23,30 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import me.ashtheking.currency.Currency;
import me.ashtheking.currency.CurrencyList;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import me.ashtheking.currency.Currency;
import me.ashtheking.currency.CurrencyList;
public class Economy_MultiCurrency implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "MultiCurrency";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private Currency economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_MultiCurrency(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -159,13 +151,14 @@ public class Economy_MultiCurrency implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_MultiCurrency economy = null;
public EconomyServerListener(Economy_MultiCurrency economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin mcur = plugin.getServer().getPluginManager().getPlugin("MultiCurrency");
@ -177,6 +170,7 @@ public class Economy_MultiCurrency implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("MultiCurrency")) {

View File

@ -5,36 +5,28 @@ import java.util.List;
import java.util.logging.Logger;
import me.ethan.eWallet.ECO;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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;
public class Economy_eWallet implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "eWallet";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private ECO econ = null;
private EconomyServerListener economyServerListener = null;
public Economy_eWallet(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (econ == null) {
@ -46,13 +38,14 @@ public class Economy_eWallet implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_eWallet economy = null;
public EconomyServerListener(Economy_eWallet economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet");
@ -64,6 +57,7 @@ public class Economy_eWallet implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.econ != null) {
if (event.getPlugin().getDescription().getName().equals("eWallet")) {

View File

@ -27,13 +27,13 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.nijiko.coelho.iConomy.iConomy;
import com.nijiko.coelho.iConomy.system.Account;
@ -43,18 +43,11 @@ public class Economy_iConomy4 implements Economy {
private String name = "iConomy 4";
private Plugin plugin = null;
private PluginManager pluginManager = null;
protected iConomy economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_iConomy4(Plugin plugin) {
this.plugin = plugin;
this.pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -170,13 +163,14 @@ public class Economy_iConomy4 implements Economy {
return new EconomyResponse(amount, balance, type, errorMessage);
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_iConomy4 economy = null;
public EconomyServerListener(Economy_iConomy4 economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy");
@ -188,6 +182,7 @@ public class Economy_iConomy4 implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("iConomy")) {

View File

@ -27,13 +27,13 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.iConomy.iConomy;
@ -45,18 +45,11 @@ public class Economy_iConomy5 implements Economy {
private String name = "iConomy 5";
private JavaPlugin plugin = null;
private PluginManager pluginManager = null;
protected iConomy economy = null;
private EconomyServerListener economyServerListener = null;
public Economy_iConomy5(JavaPlugin plugin) {
this.plugin = plugin;
this.pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -128,13 +121,14 @@ public class Economy_iConomy5 implements Economy {
return new EconomyResponse(amount, balance, type, errorMessage);
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_iConomy5 economy = null;
public EconomyServerListener(Economy_iConomy5 economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
@ -146,6 +140,7 @@ public class Economy_iConomy5 implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("iConomy")) {

View File

@ -3,13 +3,17 @@ package net.milkbowl.vault.economy.plugins;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.iCo6.iConomy;
@ -17,28 +21,17 @@ import com.iCo6.system.Account;
import com.iCo6.system.Accounts;
import com.iCo6.system.Holdings;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
public class Economy_iConomy6 implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "iConomy 6";
private JavaPlugin plugin = null;
private PluginManager pluginManager = null;
protected iConomy economy = null;
private Accounts accounts;
private EconomyServerListener economyServerListener = null;
public Economy_iConomy6(JavaPlugin plugin) {
this.plugin = plugin;
this.pluginManager = this.plugin.getServer().getPluginManager();
economyServerListener = new EconomyServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
@ -51,13 +44,14 @@ public class Economy_iConomy6 implements Economy {
}
}
private class EconomyServerListener extends ServerListener {
public class EconomyServerListener implements Listener {
Economy_iConomy6 economy = null;
public EconomyServerListener(Economy_iConomy6 economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
@ -70,6 +64,7 @@ public class Economy_iConomy6 implements Economy {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("iConomy")) {

View File

@ -15,33 +15,25 @@ import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
public class Permission_GroupManager extends Permission {
private String name = "GroupManager";
private PluginManager pluginManager = null;
private GroupManager groupManager;
private AnjoPermissionsHandler perms;
private PermissionServerListener permissionServerListener = null;
@SuppressWarnings("deprecation")
public Permission_GroupManager(Vault plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (groupManager == null) {
@ -56,7 +48,7 @@ public class Permission_GroupManager extends Permission {
}
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
Permission_GroupManager permission = null;
public PermissionServerListener(Permission_GroupManager permission) {
@ -64,6 +56,7 @@ public class Permission_GroupManager extends Permission {
}
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
@ -78,6 +71,7 @@ public class Permission_GroupManager extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (permission.groupManager != null) {
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {

View File

@ -30,13 +30,12 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.nijiko.permissions.Group;
import com.nijiko.permissions.ModularControl;
@ -46,18 +45,11 @@ public class Permission_Permissions3 extends Permission {
private String name = "Permissions3";
private ModularControl perms;
private PluginManager pluginManager = null;
private Permissions permission = null;
private PermissionServerListener permissionServerListener = null;
public Permission_Permissions3(Vault plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener();
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin);
// Load Plugin in case it was loaded before
if (permission == null) {
@ -86,7 +78,9 @@ public class Permission_Permissions3 extends Permission {
return this.permission.getHandler().inGroup(worldName, playerName, groupName);
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission == null) {
Plugin permi = event.getPlugin();
@ -100,6 +94,7 @@ public class Permission_Permissions3 extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (permission != null) {
if (event.getPlugin().getDescription().getName().equals("Permissions")) {

View File

@ -3,36 +3,28 @@ 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;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.platymuus.bukkit.permissions.Group;
import com.platymuus.bukkit.permissions.PermissionsPlugin;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
public class Permission_PermissionsBukkit extends Permission {
private final String name = "PermissionsBukkit";
private PluginManager pluginManager = null;
private PermissionsPlugin perms = null;
private PermissionServerListener permissionServerListener = null;
public Permission_PermissionsBukkit(Vault plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (perms == null) {
@ -44,13 +36,14 @@ public class Permission_PermissionsBukkit extends Permission {
}
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
Permission_PermissionsBukkit permission = null;
public PermissionServerListener(Permission_PermissionsBukkit permission) {
this.permission = permission;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.perms == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsBukkit");
@ -64,6 +57,7 @@ public class Permission_PermissionsBukkit extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (permission.perms != null) {
if (event.getPlugin().getDescription().getName().equals("PermissionsBukkit")) {

View File

@ -22,14 +22,14 @@ package net.milkbowl.vault.permission.plugins;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
@ -38,18 +38,11 @@ import ru.tehkode.permissions.bukkit.PermissionsEx;
public class Permission_PermissionsEx extends Permission {
private final String name = "PermissionsEx";
private PluginManager pluginManager = null;
private PermissionsEx permission = null;
private PermissionServerListener permissionServerListener = null;
public Permission_PermissionsEx(Vault plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (permission == null) {
@ -95,13 +88,14 @@ public class Permission_PermissionsEx extends Permission {
return PermissionsEx.getPermissionManager().getUser(playerName).inGroup(groupName);
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
Permission_PermissionsEx permission = null;
public PermissionServerListener(Permission_PermissionsEx permission) {
this.permission = permission;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (permission.permission == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
@ -123,6 +117,7 @@ public class Permission_PermissionsEx extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (permission.permission != null) {
if (event.getPlugin().getDescription().getName().equals("PermissionsEx")) {

View File

@ -1,28 +1,35 @@
package net.milkbowl.vault.permission.plugins;
import com.dthielke.starburst.*;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
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;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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 com.dthielke.starburst.Group;
import com.dthielke.starburst.GroupManager;
import com.dthielke.starburst.GroupSet;
import com.dthielke.starburst.StarburstPlugin;
import com.dthielke.starburst.User;
public class Permission_Starburst extends Permission {
private StarburstPlugin perms;
private String name = "Starburst";
private PermissionServerListener permissionServerListener;
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (perms == null) {
Plugin p = event.getPlugin();
@ -33,6 +40,7 @@ public class Permission_Starburst extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (perms != null) {
if (event.getPlugin().getDescription().getName().equals("bPermissions")) {
@ -45,11 +53,7 @@ public class Permission_Starburst extends Permission {
public Permission_Starburst(Vault plugin) {
this.plugin = plugin;
permissionServerListener = new PermissionServerListener();
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin);
// Load Plugin in case it was loaded before
if (perms == null) {

View File

@ -2,11 +2,15 @@ package net.milkbowl.vault.permission.plugins;
import java.util.List;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import de.bananaco.permissions.Permissions;
@ -14,23 +18,15 @@ import de.bananaco.permissions.interfaces.PermissionSet;
import de.bananaco.permissions.worlds.HasPermission;
import de.bananaco.permissions.worlds.WorldPermissionsManager;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
public class Permission_bPermissions extends Permission {
private String name = "bPermissions";
private WorldPermissionsManager perms;
private PermissionServerListener permissionServerListener = null;
public Permission_bPermissions(Vault plugin) {
this.plugin = plugin;
permissionServerListener = new PermissionServerListener();
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, 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("bPermissions");
@ -41,7 +37,9 @@ public class Permission_bPermissions extends Permission {
}
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (perms == null) {
Plugin p = event.getPlugin();
@ -52,6 +50,7 @@ public class Permission_bPermissions extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (perms != null) {
if (event.getPlugin().getDescription().getName().equals("bPermissions")) {

View File

@ -1,10 +1,14 @@
package net.milkbowl.vault.permission.plugins;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import de.bananaco.bpermissions.api.Group;
@ -12,23 +16,16 @@ import de.bananaco.bpermissions.api.User;
import de.bananaco.bpermissions.api.World;
import de.bananaco.bpermissions.api.WorldManager;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
public class Permission_bPermissions2 extends Permission {
private String name = "bPermissions2";
private WorldManager perms;
private PermissionServerListener permissionServerListener = null;
public Permission_bPermissions2(Vault plugin) {
this.plugin = plugin;
permissionServerListener = new PermissionServerListener();
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, 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("bPermissions");
@ -39,7 +36,9 @@ public class Permission_bPermissions2 extends Permission {
}
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (perms == null) {
Plugin p = event.getPlugin();
@ -50,6 +49,7 @@ public class Permission_bPermissions2 extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (perms != null) {
if (event.getPlugin().getDescription().getName().equals("bPermissions")) {

View File

@ -3,36 +3,31 @@ 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;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
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.event.server.ServerListener;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsPlugin;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.permission.Permission;
public class Permission_zPermissions extends Permission {
private static final String name = "zPermissions";
private ZPermissionsPlugin perms;
private PermissionServerListener permissionServerListener = null;
private ConsoleCommandSender ccs;
public Permission_zPermissions(Vault plugin) {
this.plugin = plugin;
ccs = Bukkit.getServer().getConsoleSender();
permissionServerListener = new PermissionServerListener();
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.plugin.getServer().getPluginManager().registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, 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("zPermissions");
@ -43,7 +38,9 @@ public class Permission_zPermissions extends Permission {
}
}
private class PermissionServerListener extends ServerListener {
public class PermissionServerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (perms == null) {
Plugin p = event.getPlugin();
@ -54,6 +51,7 @@ public class Permission_zPermissions extends Permission {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (perms != null) {
if (event.getPlugin().getDescription().getName().equals("zPermissions")) {