summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
blob: d0df57aa782b14f26f0c3003cc5a4b190a4caecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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(GroupManager plugin) {
		
		this.plugin = plugin;
		this.server = plugin.getServer();
		
	}

	protected void callEvent(GMGroupEvent event) {

		event.schedule(event);
	}

	protected void callEvent(GMUserEvent event) {

		event.schedule(event);
	}

	protected void callEvent(GMSystemEvent event) {

		event.schedule(event);
	}

	public void callEvent(Group group, GMGroupEvent.Action action) {

		callEvent(new GMGroupEvent(group, action));
	}

	public void callEvent(String groupName, GMGroupEvent.Action action) {

		callEvent(new GMGroupEvent(groupName, action));
	}

	public void callEvent(User user, GMUserEvent.Action action) {

		callEvent(new GMUserEvent(user, action));
	}

	public void callEvent(String userName, GMUserEvent.Action action) {

		callEvent(new GMUserEvent(userName, action));
	}

	public void callEvent(GMSystemEvent.Action action) {

		callEvent(new GMSystemEvent(action));
	}
	
	/**
	 * @return the plugin
	 */
	public GroupManager getPlugin() {
	
		return plugin;
	}
	
	/**
	 * @return the server
	 */
	public Server getServer() {
	
		return server;
	}

	
}