2011-03-30 14:54:37 +01:00
|
|
|
package org.bukkit;
|
|
|
|
|
2013-11-13 17:53:49 -07:00
|
|
|
import java.awt.image.BufferedImage;
|
2011-11-25 03:46:47 +00:00
|
|
|
import java.io.File;
|
2014-11-30 21:09:01 +00:00
|
|
|
import java.io.Serializable;
|
2014-06-24 09:35:27 -05:00
|
|
|
import java.util.Collection;
|
2014-11-30 21:09:01 +00:00
|
|
|
import java.util.Collections;
|
2011-07-23 23:18:58 -04:00
|
|
|
import java.util.Iterator;
|
2011-08-18 12:55:25 +01:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2011-09-03 01:59:08 +01:00
|
|
|
import java.util.Set;
|
2011-08-18 12:55:25 +01:00
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.logging.Logger;
|
2012-01-30 21:32:48 +01:00
|
|
|
|
2012-08-07 00:16:57 -05:00
|
|
|
import org.bukkit.Warning.WarningState;
|
2014-06-03 15:39:01 -05:00
|
|
|
import org.bukkit.command.CommandException;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-09-24 23:11:01 +01:00
|
|
|
import org.bukkit.command.ConsoleCommandSender;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.command.PluginCommand;
|
2014-11-30 21:09:01 +00:00
|
|
|
import org.bukkit.entity.Entity;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.entity.Player;
|
2012-02-29 13:32:33 -05:00
|
|
|
import org.bukkit.event.inventory.InventoryType;
|
2014-11-30 21:09:01 +00:00
|
|
|
import org.bukkit.event.server.ServerListPingEvent;
|
2012-03-01 00:07:05 -05:00
|
|
|
import org.bukkit.help.HelpMap;
|
2012-02-29 13:32:33 -05:00
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
import org.bukkit.inventory.InventoryHolder;
|
2014-11-30 21:09:01 +00:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.inventory.Recipe;
|
|
|
|
import org.bukkit.map.MapView;
|
2014-11-30 21:09:01 +00:00
|
|
|
import org.bukkit.permissions.Permissible;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
import org.bukkit.plugin.ServicesManager;
|
2012-01-13 08:51:10 +00:00
|
|
|
import org.bukkit.plugin.messaging.Messenger;
|
2011-08-18 12:55:25 +01:00
|
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
2013-03-20 14:14:42 -04:00
|
|
|
import org.bukkit.scoreboard.ScoreboardManager;
|
2013-11-13 17:53:49 -07:00
|
|
|
import org.bukkit.util.CachedServerIcon;
|
2011-08-18 12:55:25 +01:00
|
|
|
|
2012-01-30 21:32:48 +01:00
|
|
|
import com.avaje.ebean.config.ServerConfig;
|
2014-11-30 21:09:01 +00:00
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
|
|
|
|
|
import org.bukkit.inventory.ItemFactory;
|
|
|
|
import org.bukkit.inventory.meta.ItemMeta;
|
2012-01-30 21:32:48 +01:00
|
|
|
|
2011-03-30 14:54:37 +01:00
|
|
|
/**
|
|
|
|
* Represents the Bukkit core, for version and Server singleton handling
|
|
|
|
*/
|
|
|
|
public final class Bukkit {
|
|
|
|
private static Server server;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Static class cannot be initialized.
|
|
|
|
*/
|
2011-05-14 23:22:54 +02:00
|
|
|
private Bukkit() {}
|
2011-03-30 14:54:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current {@link Server} singleton
|
|
|
|
*
|
|
|
|
* @return Server instance being ran
|
|
|
|
*/
|
|
|
|
public static Server getServer() {
|
|
|
|
return server;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts to set the {@link Server} singleton.
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2011-03-30 14:54:37 +01:00
|
|
|
* This cannot be done if the Server is already set.
|
|
|
|
*
|
|
|
|
* @param server Server instance
|
|
|
|
*/
|
|
|
|
public static void setServer(Server server) {
|
|
|
|
if (Bukkit.server != null) {
|
2011-04-01 16:04:43 +01:00
|
|
|
throw new UnsupportedOperationException("Cannot redefine singleton Server");
|
2011-03-30 14:54:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Bukkit.server = server;
|
2011-10-31 04:01:56 +00:00
|
|
|
server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")");
|
2011-03-30 14:54:37 +01:00
|
|
|
}
|
2011-08-18 12:55:25 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the name of this server implementation.
|
|
|
|
*
|
|
|
|
* @return name of this server implementation
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getName() {
|
|
|
|
return server.getName();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the version string of this server implementation.
|
|
|
|
*
|
|
|
|
* @return version of this server implementation
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getVersion() {
|
|
|
|
return server.getVersion();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the Bukkit version that this server is running.
|
|
|
|
*
|
|
|
|
* @return version of Bukkit
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-10-31 04:01:56 +00:00
|
|
|
public static String getBukkitVersion() {
|
|
|
|
return server.getBukkitVersion();
|
|
|
|
}
|
|
|
|
|
2014-06-24 09:35:27 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets an array copy of all currently logged in players.
|
|
|
|
* <p>
|
2014-06-24 09:35:27 -05:00
|
|
|
* This method exists for legacy reasons to provide backwards
|
|
|
|
* compatibility. It will not exist at runtime and should not be used
|
|
|
|
* under any circumstances.
|
|
|
|
*
|
2014-11-30 21:09:01 +00:00
|
|
|
* @deprecated superseded by {@link #getOnlinePlayers()}
|
|
|
|
* @return an array of Players that are currently online
|
2014-06-24 09:35:27 -05:00
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static Player[] _INVALID_getOnlinePlayers() {
|
|
|
|
return server._INVALID_getOnlinePlayers();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a view of all currently logged in players. This {@linkplain
|
|
|
|
* Collections#unmodifiableCollection(Collection) view} is a reused
|
|
|
|
* object, making some operations like {@link Collection#size()}
|
|
|
|
* zero-allocation.
|
|
|
|
* <p>
|
|
|
|
* The collection is a view backed by the internal representation, such
|
|
|
|
* that, changes to the internal state of the server will be reflected
|
|
|
|
* immediately. However, the reuse of the returned collection (identity)
|
|
|
|
* is not strictly guaranteed for future or all implementations. Casting
|
|
|
|
* the collection, or relying on interface implementations (like {@link
|
|
|
|
* Serializable} or {@link List}), is deprecated.
|
|
|
|
* <p>
|
|
|
|
* Iteration behavior is undefined outside of self-contained main-thread
|
|
|
|
* uses. Normal and immediate iterator use without consequences that
|
|
|
|
* affect the collection are fully supported. The effects following
|
|
|
|
* (non-exhaustive) {@link Entity#teleport(Location) teleportation},
|
|
|
|
* {@link Player#setHealth(double) death}, and {@link Player#kickPlayer(
|
|
|
|
* String) kicking} are undefined. Any use of this collection from
|
|
|
|
* asynchronous threads is unsafe.
|
|
|
|
* <p>
|
|
|
|
* For safe consequential iteration or mimicking the old array behavior,
|
|
|
|
* using {@link Collection#toArray(Object[])} is recommended. For making
|
|
|
|
* snapshots, {@link ImmutableList#copyOf(Collection)} is recommended.
|
|
|
|
*
|
|
|
|
* @return a view of currently online players.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-06-24 09:35:27 -05:00
|
|
|
public static Collection<? extends Player> getOnlinePlayers() {
|
2011-08-18 12:55:25 +01:00
|
|
|
return server.getOnlinePlayers();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get the maximum amount of players which can login to this server.
|
|
|
|
*
|
|
|
|
* @return the amount of players this server allows
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static int getMaxPlayers() {
|
|
|
|
return server.getMaxPlayers();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get the game port that the server runs on.
|
|
|
|
*
|
|
|
|
* @return the port number of this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static int getPort() {
|
|
|
|
return server.getPort();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get the view distance from this server.
|
|
|
|
*
|
|
|
|
* @return the view distance from this server.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static int getViewDistance() {
|
|
|
|
return server.getViewDistance();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get the IP that this server is bound to, or empty string if not
|
|
|
|
* specified.
|
|
|
|
*
|
|
|
|
* @return the IP string that this server is bound to, otherwise empty
|
|
|
|
* string
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getIp() {
|
|
|
|
return server.getIp();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get the name of this server.
|
|
|
|
*
|
|
|
|
* @return the name of this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getServerName() {
|
|
|
|
return server.getServerName();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get an ID of this server. The ID is a simple generally alphanumeric ID
|
|
|
|
* that can be used for uniquely identifying this server.
|
|
|
|
*
|
|
|
|
* @return the ID of this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getServerId() {
|
|
|
|
return server.getServerId();
|
|
|
|
}
|
2014-11-30 21:09:01 +00:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get world type (level-type setting) for default world.
|
|
|
|
*
|
|
|
|
* @return the value of level-type (e.g. DEFAULT, FLAT, DEFAULT_1_1)
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-03-10 01:27:38 -06:00
|
|
|
public static String getWorldType() {
|
|
|
|
return server.getWorldType();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get generate-structures setting.
|
|
|
|
*
|
|
|
|
* @return true if structure generation is enabled, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-03-10 01:27:38 -06:00
|
|
|
public static boolean getGenerateStructures() {
|
|
|
|
return server.getGenerateStructures();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether this server allows the End or not.
|
|
|
|
*
|
|
|
|
* @return whether this server allows the End or not
|
|
|
|
*/
|
|
|
|
public static boolean getAllowEnd() {
|
|
|
|
return server.getAllowEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets whether this server allows the Nether or not.
|
|
|
|
*
|
|
|
|
* @return whether this server allows the Nether or not
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean getAllowNether() {
|
|
|
|
return server.getAllowNether();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether this server has a whitelist or not.
|
|
|
|
*
|
|
|
|
* @return whether this server has a whitelist or not
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean hasWhitelist() {
|
|
|
|
return server.hasWhitelist();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Sets if the server is whitelisted.
|
|
|
|
*
|
|
|
|
* @param value true for whitelist on, false for off
|
|
|
|
*/
|
|
|
|
public static void setWhitelist(boolean value) {
|
|
|
|
server.setWhitelist(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a list of whitelisted players.
|
|
|
|
*
|
|
|
|
* @return a set containing all whitelisted players
|
|
|
|
*/
|
|
|
|
public static Set<OfflinePlayer> getWhitelistedPlayers() {
|
|
|
|
return server.getWhitelistedPlayers();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reloads the whitelist from disk.
|
|
|
|
*/
|
|
|
|
public static void reloadWhitelist() {
|
|
|
|
server.reloadWhitelist();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcast a message to all players.
|
|
|
|
* <p>
|
|
|
|
* This is the same as calling {@link #broadcast(java.lang.String,
|
|
|
|
* java.lang.String)} to {@link Server#BROADCAST_CHANNEL_USERS}
|
|
|
|
*
|
|
|
|
* @param message the message
|
|
|
|
* @return the number of players
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static int broadcastMessage(String message) {
|
|
|
|
return server.broadcastMessage(message);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the name of the update folder. The update folder is used to safely
|
|
|
|
* update plugins at the right moment on a plugin load.
|
|
|
|
* <p>
|
|
|
|
* The update folder name is relative to the plugins folder.
|
|
|
|
*
|
|
|
|
* @return the name of the update folder
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static String getUpdateFolder() {
|
|
|
|
return server.getUpdateFolder();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the update folder. The update folder is used to safely update
|
|
|
|
* plugins at the right moment on a plugin load.
|
|
|
|
*
|
|
|
|
* @return the update folder
|
|
|
|
*/
|
|
|
|
public static File getUpdateFolderFile() {
|
|
|
|
return server.getUpdateFolderFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the value of the connection throttle setting.
|
|
|
|
*
|
|
|
|
* @return the value of the connection throttle setting
|
|
|
|
*/
|
|
|
|
public static long getConnectionThrottle() {
|
|
|
|
return server.getConnectionThrottle();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets default ticks per animal spawns value.
|
|
|
|
* <p>
|
|
|
|
* <b>Example Usage:</b>
|
|
|
|
* <ul>
|
|
|
|
* <li>A value of 1 will mean the server will attempt to spawn monsters
|
|
|
|
* every tick.
|
|
|
|
* <li>A value of 400 will mean the server will attempt to spawn monsters
|
|
|
|
* every 400th tick.
|
|
|
|
* <li>A value below 0 will be reset back to Minecraft's default.
|
|
|
|
* </ul>
|
|
|
|
* <p>
|
|
|
|
* <b>Note:</b> If set to 0, animal spawning will be disabled. We
|
|
|
|
* recommend using spawn-animals to control this instead.
|
|
|
|
* <p>
|
|
|
|
* Minecraft default: 400.
|
|
|
|
*
|
|
|
|
* @return the default ticks per animal spawns value
|
|
|
|
*/
|
|
|
|
public static int getTicksPerAnimalSpawns() {
|
|
|
|
return server.getTicksPerAnimalSpawns();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the default ticks per monster spawns value.
|
|
|
|
* <p>
|
|
|
|
* <b>Example Usage:</b>
|
|
|
|
* <ul>
|
|
|
|
* <li>A value of 1 will mean the server will attempt to spawn monsters
|
|
|
|
* every tick.
|
|
|
|
* <li>A value of 400 will mean the server will attempt to spawn monsters
|
|
|
|
* every 400th tick.
|
|
|
|
* <li>A value below 0 will be reset back to Minecraft's default.
|
|
|
|
* </ul>
|
|
|
|
* <p>
|
|
|
|
* <b>Note:</b> If set to 0, monsters spawning will be disabled. We
|
|
|
|
* recommend using spawn-monsters to control this instead.
|
|
|
|
* <p>
|
|
|
|
* Minecraft default: 1.
|
|
|
|
*
|
|
|
|
* @return the default ticks per monsters spawn value
|
|
|
|
*/
|
|
|
|
public static int getTicksPerMonsterSpawns() {
|
|
|
|
return server.getTicksPerMonsterSpawns();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a player object by the given username.
|
|
|
|
* <p>
|
|
|
|
* This method may not return objects for offline players.
|
|
|
|
*
|
|
|
|
* @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
|
|
|
* guaranteed to be unique
|
|
|
|
* @param name the name to look up
|
|
|
|
* @return a player if one was found, null otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-03-28 21:12:42 -05:00
|
|
|
@Deprecated
|
2011-08-18 12:55:25 +01:00
|
|
|
public static Player getPlayer(String name) {
|
|
|
|
return server.getPlayer(name);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the player with the exact given name, case insensitive.
|
|
|
|
*
|
|
|
|
* @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
|
|
|
* guaranteed to be unique
|
|
|
|
* @param name Exact name of the player to retrieve
|
|
|
|
* @return a player object if one was found, null otherwise
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static Player getPlayerExact(String name) {
|
|
|
|
return server.getPlayerExact(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts to match any players with the given name, and returns a list
|
|
|
|
* of all possibly matches.
|
|
|
|
* <p>
|
|
|
|
* This list is not sorted in any particular order. If an exact match is
|
|
|
|
* found, the returned list will only contain a single result.
|
|
|
|
*
|
|
|
|
* @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
|
|
|
* guaranteed to be unique
|
|
|
|
* @param name the (partial) name to match
|
|
|
|
* @return list of all possible players
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-03-28 21:12:42 -05:00
|
|
|
@Deprecated
|
2011-08-18 12:55:25 +01:00
|
|
|
public static List<Player> matchPlayer(String name) {
|
|
|
|
return server.matchPlayer(name);
|
|
|
|
}
|
|
|
|
|
2014-03-28 21:12:42 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the player with the given UUID.
|
|
|
|
*
|
|
|
|
* @param id UUID of the player to retrieve
|
|
|
|
* @return a player object if one was found, null otherwise
|
2014-03-28 21:12:42 -05:00
|
|
|
*/
|
|
|
|
public static Player getPlayer(UUID id) {
|
|
|
|
return server.getPlayer(id);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the plugin manager for interfacing with plugins.
|
|
|
|
*
|
|
|
|
* @return a plugin manager for this Server instance
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static PluginManager getPluginManager() {
|
|
|
|
return server.getPluginManager();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the scheduler for managing scheduled events.
|
|
|
|
*
|
|
|
|
* @return a scheduling service for this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static BukkitScheduler getScheduler() {
|
|
|
|
return server.getScheduler();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a services manager.
|
|
|
|
*
|
|
|
|
* @return s services manager
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static ServicesManager getServicesManager() {
|
|
|
|
return server.getServicesManager();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a list of all worlds on this server.
|
|
|
|
*
|
|
|
|
* @return a list of worlds
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static List<World> getWorlds() {
|
|
|
|
return server.getWorlds();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates or loads a world with the given name using the specified
|
|
|
|
* options.
|
|
|
|
* <p>
|
|
|
|
* If the world is already loaded, it will just return the equivalent of
|
|
|
|
* getWorld(creator.name()).
|
|
|
|
*
|
|
|
|
* @param creator the options to use when creating the world
|
|
|
|
* @return newly created or loaded world
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static World createWorld(WorldCreator creator) {
|
|
|
|
return server.createWorld(creator);
|
2011-09-25 01:04:43 +01:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Unloads a world with the given name.
|
|
|
|
*
|
|
|
|
* @param name Name of the world to unload
|
|
|
|
* @param save whether to save the chunks before unloading
|
|
|
|
* @return true if successful, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean unloadWorld(String name, boolean save) {
|
|
|
|
return server.unloadWorld(name, save);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Unloads the given world.
|
|
|
|
*
|
|
|
|
* @param world the world to unload
|
|
|
|
* @param save whether to save the chunks before unloading
|
|
|
|
* @return true if successful, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean unloadWorld(World world, boolean save) {
|
|
|
|
return server.unloadWorld(world, save);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the world with the given name.
|
|
|
|
*
|
|
|
|
* @param name the name of the world to retrieve
|
|
|
|
* @return a world with the given name, or null if none exists
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static World getWorld(String name) {
|
|
|
|
return server.getWorld(name);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the world from the given Unique ID.
|
|
|
|
*
|
|
|
|
* @param uid a unique-id of the world to retrieve
|
|
|
|
* @return a world with the given Unique ID, or null if none exists
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static World getWorld(UUID uid) {
|
|
|
|
return server.getWorld(uid);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the map from the given item ID.
|
|
|
|
*
|
|
|
|
* @param id the id of the map to get
|
|
|
|
* @return a map view if it exists, or null otherwise
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-08-18 12:55:25 +01:00
|
|
|
public static MapView getMap(short id) {
|
|
|
|
return server.getMap(id);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Create a new map with an automatically assigned ID.
|
|
|
|
*
|
|
|
|
* @param world the world the map will belong to
|
|
|
|
* @return a newly created map view
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static MapView createMap(World world) {
|
|
|
|
return server.createMap(world);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Reloads the server, refreshing settings and plugin information.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static void reload() {
|
|
|
|
server.reload();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Returns the primary logger associated with this server instance.
|
|
|
|
*
|
|
|
|
* @return Logger associated with this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static Logger getLogger() {
|
|
|
|
return server.getLogger();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a {@link PluginCommand} with the given name or alias.
|
|
|
|
*
|
|
|
|
* @param name the name of the command to retrieve
|
|
|
|
* @return a plugin command if found, null otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static PluginCommand getPluginCommand(String name) {
|
|
|
|
return server.getPluginCommand(name);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Writes loaded players to disk.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static void savePlayers() {
|
|
|
|
server.savePlayers();
|
|
|
|
}
|
2014-11-30 21:09:01 +00:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Dispatches a command on this server, and executes it if found.
|
|
|
|
*
|
|
|
|
* @param sender the apparent sender of the command
|
|
|
|
* @param commandLine the command + arguments. Example: <code>test abc
|
|
|
|
* 123</code>
|
|
|
|
* @return returns false if no target is found
|
|
|
|
* @throws CommandException thrown when the executor for the given command
|
|
|
|
* fails with an unhandled exception
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-06-03 15:39:01 -05:00
|
|
|
public static boolean dispatchCommand(CommandSender sender, String commandLine) throws CommandException {
|
2011-08-18 12:55:25 +01:00
|
|
|
return server.dispatchCommand(sender, commandLine);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Populates a given {@link ServerConfig} with values attributes to this
|
|
|
|
* server.
|
|
|
|
*
|
|
|
|
* @param config the server config to populate
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static void configureDbConfig(ServerConfig config) {
|
|
|
|
server.configureDbConfig(config);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Adds a recipe to the crafting manager.
|
|
|
|
*
|
|
|
|
* @param recipe the recipe to add
|
|
|
|
* @return true if the recipe was added, false if it wasn't for some
|
|
|
|
* reason
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean addRecipe(Recipe recipe) {
|
|
|
|
return server.addRecipe(recipe);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get a list of all recipes for a given item. The stack size is ignored
|
|
|
|
* in comparisons. If the durability is -1, it will match any data value.
|
|
|
|
*
|
|
|
|
* @param result the item to match against recipe results
|
|
|
|
* @return a list of recipes with the given result
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-02-25 12:39:10 -05:00
|
|
|
public static List<Recipe> getRecipesFor(ItemStack result) {
|
2011-07-23 23:18:58 -04:00
|
|
|
return server.getRecipesFor(result);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Get an iterator through the list of crafting recipes.
|
|
|
|
*
|
|
|
|
* @return an iterator
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-02-25 12:39:10 -05:00
|
|
|
public static Iterator<Recipe> recipeIterator() {
|
2011-07-23 23:18:58 -04:00
|
|
|
return server.recipeIterator();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Clears the list of crafting recipes.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-02-25 12:39:10 -05:00
|
|
|
public static void clearRecipes() {
|
2011-07-23 23:18:58 -04:00
|
|
|
server.clearRecipes();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Resets the list of crafting recipes to the default.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-02-25 12:39:10 -05:00
|
|
|
public static void resetRecipes() {
|
2011-07-23 23:18:58 -04:00
|
|
|
server.resetRecipes();
|
|
|
|
}
|
2014-11-30 21:09:01 +00:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a list of command aliases defined in the server properties.
|
|
|
|
*
|
|
|
|
* @return a map of aliases to command names
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static Map<String, String[]> getCommandAliases() {
|
|
|
|
return server.getCommandAliases();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the radius, in blocks, around each worlds spawn point to protect.
|
|
|
|
*
|
|
|
|
* @return spawn radius, or 0 if none
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static int getSpawnRadius() {
|
|
|
|
return server.getSpawnRadius();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Sets the radius, in blocks, around each worlds spawn point to protect.
|
|
|
|
*
|
|
|
|
* @param value new spawn radius, or 0 if none
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static void setSpawnRadius(int value) {
|
|
|
|
server.setSpawnRadius(value);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether the Server is in online mode or not.
|
|
|
|
*
|
|
|
|
* @return true if the server authenticates clients, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean getOnlineMode() {
|
|
|
|
return server.getOnlineMode();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether this server allows flying or not.
|
|
|
|
*
|
|
|
|
* @return true if the server allows flight, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-08-18 12:55:25 +01:00
|
|
|
public static boolean getAllowFlight() {
|
|
|
|
return server.getAllowFlight();
|
|
|
|
}
|
2011-09-02 20:18:10 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether the server is in hardcore mode or not.
|
|
|
|
*
|
|
|
|
* @return true if the server mode is hardcore, false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-10-29 01:45:08 -04:00
|
|
|
public static boolean isHardcore() {
|
|
|
|
return server.isHardcore();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets whether to use vanilla (false) or exact behaviour (true).
|
|
|
|
*
|
|
|
|
* <ul>
|
|
|
|
* <li>Vanilla behaviour: check for collisions and move the player if
|
|
|
|
* needed.
|
|
|
|
* <li>Exact behaviour: spawn players exactly where they should be.
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* @return true if exact location locations are used for spawning, false
|
|
|
|
* for vanilla collision detection or otherwise
|
2015-05-31 12:07:39 +10:00
|
|
|
*
|
|
|
|
* @deprecated non standard and unused feature.
|
2014-11-30 21:09:01 +00:00
|
|
|
*/
|
2015-05-31 12:07:39 +10:00
|
|
|
@Deprecated
|
2014-11-30 21:09:01 +00:00
|
|
|
public static boolean useExactLoginLocation() {
|
|
|
|
return server.useExactLoginLocation();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shutdowns the server, stopping everything.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-02 20:18:10 +01:00
|
|
|
public static void shutdown() {
|
|
|
|
server.shutdown();
|
|
|
|
}
|
2011-09-02 22:21:26 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Broadcasts the specified message to every user with the given
|
|
|
|
* permission name.
|
|
|
|
*
|
|
|
|
* @param message message to broadcast
|
|
|
|
* @param permission the required permission {@link Permissible
|
|
|
|
* permissibles} must have to receive the broadcast
|
|
|
|
* @return number of message recipients
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-03 00:41:22 +01:00
|
|
|
public static int broadcast(String message, String permission) {
|
2011-09-02 22:21:26 +01:00
|
|
|
return server.broadcast(message, permission);
|
|
|
|
}
|
2011-09-03 00:41:22 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the player by the given name, regardless if they are offline or
|
|
|
|
* online.
|
|
|
|
* <p>
|
|
|
|
* This method may involve a blocking web request to get the UUID for the
|
|
|
|
* given name.
|
|
|
|
* <p>
|
|
|
|
* This will return an object even if the player does not exist. To this
|
|
|
|
* method, all players will exist.
|
|
|
|
*
|
|
|
|
* @deprecated Persistent storage of users should be by UUID as names are no longer
|
|
|
|
* unique past a single session.
|
|
|
|
* @param name the name the player to retrieve
|
|
|
|
* @return an offline player
|
|
|
|
* @see #getOfflinePlayer(java.util.UUID)
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-03-28 21:12:42 -05:00
|
|
|
@Deprecated
|
2011-09-03 00:41:22 +01:00
|
|
|
public static OfflinePlayer getOfflinePlayer(String name) {
|
|
|
|
return server.getOfflinePlayer(name);
|
|
|
|
}
|
2011-09-03 01:59:08 +01:00
|
|
|
|
2014-03-28 21:12:42 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the player by the given UUID, regardless if they are offline or
|
|
|
|
* online.
|
|
|
|
* <p>
|
|
|
|
* This will return an object even if the player does not exist. To this
|
|
|
|
* method, all players will exist.
|
|
|
|
*
|
|
|
|
* @param id the UUID of the player to retrieve
|
|
|
|
* @return an offline player
|
2014-03-28 21:12:42 -05:00
|
|
|
*/
|
|
|
|
public static OfflinePlayer getOfflinePlayer(UUID id) {
|
|
|
|
return server.getOfflinePlayer(id);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a set containing all current IPs that are banned.
|
|
|
|
*
|
|
|
|
* @return a set containing banned IP addresses
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-03 01:59:08 +01:00
|
|
|
public static Set<String> getIPBans() {
|
|
|
|
return server.getIPBans();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Bans the specified address from the server.
|
|
|
|
*
|
|
|
|
* @param address the IP address to ban
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-03 01:59:08 +01:00
|
|
|
public static void banIP(String address) {
|
|
|
|
server.banIP(address);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Unbans the specified address from the server.
|
|
|
|
*
|
|
|
|
* @param address the IP address to unban
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-03 01:59:08 +01:00
|
|
|
public static void unbanIP(String address) {
|
|
|
|
server.unbanIP(address);
|
|
|
|
}
|
2011-12-25 16:02:30 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a set containing all banned players.
|
|
|
|
*
|
|
|
|
* @return a set containing banned players
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-03 02:21:08 +01:00
|
|
|
public static Set<OfflinePlayer> getBannedPlayers() {
|
2011-09-03 02:13:37 +01:00
|
|
|
return server.getBannedPlayers();
|
|
|
|
}
|
2011-09-03 04:37:23 +01:00
|
|
|
|
2014-02-03 22:16:14 -07:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a ban list for the supplied type.
|
|
|
|
* <p>
|
|
|
|
* Bans by name are no longer supported and this method will return
|
|
|
|
* null when trying to request them. The replacement is bans by UUID.
|
|
|
|
*
|
|
|
|
* @param type the type of list to fetch, cannot be null
|
|
|
|
* @return a ban list of the specified type
|
2014-02-03 22:16:14 -07:00
|
|
|
*/
|
|
|
|
public static BanList getBanList(BanList.Type type){
|
2014-03-24 13:20:52 -05:00
|
|
|
return server.getBanList(type);
|
2014-02-03 22:16:14 -07:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a set containing all player operators.
|
|
|
|
*
|
|
|
|
* @return a set containing player operators
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static Set<OfflinePlayer> getOperators() {
|
|
|
|
return server.getOperators();
|
2011-09-03 04:37:23 +01:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the default {@link GameMode} for new players.
|
|
|
|
*
|
|
|
|
* @return the default game mode
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static GameMode getDefaultGameMode() {
|
|
|
|
return server.getDefaultGameMode();
|
2011-09-03 04:37:23 +01:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Sets the default {@link GameMode} for new players.
|
|
|
|
*
|
|
|
|
* @param mode the new game mode
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static void setDefaultGameMode(GameMode mode) {
|
|
|
|
server.setDefaultGameMode(mode);
|
2011-09-03 04:37:23 +01:00
|
|
|
}
|
2011-09-24 23:11:01 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets a {@link ConsoleCommandSender} that may be used as an input source
|
|
|
|
* for this server.
|
|
|
|
*
|
|
|
|
* @return a console command sender
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-09-24 23:11:01 +01:00
|
|
|
public static ConsoleCommandSender getConsoleSender() {
|
|
|
|
return server.getConsoleSender();
|
|
|
|
}
|
2011-09-25 03:27:44 +01:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the folder that contains all of the various {@link World}s.
|
|
|
|
*
|
|
|
|
* @return folder that contains all worlds
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2011-11-25 03:46:47 +00:00
|
|
|
public static File getWorldContainer() {
|
|
|
|
return server.getWorldContainer();
|
|
|
|
}
|
2012-01-13 08:51:10 +00:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets every player that has ever played on this server.
|
|
|
|
*
|
|
|
|
* @return an array containing all previous players
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static OfflinePlayer[] getOfflinePlayers() {
|
|
|
|
return server.getOfflinePlayers();
|
2012-02-25 12:39:10 -05:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the {@link Messenger} responsible for this server.
|
|
|
|
*
|
|
|
|
* @return messenger responsible for this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static Messenger getMessenger() {
|
|
|
|
return server.getMessenger();
|
2012-02-25 12:39:10 -05:00
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the {@link HelpMap} providing help topics for this server.
|
|
|
|
*
|
|
|
|
* @return a help map for this server
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-11-30 21:09:01 +00:00
|
|
|
public static HelpMap getHelpMap() {
|
|
|
|
return server.getHelpMap();
|
2012-02-25 12:39:10 -05:00
|
|
|
}
|
2012-02-29 13:32:33 -05:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates an empty inventory of the specified type. If the type is {@link
|
|
|
|
* InventoryType#CHEST}, the new inventory has a size of 27; otherwise the
|
|
|
|
* new inventory has the normal size for its type.
|
|
|
|
*
|
|
|
|
* @param owner the holder of the inventory, or null to indicate no holder
|
|
|
|
* @param type the type of inventory to create
|
|
|
|
* @return a new inventory
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-02-29 13:32:33 -05:00
|
|
|
public static Inventory createInventory(InventoryHolder owner, InventoryType type) {
|
|
|
|
return server.createInventory(owner, type);
|
|
|
|
}
|
|
|
|
|
2013-04-11 14:13:11 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates an empty inventory with the specified type and title. If the type
|
|
|
|
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
|
|
|
* otherwise the new inventory has the normal size for its type.<br>
|
|
|
|
* It should be noted that some inventory types do not support titles and
|
|
|
|
* may not render with said titles on the Minecraft client.
|
|
|
|
*
|
|
|
|
* @param owner The holder of the inventory; can be null if there's no holder.
|
|
|
|
* @param type The type of inventory to create.
|
|
|
|
* @param title The title of the inventory, to be displayed when it is viewed.
|
|
|
|
* @return The new inventory.
|
2013-04-11 14:13:11 -05:00
|
|
|
*/
|
|
|
|
public static Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
|
|
|
|
return server.createInventory(owner, type, title);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
|
|
|
|
* specified size.
|
|
|
|
*
|
|
|
|
* @param owner the holder of the inventory, or null to indicate no holder
|
|
|
|
* @param size a multiple of 9 as the size of inventory to create
|
|
|
|
* @return a new inventory
|
|
|
|
* @throws IllegalArgumentException if the size is not a multiple of 9
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-06-03 15:39:01 -05:00
|
|
|
public static Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException {
|
2012-02-29 13:32:33 -05:00
|
|
|
return server.createInventory(owner, size);
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
|
|
|
|
* specified size and title.
|
|
|
|
*
|
|
|
|
* @param owner the holder of the inventory, or null to indicate no holder
|
|
|
|
* @param size a multiple of 9 as the size of inventory to create
|
|
|
|
* @param title the title of the inventory, displayed when inventory is
|
|
|
|
* viewed
|
|
|
|
* @return a new inventory
|
|
|
|
* @throws IllegalArgumentException if the size is not a multiple of 9
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2014-06-03 15:39:01 -05:00
|
|
|
public static Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException {
|
2012-02-29 13:32:33 -05:00
|
|
|
return server.createInventory(owner, size, title);
|
|
|
|
}
|
2012-03-01 00:07:05 -05:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets user-specified limit for number of monsters that can spawn in a
|
|
|
|
* chunk.
|
|
|
|
*
|
|
|
|
* @return the monster spawn limit
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-04-23 19:25:11 -05:00
|
|
|
public static int getMonsterSpawnLimit() {
|
|
|
|
return server.getMonsterSpawnLimit();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets user-specified limit for number of animals that can spawn in a
|
|
|
|
* chunk.
|
|
|
|
*
|
|
|
|
* @return the animal spawn limit
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-04-23 19:25:11 -05:00
|
|
|
public static int getAnimalSpawnLimit() {
|
|
|
|
return server.getAnimalSpawnLimit();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets user-specified limit for number of water animals that can spawn in
|
|
|
|
* a chunk.
|
|
|
|
*
|
|
|
|
* @return the water animal spawn limit
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-04-23 19:25:11 -05:00
|
|
|
public static int getWaterAnimalSpawnLimit() {
|
|
|
|
return server.getWaterAnimalSpawnLimit();
|
|
|
|
}
|
2014-11-30 21:09:01 +00:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets user-specified limit for number of ambient mobs that can spawn in
|
|
|
|
* a chunk.
|
|
|
|
*
|
|
|
|
* @return the ambient spawn limit
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-10-31 11:18:06 -05:00
|
|
|
public static int getAmbientSpawnLimit() {
|
|
|
|
return server.getAmbientSpawnLimit();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Checks the current thread against the expected primary thread for the
|
|
|
|
* server.
|
|
|
|
* <p>
|
|
|
|
* <b>Note:</b> this method should not be used to indicate the current
|
|
|
|
* synchronized state of the runtime. A current thread matching the main
|
|
|
|
* thread indicates that it is synchronized, but a mismatch <b>does not
|
|
|
|
* preclude</b> the same assumption.
|
|
|
|
*
|
|
|
|
* @return true if the current thread matches the expected primary thread,
|
|
|
|
* false otherwise
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-06-13 21:28:13 -05:00
|
|
|
public static boolean isPrimaryThread() {
|
|
|
|
return server.isPrimaryThread();
|
|
|
|
}
|
2012-07-03 17:39:12 -05:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the message that is displayed on the server list.
|
|
|
|
*
|
|
|
|
* @return the servers MOTD
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-07-03 17:39:12 -05:00
|
|
|
public static String getMotd() {
|
|
|
|
return server.getMotd();
|
|
|
|
}
|
2012-08-07 00:16:57 -05:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the default message that is displayed when the server is stopped.
|
|
|
|
*
|
|
|
|
* @return the shutdown message
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-12-05 05:55:26 -06:00
|
|
|
public static String getShutdownMessage() {
|
|
|
|
return server.getShutdownMessage();
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the current warning state for the server.
|
|
|
|
*
|
|
|
|
* @return the configured warning state
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-08-07 00:16:57 -05:00
|
|
|
public static WarningState getWarningState() {
|
|
|
|
return server.getWarningState();
|
|
|
|
}
|
2012-12-17 01:16:28 -06:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the instance of the item factory (for {@link ItemMeta}).
|
|
|
|
*
|
|
|
|
* @return the item factory
|
|
|
|
* @see ItemFactory
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2012-12-17 01:16:28 -06:00
|
|
|
public static ItemFactory getItemFactory() {
|
|
|
|
return server.getItemFactory();
|
|
|
|
}
|
2013-03-20 14:14:42 -04:00
|
|
|
|
2013-05-16 04:41:09 -05:00
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the instance of the scoreboard manager.
|
|
|
|
* <p>
|
|
|
|
* This will only exist after the first world has loaded.
|
|
|
|
*
|
|
|
|
* @return the scoreboard manager or null if no worlds are loaded.
|
2013-05-16 04:41:09 -05:00
|
|
|
*/
|
2013-03-20 14:14:42 -04:00
|
|
|
public static ScoreboardManager getScoreboardManager() {
|
|
|
|
return server.getScoreboardManager();
|
|
|
|
}
|
2013-11-13 17:53:49 -07:00
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets an instance of the server's default server-icon.
|
|
|
|
*
|
|
|
|
* @return the default server-icon; null values may be used by the
|
|
|
|
* implementation to indicate no defined icon, but this behavior is
|
|
|
|
* not guaranteed
|
2013-11-13 17:53:49 -07:00
|
|
|
*/
|
|
|
|
public static CachedServerIcon getServerIcon() {
|
|
|
|
return server.getServerIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Loads an image from a file, and returns a cached image for the specific
|
|
|
|
* server-icon.
|
|
|
|
* <p>
|
|
|
|
* Size and type are implementation defined. An incompatible file is
|
|
|
|
* guaranteed to throw an implementation-defined {@link Exception}.
|
|
|
|
*
|
|
|
|
* @param file the file to load the from
|
|
|
|
* @throws IllegalArgumentException if image is null
|
|
|
|
* @throws Exception if the image does not meet current server server-icon
|
|
|
|
* specifications
|
|
|
|
* @return a cached server-icon that can be used for a {@link
|
|
|
|
* ServerListPingEvent#setServerIcon(CachedServerIcon)}
|
2013-11-13 17:53:49 -07:00
|
|
|
*/
|
2014-06-03 15:39:01 -05:00
|
|
|
public static CachedServerIcon loadServerIcon(File file) throws IllegalArgumentException, Exception {
|
2013-11-13 17:53:49 -07:00
|
|
|
return server.loadServerIcon(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Creates a cached server-icon for the specific image.
|
|
|
|
* <p>
|
|
|
|
* Size and type are implementation defined. An incompatible file is
|
|
|
|
* guaranteed to throw an implementation-defined {@link Exception}.
|
|
|
|
*
|
|
|
|
* @param image the image to use
|
|
|
|
* @throws IllegalArgumentException if image is null
|
|
|
|
* @throws Exception if the image does not meet current server
|
|
|
|
* server-icon specifications
|
|
|
|
* @return a cached server-icon that can be used for a {@link
|
|
|
|
* ServerListPingEvent#setServerIcon(CachedServerIcon)}
|
2013-11-13 17:53:49 -07:00
|
|
|
*/
|
2014-06-03 15:39:01 -05:00
|
|
|
public static CachedServerIcon loadServerIcon(BufferedImage image) throws IllegalArgumentException, Exception {
|
2013-11-13 17:53:49 -07:00
|
|
|
return server.loadServerIcon(image);
|
|
|
|
}
|
2014-01-07 01:31:35 -05:00
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Set the idle kick timeout. Any players idle for the specified amount of
|
|
|
|
* time will be automatically kicked.
|
|
|
|
* <p>
|
|
|
|
* A value of 0 will disable the idle kick timeout.
|
|
|
|
*
|
|
|
|
* @param threshold the idle timeout in minutes
|
2014-01-07 01:31:35 -05:00
|
|
|
*/
|
|
|
|
public static void setIdleTimeout(int threshold) {
|
|
|
|
server.setIdleTimeout(threshold);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* Gets the idle kick timeout.
|
|
|
|
*
|
|
|
|
* @return the idle timeout in minutes
|
2014-01-07 01:31:35 -05:00
|
|
|
*/
|
|
|
|
public static int getIdleTimeout() {
|
|
|
|
return server.getIdleTimeout();
|
|
|
|
}
|
2014-01-14 21:32:03 -06:00
|
|
|
|
|
|
|
/**
|
2014-11-30 21:09:01 +00:00
|
|
|
* @see UnsafeValues
|
|
|
|
* @return the unsafe values instance
|
2014-01-14 21:32:03 -06:00
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static UnsafeValues getUnsafe() {
|
|
|
|
return server.getUnsafe();
|
|
|
|
}
|
2011-03-30 14:54:37 +01:00
|
|
|
}
|