summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java
blob: 0834b3adae2182828f99b0b1411c413a5eb6f751 (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
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.");
	}
	
	
}