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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
package org.bukkit;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Logger;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.Recipe;
import org.bukkit.map.MapView;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import com.avaje.ebean.config.ServerConfig;
/**
* Represents the Bukkit core, for version and Server singleton handling
*/
public final class Bukkit {
private static Server server;
/**
* Static class cannot be initialized.
*/
private Bukkit() {}
/**
* Gets the current {@link Server} singleton
*
* @return Server instance being ran
*/
public static Server getServer() {
return server;
}
/**
* Attempts to set the {@link Server} singleton.
* <p />
* This cannot be done if the Server is already set.
*
* @param server Server instance
*/
public static void setServer(Server server) {
if (Bukkit.server != null) {
throw new UnsupportedOperationException("Cannot redefine singleton Server");
}
Bukkit.server = server;
server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")");
}
public static String getName() {
return server.getName();
}
public static String getVersion() {
return server.getVersion();
}
public static String getBukkitVersion() {
return server.getBukkitVersion();
}
public static Player[] getOnlinePlayers() {
return server.getOnlinePlayers();
}
public static int getMaxPlayers() {
return server.getMaxPlayers();
}
public static int getPort() {
return server.getPort();
}
public static int getViewDistance() {
return server.getViewDistance();
}
public static String getIp() {
return server.getIp();
}
public static String getServerName() {
return server.getServerName();
}
public static String getServerId() {
return server.getServerId();
}
public static String getWorldType() {
return server.getWorldType();
}
public static boolean getGenerateStructures() {
return server.getGenerateStructures();
}
public static boolean getAllowNether() {
return server.getAllowNether();
}
public static boolean hasWhitelist() {
return server.hasWhitelist();
}
public static int broadcastMessage(String message) {
return server.broadcastMessage(message);
}
public static String getUpdateFolder() {
return server.getUpdateFolder();
}
public static Player getPlayer(String name) {
return server.getPlayer(name);
}
public static List<Player> matchPlayer(String name) {
return server.matchPlayer(name);
}
public static PluginManager getPluginManager() {
return server.getPluginManager();
}
public static BukkitScheduler getScheduler() {
return server.getScheduler();
}
public static ServicesManager getServicesManager() {
return server.getServicesManager();
}
public static List<World> getWorlds() {
return server.getWorlds();
}
public static World createWorld(WorldCreator options) {
return server.createWorld(options);
}
public static boolean unloadWorld(String name, boolean save) {
return server.unloadWorld(name, save);
}
public static boolean unloadWorld(World world, boolean save) {
return server.unloadWorld(world, save);
}
public static World getWorld(String name) {
return server.getWorld(name);
}
public static World getWorld(UUID uid) {
return server.getWorld(uid);
}
public static MapView getMap(short id) {
return server.getMap(id);
}
public static MapView createMap(World world) {
return server.createMap(world);
}
public static void reload() {
server.reload();
}
public static Logger getLogger() {
return server.getLogger();
}
public static PluginCommand getPluginCommand(String name) {
return server.getPluginCommand(name);
}
public static void savePlayers() {
server.savePlayers();
}
public static boolean dispatchCommand(CommandSender sender, String commandLine) {
return server.dispatchCommand(sender, commandLine);
}
public static void configureDbConfig(ServerConfig config) {
server.configureDbConfig(config);
}
public static boolean addRecipe(Recipe recipe) {
return server.addRecipe(recipe);
}
public static List<Recipe> getRecipesFor(ItemStack result) {
return server.getRecipesFor(result);
}
public static Iterator<Recipe> recipeIterator() {
return server.recipeIterator();
}
public static void clearRecipes() {
server.clearRecipes();
}
public static void resetRecipes() {
server.resetRecipes();
}
public static Map<String, String[]> getCommandAliases() {
return server.getCommandAliases();
}
public static int getSpawnRadius() {
return server.getSpawnRadius();
}
public static void setSpawnRadius(int value) {
server.setSpawnRadius(value);
}
public static boolean getOnlineMode() {
return server.getOnlineMode();
}
public static boolean getAllowFlight() {
return server.getAllowFlight();
}
public static void shutdown() {
server.shutdown();
}
public static int broadcast(String message, String permission) {
return server.broadcast(message, permission);
}
public static OfflinePlayer getOfflinePlayer(String name) {
return server.getOfflinePlayer(name);
}
public static Player getPlayerExact(String name) {
return server.getPlayerExact(name);
}
public static Set<String> getIPBans() {
return server.getIPBans();
}
public static void banIP(String address) {
server.banIP(address);
}
public static void unbanIP(String address) {
server.unbanIP(address);
}
public static Set<OfflinePlayer> getBannedPlayers() {
return server.getBannedPlayers();
}
public static void setWhitelist(boolean value) {
server.setWhitelist(value);
}
public static Set<OfflinePlayer> getWhitelistedPlayers() {
return server.getWhitelistedPlayers();
}
public static void reloadWhitelist() {
server.reloadWhitelist();
}
public static ConsoleCommandSender getConsoleSender() {
return server.getConsoleSender();
}
public static Set<OfflinePlayer> getOperators() {
return server.getOperators();
}
public static File getWorldContainer() {
return server.getWorldContainer();
}
public static Messenger getMessenger() {
return server.getMessenger();
}
public static boolean getAllowEnd() {
return server.getAllowEnd();
}
public static File getUpdateFolderFile() {
return server.getUpdateFolderFile();
}
public static long getConnectionThrottle() {
return server.getConnectionThrottle();
}
public static int getTicksPerAnimalSpawns() {
return server.getTicksPerAnimalSpawns();
}
public static int getTicksPerMonsterSpawns() {
return server.getTicksPerMonsterSpawns();
}
public static boolean useExactLoginLocation() {
return server.useExactLoginLocation();
}
public static GameMode getDefaultGameMode() {
return server.getDefaultGameMode();
}
public static void setDefaultGameMode(GameMode mode) {
server.setDefaultGameMode(mode);
}
public static OfflinePlayer[] getOfflinePlayers() {
return server.getOfflinePlayers();
}
public static Inventory createInventory(InventoryHolder owner, InventoryType type) {
return server.createInventory(owner, type);
}
public static Inventory createInventory(InventoryHolder owner, int size) {
return server.createInventory(owner, size);
}
public static Inventory createInventory(InventoryHolder owner, int size, String title) {
return server.createInventory(owner, size, title);
}
public static HelpMap getHelpMap() {
return server.getHelpMap();
}
public static int getMonsterSpawnLimit() {
return server.getMonsterSpawnLimit();
}
public static int getAnimalSpawnLimit() {
return server.getAnimalSpawnLimit();
}
public static int getWaterAnimalSpawnLimit() {
return server.getWaterAnimalSpawnLimit();
}
public static boolean isPrimaryThread() {
return server.isPrimaryThread();
}
public static String getMotd() {
return server.getMotd();
}
}
|