mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-21 10:52:01 +00:00
Separated all events to be independent classes.
This commit is contained in:
parent
9041596384
commit
6e03ea7b7d
|
@ -26,7 +26,6 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
|
||||
import org.anjocaido.groupmanager.events.GMWorldListener;
|
||||
import org.anjocaido.groupmanager.events.GroupManagerEvent;
|
||||
import org.anjocaido.groupmanager.utils.GMLoggerHandler;
|
||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
||||
import org.anjocaido.groupmanager.utils.Tasks;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.anjocaido.groupmanager.events;
|
||||
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.data.Group;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
|
||||
|
@ -8,7 +11,7 @@ import org.bukkit.event.HandlerList;
|
|||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class GMGroupEvent extends GroupManagerEvent {
|
||||
public class GMGroupEvent extends Event {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -67,4 +70,16 @@ public class GMGroupEvent extends GroupManagerEvent {
|
|||
GROUP_ADDED,
|
||||
GROUP_REMOVED,
|
||||
}
|
||||
|
||||
public void schedule(final GMGroupEvent event) {
|
||||
|
||||
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}, 1) == -1)
|
||||
GroupManager.logger.warning("Could not schedule GM Event.");
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package org.anjocaido.groupmanager.events;
|
||||
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
|
||||
|
@ -7,7 +10,7 @@ import org.bukkit.event.HandlerList;
|
|||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class GMSystemEvent extends GroupManagerEvent {
|
||||
public class GMSystemEvent extends Event {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -44,4 +47,16 @@ public class GMSystemEvent extends GroupManagerEvent {
|
|||
DEFAULT_GROUP_CHANGED,
|
||||
VALIDATE_TOGGLE,
|
||||
}
|
||||
|
||||
public void schedule(final GMSystemEvent event) {
|
||||
|
||||
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}, 1) == -1)
|
||||
GroupManager.logger.warning("Could not schedule GM Event.");
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package org.anjocaido.groupmanager.events;
|
||||
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.data.User;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
|
||||
|
@ -8,7 +11,7 @@ import org.bukkit.event.HandlerList;
|
|||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class GMUserEvent extends GroupManagerEvent {
|
||||
public class GMUserEvent extends Event {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -69,4 +72,16 @@ public class GMUserEvent extends GroupManagerEvent {
|
|||
USER_ADDED,
|
||||
USER_REMOVED,
|
||||
}
|
||||
|
||||
public void schedule(final GMUserEvent event) {
|
||||
|
||||
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}, 1) == -1)
|
||||
GroupManager.logger.warning("Could not schedule GM Event.");
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package org.anjocaido.groupmanager.events;
|
||||
|
||||
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public abstract class GroupManagerEvent extends Event {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8790362185329926951L;
|
||||
|
||||
protected GroupManagerEvent(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers all GroupManager events for other plugins to see.
|
||||
* Schedules events for 1 tick later to allow GM to finish populating super perms.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void schedule(final GroupManagerEvent event) {
|
||||
|
||||
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}, 1) == -1)
|
||||
GroupManager.logger.warning("Could not schedule GM Event.");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,6 +7,8 @@ import org.anjocaido.groupmanager.data.User;
|
|||
/**
|
||||
* @author ElgarL
|
||||
*
|
||||
* Handles all Event generation.
|
||||
*
|
||||
*/
|
||||
public class GroupManagerEventHandler {
|
||||
|
||||
|
|
Loading…
Reference in a new issue