Ditching GM and weird API... No one has specifically requested GM

support anyways, wonder why...
This commit is contained in:
Rigby 2011-03-14 22:54:50 +00:00
parent f73d5dbcf1
commit b8ee4c7f53
3 changed files with 7 additions and 49 deletions

View File

@ -13,7 +13,7 @@ public class MVPermissions {
* Constructor FTW
* @param plugin Pass along the Core Plugin.
*/
public MVPermissions(MultiVerseCore plugin){
public MVPermissions(MultiVerseCore plugin) {
this.plugin = plugin;
}
@ -27,9 +27,7 @@ public class MVPermissions {
public boolean has(Player p, String node){
boolean result = false;
if(MultiVerseCore.GroupManager!=null){
result = MultiVerseCore.GroupManager.getWorldsHolder().getWorldPermissions(p).has(p, node);
} else if(MultiVerseCore.Permissions!=null){
if(MultiVerseCore.Permissions!=null){
result = MultiVerseCore.Permissions.has(p, node);
} else if(p.isOp()){
result = true;
@ -74,9 +72,7 @@ public class MVPermissions {
public Boolean canEnterWorld(Player p, World w) {
String group = "";
if(MultiVerseCore.GroupManager!=null){
group = MultiVerseCore.GroupManager.getWorldsHolder().getWorldPermissions(p).getGroup(p.getName());
} else if (MultiVerseCore.Permissions!=null){
if (MultiVerseCore.Permissions!=null){
group = MultiVerseCore.Permissions.getGroup(p.getName(), p.getWorld().getName());
}

View File

@ -21,20 +21,10 @@ public class MVPluginListener extends ServerListener {
*/
public void onPluginEnabled(PluginEvent event){
/**
* Check to see if GroupManager just enabled.
*/
if(event.getPlugin().getDescription().getName().equals("GroupManager")){
MultiVerseCore.GroupManager = (GroupManager) plugin.getServer().getPluginManager().getPlugin("GroupManager");
MultiVerseCore.log.info(MultiVerseCore.logPrefix + " - Found GroupManager");
}
/**
* Check to see if Permissions was just enabled, we only wan't to perform the following if GroupManager is not found.
*/
if(event.getPlugin().getDescription().getName().equals("Permissions")
&& MultiVerseCore.GroupManager==null
&& plugin.getServer().getPluginManager().getPlugin("GroupManager") == null) {
if(event.getPlugin().getDescription().getName().equals("Permissions")) {
MultiVerseCore.Permissions = (PermissionHandler) plugin.getServer().getPluginManager().getPlugin("Permissions");
MultiVerseCore.log.info(MultiVerseCore.logPrefix + "- Found Permissions");
}
@ -58,14 +48,6 @@ public class MVPluginListener extends ServerListener {
* We'll check if any of the plugins we rely on decide to Disable themselves.
*/
public void onPluginDisabled(PluginEvent event){
/**
* Check to see if GroupManager just disabled.
*/
if(event.getPlugin().getDescription().getName().equals("GroupManager")){
MultiVerseCore.GroupManager = null;
MultiVerseCore.log.info(MultiVerseCore.logPrefix + " - GroupManager has been Disabled");
}
/**
* Check to see if Permissions just disabled.
*/

View File

@ -21,8 +21,6 @@ import org.bukkit.util.config.Configuration;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.anjocaido.groupmanager.GroupManager;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
@ -51,14 +49,11 @@ public class MultiVerseCore extends JavaPlugin {
public static final File dataFolder = new File("plugins" + File.separator + "MultiVerse");
// MultiVerse Permissions Handler
public static MVPermissions ph;
public MVPermissions ph = new MVPermissions(this);
// Permissions Handler
public static PermissionHandler Permissions = null;
// GroupManager Permissions Handler
public static GroupManager GroupManager = null;
// iConomy Handler
public static iConomy iConomy = null;
public static boolean useiConomy = false;
@ -107,8 +102,6 @@ public class MultiVerseCore extends JavaPlugin {
loadWorlds();
// Purge Worlds of old Monsters/Animals which don't adhere to the setup.
purgeWorlds();
// Setup Group Manager.
setupGroupManager();
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
setupPermissions();
// Setup iConomy.
@ -142,19 +135,6 @@ public class MultiVerseCore extends JavaPlugin {
pm.registerEvent(Event.Type.PLUGIN_ENABLE, pluginListener, Priority.Monitor, this); // Monitor for Permissions Plugin etc.
}
/**
* Check to see if GroupManager is enabled and setup accordingly.
*/
private void setupGroupManager(){
Plugin p = this.getServer().getPluginManager().getPlugin("GroupManager");
if (p != null) {
if (!this.getServer().getPluginManager().isPluginEnabled(p)) {
this.getServer().getPluginManager().enablePlugin(p);
}
MultiVerseCore.GroupManager = (GroupManager) p;
}
}
/**
* Check for Permissions plugin and then setup our own Permissions Handler.
@ -323,8 +303,8 @@ public class MultiVerseCore extends JavaPlugin {
/**
* Grab the Permissions Handler for MultiVerse
*/
public static MVPermissions getPermissions() {
return ph;
public MVPermissions getPermissions() {
return this.ph;
}
/**