72 lines
1.8 KiB
Java
72 lines
1.8 KiB
Java
package org.anjocaido.groupmanager.events;
|
|
|
|
import org.anjocaido.groupmanager.GroupManager;
|
|
import org.anjocaido.groupmanager.data.Group;
|
|
import org.anjocaido.groupmanager.data.User;
|
|
import org.bukkit.Server;
|
|
|
|
/**
|
|
* @author ElgarL
|
|
*
|
|
* Handles all Event generation.
|
|
*
|
|
*/
|
|
public class GroupManagerEventHandler {
|
|
|
|
private final Server server;
|
|
private final GroupManager plugin;
|
|
|
|
public GroupManagerEventHandler(final GroupManager plugin) {
|
|
|
|
this.plugin = plugin;
|
|
this.server = plugin.getServer();
|
|
|
|
}
|
|
|
|
public void callEvent(final GMSystemEvent.Action action) {
|
|
callEvent(new GMSystemEvent(action));
|
|
}
|
|
|
|
public void callEvent(final Group group, final GMGroupEvent.Action action) {
|
|
callEvent(new GMGroupEvent(group, action));
|
|
}
|
|
|
|
public void callEvent(final String groupName, final GMGroupEvent.Action action) {
|
|
callEvent(new GMGroupEvent(groupName, action));
|
|
}
|
|
|
|
public void callEvent(final String userName, final GMUserEvent.Action action) {
|
|
callEvent(new GMUserEvent(userName, action));
|
|
}
|
|
|
|
public void callEvent(final User user, final GMUserEvent.Action action) {
|
|
callEvent(new GMUserEvent(user, action));
|
|
}
|
|
|
|
/**
|
|
* @return the plugin
|
|
*/
|
|
public GroupManager getPlugin() {
|
|
return plugin;
|
|
}
|
|
|
|
/**
|
|
* @return the server
|
|
*/
|
|
public Server getServer() {
|
|
return server;
|
|
}
|
|
|
|
protected void callEvent(final GMGroupEvent event) {
|
|
event.schedule(event);
|
|
}
|
|
|
|
protected void callEvent(final GMSystemEvent event) {
|
|
event.schedule(event);
|
|
}
|
|
|
|
protected void callEvent(final GMUserEvent event) {
|
|
event.schedule(event);
|
|
}
|
|
|
|
} |