13
0
geforkt von Mirrors/Paper

Pulling all pending Bukkit-JavaDoc changes

By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2013-05-16 04:41:09 -05:00
Ursprung a25fb951f6
Commit 1366d7b502
11 geänderte Dateien mit 1063 neuen und 102 gelöschten Zeilen

Datei anzeigen

@ -65,338 +65,590 @@ public final class Bukkit {
server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")"); server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")");
} }
/**
* @see Server#getName()
*/
public static String getName() { public static String getName() {
return server.getName(); return server.getName();
} }
/**
* @see Server#getVersion()
*/
public static String getVersion() { public static String getVersion() {
return server.getVersion(); return server.getVersion();
} }
/**
* @see Server#getBukkitVersion()
*/
public static String getBukkitVersion() { public static String getBukkitVersion() {
return server.getBukkitVersion(); return server.getBukkitVersion();
} }
/**
* @see Server#getOnlinePlayers()
*/
public static Player[] getOnlinePlayers() { public static Player[] getOnlinePlayers() {
return server.getOnlinePlayers(); return server.getOnlinePlayers();
} }
/**
* @see Server#getMaxPlayers()
*/
public static int getMaxPlayers() { public static int getMaxPlayers() {
return server.getMaxPlayers(); return server.getMaxPlayers();
} }
/**
* @see Server#getPort()
*/
public static int getPort() { public static int getPort() {
return server.getPort(); return server.getPort();
} }
/**
* @see Server#getViewDistance()
*/
public static int getViewDistance() { public static int getViewDistance() {
return server.getViewDistance(); return server.getViewDistance();
} }
/**
* @see Server#getIp()
*/
public static String getIp() { public static String getIp() {
return server.getIp(); return server.getIp();
} }
/**
* @see Server#getServerName()
*/
public static String getServerName() { public static String getServerName() {
return server.getServerName(); return server.getServerName();
} }
/**
* @see Server#getServerId()
*/
public static String getServerId() { public static String getServerId() {
return server.getServerId(); return server.getServerId();
} }
/**
* @see Server#getWorldType()
*/
public static String getWorldType() { public static String getWorldType() {
return server.getWorldType(); return server.getWorldType();
} }
/**
* @see Server#getGenerateStructures()
*/
public static boolean getGenerateStructures() { public static boolean getGenerateStructures() {
return server.getGenerateStructures(); return server.getGenerateStructures();
} }
/**
* @see Server#getAllowNether()
*/
public static boolean getAllowNether() { public static boolean getAllowNether() {
return server.getAllowNether(); return server.getAllowNether();
} }
/**
* @see Server#hasWhitelist()
*/
public static boolean hasWhitelist() { public static boolean hasWhitelist() {
return server.hasWhitelist(); return server.hasWhitelist();
} }
/**
* @see Server#broadcastMessage(String message)
*/
public static int broadcastMessage(String message) { public static int broadcastMessage(String message) {
return server.broadcastMessage(message); return server.broadcastMessage(message);
} }
/**
* @see Server#getUpdateFolder()
*/
public static String getUpdateFolder() { public static String getUpdateFolder() {
return server.getUpdateFolder(); return server.getUpdateFolder();
} }
/**
* @see Server#getPlayer(String name)
*/
public static Player getPlayer(String name) { public static Player getPlayer(String name) {
return server.getPlayer(name); return server.getPlayer(name);
} }
/**
* @see Server#matchPlayer(String name)
*/
public static List<Player> matchPlayer(String name) { public static List<Player> matchPlayer(String name) {
return server.matchPlayer(name); return server.matchPlayer(name);
} }
/**
* @see Server#getPluginManager()
*/
public static PluginManager getPluginManager() { public static PluginManager getPluginManager() {
return server.getPluginManager(); return server.getPluginManager();
} }
/**
* @see Server#getScheduler()
*/
public static BukkitScheduler getScheduler() { public static BukkitScheduler getScheduler() {
return server.getScheduler(); return server.getScheduler();
} }
/**
* @see Server#getServicesManager()
*/
public static ServicesManager getServicesManager() { public static ServicesManager getServicesManager() {
return server.getServicesManager(); return server.getServicesManager();
} }
/**
* @see Server#getWorlds()
*/
public static List<World> getWorlds() { public static List<World> getWorlds() {
return server.getWorlds(); return server.getWorlds();
} }
/**
* @see Server#createWorld(WorldCreator options)
*/
public static World createWorld(WorldCreator options) { public static World createWorld(WorldCreator options) {
return server.createWorld(options); return server.createWorld(options);
} }
/**
* @see Server#unloadWorld(String name, boolean save)
*/
public static boolean unloadWorld(String name, boolean save) { public static boolean unloadWorld(String name, boolean save) {
return server.unloadWorld(name, save); return server.unloadWorld(name, save);
} }
/**
* @see Server#unloadWorld(World world, boolean save)
*/
public static boolean unloadWorld(World world, boolean save) { public static boolean unloadWorld(World world, boolean save) {
return server.unloadWorld(world, save); return server.unloadWorld(world, save);
} }
/**
* @see Server#getWorld(String name)
*/
public static World getWorld(String name) { public static World getWorld(String name) {
return server.getWorld(name); return server.getWorld(name);
} }
/**
* @see Server#getWorld(UUID uid)
*/
public static World getWorld(UUID uid) { public static World getWorld(UUID uid) {
return server.getWorld(uid); return server.getWorld(uid);
} }
/**
* @see Server#getMap(short id)
*/
public static MapView getMap(short id) { public static MapView getMap(short id) {
return server.getMap(id); return server.getMap(id);
} }
/**
* @see Server#createMap(World world)
*/
public static MapView createMap(World world) { public static MapView createMap(World world) {
return server.createMap(world); return server.createMap(world);
} }
/**
* @see Server#reload()
*/
public static void reload() { public static void reload() {
server.reload(); server.reload();
} }
/**
* @see Server#getLogger()
*/
public static Logger getLogger() { public static Logger getLogger() {
return server.getLogger(); return server.getLogger();
} }
/**
* @see Server#getPluginCommand(String name)
*/
public static PluginCommand getPluginCommand(String name) { public static PluginCommand getPluginCommand(String name) {
return server.getPluginCommand(name); return server.getPluginCommand(name);
} }
/**
* @see Server#savePlayers()
*/
public static void savePlayers() { public static void savePlayers() {
server.savePlayers(); server.savePlayers();
} }
/**
* @see Server#dispatchCommand(CommandSender sender, String commandLine)
*/
public static boolean dispatchCommand(CommandSender sender, String commandLine) { public static boolean dispatchCommand(CommandSender sender, String commandLine) {
return server.dispatchCommand(sender, commandLine); return server.dispatchCommand(sender, commandLine);
} }
/**
* @see Server#configureDbConfig(ServerConfig config)
*/
public static void configureDbConfig(ServerConfig config) { public static void configureDbConfig(ServerConfig config) {
server.configureDbConfig(config); server.configureDbConfig(config);
} }
/**
* @see Server#addRecipe(Recipe recipe)
*/
public static boolean addRecipe(Recipe recipe) { public static boolean addRecipe(Recipe recipe) {
return server.addRecipe(recipe); return server.addRecipe(recipe);
} }
/**
* @see Server#getRecipesFor(ItemStack result)
*/
public static List<Recipe> getRecipesFor(ItemStack result) { public static List<Recipe> getRecipesFor(ItemStack result) {
return server.getRecipesFor(result); return server.getRecipesFor(result);
} }
/**
* @see Server#recipeIterator()
*/
public static Iterator<Recipe> recipeIterator() { public static Iterator<Recipe> recipeIterator() {
return server.recipeIterator(); return server.recipeIterator();
} }
/**
* @see Server#clearRecipes()
*/
public static void clearRecipes() { public static void clearRecipes() {
server.clearRecipes(); server.clearRecipes();
} }
/**
* @see Server#resetRecipes()
*/
public static void resetRecipes() { public static void resetRecipes() {
server.resetRecipes(); server.resetRecipes();
} }
/**
* @see Server#getCommandAliases()
*/
public static Map<String, String[]> getCommandAliases() { public static Map<String, String[]> getCommandAliases() {
return server.getCommandAliases(); return server.getCommandAliases();
} }
/**
* @see Server#getSpawnRadius()
*/
public static int getSpawnRadius() { public static int getSpawnRadius() {
return server.getSpawnRadius(); return server.getSpawnRadius();
} }
/**
* @see Server#setSpawnRadius(int value)
*/
public static void setSpawnRadius(int value) { public static void setSpawnRadius(int value) {
server.setSpawnRadius(value); server.setSpawnRadius(value);
} }
/**
* @see Server#getOnlineMode()
*/
public static boolean getOnlineMode() { public static boolean getOnlineMode() {
return server.getOnlineMode(); return server.getOnlineMode();
} }
/**
* @see Server#getAllowFlight()
*/
public static boolean getAllowFlight() { public static boolean getAllowFlight() {
return server.getAllowFlight(); return server.getAllowFlight();
} }
/**
* @see Server#isHardcore()
*/
public static boolean isHardcore() { public static boolean isHardcore() {
return server.isHardcore(); return server.isHardcore();
} }
/**
* @see Server#shutdown()
*/
public static void shutdown() { public static void shutdown() {
server.shutdown(); server.shutdown();
} }
/**
* @see Server#broadcast(String message, String permission)
*/
public static int broadcast(String message, String permission) { public static int broadcast(String message, String permission) {
return server.broadcast(message, permission); return server.broadcast(message, permission);
} }
/**
* @see Server#getOfflinePlayer(String name)
*/
public static OfflinePlayer getOfflinePlayer(String name) { public static OfflinePlayer getOfflinePlayer(String name) {
return server.getOfflinePlayer(name); return server.getOfflinePlayer(name);
} }
/**
* @see Server#getPlayerExact(String name)
*/
public static Player getPlayerExact(String name) { public static Player getPlayerExact(String name) {
return server.getPlayerExact(name); return server.getPlayerExact(name);
} }
/**
* @see Server#getIPBans()
*/
public static Set<String> getIPBans() { public static Set<String> getIPBans() {
return server.getIPBans(); return server.getIPBans();
} }
/**
* @see Server#banIP(String address)
*/
public static void banIP(String address) { public static void banIP(String address) {
server.banIP(address); server.banIP(address);
} }
/**
* @see Server#unbanIP(String address)
*/
public static void unbanIP(String address) { public static void unbanIP(String address) {
server.unbanIP(address); server.unbanIP(address);
} }
/**
* @see Server#getBannedPlayers()
*/
public static Set<OfflinePlayer> getBannedPlayers() { public static Set<OfflinePlayer> getBannedPlayers() {
return server.getBannedPlayers(); return server.getBannedPlayers();
} }
/**
* @see Server#setWhitelist(boolean value)
*/
public static void setWhitelist(boolean value) { public static void setWhitelist(boolean value) {
server.setWhitelist(value); server.setWhitelist(value);
} }
/**
* @see Server#getWhitelistedPlayers()
*/
public static Set<OfflinePlayer> getWhitelistedPlayers() { public static Set<OfflinePlayer> getWhitelistedPlayers() {
return server.getWhitelistedPlayers(); return server.getWhitelistedPlayers();
} }
/**
* @see Server#reloadWhitelist()
*/
public static void reloadWhitelist() { public static void reloadWhitelist() {
server.reloadWhitelist(); server.reloadWhitelist();
} }
/**
* @see Server#getConsoleSender()
*/
public static ConsoleCommandSender getConsoleSender() { public static ConsoleCommandSender getConsoleSender() {
return server.getConsoleSender(); return server.getConsoleSender();
} }
/**
* @see Server#getOperators()
*/
public static Set<OfflinePlayer> getOperators() { public static Set<OfflinePlayer> getOperators() {
return server.getOperators(); return server.getOperators();
} }
/**
* @see Server#getWorldContainer()
*/
public static File getWorldContainer() { public static File getWorldContainer() {
return server.getWorldContainer(); return server.getWorldContainer();
} }
/**
* @see Server#getMessenger()
*/
public static Messenger getMessenger() { public static Messenger getMessenger() {
return server.getMessenger(); return server.getMessenger();
} }
/**
* @see Server#getAllowEnd()
*/
public static boolean getAllowEnd() { public static boolean getAllowEnd() {
return server.getAllowEnd(); return server.getAllowEnd();
} }
/**
* @see Server#getUpdateFolderFile()
*/
public static File getUpdateFolderFile() { public static File getUpdateFolderFile() {
return server.getUpdateFolderFile(); return server.getUpdateFolderFile();
} }
/**
* @see Server#getConnectionThrottle()
*/
public static long getConnectionThrottle() { public static long getConnectionThrottle() {
return server.getConnectionThrottle(); return server.getConnectionThrottle();
} }
/**
* @see Server#getTicksPerAnimalSpawns()
*/
public static int getTicksPerAnimalSpawns() { public static int getTicksPerAnimalSpawns() {
return server.getTicksPerAnimalSpawns(); return server.getTicksPerAnimalSpawns();
} }
/**
* @see Server#getTicksPerMonsterSpawns()
*/
public static int getTicksPerMonsterSpawns() { public static int getTicksPerMonsterSpawns() {
return server.getTicksPerMonsterSpawns(); return server.getTicksPerMonsterSpawns();
} }
/**
* @see Server#useExactLoginLocation()
*/
public static boolean useExactLoginLocation() { public static boolean useExactLoginLocation() {
return server.useExactLoginLocation(); return server.useExactLoginLocation();
} }
/**
* @see Server#getDefaultGameMode()
*/
public static GameMode getDefaultGameMode() { public static GameMode getDefaultGameMode() {
return server.getDefaultGameMode(); return server.getDefaultGameMode();
} }
/**
* @see Server#setDefaultGameMode(GameMode mode)
*/
public static void setDefaultGameMode(GameMode mode) { public static void setDefaultGameMode(GameMode mode) {
server.setDefaultGameMode(mode); server.setDefaultGameMode(mode);
} }
/**
* @see Server#getOfflinePlayers()
*/
public static OfflinePlayer[] getOfflinePlayers() { public static OfflinePlayer[] getOfflinePlayers() {
return server.getOfflinePlayers(); return server.getOfflinePlayers();
} }
/**
* @see Server#createInventory(InventoryHolder owner, InventoryType type)
*/
public static Inventory createInventory(InventoryHolder owner, InventoryType type) { public static Inventory createInventory(InventoryHolder owner, InventoryType type) {
return server.createInventory(owner, type); return server.createInventory(owner, type);
} }
/**
* @see Server#createInventory(InventoryHolder owner, int size)
*/
public static Inventory createInventory(InventoryHolder owner, int size) { public static Inventory createInventory(InventoryHolder owner, int size) {
return server.createInventory(owner, size); return server.createInventory(owner, size);
} }
/**
* @see Server#createInventory(InventoryHolder owner, int size, String title)
*/
public static Inventory createInventory(InventoryHolder owner, int size, String title) { public static Inventory createInventory(InventoryHolder owner, int size, String title) {
return server.createInventory(owner, size, title); return server.createInventory(owner, size, title);
} }
/**
* @see Server#getHelpMap()
*/
public static HelpMap getHelpMap() { public static HelpMap getHelpMap() {
return server.getHelpMap(); return server.getHelpMap();
} }
/**
* @see Server#getMonsterSpawnLimit()
*/
public static int getMonsterSpawnLimit() { public static int getMonsterSpawnLimit() {
return server.getMonsterSpawnLimit(); return server.getMonsterSpawnLimit();
} }
/**
* @see Server#getAnimalSpawnLimit()
*/
public static int getAnimalSpawnLimit() { public static int getAnimalSpawnLimit() {
return server.getAnimalSpawnLimit(); return server.getAnimalSpawnLimit();
} }
/**
* @see Server#getWaterAnimalSpawnLimit()
*/
public static int getWaterAnimalSpawnLimit() { public static int getWaterAnimalSpawnLimit() {
return server.getWaterAnimalSpawnLimit(); return server.getWaterAnimalSpawnLimit();
} }
/**
* @see Server#getAmbientSpawnLimit()
*/
public static int getAmbientSpawnLimit() { public static int getAmbientSpawnLimit() {
return server.getAmbientSpawnLimit(); return server.getAmbientSpawnLimit();
} }
/**
* @see Server#isPrimaryThread()
*/
public static boolean isPrimaryThread() { public static boolean isPrimaryThread() {
return server.isPrimaryThread(); return server.isPrimaryThread();
} }
/**
* @see Server#getMotd()
*/
public static String getMotd() { public static String getMotd() {
return server.getMotd(); return server.getMotd();
} }
/**
* @see Server#getShutdownMessage()
*/
public static String getShutdownMessage() { public static String getShutdownMessage() {
return server.getShutdownMessage(); return server.getShutdownMessage();
} }
/**
* @see Server#getWarningState()
*/
public static WarningState getWarningState() { public static WarningState getWarningState() {
return server.getWarningState(); return server.getWarningState();
} }
/**
* @see Server#getItemFactory()
*/
public static ItemFactory getItemFactory() { public static ItemFactory getItemFactory() {
return server.getItemFactory(); return server.getItemFactory();
} }
/**
* @see Server#getScoreboardManager()
*/
public static ScoreboardManager getScoreboardManager() { public static ScoreboardManager getScoreboardManager() {
return server.getScoreboardManager(); return server.getScoreboardManager();
} }

Datei anzeigen

@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.util.StringUtil; import org.bukkit.util.StringUtil;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -279,10 +280,13 @@ public abstract class Command {
} }
/** /**
* Sets the list of aliases to request on registration for this command * Sets the list of aliases to request on registration for this command.
* This is not effective outside of defining aliases in the {@link
* PluginDescriptionFile#getCommands()} (under the
* `<code>aliases</code>' node) is equivalent to this method.
* *
* @param aliases Aliases to register to this command * @param aliases aliases to register to this command
* @return This command object, for linking * @return this command object, for chaining
*/ */
public Command setAliases(List<String> aliases) { public Command setAliases(List<String> aliases) {
this.aliases = aliases; this.aliases = aliases;
@ -293,10 +297,12 @@ public abstract class Command {
} }
/** /**
* Sets a brief description of this command * Sets a brief description of this command. Defining a description in the
* {@link PluginDescriptionFile#getCommands()} (under the
* `<code>description</code>' node) is equivalent to this method.
* *
* @param description New command description * @param description new command description
* @return This command object, for linking * @return this command object, for chaining
*/ */
public Command setDescription(String description) { public Command setDescription(String description) {
this.description = description; this.description = description;
@ -306,8 +312,9 @@ public abstract class Command {
/** /**
* Sets the message sent when a permission check fails * Sets the message sent when a permission check fails
* *
* @param permissionMessage New permission message, null to indicate default message, or an empty string to indicate no message * @param permissionMessage new permission message, null to indicate
* @return This command object, for linking * default message, or an empty string to indicate no message
* @return this command object, for chaining
*/ */
public Command setPermissionMessage(String permissionMessage) { public Command setPermissionMessage(String permissionMessage) {
this.permissionMessage = permissionMessage; this.permissionMessage = permissionMessage;
@ -317,8 +324,8 @@ public abstract class Command {
/** /**
* Sets the example usage of this command * Sets the example usage of this command
* *
* @param usage New example usage * @param usage new example usage
* @return This command object, for linking * @return this command object, for chaining
*/ */
public Command setUsage(String usage) { public Command setUsage(String usage) {
this.usageMessage = usage; this.usageMessage = usage;

Datei anzeigen

@ -560,7 +560,7 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* not be reliable, as it is a state provided by the client, and may therefore not be accurate. * not be reliable, as it is a state provided by the client, and may therefore not be accurate.
* *
* @return True if the player standing on a solid block, else false. * @return True if the player standing on a solid block, else false.
* @deprecated Inconsistent with {@link org.bukkit.craftbukkit.entity.Entity#isOnGround()} * @deprecated Inconsistent with {@link org.bukkit.entity.Entity#isOnGround()}
*/ */
@Deprecated @Deprecated
public boolean isOnGround(); public boolean isOnGround();

Datei anzeigen

@ -9,8 +9,10 @@ import org.bukkit.potion.PotionEffect;
* Represents a thrown potion bottle * Represents a thrown potion bottle
*/ */
public interface ThrownPotion extends Projectile { public interface ThrownPotion extends Projectile {
/** /**
* Returns the effects that are applied by this potion. * Returns the effects that are applied by this potion.
*
* @return The potion effects * @return The potion effects
*/ */
public Collection<PotionEffect> getEffects(); public Collection<PotionEffect> getEffects();
@ -18,9 +20,9 @@ public interface ThrownPotion extends Projectile {
/** /**
* Returns a copy of the ItemStack for this thrown potion. * Returns a copy of the ItemStack for this thrown potion.
* <p> * <p>
* Altering this copy will not alter the thrown potion directly. * Altering this copy will not alter the thrown potion directly. If you
* If you want to alter the thrown potion, you must use the * want to alter the thrown potion, you must use the {@link
* {@link #setItemStack(ItemStack) setItemStack} method. * #setItem(ItemStack) setItemStack} method.
* *
* @return A copy of the ItemStack for this thrown potion. * @return A copy of the ItemStack for this thrown potion.
*/ */

Datei anzeigen

@ -1,31 +1,42 @@
package org.bukkit.event; package org.bukkit.event;
import org.bukkit.plugin.PluginManager;
/** /**
* Represents an event * Represents an event.
*
* @see PluginManager#callEvent(Event)
* @see PluginManager#registerEvents(Listener,Plugin)
*/ */
public abstract class Event { public abstract class Event {
private String name; private String name;
private final boolean async; private final boolean async;
/** /**
* The default constructor is defined for cleaner code. * The default constructor is defined for cleaner code. This constructor
* This constructor assumes the event is synchronous. * assumes the event is synchronous.
*/ */
public Event() { public Event() {
this(false); this(false);
} }
/** /**
* This constructor is used to explicitly declare an event as synchronous or asynchronous. * This constructor is used to explicitly declare an event as synchronous
* or asynchronous.
* *
* @param isAsync true indicates the event will fire asynchronously. false by default * @param isAsync true indicates the event will fire asynchronously, false
* by default from default constructor
*/ */
public Event(boolean isAsync) { public Event(boolean isAsync) {
this.async = isAsync; this.async = isAsync;
} }
/** /**
* @return Name of this event * Convenience method for providing a user-friendly identifier. By
* default, it is the event's class's {@linkplain Class#getSimpleName()
* simple name}.
*
* @return name of this event
*/ */
public String getEventName() { public String getEventName() {
if (name == null) { if (name == null) {
@ -37,17 +48,24 @@ public abstract class Event {
public abstract HandlerList getHandlers(); public abstract HandlerList getHandlers();
/** /**
* Any custom event that should not by synchronized with other events must use the specific constructor. * Any custom event that should not by synchronized with other events must
* These are the caveats of using an asynchronous event: * use the specific constructor. These are the caveats of using an
* <li>The event is never fired from inside code triggered by a synchronous event. * asynchronous event:
* Attempting to do so results in an {@link java.lang.IllegalStateException}.</li> * <ul>
* <li>However, asynchronous event handlers may fire synchronous or asynchronous events</li> * <li>The event is never fired from inside code triggered by a
* <li>The event may be fired multiple times simultaneously and in any order.</li> * synchronous event. Attempting to do so results in an {@link
* <li>Any newly registered or unregistered handler is ignored after an event starts execution.</li> * java.lang.IllegalStateException}.
* <li>The handlers for this event may block for any length of time.</li> * <li>However, asynchronous event handlers may fire synchronous or
* <li>Some implementations may selectively declare a specific event use as asynchronous. * asynchronous events
* This behavior should be clearly defined.</li> * <li>The event may be fired multiple times simultaneously and in any
* <li>Asynchronous calls are not calculated in the plugin timing system.</li> * order.
* <li>Any newly registered or unregistered handler is ignored after an
* event starts execution.
* <li>The handlers for this event may block for any length of time.
* <li>Some implementations may selectively declare a specific event use
* as asynchronous. This behavior should be clearly defined.
* <li>Asynchronous calls are not calculated in the plugin timing system.
* </ul>
* *
* @return false by default, true if the event fires asynchronously * @return false by default, true if the event fires asynchronously
*/ */
@ -58,20 +76,20 @@ public abstract class Event {
public enum Result { public enum Result {
/** /**
* Deny the event. * Deny the event. Depending on the event, the action indicated by the
* Depending on the event, the action indicated by the event will either not take place or will be reverted. * event will either not take place or will be reverted. Some actions
* Some actions may not be denied. * may not be denied.
*/ */
DENY, DENY,
/** /**
* Neither deny nor allow the event. * Neither deny nor allow the event. The server will proceed with its
* The server will proceed with its normal handling. * normal handling.
*/ */
DEFAULT, DEFAULT,
/** /**
* Allow / Force the event. * Allow / Force the event. The action indicated by the event will
* The action indicated by the event will take place if possible, even if the server would not normally allow the action. * take place if possible, even if the server would not normally allow
* Some actions may not be allowed. * the action. Some actions may not be allowed.
*/ */
ALLOW; ALLOW;
} }

Datei anzeigen

@ -130,9 +130,20 @@ public interface Plugin extends TabExecutor {
public void setNaggable(boolean canNag); public void setNaggable(boolean canNag);
/** /**
* Gets the {@link EbeanServer} tied to this plugin * Gets the {@link EbeanServer} tied to this plugin. This will only be
* available if enabled in the {@link
* PluginDescriptionFile#isDatabaseEnabled()}
* <p>
* <i>For more information on the use of <a href="http://www.avaje.org/">
* Avaje Ebeans ORM</a>, see <a
* href="http://www.avaje.org/ebean/documentation.html">Avaje Ebeans
* Documentation</a></i>
* <p>
* <i>For an example using Ebeans ORM, see <a
* href="https://github.com/Bukkit/HomeBukkit">Bukkit's Homebukkit Plugin
* </a></i>
* *
* @return Ebean server instance * @return ebean server instance or null if not enabled
*/ */
public EbeanServer getDatabase(); public EbeanServer getDatabase();

Datei anzeigen

@ -7,6 +7,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.Permission; import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault; import org.bukkit.permissions.PermissionDefault;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
@ -16,7 +21,148 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
/** /**
* Provides access to a Plugins description file, plugin.yaml * This type is the runtime-container for the information in the plugin.yml.
* All plugins must have a respective plugin.yml. For plugins written in java
* using the standard plugin loader, this file must be in the root of the jar
* file.
* <p>
* When Bukkit loads a plugin, it needs to know some basic information about
* it. It reads this information from a YAML file, 'plugin.yml'. This file
* consists of a set of attributes, each defined on a new line and with no
* indentation.
* <p>
* Every (almost* every) method corresponds with a specific entry in the
* plugin.yml. These are the <b>required</b> entries for every plugin.yml:
* <ul>
* <li>{@link #getName()} - <code>name</code>
* <li>{@link #getVersion()} - <code>version</code>
* <li>{@link #getMain()} - <code>main</code>
* </ul>
* <p>
* Failing to include any of these items will throw an exception and cause the
* server to ignore your plugin.
* <p>
* This is a list of the possible yaml keys, with specific details included in
* the respective method documentations:
* <table border=1>
* <tr>
* <th>Node</th>
* <th>Method</th>
* <th>Summary</th>
* </tr><tr>
* <td><code>name</code></td>
* <td>{@link #getName()}</td>
* <td>The unique name of plugin</td>
* </tr><tr>
* <td><code>version</code></td>
* <td>{@link #getVersion()}</td>
* <td>A plugin revision identifier</td>
* </tr><tr>
* <td><code>main</code></td>
* <td>{@link #getMain()}</td>
* <td>The plugin's initial class file</td>
* </tr><tr>
* <td><code>author</code><br><code>authors</code></td>
* <td>{@link #getAuthors()}</td>
* <td>The plugin contributors</td>
* </tr><tr>
* <td><code>description</code></td>
* <td>{@link #getDescription()}</td>
* <td>Human readable plugin summary</td>
* </tr><tr>
* <td><code>website</code></td>
* <td>{@link #getWebsite()}</td>
* <td>The URL to the plugin's site</td>
* </tr><tr>
* <td><code>prefix</code></td>
* <td>{@link #getPrefix()}</td>
* <td>The token to prefix plugin log entries</td>
* </tr><tr>
* <td><code>database</code></td>
* <td>{@link #isDatabaseEnabled()}</td>
* <td>Indicator to enable database support</td>
* </tr><tr>
* <td><code>load</code></td>
* <td>{@link #getLoad()}</td>
* <td>The phase of server-startup this plugin will load during</td>
* </tr><tr>
* <td><code>depend</code></td>
* <td>{@link #getDepend()}</td>
* <td>Other required plugins</td>
* </tr><tr>
* <td><code>softdepend</code></td>
* <td>{@link #getSoftDepend()}</td>
* <td>Other plugins that add functionality</td>
* </tr><tr>
* <td><code>loadbefore</code></td>
* <td>{@link #getLoadBefore()}</td>
* <td>The inverse softdepend</td>
* </tr><tr>
* <td><code>commands</code></td>
* <td>{@link #getCommands()}</td>
* <td>The commands the plugin will register</td>
* </tr><tr>
* <td><code>permissions</code></td>
* <td>{@link #getPermissions()}</td>
* <td>The permissions the plugin will register</td>
* </tr><tr>
* <td><code>default-permission</code></td>
* <td>{@link #getPermissionDefault()}</td>
* <td>The default {@link Permission#getDefault() default} permission
* state for defined {@link #getPermissions() permissions} the plugin
* will register</td>
* </tr>
* </table>
* <p>
* A plugin.yml example:<blockquote><pre>
*name: Inferno
*version: 1.4.1
*description: This plugin is so 31337. You can set yourself on fire.
*# We could place every author in the authors list, but chose not to for illustrative purposes
*# Also, having an author distinguishes that person as the project lead, and ensures their
*# name is displayed first
*author: CaptainInflamo
*authors: [Cogito, verrier, EvilSeph]
*website: http://www.curse.com/server-mods/minecraft/myplugin
*
*main: com.captaininflamo.bukkit.inferno.Inferno
*database: false
*depend: [NewFire, FlameWire]
*
*commands:
* flagrate:
* description: Set yourself on fire.
* aliases: [combust_me, combustMe]
* permission: inferno.flagrate
* usage: Syntax error! Simply type /&lt;command&gt; to ignite yourself.
* burningdeaths:
* description: List how many times you have died by fire.
* aliases: [burning_deaths, burningDeaths]
* permission: inferno.burningdeaths
* usage: |
* /&lt;command&gt; [player]
* Example: /&lt;command&gt; - see how many times you have burned to death
* Example: /&lt;command&gt; CaptainIce - see how many times CaptainIce has burned to death
*
*permissions:
* inferno.*:
* description: Gives access to all Inferno commands
* children:
* inferno.flagrate: true
* inferno.burningdeaths: true
* inferno.burningdeaths.others: true
* inferno.flagrate:
* description: Allows you to ignite yourself
* default: true
* inferno.burningdeaths:
* description: Allows you to see how many times you have burned to death
* default: true
* inferno.burningdeaths.others:
* description: Allows you to see how many times others have burned to death
* default: op
* children:
* inferno.burningdeaths: true
*</pre></blockquote>
*/ */
public final class PluginDescriptionFile { public final class PluginDescriptionFile {
private static final Yaml yaml = new Yaml(new SafeConstructor()); private static final Yaml yaml = new Yaml(new SafeConstructor());
@ -46,7 +192,8 @@ public final class PluginDescriptionFile {
* Loads a PluginDescriptionFile from the specified reader * Loads a PluginDescriptionFile from the specified reader
* *
* @param reader The reader * @param reader The reader
* @throws InvalidDescriptionException If the PluginDescriptionFile is invalid * @throws InvalidDescriptionException If the PluginDescriptionFile is
* invalid
*/ */
public PluginDescriptionFile(final Reader reader) throws InvalidDescriptionException { public PluginDescriptionFile(final Reader reader) throws InvalidDescriptionException {
loadMap(asMap(yaml.load(reader))); loadMap(asMap(yaml.load(reader)));
@ -66,99 +213,522 @@ public final class PluginDescriptionFile {
} }
/** /**
* Saves this PluginDescriptionFile to the given writer * Gives the name of the plugin. This name is a unique identifier for
* plugins.
* <ul>
* <li>Must consist of all alphanumeric characters, underscores, hyphon,
* and period (a-z,A-Z,0-9, _.-). Any other character will cause the
* plugin.yml to fail loading.
* <li>Used to determine the name of the plugin's data folder. Data
* folders are placed in the ./plugins/ directory by default, but this
* behavior should not be relied on. {@link Plugin#getDataFolder()}
* should be used to reference the data folder.
* <li>It is good practice to name your jar the same as this, for example
* 'MyPlugin.jar'.
* <li>Case sensitive.
* <li>The is the token referenced in {@link #getDepend()}, {@link
* #getSoftDepend()}, and {@link #getLoadBefore()}.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>name</code>.
* <p>
* Example:<blockquote><pre>name: MyPlugin</pre></blockquote>
* *
* @param writer Writer to output this file to * @return the name of the plugin
*/
public void save(Writer writer) {
yaml.dump(saveMap(), writer);
}
/**
* Returns the name of a plugin
*
* @return String name
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* Returns the version of a plugin * Gives the version of the plugin.
* <ul>
* <li>Version is an arbitrary string, however the most common format is
* MajorRelease.MinorRelease.Build (eg: 1.4.1).
* <li>Typically you will increment this every time you release a new
* feature or bug fix.
* <li>Displayed when a user types <code>/version PluginName</code>
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>version</code>.
* <p>
* Example:<blockquote><pre>version: 1.4.1</pre></blockquote>
* *
* @return String name * @return the version of the plugin
*/ */
public String getVersion() { public String getVersion() {
return version; return version;
} }
/** /**
* Returns the name of a plugin including the version * Gives the fully qualified name of the main class for a plugin. The
* format should follow the {@link ClassLoader#loadClass(String)} syntax
* to successfully be resolved at runtime. For most plugins, this is the
* class that extends {@link JavaPlugin}.
* <ul>
* <li>This must contain the full namespace including the class file
* itself.
* <li>If your namespace is <code>org.bukkit.plugin</code>, and your class
* file is called <code>MyPlugin</code> then this must be
* <code>org.bukkit.plugin.MyPlugin</code>
* <li>No plugin can use <code>org.bukkit.</code> as a base package for
* <b>any class</b>, including the main class.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>main</code>.
* <p>
* Example:
* <blockquote><pre>main: org.bukkit.plugin.MyPlugin</pre></blockquote>
* *
* @return String name * @return the fully qualified main class for the plugin
*/
public String getFullName() {
return name + " v" + version;
}
/**
* Returns the main class for a plugin
*
* @return Java classpath
*/ */
public String getMain() { public String getMain() {
return main; return main;
} }
public Map<String, Map<String, Object>> getCommands() {
return commands;
}
public List<String> getDepend() {
return depend;
}
public List<String> getSoftDepend() {
return softDepend;
}
/** /**
* Gets the list of plugins that should consider this plugin a soft-dependency * Gives a human-friendly description of the functionality the plugin
* @return immutable list of plugins that should consider this plugin a soft-dependency * provides.
*/ * <ul>
public List<String> getLoadBefore() { * <li>The description can have multiple lines.
return loadBefore; * <li>Displayed when a user types <code>/version PluginName</code>
} * </ul>
* <p>
public PluginLoadOrder getLoad() { * In the plugin.yml, this entry is named <code>description</code>.
return order; * <p>
} * Example:
* <blockquote><pre>description: This plugin is so 31337. You can set yourself on fire.</pre></blockquote>
/**
* Gets the description of this plugin
* *
* @return Description of this plugin * @return description of this plugin, or null if not specified
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Gives the phase of server startup that the plugin should be loaded.
* <ul>
* <li>Possible values are in {@link PluginLoadOrder}.
* <li>Defaults to {@link PluginLoadOrder#POSTWORLD}.
* <li>Certain caveats apply to each phase.
* <li>When different, {@link #getDepend()}, {@link #getSoftDepend()}, and
* {@link #getLoadBefore()} become relative in order loaded per-phase.
* If a plugin loads at <code>STARTUP</code>, but a dependency loads
* at <code>POSTWORLD</code>, the dependency will not be loaded before
* the plugin is loaded.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>load</code>.
* <p>
* Example:<blockquote><pre>load: STARTUP</pre></blockquote>
*
* @return the phase when the plugin should be loaded
*/
public PluginLoadOrder getLoad() {
return order;
}
/**
* Gives the list of authors for the plugin.
* <ul>
* <li>Gives credit to the developer.
* <li>Used in some server error messages to provide helpful feedback on
* who to contact when an error occurs.
* <li>A bukkit.org forum handle or email address is recommended.
* <li>Is displayed when a user types <code>/version PluginName</code>
* <li><code>authors</code> must be in <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">YAML list
* format</a>.
* </ul>
* <p>
* In the plugin.yml, this has two entries, <code>author</code> and
* <code>authors</code>.
* <p>
* Single author example:
* <blockquote><pre>author: CaptainInflamo</pre></blockquote>
* Multiple author example:
* <blockquote><pre>authors: [Cogito, verrier, EvilSeph]</pre></blockquote>
* When both are specified, author will be the first entry in the list, so
* this example:
* <blockquote><pre>author: Grum
*authors:
*- feildmaster
*- amaranth</pre></blockquote>
* Is equivilant to this example:
* <blockquote><pre>authors: [Grum, feildmaster, aramanth]<pre></blockquote>
*
* @return an immutable list of the plugin's authors
*/
public List<String> getAuthors() { public List<String> getAuthors() {
return authors; return authors;
} }
/**
* Gives the plugin's or plugin's author's website.
* <ul>
* <li>A link to the Curse page that includes documentation and downloads
* is highly recommended.
* <li>Displayed when a user types <code>/version PluginName</code>
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>website</code>.
* <p>
* Example:
* <blockquote><pre>website: http://www.curse.com/server-mods/minecraft/myplugin</pre></blockquote>
*
* @return description of this plugin, or null if not specified
*/
public String getWebsite() { public String getWebsite() {
return website; return website;
} }
/**
* Gives if the plugin uses a database.
* <ul>
* <li>Using a database is non-trivial.
* <li>Valid values include <code>true</code> and <code>false</code>
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>database</code>.
* <p>
* Example:
* <blockquote><pre>database: false</pre></blockquote>
*
* @return if this plugin requires a database
* @see Plugin#getDatabase()
*/
public boolean isDatabaseEnabled() { public boolean isDatabaseEnabled() {
return database; return database;
} }
public void setDatabaseEnabled(boolean database) { /**
this.database = database; * Gives a list of other plugins that the plugin requires.
* <ul>
* <li>Use the value in the {@link #getName()} of the target plugin to
* specify the dependency.
* <li>If any plugin listed here is not found, your plugin will fail to
* load at startup.
* <li>If multiple plugins list each other in <code>depend</code>,
* creating a network with no individual plugin does not list another
* plugin in the <a
* href=https://en.wikipedia.org/wiki/Circular_dependency>network</a>,
* all plugins in that network will fail.
* <li><code>depend</code> must be in must be in <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">YAML list
* format</a>.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>depend</code>.
* <p>
* Example:
* <blockquote><pre>depend:
*- OnePlugin
*- AnotherPlugin</pre></blockquote>
*
* @return immutable list of the plugin's dependencies
*/
public List<String> getDepend() {
return depend;
} }
/**
* Gives a list of other plugins that the plugin requires for full
* functionality. The {@link PluginManager} will make best effort to treat
* all entries here as if they were a {@link #getDepend() dependency}, but
* will never fail because of one of these entries.
* <ul>
* <li>Use the value in the {@link #getName()} of the target plugin to
* specify the dependency.
* <li>When an unresolvable plugin is listed, it will be ignored and does
* not affect load order.
* <li>When a circular dependency occurs (a network of plugins depending
* or soft-dependending each other), it will arbitrarily choose a
* plugin that can be resolved when ignoring soft-dependencies.
* <li><code>softdepend</code> must be in <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">YAML list
* format</a>.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>softdepend</code>.
* <p>
* Example:
* <blockquote><pre>softdepend: [OnePlugin, AnotherPlugin]</pre></blockquote>
*
* @return immutable list of the plugin's preferred dependencies
*/
public List<String> getSoftDepend() {
return softDepend;
}
/**
* Gets the list of plugins that should consider this plugin a
* soft-dependency.
* <ul>
* <li>Use the value in the {@link #getName()} of the target plugin to
* specify the dependency.
* <li>The plugin should load before any other plugins listed here.
* <li>Specifying another plugin here is strictly equivalent to having the
* specified plugin's {@link #getSoftDepend()} include {@link
* #getName() this plugin}.
* <li><code>loadbefore</code> must be in <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">YAML list
* format</a>.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>loadbefore</code>.
* <p>
* Example:
* <blockquote><pre>loadbefore:
*- OnePlugin
*- AnotherPlugin</pre></blockquote>
*
* @return immutable list of plugins that should consider this plugin a
* soft-dependency
*/
public List<String> getLoadBefore() {
return loadBefore;
}
/**
* Gives the token to prefix plugin-specific logging messages with.
* <ul>
* <li>This includes all messages using {@link Plugin#getLogger()}.
* <li>If not specified, the server uses the plugin's {@link #getName()
* name}.
* <li>This should clearly indicate what plugin is being logged.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>prefix</code>.
* <p>
* Example:<blockquote><pre>prefix: ex-why-zee</pre></blockquote>
*
* @return the prefixed logging token, or null if not specified
*/
public String getPrefix() {
return prefix;
}
/**
* Gives the map of command-name to command-properties. Each entry in this
* map corresponds to a single command and the respective values are the
* properties of the command. Each property, <i>with the exception of
* aliases</i>, can be defined at runtime using methods in {@link
* PluginCommand} and are defined here only as a convenience.
* <table border=1>
* <tr>
* <th>Node</th>
* <th>Method</th>
* <th>Type</th>
* <th>Description</th>
* <th>Example</th>
* </tr><tr>
* <td><code>description</code></td>
* <td>{@link PluginCommand#setDescription(String)}</td>
* <td>String</td>
* <td>A user-friendly description for a command. It is useful for
* documentation purposes as well as in-game help.</td>
* <td><blockquote><pre>description: Set yourself on fire</pre></blockquote></td>
* </tr><tr>
* <td><code>aliases</code></td>
* <td>{@link PluginCommand#setAliases(List)}</td>
* <td>String or <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">List</a> of
* strings</td>
* <td>Alternative command names, with special usefulness for commands
* that are already registered. <i>Aliases are not effective when
* defined at runtime,</i> so the plugin description file is the
* only way to have them properly defined.</td>
* <td>Single alias format:
* <blockquote><pre>aliases: combust_me</pre></blockquote> or
* multiple alias format:
* <blockquote><pre>aliases: [combust_me, combustMe]</pre></blockquote></td>
* </tr><tr>
* <td><code>permission</code></td>
* <td>{@link PluginCommand#setPermission(String)}</td>
* <td>String</td>
* <td>The name of the {@link Permission} required to use the command.
* A user without the permission will receive the specified
* message (see {@linkplain
* PluginCommand#setPermissionMessage(String) below}), or a
* standard one if no specific message is defined. Without the
* permission node, no {@link
* PluginCommand#setExecutor(CommandExecutor) CommandExecutor} or
* {@link PluginCommand#setTabCompleter(TabCompleter)
* TabCompleter} will be called.</td>
* <td><blockquote><pre>permission: inferno.flagrate</pre></blockquote></td>
* </tr><tr>
* <td><code>permission-message</code></td>
* <td>{@link PluginCommand#setPermissionMessage(String)}</td>
* <td>String</td>
* <td><ul>
* <li>Displayed to a player that attempts to use a command, but
* does not have the required permission. See {@link
* PluginCommand#getPermission() above}.
* <li>&lt;permission&gt; is a macro that is replaced with the
* permission node required to use the command.
* <li>Using empty quotes is a valid way to indicate nothing
* should be displayed to a player.
* </ul></td>
* <td><blockquote><pre>permission-message: You do not have /&lt;permission&gt;</pre></blockquote></td>
* </tr><tr>
* <td><code>usage</code></td>
* <td>{@link PluginCommand#setUsage(String)}</td>
* <td>String</td>
* <td>This message is displayed to a player when the {@link
* PluginCommand#setExecutor(CommandExecutor)} {@linkplain
* CommandExecutor#onCommand(CommandSender,Command,String,String[])
* returns false}. &lt;command&gt; is a macro that is replaced
* the command issued.</td>
* <td><blockquote><pre>usage: Syntax error! Perhaps you meant /&lt;command&gt; PlayerName?</pre></blockquote>
* It is worth noting that to use a colon in a yaml, like
* <code>`usage: Usage: /god [player]'</code>, you need to
* <a href="http://yaml.org/spec/current.html#id2503232">surround
* the message with double-quote</a>:
* <blockquote><pre>usage: "Usage: /god [player]"</pre></blockquote></td>
* </tr>
* </table>
* The commands are structured as a hiearchy of <a
* href="http://yaml.org/spec/current.html#id2502325">nested mappings</a>.
* The primary (top-level, no intendentation) node is
* `<code>commands</code>', while each individual command name is
* indented, indicating it maps to some value (in our case, the
* properties of the table above).
* <p>
* Here is an example bringing together the piecemeal examples above, as
* well as few more definitions:<blockquote><pre>
*commands:
* flagrate:
* description: Set yourself on fire.
* aliases: [combust_me, combustMe]
* permission: inferno.flagrate
* permission-message: You do not have /&lt;permission&gt;
* usage: Syntax error! Perhaps you meant /&lt;command&gt; PlayerName?
* burningdeaths:
* description: List how many times you have died by fire.
* aliases:
* - burning_deaths
* - burningDeaths
* permission: inferno.burningdeaths
* usage: |
* /&lt;command&gt; [player]
* Example: /&lt;command&gt; - see how many times you have burned to death
* Example: /&lt;command&gt; CaptainIce - see how many times CaptainIce has burned to death
* # The next command has no description, aliases, etc. defined, but is still valid
* # Having an empty declaration is useful for defining the description, permission, and messages from a configuration dynamically
* apocalypse:
*</pre></blockquote>
*
* @return the commands this plugin will register
*/
public Map<String, Map<String, Object>> getCommands() {
return commands;
}
/**
* Gives the list of permissions the plugin will register at runtime,
* immediately proceding enabling. The format for defining permissions is
* a map from permission name to properties. To represent a map without
* any specific property, empty <a
* href="http://yaml.org/spec/current.html#id2502702">curly-braces</a> (
* <code>&#123;&#125;</code> ) may be used (as a null value is not
* accepted, unlike the {@link #getCommands() commands} above).
* <p>
* A list of optional properties for permissions:
* <table border=1>
* <tr>
* <th>Node</th>
* <th>Description</th>
* <th>Example</th>
* </tr><tr>
* <td><code>description</code></td>
* <td>Plaintext (user-friendly) description of what the permission
* is for.</td>
* <td><blockquote><pre>description: Allows you to set yourself on fire</pre></blockquote></td>
* </tr><tr>
* <td><code>default</code></td>
* <td>The default state for the permission, as defined by {@link
* Permission#getDefault()}. If not defined, it will be set to
* the value of {@link PluginDescriptionFile#getPermissionDefault()}.
* <p>
* For reference:<ul>
* <li><code>true</code> - Represents a positive assignment to
* {@link Permissible permissibles}.
* <li><code>false</code> - Represents no assignment to {@link
* Permissible permissibles}.
* <li><code>op</code> - Represents a positive assignment to
* {@link Permissible#isOp() operator permissibles}.
* <li><code>notop</code> - Represents a positive assignment to
* {@link Permissible#isOp() non-operator permissibiles}.
* </ul></td>
* <td><blockquote><pre>default: true</pre></blockquote></td>
* </tr><tr>
* <td><code>children</code></td>
* <td>Allows other permissions to be set as a {@linkplain
* Permission#getChildren() relation} to the parent permission.
* When a parent permissions is assigned, child permissions are
* respectively assigned as well.
* <ul>
* <li>When a parent permission is assigned negatively, child
* permissions are assigned based on an inversion of their
* association.
* <li>When a parent permission is assigned positively, child
* permissions are assigned based on their association.
* </ul>
* <p>
* Child permissions may be defined in a number of ways:<ul>
* <li>Children may be defined as a <a
* href="http://en.wikipedia.org/wiki/YAML#Lists">list</a> of
* names. Using a list will treat all children associated
* positively to their parent.
* <li>Children may be defined as a map. Each permission name maps
* to either a boolean (representing the association), or a
* nested permission definition (just as another permission).
* Using a nested definition treats the child as a positive
* association.
* <li>A nested permission definition must be a map of these same
* properties. To define a valid nested permission without
* defining any specific property, empty curly-braces (
* <code>&#123;&#125;</code> ) must be used.
* <li>A nested permission may carry it's own nested permissions
* as children, as they may also have nested permissions, and
* so forth. There is no direct limit to how deep the
* permission tree is defined.
* </ul></td>
* <td>As a list:
* <blockquote><pre>children: [inferno.flagrate, inferno.burningdeaths]</pre></blockquote>
* Or as a mapping:
* <blockquote><pre>children:
* inferno.flagrate: true
* inferno.burningdeaths: true</pre></blockquote>
* An additional example showing basic nested values can be seen
* <a href="doc-files/permissions-example_plugin.yml">here</a>.
* </td>
* </tr>
* </table>
* The permissions are structured as a hiearchy of <a
* href="http://yaml.org/spec/current.html#id2502325">nested mappings</a>.
* The primary (top-level, no intendentation) node is
* `<code>permissions</code>', while each individual permission name is
* indented, indicating it maps to some value (in our case, the
* properties of the table above).
* <p>
* Here is an example using some of the properties:<blockquote><pre>
*permissions:
* inferno.*:
* description: Gives access to all Inferno commands
* children:
* inferno.flagrate: true
* inferno.burningdeaths: true
* inferno.flagate:
* description: Allows you to ignite yourself
* default: true
* inferno.burningdeaths:
* description: Allows you to see how many times you have burned to death
* default: true
*</pre></blockquote>
* Another example, with nested definitions, can be found <a
* href="doc-files/permissions-example_plugin.yml">here</a>.
*/
public List<Permission> getPermissions() { public List<Permission> getPermissions() {
if (permissions == null) { if (permissions == null) {
if (lazyPermissions == null) { if (lazyPermissions == null) {
@ -171,16 +741,53 @@ public final class PluginDescriptionFile {
return permissions; return permissions;
} }
/**
* Gives the default {@link Permission#getDefault() default} state of
* {@link #getPermissions() permissions} registered for the plugin.
* <ul>
* <li>If not specified, it will be {@link PermissionDefault#OP}.
* <li>It is matched using {@link PermissionDefault#getByName(String)}
* <li>It only affects permissions that do not define the
* <code>default</code> node.
* <li>It may be any value in {@link PermissionDefault}.
* </ul>
* <p>
* In the plugin.yml, this entry is named <code>default-permission</code>.
* <p>
* Example:<blockquote><pre>default-permission: NOT_OP</pre></blockquote>
*
* @return the default value for the plugin's permissions
*/
public PermissionDefault getPermissionDefault() { public PermissionDefault getPermissionDefault() {
return defaultPerm; return defaultPerm;
} }
/**
* Returns the name of a plugin, including the version. This method is
* provided for convenience; it uses the {@link #getName()} and {@link
* #getVersion()} entries.
*
* @return a descriptive name of the plugin and respective version
*/
public String getFullName() {
return name + " v" + version;
}
public String getClassLoaderOf() { public String getClassLoaderOf() {
return classLoaderOf; return classLoaderOf;
} }
public String getPrefix() { public void setDatabaseEnabled(boolean database) {
return prefix; this.database = database;
}
/**
* Saves this PluginDescriptionFile to the given writer
*
* @param writer Writer to output this file to
*/
public void save(Writer writer) {
yaml.dump(saveMap(), writer);
} }
private void loadMap(Map<?, ?> map) throws InvalidDescriptionException { private void loadMap(Map<?, ?> map) throws InvalidDescriptionException {

Datei anzeigen

@ -307,10 +307,12 @@ public abstract class JavaPlugin extends PluginBase {
} }
/** /**
* Gets the command with the given name, specific to this plugin * Gets the command with the given name, specific to this plugin. Commands
* need to be registered in the {@link PluginDescriptionFile#getCommands()
* PluginDescriptionFile} to exist at runtime.
* *
* @param name Name or alias of the command * @param name name or alias of the command
* @return PluginCommand if found, otherwise null * @return the plugin command if found, otherwise null
*/ */
public PluginCommand getCommand(String name) { public PluginCommand getCommand(String name) {
String alias = name.toLowerCase(); String alias = name.toLowerCase();

Datei anzeigen

@ -88,7 +88,6 @@ public interface Objective {
/** /**
* Gets a player's Score for an Objective on this Scoreboard * Gets a player's Score for an Objective on this Scoreboard
* *
* @param objective Objective for the Score
* @param player Player for the Score * @param player Player for the Score
* @return Score tracking the Objective and player specified * @return Score tracking the Objective and player specified
* @throws IllegalArgumentException if player is null * @throws IllegalArgumentException if player is null

Datei anzeigen

@ -158,7 +158,6 @@ public interface Team {
/** /**
* Unregisters this team from the Scoreboard * Unregisters this team from the Scoreboard
* *
* @param team Team to unregister
* @throws IllegalStateException if this team has been unregistered * @throws IllegalStateException if this team has been unregistered
*/ */
void unregister() throws IllegalStateException; void unregister() throws IllegalStateException;

Datei anzeigen

@ -0,0 +1,64 @@
name: ScrapBukkit
main: com.dinnerbone.bukkit.scrap.ScrapBukkit
version: 1.0.0
website: http://www.bukkit.org
author: The Bukkit Team
description: >
Miscellaneous administrative commands for Bukkit.
This plugin is one of the default plugins shipped with Bukkit.
# commands: snipped
permissions:
scrapbukkit.*:
description: Gives all permissions for Scrapbukkit
default: op
children:
scrapbukkit.remove:
description: Allows the player to remove items from anyones inventory
children:
scrapbukkit.remove.self:
description: Allows the player to remove items from their own inventory
scrapbukkit.remove.other:
description: Allows the player to remove items from other peoples inventory
scrapbukkit.time:
description: Allows the player to view and change the time
children:
scrapbukkit.time.view:
description: Allows the player to view the time
default: true
scrapbukkit.time.change:
description: Allows the player to change the time
scrapbukkit.tp:
description: Allows the player to teleport anyone to anyone else
children:
scrapbukkit.tp.here:
description: Allows the player to teleport other players to themselves
scrapbukkit.tp.self:
description: Allows the player to teleport themselves to another player
scrapbukkit.tp.other:
description: Allows the player to teleport anyone to another player
scrapbukkit.give:
description: Allows the player to give items
children:
scrapbukkit.give.self:
description: Allows the player to give themselves items
scrapbukkit.give.other:
description: Allows the player to give other players items
scrapbukkit.clear:
description: Allows the player to clear inventories
children:
scrapbukkit.clear.self:
description: Allows the player to clear their own inventory
scrapbukkit.clear.other:
description: Allows the player to clear other players inventory
scrapbukkit.some.standard.perm: {}
scrapbukkit.some.other.perm: true
scrapbukkit.some.bad.perm: false
# This is defined here individually, as simply giving it an association will not cause it to exist at runtime
scrapbukkit.some.bad.perm: {}
scrapbukkit.some.other.perm: {}