summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/api/IPlugin.java
blob: 33091c24f920132121d48ae03ee2b766a367a594 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package net.ess3.api;

import java.io.File;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;


public interface IPlugin extends Plugin
{
	/**
	 * Get an instance of essentials
	 *
	 * @return the instance
	 */
	IEssentials getEssentials();

	/**
	 * Schedule an a-sync task
	 *
	 * @param run - Code to call later
	 * @return - BukkitTask for the task created
	 */
	BukkitTask runTaskAsynchronously(final Runnable run);

	/**
	 * Schedule a sync task (ran in main thread) to be run
	 *
	 * @param run - Code to be run later
	 * @return - Integer for the task id
	 */
	int scheduleSyncDelayedTask(final Runnable run);

	/**
	 * Call an a-sync task to be run with a given delay
	 *
	 * @param run - Code to be run
	 * @param delay - Long that represents how long to wait
	 * @return - BukkitTask for the task created
	 */
	BukkitTask runTaskLaterAsynchronously(final Runnable run, final long delay);

	/**
	 * Call an a-sync task to be run with a given delay
	 *
	 * @param run - Code to be run
	 * @param delay - Long that represents how long to wait
	 * @param period - Time to wait between every run after the first
	 * @return - BukkitTask for the task created
	 */
	BukkitTask runTaskTimerAsynchronously(final Runnable run, final long delay, final long period);

	/**
	 * Schedule a sync (ran in main thread) delayed task
	 *
	 * @param run - Code to run
	 * @param delay - Long that represents how long to wait
	 * @return - Integer of the task ID
	 */
	int scheduleSyncDelayedTask(final Runnable run, final long delay);

	/**
	 * Schedule a sync (in the main thread) repeating task
	 *
	 * @param run - Code to run
	 * @param delay - Delay for the first run
	 * @param period - Time to wait between every run after the first
	 * @return - int of the task ID
	 */
	int scheduleSyncRepeatingTask(final Runnable run, final long delay, final long period);

	/**
	 * Schedule an a-sync repeating task
	 *
	 * @param run - Code to run
	 * @param delay - Delay for the first run
	 * @param period - Time to wait between every run after the first
	 * @return - int of the task ID
	 */
	BukkitTask scheduleAsyncRepeatingTask(final Runnable run, final long delay, final long period);

	/**
	 *
	 * @return
	 */
	File getRootFolder();

	/**
	 * Stop a running task from a task id
	 *
	 * @param taskId
	 */
	void cancelTask(final int taskId);

	/**
	 * Stop a running task from a bukkit task
	 *
	 * @param taskId
	 */
	void cancelTask(final BukkitTask taskId);

	/**
	 * Get the essentials version
	 *
	 * @return
	 */
	String getVersion();

	/**
	 * Load a class, currently needs updating
	 *
	 * @param name - class name
	 * @return - loaded class
	 */
	Class<?> getClassByName(final String name);

	/**
	 * Call a re-spawn event on a player
	 *
	 * @param player - Player to re-spawn
	 * @param loc - Location to send
	 * @param bedSpawn - do you use bed?
	 * @return - Location after event called
	 */
	Location callRespawnEvent(Player player, Location loc, boolean bedSpawn);

	/**
	 * Call a suicide event on a player
	 *
	 * @param player - Player to kill
	 */
	void callSuicideEvent(Player player);

	/**
	 * Finds if an essentials module is loaded
	 *
	 * @param name
	 * @return
	 */
	boolean isModuleEnabled(String name);

	/**
	 *
	 * @param plugin
	 */
	void onPluginEnable(Plugin plugin);

	/**
	 *
	 * @param plugin
	 */
	void onPluginDisable(Plugin plugin);

	/**
	 * Register a module with Essentials
	 *
	 * @param module - Your plugin instance
	 */
	void registerModule(Plugin module);
}