mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-08-26 07:22:56 +02:00
Moved events into GMWorldListener
Better error output
This commit is contained in:
parent
bfd6049913
commit
0e867df195
|
@ -8,6 +8,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.anjocaido.groupmanager.utils.Tasks;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GroupManager extends JavaPlugin {
|
|||
private GMConfiguration config;
|
||||
private GMLoggerHandler ch;
|
||||
public static BukkitPermissions BukkitPermissions;
|
||||
private WorldListener WorldEvents;
|
||||
private static WorldListener WorldEvents;
|
||||
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
|
||||
|
||||
//PERMISSIONS FOR COMMAND BEING LOADED
|
||||
|
@ -74,6 +74,10 @@ public class GroupManager extends JavaPlugin {
|
|||
worldsHolder.saveChanges();
|
||||
}
|
||||
disableScheduler();
|
||||
|
||||
WorldEvents = null;
|
||||
BukkitPermissions = null;
|
||||
|
||||
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
|
||||
|
@ -99,12 +103,10 @@ public class GroupManager extends JavaPlugin {
|
|||
throw new IllegalStateException("An error ocurred while loading GroupManager");
|
||||
}
|
||||
|
||||
// Setup the world listener and bukkit permissions to handle events.
|
||||
// Initialize the world listener and bukkit permissions to handle events.
|
||||
WorldEvents = new GMWorldListener(this);
|
||||
BukkitPermissions = new BukkitPermissions(this);
|
||||
|
||||
this.getServer().getPluginManager().registerEvent(Event.Type.WORLD_INIT, WorldEvents, Event.Priority.Lowest, this);
|
||||
|
||||
enableScheduler();
|
||||
|
||||
/*
|
||||
|
@ -117,7 +119,6 @@ public class GroupManager extends JavaPlugin {
|
|||
setLoaded(true);
|
||||
}
|
||||
|
||||
//setLoaded(true);
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.anjocaido.groupmanager.events;
|
||||
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
import org.bukkit.event.world.WorldListener;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author ElgarL
|
||||
*
|
||||
|
@ -18,8 +18,13 @@ public class GMWorldListener extends WorldListener {
|
|||
|
||||
public GMWorldListener(GroupManager instance) {
|
||||
plugin = instance;
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
private void registerEvents() {
|
||||
plugin.getServer().getPluginManager().registerEvent(Event.Type.WORLD_INIT, this, Event.Priority.Lowest, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldInit(WorldInitEvent event) {
|
||||
String worldName = event.getWorld().getName();
|
||||
|
@ -29,8 +34,10 @@ public class GMWorldListener extends WorldListener {
|
|||
GroupManager.logger.info("Creating data for: " + worldName);
|
||||
plugin.getWorldsHolder().setupWorldFolder(worldName);
|
||||
plugin.getWorldsHolder().loadWorld(worldName);
|
||||
if (plugin.getWorldsHolder().isInList(worldName))
|
||||
if (plugin.getWorldsHolder().isInList(worldName)) {
|
||||
GroupManager.logger.info("Don't forget to configure/mirror this world in config.yml.");
|
||||
}
|
||||
} else
|
||||
GroupManager.logger.severe("Failed to configure this world.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,7 +43,6 @@ import org.bukkit.event.server.ServerListener;
|
|||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
//import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user