Generic cleanup of warnings, whitespace and style.
This commit is contained in:
parent
a345613cfa
commit
b9fca3c04d
@ -6,34 +6,34 @@ import java.util.HashMap;
|
|||||||
* Represents the art on a painting
|
* Represents the art on a painting
|
||||||
*/
|
*/
|
||||||
public enum Art {
|
public enum Art {
|
||||||
KEBAB(0,1,1),
|
KEBAB(0, 1, 1),
|
||||||
AZTEC(1,1,1),
|
AZTEC(1, 1, 1),
|
||||||
ALBAN(2,1,1),
|
ALBAN(2, 1, 1),
|
||||||
AZTEC2(3,1,1),
|
AZTEC2(3, 1, 1),
|
||||||
BOMB(4,1,1),
|
BOMB(4, 1, 1),
|
||||||
PLANT(5,1,1),
|
PLANT(5, 1, 1),
|
||||||
WASTELAND(6,1,1),
|
WASTELAND(6, 1, 1),
|
||||||
POOL(7,2,1),
|
POOL(7, 2, 1),
|
||||||
COURBET(8,2,1),
|
COURBET(8, 2, 1),
|
||||||
SEA(9,2,1),
|
SEA(9, 2, 1),
|
||||||
SUNSET(10,2,1),
|
SUNSET(10, 2, 1),
|
||||||
CREEBET(11,2,1),
|
CREEBET(11, 2, 1),
|
||||||
WANDERER(12,1,2),
|
WANDERER(12, 1, 2),
|
||||||
GRAHAM(13,1,2),
|
GRAHAM(13, 1, 2),
|
||||||
MATCH(14,4,2),
|
MATCH(14, 4, 2),
|
||||||
BUST(15,2,2),
|
BUST(15, 2, 2),
|
||||||
STAGE(16,2,2),
|
STAGE(16, 2, 2),
|
||||||
VOID(17,2,2),
|
VOID(17, 2, 2),
|
||||||
SKULL_AND_ROSES(18,2,2),
|
SKULL_AND_ROSES(18, 2, 2),
|
||||||
FIGHTERS(19,2,2),
|
FIGHTERS(19, 2, 2),
|
||||||
POINTER(20,4,4),
|
POINTER(20, 4, 4),
|
||||||
PIGSCENE(21,4,4),
|
PIGSCENE(21, 4, 4),
|
||||||
BURNINGSKULL(22,4,4),
|
BURNINGSKULL(22, 4, 4),
|
||||||
SKELETON(23,4,3),
|
SKELETON(23, 4, 3),
|
||||||
DONKEYKONG(24,4,3);
|
DONKEYKONG(24, 4, 3);
|
||||||
private int id, width, height;
|
private int id, width, height;
|
||||||
private static HashMap<String,Art> names = new HashMap<String,Art>();
|
private static HashMap<String, Art> names = new HashMap<String, Art>();
|
||||||
private static HashMap<Integer,Art> ids = new HashMap<Integer,Art>();
|
private static HashMap<Integer, Art> ids = new HashMap<Integer, Art>();
|
||||||
static {
|
static {
|
||||||
for (Art art : Art.values()) {
|
for (Art art : Art.values()) {
|
||||||
ids.put(art.id, art);
|
ids.put(art.id, art);
|
||||||
|
@ -32,6 +32,7 @@ public interface BlockChangeDelegate {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block type at the location.
|
* Get the block type at the location.
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param y Y coordinate
|
* @param y Y coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
|
@ -258,7 +258,7 @@ public final class Bukkit {
|
|||||||
public static void unbanIP(String address) {
|
public static void unbanIP(String address) {
|
||||||
server.unbanIP(address);
|
server.unbanIP(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<OfflinePlayer> getBannedPlayers() {
|
public static Set<OfflinePlayer> getBannedPlayers() {
|
||||||
return server.getBannedPlayers();
|
return server.getBannedPlayers();
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,14 @@ public interface Chunk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture thread-safe read-only snapshot of chunk data
|
* Capture thread-safe read-only snapshot of chunk data
|
||||||
|
*
|
||||||
* @return ChunkSnapshot
|
* @return ChunkSnapshot
|
||||||
*/
|
*/
|
||||||
ChunkSnapshot getChunkSnapshot();
|
ChunkSnapshot getChunkSnapshot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture thread-safe read-only snapshot of chunk data
|
* Capture thread-safe read-only snapshot of chunk data
|
||||||
|
*
|
||||||
* @param includeMaxblocky - if true, snapshot includes per-coordinate maximum Y values
|
* @param includeMaxblocky - if true, snapshot includes per-coordinate maximum Y values
|
||||||
* @param includeBiome - if true, snapshot includes per-coordinate biome type
|
* @param includeBiome - if true, snapshot includes per-coordinate biome type
|
||||||
* @param includeBiomeTempRain - if true, snapshot includes per-coordinate raw biome temperature and rainfall
|
* @param includeBiomeTempRain - if true, snapshot includes per-coordinate raw biome temperature and rainfall
|
||||||
@ -57,12 +59,14 @@ public interface Chunk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all entities in the chunk.
|
* Get a list of all entities in the chunk.
|
||||||
|
*
|
||||||
* @return The entities.
|
* @return The entities.
|
||||||
*/
|
*/
|
||||||
Entity[] getEntities();
|
Entity[] getEntities();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all tile entities in the chunk.
|
* Get a list of all tile entities in the chunk.
|
||||||
|
*
|
||||||
* @return The tile entities.
|
* @return The tile entities.
|
||||||
*/
|
*/
|
||||||
BlockState[] getTileEntities();
|
BlockState[] getTileEntities();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
* Purpose is to allow clean, efficient copy of a chunk data to be made, and then handed off for processing in another thread (e.g. map rendering)
|
* Purpose is to allow clean, efficient copy of a chunk data to be made, and then handed off for processing in another thread (e.g. map rendering)
|
||||||
@ -106,6 +107,7 @@ public interface ChunkSnapshot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get world full time when chunk snapshot was captured
|
* Get world full time when chunk snapshot was captured
|
||||||
|
*
|
||||||
* @return time in ticks
|
* @return time in ticks
|
||||||
*/
|
*/
|
||||||
long getCaptureFullTime();
|
long getCaptureFullTime();
|
||||||
|
@ -240,10 +240,10 @@ public class Location implements Cloneable {
|
|||||||
z += vec.z;
|
z += vec.z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the location by a vector.
|
* Adds the location by a vector.
|
||||||
*
|
*
|
||||||
* @see Vector
|
* @see Vector
|
||||||
* @param vec Vector to use
|
* @param vec Vector to use
|
||||||
* @return the same location
|
* @return the same location
|
||||||
@ -289,10 +289,10 @@ public class Location implements Cloneable {
|
|||||||
z -= vec.z;
|
z -= vec.z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtracts the location by a vector.
|
* Subtracts the location by a vector.
|
||||||
*
|
*
|
||||||
* @see Vector
|
* @see Vector
|
||||||
* @param vec The vector to use
|
* @param vec The vector to use
|
||||||
* @return the same location
|
* @return the same location
|
||||||
@ -348,7 +348,7 @@ public class Location implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the distance between this location and another. The value
|
* Get the distance between this location and another. The value
|
||||||
* of this method is not cached and uses a costly square-root function, so
|
* of this method is not cached and uses a costly square-root function, so
|
||||||
* do not repeatedly call this method to get the location's magnitude. NaN
|
* do not repeatedly call this method to get the location's magnitude. NaN
|
||||||
* will be returned if the inner result of the sqrt() function overflows,
|
* will be returned if the inner result of the sqrt() function overflows,
|
||||||
|
@ -47,13 +47,13 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|||||||
* @param value true if whitelisted
|
* @param value true if whitelisted
|
||||||
*/
|
*/
|
||||||
public void setWhitelisted(boolean value);
|
public void setWhitelisted(boolean value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a {@link Player} object that this represents, if there is one
|
* Gets a {@link Player} object that this represents, if there is one
|
||||||
* <p>
|
* <p>
|
||||||
* If the player is online, this will return that player. Otherwise,
|
* If the player is online, this will return that player. Otherwise,
|
||||||
* it will return null.
|
* it will return null.
|
||||||
*
|
*
|
||||||
* @return Online player
|
* @return Online player
|
||||||
*/
|
*/
|
||||||
public Player getPlayer();
|
public Player getPlayer();
|
||||||
|
@ -53,10 +53,10 @@ public interface Server {
|
|||||||
* @return version of this server implementation
|
* @return version of this server implementation
|
||||||
*/
|
*/
|
||||||
public String getVersion();
|
public String getVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Bukkit version that this server is running.
|
* Gets the Bukkit version that this server is running.
|
||||||
*
|
*
|
||||||
* @return Version of Bukkit
|
* @return Version of Bukkit
|
||||||
*/
|
*/
|
||||||
public String getBukkitVersion();
|
public String getBukkitVersion();
|
||||||
@ -110,7 +110,7 @@ public interface Server {
|
|||||||
* @return The ID of this server
|
* @return The ID of this server
|
||||||
*/
|
*/
|
||||||
public String getServerId();
|
public String getServerId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether this server allows the End or not.
|
* Gets whether this server allows the End or not.
|
||||||
*
|
*
|
||||||
@ -304,7 +304,7 @@ public interface Server {
|
|||||||
*/
|
*/
|
||||||
public World createWorld(WorldCreator creator);
|
public World createWorld(WorldCreator creator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads a world with the given name.
|
* Unloads a world with the given name.
|
||||||
*
|
*
|
||||||
* @param name Name of the world to unload
|
* @param name Name of the world to unload
|
||||||
@ -398,6 +398,7 @@ public interface Server {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a recipe to the crafting manager.
|
* Adds a recipe to the crafting manager.
|
||||||
|
*
|
||||||
* @param recipe The recipe to add.
|
* @param recipe The recipe to add.
|
||||||
* @return True to indicate that the recipe was added.
|
* @return True to indicate that the recipe was added.
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ public interface TravelAgent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to create a portal near the given location.
|
* Attempt to create a portal near the given location.
|
||||||
*
|
*
|
||||||
* @param location The desired location of the portal.
|
* @param location The desired location of the portal.
|
||||||
* @return True if a nether portal was successfully created.
|
* @return True if a nether portal was successfully created.
|
||||||
*/
|
*/
|
||||||
|
@ -552,12 +552,14 @@ public interface World {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current PVP setting for this world.
|
* Gets the current PVP setting for this world.
|
||||||
|
*
|
||||||
* @return True if PVP is enabled
|
* @return True if PVP is enabled
|
||||||
*/
|
*/
|
||||||
public boolean getPVP();
|
public boolean getPVP();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the PVP setting for this world.
|
* Sets the PVP setting for this world.
|
||||||
|
*
|
||||||
* @param pvp True/False whether PVP should be Enabled.
|
* @param pvp True/False whether PVP should be Enabled.
|
||||||
*/
|
*/
|
||||||
public void setPVP(boolean pvp);
|
public void setPVP(boolean pvp);
|
||||||
@ -613,7 +615,8 @@ public interface World {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome
|
* Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome
|
||||||
* data. Used for representing an ungenerated chunk, or for fetching only biome data without loading a chunk.
|
* data. Used for representing an ungenerated chunk, or for fetching only biome data without loading a chunk.
|
||||||
|
*
|
||||||
* @param x - chunk x coordinate
|
* @param x - chunk x coordinate
|
||||||
* @param z - chunk z coordinate
|
* @param z - chunk z coordinate
|
||||||
* @param includeBiome - if true, snapshot includes per-coordinate biome type
|
* @param includeBiome - if true, snapshot includes per-coordinate biome type
|
||||||
@ -706,10 +709,10 @@ public interface World {
|
|||||||
public boolean getKeepSpawnInMemory();
|
public boolean getKeepSpawnInMemory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the world's spawn area should be kept loaded into memory or not.
|
* Sets whether the world's spawn area should be kept loaded into memory or not.
|
||||||
*
|
*
|
||||||
* @param keepLoaded if true then the world's spawn area will be kept loaded into memory.
|
* @param keepLoaded if true then the world's spawn area will be kept loaded into memory.
|
||||||
*/
|
*/
|
||||||
public void setKeepSpawnInMemory(boolean keepLoaded);
|
public void setKeepSpawnInMemory(boolean keepLoaded);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,7 +226,7 @@ public class WorldCreator {
|
|||||||
if (output == null) {
|
if (output == null) {
|
||||||
output = Bukkit.getConsoleSender();
|
output = Bukkit.getConsoleSender();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
String[] split = name.split(":", 2);
|
String[] split = name.split(":", 2);
|
||||||
String id = (split.length > 1) ? split[1] : null;
|
String id = (split.length > 1) ? split[1] : null;
|
||||||
|
@ -23,12 +23,14 @@ public interface Block {
|
|||||||
/**
|
/**
|
||||||
* @deprecated use {@link #getRelative(BlockFace face)}
|
* @deprecated use {@link #getRelative(BlockFace face)}
|
||||||
*/
|
*/
|
||||||
@Deprecated Block getFace(BlockFace face);
|
@Deprecated
|
||||||
|
Block getFace(BlockFace face);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use {@link #getRelative(BlockFace face, int distance)}
|
* @deprecated use {@link #getRelative(BlockFace face, int distance)}
|
||||||
*/
|
*/
|
||||||
@Deprecated Block getFace(BlockFace face, int distance);
|
@Deprecated
|
||||||
|
Block getFace(BlockFace face, int distance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block at the given offsets
|
* Gets the block at the given offsets
|
||||||
@ -56,8 +58,9 @@ public interface Block {
|
|||||||
* <br />
|
* <br />
|
||||||
* For example, the following method places water at 100,102,100; two blocks
|
* For example, the following method places water at 100,102,100; two blocks
|
||||||
* above 100,100,100.
|
* above 100,100,100.
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Block block = world.getBlockAt(100,100,100);
|
* Block block = world.getBlockAt(100, 100, 100);
|
||||||
* Block shower = block.getFace(BlockFace.UP, 2);
|
* Block shower = block.getFace(BlockFace.UP, 2);
|
||||||
* shower.setType(Material.WATER);
|
* shower.setType(Material.WATER);
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -164,12 +167,14 @@ public interface Block {
|
|||||||
* Gets the face relation of this block compared to the given block<br />
|
* Gets the face relation of this block compared to the given block<br />
|
||||||
* <br />
|
* <br />
|
||||||
* For example:
|
* For example:
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Block current = world.getBlockAt(100, 100, 100);
|
* Block current = world.getBlockAt(100, 100, 100);
|
||||||
* Block target = world.getBlockAt(100, 101, 100);
|
* Block target = world.getBlockAt(100, 101, 100);
|
||||||
*
|
*
|
||||||
* current.getFace(target) == BlockFace.Up;
|
* current.getFace(target) == BlockFace.Up;
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
* <br />
|
* <br />
|
||||||
* If the given block is not connected to this block, null may be returned
|
* If the given block is not connected to this block, null may be returned
|
||||||
*
|
*
|
||||||
|
@ -42,6 +42,7 @@ public enum BlockFace {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of X-coordinates to modify to get the represented block
|
* Get the amount of X-coordinates to modify to get the represented block
|
||||||
|
*
|
||||||
* @return Amount of X-coordinates to modify
|
* @return Amount of X-coordinates to modify
|
||||||
*/
|
*/
|
||||||
public int getModX() {
|
public int getModX() {
|
||||||
@ -50,6 +51,7 @@ public enum BlockFace {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of Y-coordinates to modify to get the represented block
|
* Get the amount of Y-coordinates to modify to get the represented block
|
||||||
|
*
|
||||||
* @return Amount of Y-coordinates to modify
|
* @return Amount of Y-coordinates to modify
|
||||||
*/
|
*/
|
||||||
public int getModY() {
|
public int getModY() {
|
||||||
@ -58,6 +60,7 @@ public enum BlockFace {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of Z-coordinates to modify to get the represented block
|
* Get the amount of Z-coordinates to modify to get the represented block
|
||||||
|
*
|
||||||
* @return Amount of Z-coordinates to modify
|
* @return Amount of Z-coordinates to modify
|
||||||
*/
|
*/
|
||||||
public int getModZ() {
|
public int getModZ() {
|
||||||
|
@ -8,24 +8,28 @@ import org.bukkit.Material;
|
|||||||
public interface Jukebox extends BlockState {
|
public interface Jukebox extends BlockState {
|
||||||
/**
|
/**
|
||||||
* Get the record currently playing
|
* Get the record currently playing
|
||||||
|
*
|
||||||
* @return The record Material, or AIR if none is playing
|
* @return The record Material, or AIR if none is playing
|
||||||
*/
|
*/
|
||||||
public Material getPlaying();
|
public Material getPlaying();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the record currently playing
|
* Set the record currently playing
|
||||||
|
*
|
||||||
* @param record The record Material, or null/AIR to stop playing
|
* @param record The record Material, or null/AIR to stop playing
|
||||||
*/
|
*/
|
||||||
public void setPlaying(Material record);
|
public void setPlaying(Material record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the jukebox is currently playing a record
|
* Check if the jukebox is currently playing a record
|
||||||
|
*
|
||||||
* @return True if there is a record playing
|
* @return True if there is a record playing
|
||||||
*/
|
*/
|
||||||
public boolean isPlaying();
|
public boolean isPlaying();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the jukebox playing and eject the current record
|
* Stop the jukebox playing and eject the current record
|
||||||
|
*
|
||||||
* @return True if a record was ejected; false if there was none playing
|
* @return True if a record was ejected; false if there was none playing
|
||||||
*/
|
*/
|
||||||
public boolean eject();
|
public boolean eject();
|
||||||
|
@ -47,7 +47,7 @@ public interface NoteBlock extends BlockState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays an arbitrary note with an arbitrary instrument
|
* Plays an arbitrary note with an arbitrary instrument
|
||||||
*
|
*
|
||||||
* @param instrument Instrument ID
|
* @param instrument Instrument ID
|
||||||
* @param note Note ID
|
* @param note Note ID
|
||||||
* @return true if successful, otherwise false
|
* @return true if successful, otherwise false
|
||||||
@ -56,7 +56,7 @@ public interface NoteBlock extends BlockState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays an arbitrary note with an arbitrary instrument
|
* Plays an arbitrary note with an arbitrary instrument
|
||||||
*
|
*
|
||||||
* @param instrument The instrument
|
* @param instrument The instrument
|
||||||
* @param note The note
|
* @param note The note
|
||||||
* @return true if successful, otherwise false
|
* @return true if successful, otherwise false
|
||||||
|
@ -11,7 +11,7 @@ public enum PistonMoveReaction {
|
|||||||
private int id;
|
private int id;
|
||||||
private static Map<Integer, PistonMoveReaction> byId = new HashMap<Integer, PistonMoveReaction>();
|
private static Map<Integer, PistonMoveReaction> byId = new HashMap<Integer, PistonMoveReaction>();
|
||||||
static {
|
static {
|
||||||
for (PistonMoveReaction reaction: PistonMoveReaction.values()) {
|
for (PistonMoveReaction reaction : PistonMoveReaction.values()) {
|
||||||
byId.put(reaction.id, reaction);
|
byId.put(reaction.id, reaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,6 @@ public abstract class Command {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean allowChangesFrom(CommandMap commandMap) {
|
private boolean allowChangesFrom(CommandMap commandMap) {
|
||||||
return (null == this.commandMap || this.commandMap == commandMap);
|
return (null == this.commandMap || this.commandMap == commandMap);
|
||||||
}
|
}
|
||||||
@ -237,7 +236,7 @@ public abstract class Command {
|
|||||||
|
|
||||||
for (Permissible user : users) {
|
for (Permissible user : users) {
|
||||||
if (user instanceof CommandSender) {
|
if (user instanceof CommandSender) {
|
||||||
CommandSender target = (CommandSender)user;
|
CommandSender target = (CommandSender) user;
|
||||||
|
|
||||||
if (target instanceof ConsoleCommandSender) {
|
if (target instanceof ConsoleCommandSender) {
|
||||||
target.sendMessage(result);
|
target.sendMessage(result);
|
||||||
|
@ -3,6 +3,7 @@ package org.bukkit.command;
|
|||||||
/**
|
/**
|
||||||
* Thrown when an unhandled exception occurs during the execution of a Command
|
* Thrown when an unhandled exception occurs during the execution of a Command
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class CommandException extends RuntimeException {
|
public class CommandException extends RuntimeException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,6 +13,7 @@ public class CommandException extends RuntimeException {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an instance of <code>CommandException</code> with the specified detail message.
|
* Constructs an instance of <code>CommandException</code> with the specified detail message.
|
||||||
|
*
|
||||||
* @param msg the detail message.
|
* @param msg the detail message.
|
||||||
*/
|
*/
|
||||||
public CommandException(String msg) {
|
public CommandException(String msg) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.bukkit.command;
|
package org.bukkit.command;
|
||||||
|
|
||||||
public interface ConsoleCommandSender extends CommandSender{
|
public interface ConsoleCommandSender extends CommandSender {
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package org.bukkit.command;
|
package org.bukkit.command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public final class PluginCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success && usageMessage.length() > 0) {
|
if (!success && usageMessage.length() > 0) {
|
||||||
for (String line: usageMessage.replace("<command>", commandLabel).split("\n")) {
|
for (String line : usageMessage.replace("<command>", commandLabel).split("\n")) {
|
||||||
sender.sendMessage(line);
|
sender.sendMessage(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.bukkit.command;
|
package org.bukkit.command;
|
||||||
|
|
||||||
public interface RemoteConsoleCommandSender extends CommandSender{
|
public interface RemoteConsoleCommandSender extends CommandSender {
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class SimpleCommandMap implements CommandMap {
|
|||||||
public boolean register(String label, String fallbackPrefix, Command command) {
|
public boolean register(String label, String fallbackPrefix, Command command) {
|
||||||
boolean registeredPassedLabel = register(label, fallbackPrefix, command, false);
|
boolean registeredPassedLabel = register(label, fallbackPrefix, command, false);
|
||||||
|
|
||||||
Iterator iterator = command.getAliases().iterator();
|
Iterator<String> iterator = command.getAliases().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
if (!register((String) iterator.next(), fallbackPrefix, command, true)) {
|
if (!register((String) iterator.next(), fallbackPrefix, command, true)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
@ -94,12 +94,13 @@ public class SimpleCommandMap implements CommandMap {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a command with the given name is possible, otherwise uses fallbackPrefix to create a unique name if its not an alias
|
* Registers a command with the given name is possible, otherwise uses fallbackPrefix to create a unique name if its not an alias
|
||||||
|
*
|
||||||
* @param name the name of the command, without the '/'-prefix.
|
* @param name the name of the command, without the '/'-prefix.
|
||||||
* @param fallbackPrefix a prefix which is prepended to the command with a ':' one or more times to make the command unique
|
* @param fallbackPrefix a prefix which is prepended to the command with a ':' one or more times to make the command unique
|
||||||
* @param command the command to register
|
* @param command the command to register
|
||||||
* @return true if command was registered with the passed in label, false otherwise.
|
* @return true if command was registered with the passed in label, false otherwise.
|
||||||
* If isAlias was true a return of false indicates no command was registerd
|
* If isAlias was true a return of false indicates no command was registerd
|
||||||
* If isAlias was false a return of false indicates the fallbackPrefix was used one or more times to create a unique name for the command
|
* If isAlias was false a return of false indicates the fallbackPrefix was used one or more times to create a unique name for the command
|
||||||
*/
|
*/
|
||||||
private synchronized boolean register(String label, String fallbackPrefix, Command command, boolean isAlias) {
|
private synchronized boolean register(String label, String fallbackPrefix, Command command, boolean isAlias) {
|
||||||
String lowerLabel = label.trim().toLowerCase();
|
String lowerLabel = label.trim().toLowerCase();
|
||||||
|
@ -29,7 +29,7 @@ public class DeopCommand extends VanillaCommand {
|
|||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
|
|
||||||
if (player instanceof Player) {
|
if (player instanceof Player) {
|
||||||
((Player)player).sendMessage(ChatColor.YELLOW + "You are no longer op!");
|
((Player) player).sendMessage(ChatColor.YELLOW + "You are no longer op!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -28,7 +28,7 @@ public class ExpCommand extends VanillaCommand {
|
|||||||
try {
|
try {
|
||||||
int exp = Integer.parseInt(args[1]);
|
int exp = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
Command.broadcastCommandMessage(sender, "Giving " + exp + " exp to " + player.getName());
|
Command.broadcastCommandMessage(sender, "Giving " + exp + " exp to " + player.getName());
|
||||||
|
|
||||||
player.giveExp(exp);
|
player.giveExp(exp);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
|
@ -18,7 +18,7 @@ public class KillCommand extends VanillaCommand {
|
|||||||
if (!testPermission(sender)) return true;
|
if (!testPermission(sender)) return true;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
EntityDamageEvent ede = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.SUICIDE, 1000);
|
EntityDamageEvent ede = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.SUICIDE, 1000);
|
||||||
Bukkit.getPluginManager().callEvent(ede);
|
Bukkit.getPluginManager().callEvent(ede);
|
||||||
|
@ -23,10 +23,10 @@ public class MeCommand extends VanillaCommand {
|
|||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append(sender.getName());
|
message.append(sender.getName());
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (String arg : args) {
|
||||||
message.append(" ");
|
message.append(" ");
|
||||||
message.append(args[i]);
|
message.append(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.broadcastMessage("* " + message.toString());
|
Bukkit.broadcastMessage("* " + message.toString());
|
||||||
|
@ -29,7 +29,7 @@ public class OpCommand extends VanillaCommand {
|
|||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
|
|
||||||
if (player instanceof Player) {
|
if (player instanceof Player) {
|
||||||
((Player)player).sendMessage(ChatColor.YELLOW + "You are now op!");
|
((Player) player).sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,7 @@ public class PluginsCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||||
if (!testPermission(sender)) return true;
|
if (!testPermission(sender)) return true;
|
||||||
|
|
||||||
sender.sendMessage("Plugins: " + getPluginList());
|
sender.sendMessage("Plugins: " + getPluginList());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -27,13 +27,13 @@ public class PluginsCommand extends Command {
|
|||||||
private String getPluginList() {
|
private String getPluginList() {
|
||||||
StringBuilder pluginList = new StringBuilder();
|
StringBuilder pluginList = new StringBuilder();
|
||||||
Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||||
|
|
||||||
for (Plugin plugin : plugins) {
|
for (Plugin plugin : plugins) {
|
||||||
if (pluginList.length() > 0) {
|
if (pluginList.length() > 0) {
|
||||||
pluginList.append(ChatColor.WHITE);
|
pluginList.append(ChatColor.WHITE);
|
||||||
pluginList.append(", ");
|
pluginList.append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
|
pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
|
||||||
pluginList.append(plugin.getDescription().getName());
|
pluginList.append(plugin.getDescription().getName());
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ public class SayCommand extends VanillaCommand {
|
|||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
message.append(args[0]);
|
message.append(args[0]);
|
||||||
for (int i = 1; i < args.length; i++) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
message.append(" ");
|
message.append(" ");
|
||||||
message.append(args[i]);
|
message.append(args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sender instanceof ConsoleCommandSender)) {
|
if (!(sender instanceof ConsoleCommandSender)) {
|
||||||
|
@ -15,7 +15,7 @@ public class TimeCommand extends VanillaCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Incorrect usage. Correct usage:\n" + usageMessage);
|
sender.sendMessage(ChatColor.RED + "Incorrect usage. Correct usage:\n" + usageMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class ToggleDownfallCommand extends VanillaCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (sender instanceof Player) {
|
} else if (sender instanceof Player) {
|
||||||
world = ((Player)sender).getWorld();
|
world = ((Player) sender).getWorld();
|
||||||
} else {
|
} else {
|
||||||
world = Bukkit.getWorlds().get(0);
|
world = Bukkit.getWorlds().get(0);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
|||||||
public class VersionCommand extends Command {
|
public class VersionCommand extends Command {
|
||||||
public VersionCommand(String name) {
|
public VersionCommand(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.description = "Gets the version of this server including any plugins in use";
|
this.description = "Gets the version of this server including any plugins in use";
|
||||||
this.usageMessage = "/version [plugin name]";
|
this.usageMessage = "/version [plugin name]";
|
||||||
this.setPermission("bukkit.command.version");
|
this.setPermission("bukkit.command.version");
|
||||||
@ -22,7 +22,7 @@ public class VersionCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||||
if (!testPermission(sender)) return true;
|
if (!testPermission(sender)) return true;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
|
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
|
||||||
} else {
|
} else {
|
||||||
@ -32,7 +32,7 @@ public class VersionCommand extends Command {
|
|||||||
if (name.length() > 0) {
|
if (name.length() > 0) {
|
||||||
name.append(' ');
|
name.append(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
name.append(arg);
|
name.append(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public class VersionCommand extends Command {
|
|||||||
result.append(ChatColor.GREEN);
|
result.append(ChatColor.GREEN);
|
||||||
result.append(authors.get(i));
|
result.append(authors.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,12 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
* @return Configuration source for default values, or null if none exist.
|
* @return Configuration source for default values, or null if none exist.
|
||||||
*/
|
*/
|
||||||
public Configuration getDefaults();
|
public Configuration getDefaults();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ConfigurationOptions} for this {@link Configuration}.
|
* Gets the {@link ConfigurationOptions} for this {@link Configuration}.
|
||||||
* <p>
|
* <p>
|
||||||
* All setters through this method are chainable.
|
* All setters through this method are chainable.
|
||||||
*
|
*
|
||||||
* @return Options for this configuration
|
* @return Options for this configuration
|
||||||
*/
|
*/
|
||||||
public ConfigurationOptions options();
|
public ConfigurationOptions options();
|
||||||
|
@ -7,38 +7,38 @@ public class ConfigurationOptions {
|
|||||||
private char pathSeparator = '.';
|
private char pathSeparator = '.';
|
||||||
private boolean copyDefaults = false;
|
private boolean copyDefaults = false;
|
||||||
private final Configuration configuration;
|
private final Configuration configuration;
|
||||||
|
|
||||||
protected ConfigurationOptions(Configuration configuration) {
|
protected ConfigurationOptions(Configuration configuration) {
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Configuration} that this object is responsible for.
|
* Returns the {@link Configuration} that this object is responsible for.
|
||||||
*
|
*
|
||||||
* @return Parent configuration
|
* @return Parent configuration
|
||||||
*/
|
*/
|
||||||
public Configuration configuration() {
|
public Configuration configuration() {
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the char that will be used to separate {@link ConfigurationSection}s
|
* Gets the char that will be used to separate {@link ConfigurationSection}s
|
||||||
* <p>
|
* <p>
|
||||||
* This value does not affect how the {@link Configuration} is stored, only in
|
* This value does not affect how the {@link Configuration} is stored, only in
|
||||||
* how you access the data. The default value is '.'.
|
* how you access the data. The default value is '.'.
|
||||||
*
|
*
|
||||||
* @return Path separator
|
* @return Path separator
|
||||||
*/
|
*/
|
||||||
public char pathSeparator() {
|
public char pathSeparator() {
|
||||||
return pathSeparator;
|
return pathSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the char that will be used to separate {@link ConfigurationSection}s
|
* Sets the char that will be used to separate {@link ConfigurationSection}s
|
||||||
* <p>
|
* <p>
|
||||||
* This value does not affect how the {@link Configuration} is stored, only in
|
* This value does not affect how the {@link Configuration} is stored, only in
|
||||||
* how you access the data. The default value is '.'.
|
* how you access the data. The default value is '.'.
|
||||||
*
|
*
|
||||||
* @param value Path separator
|
* @param value Path separator
|
||||||
* @return This object, for chaining
|
* @return This object, for chaining
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ public class ConfigurationOptions {
|
|||||||
this.pathSeparator = value;
|
this.pathSeparator = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the {@link Configuration} should copy values from its default {@link Configuration} directly.
|
* Checks if the {@link Configuration} should copy values from its default {@link Configuration} directly.
|
||||||
* <p>
|
* <p>
|
||||||
@ -55,13 +55,13 @@ public class ConfigurationOptions {
|
|||||||
* are provided by default. As a result, {@link ConfigurationSection#contains(java.lang.String)} will always
|
* are provided by default. As a result, {@link ConfigurationSection#contains(java.lang.String)} will always
|
||||||
* return the same value as {@link ConfigurationSection#isSet(java.lang.String)}.
|
* return the same value as {@link ConfigurationSection#isSet(java.lang.String)}.
|
||||||
* The default value is false.
|
* The default value is false.
|
||||||
*
|
*
|
||||||
* @return Whether or not defaults are directly copied
|
* @return Whether or not defaults are directly copied
|
||||||
*/
|
*/
|
||||||
public boolean copyDefaults() {
|
public boolean copyDefaults() {
|
||||||
return copyDefaults;
|
return copyDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets if the {@link Configuration} should copy values from its default {@link Configuration} directly.
|
* Sets if the {@link Configuration} should copy values from its default {@link Configuration} directly.
|
||||||
* <p>
|
* <p>
|
||||||
@ -70,7 +70,7 @@ public class ConfigurationOptions {
|
|||||||
* are provided by default. As a result, {@link ConfigurationSection#contains(java.lang.String)} will always
|
* are provided by default. As a result, {@link ConfigurationSection#contains(java.lang.String)} will always
|
||||||
* return the same value as {@link ConfigurationSection#isSet(java.lang.String)}.
|
* return the same value as {@link ConfigurationSection#isSet(java.lang.String)}.
|
||||||
* The default value is false.
|
* The default value is false.
|
||||||
*
|
*
|
||||||
* @param value Whether or not defaults are directly copied
|
* @param value Whether or not defaults are directly copied
|
||||||
* @return This object, for chaining
|
* @return This object, for chaining
|
||||||
*/
|
*/
|
||||||
|
@ -79,13 +79,13 @@ public interface ConfigurationSection {
|
|||||||
* @return Path of this section relative to its root
|
* @return Path of this section relative to its root
|
||||||
*/
|
*/
|
||||||
public String getCurrentPath();
|
public String getCurrentPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of this individual {@link ConfigurationSection}, in the path.
|
* Gets the name of this individual {@link ConfigurationSection}, in the path.
|
||||||
* <p>
|
* <p>
|
||||||
* This will always be the final part of {@link #getCurrentPath()}, unless the
|
* This will always be the final part of {@link #getCurrentPath()}, unless the
|
||||||
* section is orphaned.
|
* section is orphaned.
|
||||||
*
|
*
|
||||||
* @return Name of this section
|
* @return Name of this section
|
||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
@ -146,7 +146,7 @@ public interface ConfigurationSection {
|
|||||||
* <p>
|
* <p>
|
||||||
* Some implementations may have limitations on what you may store. See their
|
* Some implementations may have limitations on what you may store. See their
|
||||||
* individual javadocs for details. No implementations should allow you to store
|
* individual javadocs for details. No implementations should allow you to store
|
||||||
* {@link Configuration}s or {@link ConfigurationSection}s, please use
|
* {@link Configuration}s or {@link ConfigurationSection}s, please use
|
||||||
* {@link #createSection(java.lang.String)} for that.
|
* {@link #createSection(java.lang.String)} for that.
|
||||||
*
|
*
|
||||||
* @param path Path of the object to set.
|
* @param path Path of the object to set.
|
||||||
@ -164,7 +164,7 @@ public interface ConfigurationSection {
|
|||||||
* @return Newly created section
|
* @return Newly created section
|
||||||
*/
|
*/
|
||||||
public ConfigurationSection createSection(String path);
|
public ConfigurationSection createSection(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link ConfigurationSection} at the specified path, with specified values.
|
* Creates a {@link ConfigurationSection} at the specified path, with specified values.
|
||||||
* <p>
|
* <p>
|
||||||
@ -213,7 +213,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isString(String path);
|
public boolean isString(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested int by path.
|
* Gets the requested int by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -250,7 +249,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isInt(String path);
|
public boolean isInt(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested boolean by path.
|
* Gets the requested boolean by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -287,7 +285,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isBoolean(String path);
|
public boolean isBoolean(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested double by path.
|
* Gets the requested double by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -324,7 +321,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isDouble(String path);
|
public boolean isDouble(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested long by path.
|
* Gets the requested long by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -361,8 +357,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isLong(String path);
|
public boolean isLong(String path);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Java
|
// Java
|
||||||
/**
|
/**
|
||||||
* Gets the requested List by path.
|
* Gets the requested List by path.
|
||||||
@ -374,6 +368,7 @@ public interface ConfigurationSection {
|
|||||||
* @param path Path of the List to get.
|
* @param path Path of the List to get.
|
||||||
* @return Requested List.
|
* @return Requested List.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public List getList(String path);
|
public List getList(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -385,7 +380,8 @@ public interface ConfigurationSection {
|
|||||||
* @param path Path of the List to get.
|
* @param path Path of the List to get.
|
||||||
* @return Requested List.
|
* @return Requested List.
|
||||||
*/
|
*/
|
||||||
public List getList(String path, List def);
|
@SuppressWarnings("rawtypes")
|
||||||
|
public List getList(String path, List<?> def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the specified path is a List.
|
* Checks if the specified path is a List.
|
||||||
@ -400,7 +396,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isList(String path);
|
public boolean isList(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested List of String by path.
|
* Gets the requested List of String by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -551,7 +546,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getMapList(String path);
|
public List<Map<String, Object>> getMapList(String path);
|
||||||
|
|
||||||
|
|
||||||
// Bukkit
|
// Bukkit
|
||||||
/**
|
/**
|
||||||
* Gets the requested Vector by path.
|
* Gets the requested Vector by path.
|
||||||
@ -589,7 +583,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isVector(String path);
|
public boolean isVector(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested OfflinePlayer by path.
|
* Gets the requested OfflinePlayer by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -626,7 +619,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isOfflinePlayer(String path);
|
public boolean isOfflinePlayer(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested ItemStack by path.
|
* Gets the requested ItemStack by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -663,7 +655,6 @@ public interface ConfigurationSection {
|
|||||||
*/
|
*/
|
||||||
public boolean isItemStack(String path);
|
public boolean isItemStack(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the requested ConfigurationSection by path.
|
* Gets the requested ConfigurationSection by path.
|
||||||
* <p>
|
* <p>
|
||||||
@ -688,18 +679,18 @@ public interface ConfigurationSection {
|
|||||||
* @return Whether or not the specified path is a ConfigurationSection.
|
* @return Whether or not the specified path is a ConfigurationSection.
|
||||||
*/
|
*/
|
||||||
public boolean isConfigurationSection(String path);
|
public boolean isConfigurationSection(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the equivalent {@link ConfigurationSection} from the default {@link Configuration} defined in {@link #getRoot()}.
|
* Gets the equivalent {@link ConfigurationSection} from the default {@link Configuration} defined in {@link #getRoot()}.
|
||||||
* <p>
|
* <p>
|
||||||
* If the root contains no defaults, or the defaults doesn't contain a value
|
* If the root contains no defaults, or the defaults doesn't contain a value
|
||||||
* for this path, or the value at this path is not a {@link ConfigurationSection} then
|
* for this path, or the value at this path is not a {@link ConfigurationSection} then
|
||||||
* this will return null.
|
* this will return null.
|
||||||
*
|
*
|
||||||
* @return Equivalent section in root configuration
|
* @return Equivalent section in root configuration
|
||||||
*/
|
*/
|
||||||
public ConfigurationSection getDefaultSection();
|
public ConfigurationSection getDefaultSection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default value in the root at the given path as provided.
|
* Sets the default value in the root at the given path as provided.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -3,6 +3,7 @@ package org.bukkit.configuration;
|
|||||||
/**
|
/**
|
||||||
* Exception thrown when attempting to load an invalid {@link Configuration}
|
* Exception thrown when attempting to load an invalid {@link Configuration}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class InvalidConfigurationException extends Exception {
|
public class InvalidConfigurationException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of InvalidConfigurationException without a message or cause.
|
* Creates a new instance of InvalidConfigurationException without a message or cause.
|
||||||
|
@ -32,7 +32,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
|||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path may not be null");
|
throw new IllegalArgumentException("Path may not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaults == null) {
|
if (defaults == null) {
|
||||||
defaults = new MemoryConfiguration();
|
defaults = new MemoryConfiguration();
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
|||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = new MemoryConfigurationOptions(this);
|
options = new MemoryConfigurationOptions(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public class MemoryConfigurationOptions extends ConfigurationOptions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemoryConfiguration configuration() {
|
public MemoryConfiguration configuration() {
|
||||||
return (MemoryConfiguration)super.configuration();
|
return (MemoryConfiguration) super.configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
this.path = "";
|
this.path = "";
|
||||||
this.fullPath = "";
|
this.fullPath = "";
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.root = (Configuration)this;
|
this.root = (Configuration) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,16 +65,16 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
if (root == null) {
|
if (root == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be orphaned");
|
throw new IllegalArgumentException("Path cannot be orphaned");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fullPath = createPath(parent, path);
|
this.fullPath = createPath(parent, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getKeys(boolean deep) {
|
public Set<String> getKeys(boolean deep) {
|
||||||
Set<String> result = new LinkedHashSet<String>();
|
Set<String> result = new LinkedHashSet<String>();
|
||||||
|
|
||||||
if (getRoot().options().copyDefaults()) {
|
if (getRoot().options().copyDefaults()) {
|
||||||
ConfigurationSection defaults = getDefaultSection();
|
ConfigurationSection defaults = getDefaultSection();
|
||||||
|
|
||||||
if (defaults != null) {
|
if (defaults != null) {
|
||||||
result.addAll(defaults.getKeys(deep));
|
result.addAll(defaults.getKeys(deep));
|
||||||
}
|
}
|
||||||
@ -87,10 +87,10 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
public Map<String, Object> getValues(boolean deep) {
|
public Map<String, Object> getValues(boolean deep) {
|
||||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
if (getRoot().options().copyDefaults()) {
|
if (getRoot().options().copyDefaults()) {
|
||||||
ConfigurationSection defaults = getDefaultSection();
|
ConfigurationSection defaults = getDefaultSection();
|
||||||
|
|
||||||
if (defaults != null) {
|
if (defaults != null) {
|
||||||
result.putAll(defaults.getValues(deep));
|
result.putAll(defaults.getValues(deep));
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
public String getCurrentPath() {
|
public String getCurrentPath() {
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
@ -136,32 +136,32 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
public ConfigurationSection getParent() {
|
public ConfigurationSection getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDefault(String path, Object value) {
|
public void addDefault(String path, Object value) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
throw new IllegalStateException("Cannot set default on orphaned section");
|
throw new IllegalStateException("Cannot set default on orphaned section");
|
||||||
} else {
|
} else {
|
||||||
root.addDefault(createPath(this, path), value);
|
root.addDefault(createPath(this, path), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurationSection getDefaultSection() {
|
public ConfigurationSection getDefaultSection() {
|
||||||
if (getRoot() == null) {
|
if (getRoot() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration defaults = getRoot().getDefaults();
|
Configuration defaults = getRoot().getDefaults();
|
||||||
|
|
||||||
if (defaults != null) {
|
if (defaults != null) {
|
||||||
if (defaults.isConfigurationSection(getCurrentPath())) {
|
if (defaults.isConfigurationSection(getCurrentPath())) {
|
||||||
return defaults.getConfigurationSection(getCurrentPath());
|
return defaults.getConfigurationSection(getCurrentPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,9 +169,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
String[] split = path.split(Pattern.quote(Character.toString(getRoot().options().pathSeparator())));
|
String[] split = path.split(Pattern.quote(Character.toString(getRoot().options().pathSeparator())));
|
||||||
ConfigurationSection section = this;
|
ConfigurationSection section = this;
|
||||||
|
|
||||||
if (path == null) {
|
if (path.length() == 0) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
|
||||||
} else if (path.length() == 0) {
|
|
||||||
throw new IllegalArgumentException("Cannot set to an empty path");
|
throw new IllegalArgumentException("Cannot set to an empty path");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +217,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
for (int i = 0; i < split.length - 1; i++) {
|
for (int i = 0; i < split.length - 1; i++) {
|
||||||
section = section.getConfigurationSection(split[i]);
|
section = section.getConfigurationSection(split[i]);
|
||||||
|
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
@ -230,11 +228,8 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
if (section == this) {
|
if (section == this) {
|
||||||
result = map.get(key);
|
result = map.get(key);
|
||||||
return (result == null) ? def : result;
|
return (result == null) ? def : result;
|
||||||
} else if (section != null) {
|
|
||||||
return section.get(key, def);
|
|
||||||
} else {
|
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
|
return section.get(key, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurationSection createSection(String path) {
|
public ConfigurationSection createSection(String path) {
|
||||||
@ -267,13 +262,14 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
return section.createSection(key);
|
return section.createSection(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public ConfigurationSection createSection(String path, Map<String, Object> map) {
|
public ConfigurationSection createSection(String path, Map<String, Object> map) {
|
||||||
ConfigurationSection section = createSection(path);
|
ConfigurationSection section = createSection(path);
|
||||||
|
|
||||||
for(Map.Entry<String, Object> entry : map.entrySet()) {
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
if(entry.getValue() instanceof Map) {
|
if (entry.getValue() instanceof Map) {
|
||||||
section.createSection(entry.getKey(), (Map<String, Object>)entry.getValue());
|
section.createSection(entry.getKey(), (Map<String, Object>) entry.getValue());
|
||||||
} else {
|
} else {
|
||||||
section.set(entry.getKey(), entry.getValue());
|
section.set(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
@ -343,7 +339,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object def = getDefault(path);
|
Object def = getDefault(path);
|
||||||
return getBoolean(path, (def instanceof Boolean) ? (Boolean)def : false);
|
return getBoolean(path, (def instanceof Boolean) ? (Boolean) def : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBoolean(String path, boolean def) {
|
public boolean getBoolean(String path, boolean def) {
|
||||||
@ -352,7 +348,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, def);
|
Object val = get(path, def);
|
||||||
return (val instanceof Boolean) ? (Boolean)val : def;
|
return (val instanceof Boolean) ? (Boolean) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBoolean(String path) {
|
public boolean isBoolean(String path) {
|
||||||
@ -418,23 +414,25 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
return val instanceof Long;
|
return val instanceof Long;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Java
|
// Java
|
||||||
public List getList(String path) {
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<Object> getList(String path) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object def = getDefault(path);
|
Object def = getDefault(path);
|
||||||
return getList(path, (def instanceof List) ? (List)def : null);
|
return getList(path, (def instanceof List) ? (List<Object>) def : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getList(String path, List def) {
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<Object> getList(String path, List<?> def) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, def);
|
Object val = get(path, def);
|
||||||
return (val instanceof List) ? (List)val : def;
|
return (List<Object>) ((val instanceof List) ? val : def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isList(String path) {
|
public boolean isList(String path) {
|
||||||
@ -452,19 +450,19 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> result = new ArrayList();
|
List<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if ((object instanceof String) || (isPrimitiveWrapper(object))) {
|
if ((object instanceof String) || (isPrimitiveWrapper(object))) {
|
||||||
result.add(String.valueOf(object));
|
result.add(String.valueOf(object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,37 +472,38 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Integer> result = new ArrayList();
|
List<Integer> result = new ArrayList<Integer>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Integer) {
|
if (object instanceof Integer) {
|
||||||
result.add((Integer)object);
|
result.add((Integer) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Integer.valueOf((String)object));
|
result.add(Integer.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Integer)(int)(byte)(Byte)object);
|
result.add((Integer) (int) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Integer)(int)(char)(Character)object);
|
result.add((Integer) (int) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Integer)(int)(short)(Short)object);
|
result.add((Integer) (int) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Integer)(int)(int)(Integer)object);
|
result.add((Integer) (int) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Integer)(int)(long)(Long)object);
|
result.add((Integer) (int) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Integer)(int)(float)(Float)object);
|
result.add((Integer) (int) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Integer)(int)(double)(Double)object);
|
result.add((Integer) (int) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,16 +513,16 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Boolean> result = new ArrayList();
|
List<Boolean> result = new ArrayList<Boolean>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Boolean) {
|
if (object instanceof Boolean) {
|
||||||
result.add((Boolean)object);
|
result.add((Boolean) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
if (Boolean.TRUE.toString().equals(object)) {
|
if (Boolean.TRUE.toString().equals(object)) {
|
||||||
result.add(true);
|
result.add(true);
|
||||||
@ -532,7 +531,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,37 +541,38 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Double> result = new ArrayList();
|
List<Double> result = new ArrayList<Double>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Double) {
|
if (object instanceof Double) {
|
||||||
result.add((Double)object);
|
result.add((Double) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Double.valueOf((String)object));
|
result.add(Double.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Double)(double)(byte)(Byte)object);
|
result.add((Double) (double) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Double)(double)(char)(Character)object);
|
result.add((Double) (double) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Double)(double)(short)(Short)object);
|
result.add((Double) (double) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Double)(double)(int)(Integer)object);
|
result.add((Double) (double) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Double)(double)(long)(Long)object);
|
result.add((Double) (double) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Double)(double)(float)(Float)object);
|
result.add((Double) (double) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Double)(double)(double)(Double)object);
|
result.add((Double) (double) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,37 +582,38 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Float> result = new ArrayList();
|
List<Float> result = new ArrayList<Float>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Float) {
|
if (object instanceof Float) {
|
||||||
result.add((Float)object);
|
result.add((Float) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Float.valueOf((String)object));
|
result.add(Float.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Float)(float)(byte)(Byte)object);
|
result.add((Float) (float) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Float)(float)(char)(Character)object);
|
result.add((Float) (float) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Float)(float)(short)(Short)object);
|
result.add((Float) (float) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Float)(float)(int)(Integer)object);
|
result.add((Float) (float) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Float)(float)(long)(Long)object);
|
result.add((Float) (float) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Float)(float)(float)(Float)object);
|
result.add((Float) (float) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Float)(float)(double)(Double)object);
|
result.add((Float) (float) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,37 +623,38 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> result = new ArrayList();
|
List<Long> result = new ArrayList<Long>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Long) {
|
if (object instanceof Long) {
|
||||||
result.add((Long)object);
|
result.add((Long) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Long.valueOf((String)object));
|
result.add(Long.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Long)(long)(byte)(Byte)object);
|
result.add((Long) (long) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Long)(long)(char)(Character)object);
|
result.add((Long) (long) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Long)(long)(short)(Short)object);
|
result.add((Long) (long) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Long)(long)(int)(Integer)object);
|
result.add((Long) (long) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Long)(long)(long)(Long)object);
|
result.add((Long) (long) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Long)(long)(float)(Float)object);
|
result.add((Long) (long) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Long)(long)(double)(Double)object);
|
result.add((Long) (long) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,37 +664,38 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Byte> result = new ArrayList();
|
List<Byte> result = new ArrayList<Byte>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Byte) {
|
if (object instanceof Byte) {
|
||||||
result.add((Byte)object);
|
result.add((Byte) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Byte.valueOf((String)object));
|
result.add(Byte.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Byte)(byte)(byte)(Byte)object);
|
result.add((Byte) (byte) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Byte)(byte)(char)(Character)object);
|
result.add((Byte) (byte) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Byte)(byte)(short)(Short)object);
|
result.add((Byte) (byte) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Byte)(byte)(int)(Integer)object);
|
result.add((Byte) (byte) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Byte)(byte)(long)(Long)object);
|
result.add((Byte) (byte) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Byte)(byte)(float)(Float)object);
|
result.add((Byte) (byte) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Byte)(byte)(double)(Double)object);
|
result.add((Byte) (byte) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,39 +705,39 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Character> result = new ArrayList();
|
List<Character> result = new ArrayList<Character>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Character) {
|
if (object instanceof Character) {
|
||||||
result.add((Character)object);
|
result.add((Character) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
String str = (String)object;
|
String str = (String) object;
|
||||||
|
|
||||||
if (str.length() == 1) {
|
if (str.length() == 1) {
|
||||||
result.add(str.charAt(0));
|
result.add(str.charAt(0));
|
||||||
}
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Character)(char)(byte)(Byte)object);
|
result.add((Character) (char) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Character)(char)(char)(Character)object);
|
result.add((Character) (char) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Character)(char)(short)(Short)object);
|
result.add((Character) (char) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Character)(char)(int)(Integer)object);
|
result.add((Character) (char) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Character)(char)(long)(Long)object);
|
result.add((Character) (char) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Character)(char)(float)(Float)object);
|
result.add((Character) (char) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Character)(char)(double)(Double)object);
|
result.add((Character) (char) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -744,65 +747,67 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
|
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Short> result = new ArrayList();
|
List<Short> result = new ArrayList<Short>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Short) {
|
if (object instanceof Short) {
|
||||||
result.add((Short)object);
|
result.add((Short) object);
|
||||||
} else if (object instanceof String) {
|
} else if (object instanceof String) {
|
||||||
try {
|
try {
|
||||||
result.add(Short.valueOf((String)object));
|
result.add(Short.valueOf((String) object));
|
||||||
} catch (Exception ex) {}
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
} else if (object instanceof Byte) {
|
} else if (object instanceof Byte) {
|
||||||
result.add((Short)(short)(byte)(Byte)object);
|
result.add((Short) (short) (byte) (Byte) object);
|
||||||
} else if (object instanceof Character) {
|
} else if (object instanceof Character) {
|
||||||
result.add((Short)(short)(char)(Character)object);
|
result.add((Short) (short) (char) (Character) object);
|
||||||
} else if (object instanceof Short) {
|
} else if (object instanceof Short) {
|
||||||
result.add((Short)(short)(short)(Short)object);
|
result.add((Short) (short) (short) (Short) object);
|
||||||
} else if (object instanceof Integer) {
|
} else if (object instanceof Integer) {
|
||||||
result.add((Short)(short)(int)(Integer)object);
|
result.add((Short) (short) (int) (Integer) object);
|
||||||
} else if (object instanceof Long) {
|
} else if (object instanceof Long) {
|
||||||
result.add((Short)(short)(long)(Long)object);
|
result.add((Short) (short) (long) (Long) object);
|
||||||
} else if (object instanceof Float) {
|
} else if (object instanceof Float) {
|
||||||
result.add((Short)(short)(float)(Float)object);
|
result.add((Short) (short) (float) (Float) object);
|
||||||
} else if (object instanceof Double) {
|
} else if (object instanceof Double) {
|
||||||
result.add((Short)(short)(double)(Double)object);
|
result.add((Short) (short) (double) (Double) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<Map<String, Object>> getMapList(String path) {
|
public List<Map<String, Object>> getMapList(String path) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Object> list = getList(path);
|
List<Object> list = getList(path);
|
||||||
List<Map<String, Object>> result = new ArrayList();
|
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||||
|
|
||||||
for (Object object : list) {
|
for (Object object : list) {
|
||||||
if (object instanceof Map) {
|
if (object instanceof Map) {
|
||||||
result.add((Map<String, Object>)object);
|
result.add((Map<String, Object>) object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bukkit
|
// Bukkit
|
||||||
public Vector getVector(String path) {
|
public Vector getVector(String path) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object def = getDefault(path);
|
Object def = getDefault(path);
|
||||||
return getVector(path, (def instanceof Vector) ? (Vector)def : null);
|
return getVector(path, (def instanceof Vector) ? (Vector) def : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getVector(String path, Vector def) {
|
public Vector getVector(String path, Vector def) {
|
||||||
@ -811,7 +816,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, def);
|
Object val = get(path, def);
|
||||||
return (val instanceof Vector) ? (Vector)val : def;
|
return (val instanceof Vector) ? (Vector) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVector(String path) {
|
public boolean isVector(String path) {
|
||||||
@ -829,7 +834,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object def = getDefault(path);
|
Object def = getDefault(path);
|
||||||
return getOfflinePlayer(path, (def instanceof OfflinePlayer) ? (OfflinePlayer)def : null);
|
return getOfflinePlayer(path, (def instanceof OfflinePlayer) ? (OfflinePlayer) def : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OfflinePlayer getOfflinePlayer(String path, OfflinePlayer def) {
|
public OfflinePlayer getOfflinePlayer(String path, OfflinePlayer def) {
|
||||||
@ -838,7 +843,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, def);
|
Object val = get(path, def);
|
||||||
return (val instanceof OfflinePlayer) ? (OfflinePlayer)val : def;
|
return (val instanceof OfflinePlayer) ? (OfflinePlayer) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOfflinePlayer(String path) {
|
public boolean isOfflinePlayer(String path) {
|
||||||
@ -856,7 +861,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object def = getDefault(path);
|
Object def = getDefault(path);
|
||||||
return getItemStack(path, (def instanceof ItemStack) ? (ItemStack)def : null);
|
return getItemStack(path, (def instanceof ItemStack) ? (ItemStack) def : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack(String path, ItemStack def) {
|
public ItemStack getItemStack(String path, ItemStack def) {
|
||||||
@ -865,7 +870,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, def);
|
Object val = get(path, def);
|
||||||
return (val instanceof ItemStack) ? (ItemStack)val : def;
|
return (val instanceof ItemStack) ? (ItemStack) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isItemStack(String path) {
|
public boolean isItemStack(String path) {
|
||||||
@ -881,11 +886,12 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IllegalArgumentException("Path cannot be null");
|
throw new IllegalArgumentException("Path cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object val = get(path, null);
|
Object val = get(path, null);
|
||||||
if (val != null)
|
if (val != null) {
|
||||||
return (val instanceof ConfigurationSection) ? (ConfigurationSection)val : null;
|
return (val instanceof ConfigurationSection) ? (ConfigurationSection) val : null;
|
||||||
|
}
|
||||||
|
|
||||||
val = get(path, getDefault(path));
|
val = get(path, getDefault(path));
|
||||||
return (val instanceof ConfigurationSection) ? createSection(path) : null;
|
return (val instanceof ConfigurationSection) ? createSection(path) : null;
|
||||||
}
|
}
|
||||||
@ -903,7 +909,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
if (input == null) {
|
if (input == null) {
|
||||||
throw new IllegalArgumentException("Cannot store null");
|
throw new IllegalArgumentException("Cannot store null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPrimitiveWrapper(input) || isNaturallyStorable(input)) {
|
if (isPrimitiveWrapper(input) || isNaturallyStorable(input)) {
|
||||||
return input;
|
return input;
|
||||||
} else if (input instanceof ConfigurationSerializable) {
|
} else if (input instanceof ConfigurationSerializable) {
|
||||||
@ -912,14 +918,14 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
throw new IllegalArgumentException("Cannot store " + input + " into " + this + ", unsupported class");
|
throw new IllegalArgumentException("Cannot store " + input + " into " + this + ", unsupported class");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isPrimitiveWrapper(Object input) {
|
protected boolean isPrimitiveWrapper(Object input) {
|
||||||
return input instanceof Integer || input instanceof Boolean ||
|
return input instanceof Integer || input instanceof Boolean ||
|
||||||
input instanceof Character || input instanceof Byte ||
|
input instanceof Character || input instanceof Byte ||
|
||||||
input instanceof Short || input instanceof Double ||
|
input instanceof Short || input instanceof Double ||
|
||||||
input instanceof Long || input instanceof Float;
|
input instanceof Long || input instanceof Float;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isNaturallyStorable(Object input) {
|
protected boolean isNaturallyStorable(Object input) {
|
||||||
return input instanceof List || input instanceof Iterable ||
|
return input instanceof List || input instanceof Iterable ||
|
||||||
input instanceof String || input instanceof File ||
|
input instanceof String || input instanceof File ||
|
||||||
@ -937,13 +943,13 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) {
|
protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) {
|
||||||
if (section instanceof MemorySection) {
|
if (section instanceof MemorySection) {
|
||||||
MemorySection sec = (MemorySection)section;
|
MemorySection sec = (MemorySection) section;
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
|
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
|
||||||
output.add(createPath(section, entry.getKey(), this));
|
output.add(createPath(section, entry.getKey(), this));
|
||||||
|
|
||||||
if ((deep) && (entry.getValue() instanceof ConfigurationSection)) {
|
if ((deep) && (entry.getValue() instanceof ConfigurationSection)) {
|
||||||
ConfigurationSection subsection = (ConfigurationSection)entry.getValue();
|
ConfigurationSection subsection = (ConfigurationSection) entry.getValue();
|
||||||
mapChildrenKeys(output, subsection, deep);
|
mapChildrenKeys(output, subsection, deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -958,14 +964,14 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
protected void mapChildrenValues(Map<String, Object> output, ConfigurationSection section, boolean deep) {
|
protected void mapChildrenValues(Map<String, Object> output, ConfigurationSection section, boolean deep) {
|
||||||
if (section instanceof MemorySection) {
|
if (section instanceof MemorySection) {
|
||||||
MemorySection sec = (MemorySection)section;
|
MemorySection sec = (MemorySection) section;
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
|
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
|
||||||
output.put(createPath(section, entry.getKey(), this), entry.getValue());
|
output.put(createPath(section, entry.getKey(), this), entry.getValue());
|
||||||
|
|
||||||
if (entry.getValue() instanceof ConfigurationSection) {
|
if (entry.getValue() instanceof ConfigurationSection) {
|
||||||
if (deep) {
|
if (deep) {
|
||||||
mapChildrenValues(output, (ConfigurationSection)entry.getValue(), deep);
|
mapChildrenValues(output, (ConfigurationSection) entry.getValue(), deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -982,7 +988,7 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
* Creates a full path to the given {@link ConfigurationSection} from its root {@link Configuration}.
|
* Creates a full path to the given {@link ConfigurationSection} from its root {@link Configuration}.
|
||||||
* <p>
|
* <p>
|
||||||
* You may use this method for any given {@link ConfigurationSection}, not only {@link MemorySection}.
|
* You may use this method for any given {@link ConfigurationSection}, not only {@link MemorySection}.
|
||||||
*
|
*
|
||||||
* @param section Section to create a path for.
|
* @param section Section to create a path for.
|
||||||
* @param key Name of the specified section.
|
* @param key Name of the specified section.
|
||||||
* @return Full path of the section from its root.
|
* @return Full path of the section from its root.
|
||||||
@ -991,12 +997,11 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
return createPath(section, key, (section == null) ? null : section.getRoot());
|
return createPath(section, key, (section == null) ? null : section.getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a relative path to the given {@link ConfigurationSection} from the given relative section.
|
* Creates a relative path to the given {@link ConfigurationSection} from the given relative section.
|
||||||
* <p>
|
* <p>
|
||||||
* You may use this method for any given {@link ConfigurationSection}, not only {@link MemorySection}.
|
* You may use this method for any given {@link ConfigurationSection}, not only {@link MemorySection}.
|
||||||
*
|
*
|
||||||
* @param section Section to create a path for.
|
* @param section Section to create a path for.
|
||||||
* @param key Name of the specified section.
|
* @param key Name of the specified section.
|
||||||
* @param relativeTo Section to create the path relative to.
|
* @param relativeTo Section to create the path relative to.
|
||||||
@ -1022,21 +1027,21 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
|
|
||||||
builder.append(key);
|
builder.append(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(getClass().getSimpleName());
|
builder.append(getClass().getSimpleName());
|
||||||
builder.append("[path='");
|
builder.append("[path='");
|
||||||
builder.append(getCurrentPath());
|
builder.append(getCurrentPath());
|
||||||
builder.append("', root='");
|
builder.append("', root='");
|
||||||
builder.append(root.getClass().getSimpleName());
|
builder.append(root.getClass().getSimpleName());
|
||||||
builder.append("']");
|
builder.append("']");
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
if (file == null) {
|
if (file == null) {
|
||||||
throw new IllegalArgumentException("File cannot be null");
|
throw new IllegalArgumentException("File cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Files.createParentDirs(file);
|
Files.createParentDirs(file);
|
||||||
|
|
||||||
String data = saveToString();
|
String data = saveToString();
|
||||||
@ -76,7 +76,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
if (file == null) {
|
if (file == null) {
|
||||||
throw new IllegalArgumentException("File cannot be null");
|
throw new IllegalArgumentException("File cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
save(new File(file));
|
save(new File(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
|
|
||||||
load(new FileInputStream(file));
|
load(new FileInputStream(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads this {@link FileConfiguration} from the specified stream.
|
* Loads this {@link FileConfiguration} from the specified stream.
|
||||||
* <p>
|
* <p>
|
||||||
@ -124,7 +124,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
throw new IllegalArgumentException("Stream cannot be null");
|
throw new IllegalArgumentException("Stream cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStreamReader reader = new InputStreamReader(stream);
|
InputStreamReader reader = new InputStreamReader(stream);
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader input = new BufferedReader(reader);
|
BufferedReader input = new BufferedReader(reader);
|
||||||
@ -178,13 +178,13 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
* @throws IllegalArgumentException Thrown if contents is null.
|
* @throws IllegalArgumentException Thrown if contents is null.
|
||||||
*/
|
*/
|
||||||
public abstract void loadFromString(String contents) throws InvalidConfigurationException;
|
public abstract void loadFromString(String contents) throws InvalidConfigurationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles the header for this {@link FileConfiguration} and returns the result.
|
* Compiles the header for this {@link FileConfiguration} and returns the result.
|
||||||
* <p>
|
* <p>
|
||||||
* This will use the header from {@link #options()} -> {@link FileConfigurationOptions#header()},
|
* This will use the header from {@link #options()} -> {@link FileConfigurationOptions#header()},
|
||||||
* respecting the rules of {@link FileConfigurationOptions#copyHeader()} if set.
|
* respecting the rules of {@link FileConfigurationOptions#copyHeader()} if set.
|
||||||
*
|
*
|
||||||
* @return Compiled header
|
* @return Compiled header
|
||||||
*/
|
*/
|
||||||
protected abstract String buildHeader();
|
protected abstract String buildHeader();
|
||||||
@ -194,7 +194,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
|||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = new FileConfigurationOptions(this);
|
options = new FileConfigurationOptions(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FileConfigurationOptions)options;
|
return (FileConfigurationOptions) options;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,14 +8,14 @@ import org.bukkit.configuration.*;
|
|||||||
public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
||||||
private String header = null;
|
private String header = null;
|
||||||
private boolean copyHeader = true;
|
private boolean copyHeader = true;
|
||||||
|
|
||||||
protected FileConfigurationOptions(MemoryConfiguration configuration) {
|
protected FileConfigurationOptions(MemoryConfiguration configuration) {
|
||||||
super(configuration);
|
super(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileConfiguration configuration() {
|
public FileConfiguration configuration() {
|
||||||
return (FileConfiguration)super.configuration();
|
return (FileConfiguration) super.configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,7 +29,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
super.pathSeparator(value);
|
super.pathSeparator(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the header that will be applied to the top of the saved output.
|
* Gets the header that will be applied to the top of the saved output.
|
||||||
* <p>
|
* <p>
|
||||||
@ -40,13 +40,13 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
* <p>
|
* <p>
|
||||||
* Null is a valid value which will indicate that no header is to be applied.
|
* Null is a valid value which will indicate that no header is to be applied.
|
||||||
* The default value is null.
|
* The default value is null.
|
||||||
*
|
*
|
||||||
* @return Header
|
* @return Header
|
||||||
*/
|
*/
|
||||||
public String header() {
|
public String header() {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the header that will be applied to the top of the saved output.
|
* Sets the header that will be applied to the top of the saved output.
|
||||||
* <p>
|
* <p>
|
||||||
@ -56,8 +56,8 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
* but you may include one if you wish for extra spacing.
|
* but you may include one if you wish for extra spacing.
|
||||||
* <p>
|
* <p>
|
||||||
* Null is a valid value which will indicate that no header is to be applied.
|
* Null is a valid value which will indicate that no header is to be applied.
|
||||||
* The default value is null.
|
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param value New header
|
* @param value New header
|
||||||
* @return This object, for chaining
|
* @return This object, for chaining
|
||||||
*/
|
*/
|
||||||
@ -65,7 +65,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
this.header = value;
|
this.header = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether or not the header should be copied from a default source.
|
* Gets whether or not the header should be copied from a default source.
|
||||||
* <p>
|
* <p>
|
||||||
@ -78,13 +78,13 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
* specified in this configuration will be used.
|
* specified in this configuration will be used.
|
||||||
* <p>
|
* <p>
|
||||||
* Defaults to true.
|
* Defaults to true.
|
||||||
*
|
*
|
||||||
* @return Whether or not to copy the header
|
* @return Whether or not to copy the header
|
||||||
*/
|
*/
|
||||||
public boolean copyHeader() {
|
public boolean copyHeader() {
|
||||||
return copyHeader;
|
return copyHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether or not the header should be copied from a default source.
|
* Sets whether or not the header should be copied from a default source.
|
||||||
* <p>
|
* <p>
|
||||||
@ -97,13 +97,13 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
|||||||
* specified in this configuration will be used.
|
* specified in this configuration will be used.
|
||||||
* <p>
|
* <p>
|
||||||
* Defaults to true.
|
* Defaults to true.
|
||||||
*
|
*
|
||||||
* @param value Whether or not to copy the header
|
* @param value Whether or not to copy the header
|
||||||
* @return This object, for chaining
|
* @return This object, for chaining
|
||||||
*/
|
*/
|
||||||
public FileConfigurationOptions copyHeader(boolean value) {
|
public FileConfigurationOptions copyHeader(boolean value) {
|
||||||
copyHeader = value;
|
copyHeader = value;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
@ -33,20 +33,20 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
@Override
|
@Override
|
||||||
public String saveToString() {
|
public String saveToString() {
|
||||||
Map<String, Object> output = new LinkedHashMap<String, Object>();
|
Map<String, Object> output = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
yamlOptions.setIndent(options().indent());
|
yamlOptions.setIndent(options().indent());
|
||||||
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
|
|
||||||
serializeValues(output, getValues(false));
|
serializeValues(output, getValues(false));
|
||||||
|
|
||||||
String header = buildHeader();
|
String header = buildHeader();
|
||||||
String dump = yaml.dump(output);
|
String dump = yaml.dump(output);
|
||||||
|
|
||||||
if (dump.equals(BLANK_CONFIG)) {
|
if (dump.equals(BLANK_CONFIG)) {
|
||||||
dump = "";
|
dump = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return header + dump;
|
return header + dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,45 +55,47 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
if (contents == null) {
|
if (contents == null) {
|
||||||
throw new IllegalArgumentException("Contents cannot be null");
|
throw new IllegalArgumentException("Contents cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Object, Object> input = (Map<Object, Object>)yaml.load(contents);
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<Object, Object> input = (Map<Object, Object>) yaml.load(contents);
|
||||||
int size = (input == null) ? 0 : input.size();
|
int size = (input == null) ? 0 : input.size();
|
||||||
Map<String, Object> result = new LinkedHashMap<String, Object>(size);
|
Map<String, Object> result = new LinkedHashMap<String, Object>(size);
|
||||||
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
for (Map.Entry<Object, Object> entry : input.entrySet()) {
|
for (Map.Entry<Object, Object> entry : input.entrySet()) {
|
||||||
result.put(entry.getKey().toString(), entry.getValue());
|
result.put(entry.getKey().toString(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String header = parseHeader(contents);
|
String header = parseHeader(contents);
|
||||||
|
|
||||||
if (header.length() > 0) {
|
if (header.length() > 0) {
|
||||||
options().header(header);
|
options().header(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializeValues(result, this);
|
deserializeValues(result, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void deserializeValues(Map<String, Object> input, ConfigurationSection section) throws InvalidConfigurationException {
|
protected void deserializeValues(Map<String, Object> input, ConfigurationSection section) throws InvalidConfigurationException {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : input.entrySet()) {
|
for (Map.Entry<String, Object> entry : input.entrySet()) {
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
|
||||||
if (value instanceof Map) {
|
if (value instanceof Map) {
|
||||||
Map<Object, Object> subinput = (Map<Object, Object>)value;
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<Object, Object> subinput = (Map<Object, Object>) value;
|
||||||
int size = (subinput == null) ? 0 : subinput.size();
|
int size = (subinput == null) ? 0 : subinput.size();
|
||||||
Map<String, Object> subvalues = new LinkedHashMap<String, Object>(size);
|
Map<String, Object> subvalues = new LinkedHashMap<String, Object>(size);
|
||||||
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
for (Map.Entry<Object, Object> subentry : subinput.entrySet()) {
|
for (Map.Entry<Object, Object> subentry : subinput.entrySet()) {
|
||||||
subvalues.put(subentry.getKey().toString(), subentry.getValue());
|
subvalues.put(subentry.getKey().toString(), subentry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subvalues.containsKey(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
|
if (subvalues.containsKey(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
|
||||||
try {
|
try {
|
||||||
ConfigurationSerializable serializable = ConfigurationSerialization.deserializeObject(subvalues);
|
ConfigurationSerializable serializable = ConfigurationSerialization.deserializeObject(subvalues);
|
||||||
@ -110,51 +112,51 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void serializeValues(Map<String, Object> output, Map<String, Object> input) {
|
protected void serializeValues(Map<String, Object> output, Map<String, Object> input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : input.entrySet()) {
|
for (Map.Entry<String, Object> entry : input.entrySet()) {
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
|
||||||
if (value instanceof ConfigurationSection) {
|
if (value instanceof ConfigurationSection) {
|
||||||
ConfigurationSection subsection = (ConfigurationSection)entry.getValue();
|
ConfigurationSection subsection = (ConfigurationSection) entry.getValue();
|
||||||
Map<String, Object> subvalues = new LinkedHashMap<String, Object>();
|
Map<String, Object> subvalues = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
serializeValues(subvalues, subsection.getValues(false));
|
serializeValues(subvalues, subsection.getValues(false));
|
||||||
value = subvalues;
|
value = subvalues;
|
||||||
} else if (value instanceof ConfigurationSerializable) {
|
} else if (value instanceof ConfigurationSerializable) {
|
||||||
ConfigurationSerializable serializable = (ConfigurationSerializable)value;
|
ConfigurationSerializable serializable = (ConfigurationSerializable) value;
|
||||||
Map<String, Object> subvalues = new LinkedHashMap<String, Object>();
|
Map<String, Object> subvalues = new LinkedHashMap<String, Object>();
|
||||||
subvalues.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, ConfigurationSerialization.getAlias(serializable.getClass()));
|
subvalues.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, ConfigurationSerialization.getAlias(serializable.getClass()));
|
||||||
|
|
||||||
serializeValues(subvalues, serializable.serialize());
|
serializeValues(subvalues, serializable.serialize());
|
||||||
value = subvalues;
|
value = subvalues;
|
||||||
} else if ((!isPrimitiveWrapper(value)) && (!isNaturallyStorable(value))) {
|
} else if ((!isPrimitiveWrapper(value)) && (!isNaturallyStorable(value))) {
|
||||||
throw new IllegalStateException("Configuration contains non-serializable values, cannot process");
|
throw new IllegalStateException("Configuration contains non-serializable values, cannot process");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
output.put(entry.getKey(), value);
|
output.put(entry.getKey(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String parseHeader(String input) {
|
protected String parseHeader(String input) {
|
||||||
String[] lines = input.split("\r?\n", -1);
|
String[] lines = input.split("\r?\n", -1);
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
boolean readingHeader = true;
|
boolean readingHeader = true;
|
||||||
|
|
||||||
for (int i = 0; (i < lines.length) && (readingHeader); i++) {
|
for (int i = 0; (i < lines.length) && (readingHeader); i++) {
|
||||||
String line = lines[i];
|
String line = lines[i];
|
||||||
|
|
||||||
if (line.startsWith(COMMENT_PREFIX)) {
|
if (line.startsWith(COMMENT_PREFIX)) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.length() > COMMENT_PREFIX.length()) {
|
if (line.length() > COMMENT_PREFIX.length()) {
|
||||||
result.append(line.substring(COMMENT_PREFIX.length()));
|
result.append(line.substring(COMMENT_PREFIX.length()));
|
||||||
}
|
}
|
||||||
@ -164,44 +166,45 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
readingHeader = false;
|
readingHeader = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String buildHeader() {
|
protected String buildHeader() {
|
||||||
String header = options().header();
|
String header = options().header();
|
||||||
|
|
||||||
if (options().copyHeader()) {
|
if (options().copyHeader()) {
|
||||||
Configuration def = getDefaults();
|
Configuration def = getDefaults();
|
||||||
|
|
||||||
if ((def != null) && (def instanceof FileConfiguration)) {
|
if ((def != null) && (def instanceof FileConfiguration)) {
|
||||||
FileConfiguration filedefaults = (FileConfiguration)def;
|
FileConfiguration filedefaults = (FileConfiguration) def;
|
||||||
String defaultsHeader = filedefaults.buildHeader();
|
String defaultsHeader = filedefaults.buildHeader();
|
||||||
|
|
||||||
if ((defaultsHeader != null) && (defaultsHeader.length() > 0)) {
|
if ((defaultsHeader != null) && (defaultsHeader.length() > 0)) {
|
||||||
return defaultsHeader;
|
return defaultsHeader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header == null) {
|
if (header == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
String[] lines = header.split("\r?\n", -1);
|
String[] lines = header.split("\r?\n", -1);
|
||||||
boolean startedHeader = false;
|
boolean startedHeader = false;
|
||||||
|
|
||||||
for (int i = lines.length - 1; i >= 0; i--) {
|
for (int i = lines.length - 1; i >= 0; i--) {
|
||||||
builder.insert(0, "\n");
|
builder.insert(0, "\n");
|
||||||
|
|
||||||
if ((startedHeader) || (lines[i].length() != 0)) {
|
if ((startedHeader) || (lines[i].length() != 0)) {
|
||||||
builder.insert(0, lines[i]);
|
builder.insert(0, lines[i]);
|
||||||
builder.insert(0, COMMENT_PREFIX);
|
builder.insert(0, COMMENT_PREFIX);
|
||||||
startedHeader = true;
|
startedHeader = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,16 +213,16 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = new YamlConfigurationOptions(this);
|
options = new YamlConfigurationOptions(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (YamlConfigurationOptions)options;
|
return (YamlConfigurationOptions) options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link YamlConfiguration}, loading from the given file.
|
* Creates a new {@link YamlConfiguration}, loading from the given file.
|
||||||
* <p>
|
* <p>
|
||||||
* Any errors loading the Configuration will be logged and then ignored.
|
* Any errors loading the Configuration will be logged and then ignored.
|
||||||
* If the specified input is not a valid config, a blank config will be returned.
|
* If the specified input is not a valid config, a blank config will be returned.
|
||||||
*
|
*
|
||||||
* @param file Input file
|
* @param file Input file
|
||||||
* @return Resulting configuration
|
* @return Resulting configuration
|
||||||
* @throws IllegalArgumentException Thrown is file is null
|
* @throws IllegalArgumentException Thrown is file is null
|
||||||
@ -228,9 +231,9 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
if (file == null) {
|
if (file == null) {
|
||||||
throw new IllegalArgumentException("File cannot be null");
|
throw new IllegalArgumentException("File cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.load(file);
|
config.load(file);
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
@ -245,16 +248,16 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file + ": " + ex.getCause().getClass(), ex);
|
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file + ": " + ex.getCause().getClass(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link YamlConfiguration}, loading from the given stream.
|
* Creates a new {@link YamlConfiguration}, loading from the given stream.
|
||||||
* <p>
|
* <p>
|
||||||
* Any errors loading the Configuration will be logged and then ignored.
|
* Any errors loading the Configuration will be logged and then ignored.
|
||||||
* If the specified input is not a valid config, a blank config will be returned.
|
* If the specified input is not a valid config, a blank config will be returned.
|
||||||
*
|
*
|
||||||
* @param stream Input stream
|
* @param stream Input stream
|
||||||
* @return Resulting configuration
|
* @return Resulting configuration
|
||||||
* @throws IllegalArgumentException Thrown is stream is null
|
* @throws IllegalArgumentException Thrown is stream is null
|
||||||
@ -263,9 +266,9 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
throw new IllegalArgumentException("Stream cannot be null");
|
throw new IllegalArgumentException("Stream cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.load(stream);
|
config.load(stream);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -279,7 +282,7 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration: " + ex.getCause().getClass(), ex);
|
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration: " + ex.getCause().getClass(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,14 @@ package org.bukkit.configuration.file;
|
|||||||
*/
|
*/
|
||||||
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||||
private int indent = 2;
|
private int indent = 2;
|
||||||
|
|
||||||
protected YamlConfigurationOptions(YamlConfiguration configuration) {
|
protected YamlConfigurationOptions(YamlConfiguration configuration) {
|
||||||
super(configuration);
|
super(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public YamlConfiguration configuration() {
|
public YamlConfiguration configuration() {
|
||||||
return (YamlConfiguration)super.configuration();
|
return (YamlConfiguration) super.configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,23 +38,23 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
|||||||
super.copyHeader(value);
|
super.copyHeader(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets how much spaces should be used to indent each line.
|
* Gets how much spaces should be used to indent each line.
|
||||||
* <p>
|
* <p>
|
||||||
* The minimum value this may be is 2, and the maximum is 9.
|
* The minimum value this may be is 2, and the maximum is 9.
|
||||||
*
|
*
|
||||||
* @return How much to indent by
|
* @return How much to indent by
|
||||||
*/
|
*/
|
||||||
public int indent() {
|
public int indent() {
|
||||||
return indent;
|
return indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets how much spaces should be used to indent each line.
|
* Sets how much spaces should be used to indent each line.
|
||||||
* <p>
|
* <p>
|
||||||
* The minimum value this may be is 2, and the maximum is 9.
|
* The minimum value this may be is 2, and the maximum is 9.
|
||||||
*
|
*
|
||||||
* @param value New indent
|
* @param value New indent
|
||||||
* @return This object, for chaining
|
* @return This object, for chaining
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
|||||||
if ((indent < 2) || (value > 9)) {
|
if ((indent < 2) || (value > 9)) {
|
||||||
throw new IllegalArgumentException("Indent must be between 1 and 10 characters");
|
throw new IllegalArgumentException("Indent must be between 1 and 10 characters");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.indent = value;
|
this.indent = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@ import java.util.Map;
|
|||||||
* <p>
|
* <p>
|
||||||
* These objects MUST implement one of the following, in addition to the methods
|
* These objects MUST implement one of the following, in addition to the methods
|
||||||
* as defined by this interface:
|
* as defined by this interface:
|
||||||
* - A static method "deserialize" that accepts a single {@link Map<String, Object>} and returns the class.
|
* <ul>
|
||||||
* - A static method "valueOf" that accepts a single {@link Map<String, Object>} and returns the class.
|
* <li>A static method "deserialize" that accepts a single {@link Map<String, Object>} and returns the class.</li>
|
||||||
* - A constructor that accepts a single {@link Map<String, Object>}.
|
* <li>A static method "valueOf" that accepts a single {@link Map<String, Object>} and returns the class.</li>
|
||||||
|
* <li>A constructor that accepts a single {@link Map<String, Object>}.</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public interface ConfigurationSerializable {
|
public interface ConfigurationSerializable {
|
||||||
/**
|
/**
|
||||||
@ -17,7 +19,7 @@ public interface ConfigurationSerializable {
|
|||||||
* <p>
|
* <p>
|
||||||
* This class must provide a method to restore this class, as defined in the
|
* This class must provide a method to restore this class, as defined in the
|
||||||
* {@link ConfigurationSerializable} interface javadocs.
|
* {@link ConfigurationSerializable} interface javadocs.
|
||||||
*
|
*
|
||||||
* @return Map containing the current state of this class
|
* @return Map containing the current state of this class
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> serialize();
|
public Map<String, Object> serialize();
|
||||||
|
@ -17,27 +17,27 @@ public class ConfigurationSerialization {
|
|||||||
public static final String SERIALIZED_TYPE_KEY = "==";
|
public static final String SERIALIZED_TYPE_KEY = "==";
|
||||||
private final Class<? extends ConfigurationSerializable> clazz;
|
private final Class<? extends ConfigurationSerializable> clazz;
|
||||||
private static Map<String, Class<? extends ConfigurationSerializable>> aliases = new HashMap<String, Class<? extends ConfigurationSerializable>>();
|
private static Map<String, Class<? extends ConfigurationSerializable>> aliases = new HashMap<String, Class<? extends ConfigurationSerializable>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
registerClass(Vector.class);
|
registerClass(Vector.class);
|
||||||
registerClass(BlockVector.class);
|
registerClass(BlockVector.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) {
|
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Method getMethod(String name, boolean isStatic) {
|
protected Method getMethod(String name, boolean isStatic) {
|
||||||
try {
|
try {
|
||||||
Method method = clazz.getDeclaredMethod(name, Map.class);
|
Method method = clazz.getDeclaredMethod(name, Map.class);
|
||||||
|
|
||||||
if (!ConfigurationSerializable.class.isAssignableFrom(method.getReturnType())) {
|
if (!ConfigurationSerializable.class.isAssignableFrom(method.getReturnType())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (Modifier.isStatic(method.getModifiers()) != isStatic) {
|
if (Modifier.isStatic(method.getModifiers()) != isStatic) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return method;
|
return method;
|
||||||
} catch (NoSuchMethodException ex) {
|
} catch (NoSuchMethodException ex) {
|
||||||
return null;
|
return null;
|
||||||
@ -45,7 +45,7 @@ public class ConfigurationSerialization {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Constructor<? extends ConfigurationSerializable> getConstructor() {
|
protected Constructor<? extends ConfigurationSerializable> getConstructor() {
|
||||||
try {
|
try {
|
||||||
return clazz.getConstructor(Map.class);
|
return clazz.getConstructor(Map.class);
|
||||||
@ -55,11 +55,11 @@ public class ConfigurationSerialization {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String, Object> args) {
|
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String, Object> args) {
|
||||||
try {
|
try {
|
||||||
ConfigurationSerializable result = (ConfigurationSerializable)method.invoke(null, args);
|
ConfigurationSerializable result = (ConfigurationSerializable) method.invoke(null, args);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization: method returned null");
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization: method returned null");
|
||||||
} else {
|
} else {
|
||||||
@ -68,55 +68,55 @@ public class ConfigurationSerialization {
|
|||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization", ex);
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) {
|
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) {
|
||||||
try {
|
try {
|
||||||
return ctor.newInstance(args);
|
return ctor.newInstance(args);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call constructor '" + ctor.toString() + "' of " + clazz + " for deserialization", ex);
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call constructor '" + ctor.toString() + "' of " + clazz + " for deserialization", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurationSerializable deserialize(Map<String, Object> args) {
|
public ConfigurationSerializable deserialize(Map<String, Object> args) {
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
throw new IllegalArgumentException("Args must not be null");
|
throw new IllegalArgumentException("Args must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSerializable result = null;
|
ConfigurationSerializable result = null;
|
||||||
Method method = null;
|
Method method = null;
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
method = getMethod("deserialize", true);
|
method = getMethod("deserialize", true);
|
||||||
|
|
||||||
if (method != null) {
|
if (method != null) {
|
||||||
result = deserializeViaMethod(method, args);
|
result = deserializeViaMethod(method, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
method = getMethod("valueOf", true);
|
method = getMethod("valueOf", true);
|
||||||
|
|
||||||
if (method != null) {
|
if (method != null) {
|
||||||
result = deserializeViaMethod(method, args);
|
result = deserializeViaMethod(method, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
Constructor<? extends ConfigurationSerializable> constructor = getConstructor();
|
Constructor<? extends ConfigurationSerializable> constructor = getConstructor();
|
||||||
|
|
||||||
if (constructor != null) {
|
if (constructor != null) {
|
||||||
result = deserializeViaCtor(constructor, args);
|
result = deserializeViaCtor(constructor, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to deserialize the given arguments into a new instance of the given class.
|
* Attempts to deserialize the given arguments into a new instance of the given class.
|
||||||
* <p>
|
* <p>
|
||||||
@ -125,7 +125,7 @@ public class ConfigurationSerialization {
|
|||||||
* <p>
|
* <p>
|
||||||
* If a new instance could not be made, an example being the class not fully implementing
|
* If a new instance could not be made, an example being the class not fully implementing
|
||||||
* the interface, null will be returned.
|
* the interface, null will be returned.
|
||||||
*
|
*
|
||||||
* @param args Arguments for deserialization
|
* @param args Arguments for deserialization
|
||||||
* @param clazz Class to deserialize into
|
* @param clazz Class to deserialize into
|
||||||
* @return New instance of the specified class
|
* @return New instance of the specified class
|
||||||
@ -133,7 +133,7 @@ public class ConfigurationSerialization {
|
|||||||
public static ConfigurationSerializable deserializeObject(Map<String, Object> args, Class<? extends ConfigurationSerializable> clazz) {
|
public static ConfigurationSerializable deserializeObject(Map<String, Object> args, Class<? extends ConfigurationSerializable> clazz) {
|
||||||
return new ConfigurationSerialization(clazz).deserialize(args);
|
return new ConfigurationSerialization(clazz).deserialize(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to deserialize the given arguments into a new instance of the given class.
|
* Attempts to deserialize the given arguments into a new instance of the given class.
|
||||||
* <p>
|
* <p>
|
||||||
@ -142,17 +142,17 @@ public class ConfigurationSerialization {
|
|||||||
* <p>
|
* <p>
|
||||||
* If a new instance could not be made, an example being the class not fully implementing
|
* If a new instance could not be made, an example being the class not fully implementing
|
||||||
* the interface, null will be returned.
|
* the interface, null will be returned.
|
||||||
*
|
*
|
||||||
* @param args Arguments for deserialization
|
* @param args Arguments for deserialization
|
||||||
* @return New instance of the specified class
|
* @return New instance of the specified class
|
||||||
*/
|
*/
|
||||||
public static ConfigurationSerializable deserializeObject(Map<String, Object> args) {
|
public static ConfigurationSerializable deserializeObject(Map<String, Object> args) {
|
||||||
Class<? extends ConfigurationSerializable> clazz = null;
|
Class<? extends ConfigurationSerializable> clazz = null;
|
||||||
|
|
||||||
if (args.containsKey(SERIALIZED_TYPE_KEY)) {
|
if (args.containsKey(SERIALIZED_TYPE_KEY)) {
|
||||||
try {
|
try {
|
||||||
String alias = (String)args.get(SERIALIZED_TYPE_KEY);
|
String alias = (String) args.get(SERIALIZED_TYPE_KEY);
|
||||||
|
|
||||||
if (alias == null) {
|
if (alias == null) {
|
||||||
throw new IllegalArgumentException("Specified class does not exist ('" + alias + ")'");
|
throw new IllegalArgumentException("Specified class does not exist ('" + alias + ")'");
|
||||||
} else {
|
} else {
|
||||||
@ -165,71 +165,73 @@ public class ConfigurationSerialization {
|
|||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Args doesn't contain type key ('" + SERIALIZED_TYPE_KEY + "')");
|
throw new IllegalArgumentException("Args doesn't contain type key ('" + SERIALIZED_TYPE_KEY + "')");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ConfigurationSerialization(clazz).deserialize(args);
|
return new ConfigurationSerialization(clazz).deserialize(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the given {@link ConfigurationSerializable} class by its alias
|
* Registers the given {@link ConfigurationSerializable} class by its alias
|
||||||
*
|
*
|
||||||
* @param clazz Class to register
|
* @param clazz Class to register
|
||||||
*/
|
*/
|
||||||
public static void registerClass(Class<? extends ConfigurationSerializable> clazz) {
|
public static void registerClass(Class<? extends ConfigurationSerializable> clazz) {
|
||||||
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
|
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
|
||||||
|
|
||||||
if (delegate == null ) {
|
if (delegate == null) {
|
||||||
registerClass(clazz, getAlias(clazz));
|
registerClass(clazz, getAlias(clazz));
|
||||||
registerClass(clazz, clazz.getName());
|
registerClass(clazz, clazz.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the given alias to the specified {@link ConfigurationSerializable} class
|
* Registers the given alias to the specified {@link ConfigurationSerializable} class
|
||||||
*
|
*
|
||||||
* @param clazz Class to register
|
* @param clazz Class to register
|
||||||
* @param alias Alias to register as
|
* @param alias Alias to register as
|
||||||
*/
|
*/
|
||||||
public static void registerClass(Class<? extends ConfigurationSerializable> clazz, String alias) {
|
public static void registerClass(Class<? extends ConfigurationSerializable> clazz, String alias) {
|
||||||
aliases.put(alias, clazz);
|
aliases.put(alias, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters the specified alias to a {@link ConfigurationSerializable}
|
* Unregisters the specified alias to a {@link ConfigurationSerializable}
|
||||||
*
|
*
|
||||||
* @param alias Alias to unregister
|
* @param alias Alias to unregister
|
||||||
*/
|
*/
|
||||||
public static void unregisterClass(String alias) {
|
public static void unregisterClass(String alias) {
|
||||||
aliases.remove(alias);
|
aliases.remove(alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters any aliases for the specified {@link ConfigurationSerializable} class
|
* Unregisters any aliases for the specified {@link ConfigurationSerializable} class
|
||||||
*
|
*
|
||||||
* @param clazz Class to unregister
|
* @param clazz Class to unregister
|
||||||
*/
|
*/
|
||||||
public static void unregisterClass(Class<? extends ConfigurationSerializable> clazz) {
|
public static void unregisterClass(Class<? extends ConfigurationSerializable> clazz) {
|
||||||
while (aliases.values().remove(clazz));
|
while (aliases.values().remove(clazz)) {
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to get a registered {@link ConfigurationSerializable} class by its alias
|
* Attempts to get a registered {@link ConfigurationSerializable} class by its alias
|
||||||
*
|
*
|
||||||
* @param alias Alias of the serializable
|
* @param alias Alias of the serializable
|
||||||
* @return Registered class, or null if not found
|
* @return Registered class, or null if not found
|
||||||
*/
|
*/
|
||||||
public static Class<? extends ConfigurationSerializable> getClassByAlias(String alias) {
|
public static Class<? extends ConfigurationSerializable> getClassByAlias(String alias) {
|
||||||
return aliases.get(alias);
|
return aliases.get(alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the correct alias for the given {@link ConfigurationSerializable} class
|
* Gets the correct alias for the given {@link ConfigurationSerializable} class
|
||||||
*
|
*
|
||||||
* @param clazz Class to get alias for
|
* @param clazz Class to get alias for
|
||||||
* @return Alias to use for the class
|
* @return Alias to use for the class
|
||||||
*/
|
*/
|
||||||
public static String getAlias(Class<? extends ConfigurationSerializable> clazz) {
|
public static String getAlias(Class<? extends ConfigurationSerializable> clazz) {
|
||||||
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
|
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
|
||||||
|
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
if ((delegate.value() == null) || (delegate.value() == clazz)) {
|
if ((delegate.value() == null) || (delegate.value() == clazz)) {
|
||||||
delegate = null;
|
delegate = null;
|
||||||
@ -237,7 +239,7 @@ public class ConfigurationSerialization {
|
|||||||
return getAlias(delegate.value());
|
return getAlias(delegate.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delegate == null) {
|
if (delegate == null) {
|
||||||
SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
||||||
|
|
||||||
@ -245,7 +247,7 @@ public class ConfigurationSerialization {
|
|||||||
return alias.value();
|
return alias.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return clazz.getName();
|
return clazz.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ import java.lang.annotation.Target;
|
|||||||
public @interface DelegateDeserialization {
|
public @interface DelegateDeserialization {
|
||||||
/**
|
/**
|
||||||
* Which class should be used as a delegate for this classes deserialization
|
* Which class should be used as a delegate for this classes deserialization
|
||||||
*
|
*
|
||||||
* @return Delegate class
|
* @return Delegate class
|
||||||
*/
|
*/
|
||||||
public Class<? extends ConfigurationSerializable> value();
|
public Class<? extends ConfigurationSerializable> value();
|
||||||
|
@ -21,7 +21,7 @@ public @interface SerializableAs {
|
|||||||
* <p>
|
* <p>
|
||||||
* This name MUST be unique. We recommend using names such as "MyPluginThing" instead of
|
* This name MUST be unique. We recommend using names such as "MyPluginThing" instead of
|
||||||
* "Thing".
|
* "Thing".
|
||||||
*
|
*
|
||||||
* @return Name to serialize the class as.
|
* @return Name to serialize the class as.
|
||||||
*/
|
*/
|
||||||
public String value();
|
public String value();
|
||||||
|
@ -7,7 +7,7 @@ package org.bukkit.entity;
|
|||||||
public interface Animals extends Creature {
|
public interface Animals extends Creature {
|
||||||
/**
|
/**
|
||||||
* Gets the age of this animal.
|
* Gets the age of this animal.
|
||||||
*
|
*
|
||||||
* @return Age
|
* @return Age
|
||||||
*/
|
*/
|
||||||
public int getAge();
|
public int getAge();
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a Blaze monster
|
* Represents a Blaze monster
|
||||||
*/
|
*/
|
||||||
public interface Blaze extends Monster {
|
public interface Blaze extends Monster {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,11 @@ public interface Boat extends Vehicle {
|
|||||||
* @param speed The max speed.
|
* @param speed The max speed.
|
||||||
*/
|
*/
|
||||||
public void setMaxSpeed(double speed);
|
public void setMaxSpeed(double speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the deceleration rate (newSpeed = curSpeed * rate) of occupied
|
* Gets the deceleration rate (newSpeed = curSpeed * rate) of occupied
|
||||||
* boats. The default is 0.2.
|
* boats. The default is 0.2.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public double getOccupiedDeceleration();
|
public double getOccupiedDeceleration();
|
||||||
@ -31,7 +31,7 @@ public interface Boat extends Vehicle {
|
|||||||
* Sets the deceleration rate (newSpeed = curSpeed * rate) of occupied
|
* Sets the deceleration rate (newSpeed = curSpeed * rate) of occupied
|
||||||
* boats. Setting this to a higher value allows for quicker acceleration.
|
* boats. Setting this to a higher value allows for quicker acceleration.
|
||||||
* The default is 0.2.
|
* The default is 0.2.
|
||||||
*
|
*
|
||||||
* @param speed deceleration rate
|
* @param speed deceleration rate
|
||||||
*/
|
*/
|
||||||
public void setOccupiedDeceleration(double rate);
|
public void setOccupiedDeceleration(double rate);
|
||||||
@ -40,7 +40,7 @@ public interface Boat extends Vehicle {
|
|||||||
* Gets the deceleration rate (newSpeed = curSpeed * rate) of unoccupied
|
* Gets the deceleration rate (newSpeed = curSpeed * rate) of unoccupied
|
||||||
* boats. The default is -1. Values below 0 indicate that no additional
|
* boats. The default is -1. Values below 0 indicate that no additional
|
||||||
* deceleration is imposed.
|
* deceleration is imposed.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public double getUnoccupiedDeceleration();
|
public double getUnoccupiedDeceleration();
|
||||||
@ -50,21 +50,21 @@ public interface Boat extends Vehicle {
|
|||||||
* boats. Setting this to a higher value allows for quicker deceleration
|
* boats. Setting this to a higher value allows for quicker deceleration
|
||||||
* of boats when a player disembarks. The default is -1. Values below 0
|
* of boats when a player disembarks. The default is -1. Values below 0
|
||||||
* indicate that no additional deceleration is imposed.
|
* indicate that no additional deceleration is imposed.
|
||||||
*
|
*
|
||||||
* @param rate deceleration rate
|
* @param rate deceleration rate
|
||||||
*/
|
*/
|
||||||
public void setUnoccupiedDeceleration(double rate);
|
public void setUnoccupiedDeceleration(double rate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether boats can work on land.
|
* Get whether boats can work on land.
|
||||||
*
|
*
|
||||||
* @return whether boats can work on land
|
* @return whether boats can work on land
|
||||||
*/
|
*/
|
||||||
public boolean getWorkOnLand();
|
public boolean getWorkOnLand();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether boats can work on land.
|
* Set whether boats can work on land.
|
||||||
*
|
*
|
||||||
* @param workOnLand whether boats can work on land
|
* @param workOnLand whether boats can work on land
|
||||||
*/
|
*/
|
||||||
public void setWorkOnLand(boolean workOnLand);
|
public void setWorkOnLand(boolean workOnLand);
|
||||||
|
@ -6,7 +6,7 @@ package org.bukkit.entity;
|
|||||||
public interface ComplexEntityPart extends Entity {
|
public interface ComplexEntityPart extends Entity {
|
||||||
/**
|
/**
|
||||||
* Gets the parent {@link ComplexLivingEntity} of this part.
|
* Gets the parent {@link ComplexLivingEntity} of this part.
|
||||||
*
|
*
|
||||||
* @return Parent complex entity
|
* @return Parent complex entity
|
||||||
*/
|
*/
|
||||||
public ComplexLivingEntity getParent();
|
public ComplexLivingEntity getParent();
|
||||||
|
@ -8,7 +8,7 @@ import java.util.Set;
|
|||||||
public interface ComplexLivingEntity extends LivingEntity {
|
public interface ComplexLivingEntity extends LivingEntity {
|
||||||
/**
|
/**
|
||||||
* Gets a list of parts that belong to this complex entity
|
* Gets a list of parts that belong to this complex entity
|
||||||
*
|
*
|
||||||
* @return List of parts
|
* @return List of parts
|
||||||
*/
|
*/
|
||||||
public Set<ComplexEntityPart> getParts();
|
public Set<ComplexEntityPart> getParts();
|
||||||
|
@ -50,7 +50,7 @@ public enum CreatureType {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends Entity> getEntityClass() {
|
public Class<? extends Entity> getEntityClass() {
|
||||||
return clazz;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents an Ender Dragon
|
* Represents an Ender Dragon
|
||||||
*/
|
*/
|
||||||
public interface EnderDragon extends ComplexLivingEntity {
|
public interface EnderDragon extends ComplexLivingEntity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents an Ender Pearl entity
|
* Represents an Ender Pearl entity
|
||||||
*/
|
*/
|
||||||
public interface EnderPearl extends Projectile {
|
public interface EnderPearl extends Projectile {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents an Ender Signal, which is often created upon throwing an ender eye
|
* Represents an Ender Signal, which is often created upon throwing an ender eye
|
||||||
*/
|
*/
|
||||||
public interface EnderSignal extends Entity {
|
public interface EnderSignal extends Entity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ public interface Entity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this entity has been marked for removal.
|
* Returns true if this entity has been marked for removal.
|
||||||
|
*
|
||||||
* @return True if it is dead.
|
* @return True if it is dead.
|
||||||
*/
|
*/
|
||||||
public boolean isDead();
|
public boolean isDead();
|
||||||
@ -165,49 +166,53 @@ public interface Entity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distance this entity has fallen
|
* Returns the distance this entity has fallen
|
||||||
|
*
|
||||||
* @return The distance.
|
* @return The distance.
|
||||||
*/
|
*/
|
||||||
public float getFallDistance();
|
public float getFallDistance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the fall distance for this entity
|
* Sets the fall distance for this entity
|
||||||
|
*
|
||||||
* @param distance The new distance.
|
* @param distance The new distance.
|
||||||
*/
|
*/
|
||||||
public void setFallDistance(float distance);
|
public void setFallDistance(float distance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record the last {@link EntityDamageEvent} inflicted on this entity
|
* Record the last {@link EntityDamageEvent} inflicted on this entity
|
||||||
|
*
|
||||||
* @param event a {@link EntityDamageEvent}
|
* @param event a {@link EntityDamageEvent}
|
||||||
*/
|
*/
|
||||||
public void setLastDamageCause(EntityDamageEvent event);
|
public void setLastDamageCause(EntityDamageEvent event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the last {@link EntityDamageEvent} inflicted on this entity. This event may have been cancelled.
|
* Retrieve the last {@link EntityDamageEvent} inflicted on this entity. This event may have been cancelled.
|
||||||
|
*
|
||||||
* @return the last known {@link EntityDamageEvent} or null if hitherto unharmed
|
* @return the last known {@link EntityDamageEvent} or null if hitherto unharmed
|
||||||
*/
|
*/
|
||||||
public EntityDamageEvent getLastDamageCause();
|
public EntityDamageEvent getLastDamageCause();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a unique and persistent id for this entity
|
* Returns a unique and persistent id for this entity
|
||||||
|
*
|
||||||
* @return unique id
|
* @return unique id
|
||||||
*/
|
*/
|
||||||
public UUID getUniqueId();
|
public UUID getUniqueId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the amount of ticks this entity has lived for.
|
* Gets the amount of ticks this entity has lived for.
|
||||||
* <p>
|
* <p>
|
||||||
* This is the equivalent to "age" in entities.
|
* This is the equivalent to "age" in entities.
|
||||||
*
|
*
|
||||||
* @return Age of entity
|
* @return Age of entity
|
||||||
*/
|
*/
|
||||||
public int getTicksLived();
|
public int getTicksLived();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the amount of ticks this entity has lived for.
|
* Sets the amount of ticks this entity has lived for.
|
||||||
* <p>
|
* <p>
|
||||||
* This is the equivalent to "age" in entities. May not be
|
* This is the equivalent to "age" in entities. May not be less than one tick.
|
||||||
* less than one tick.
|
*
|
||||||
*
|
|
||||||
* @param value Age of entity
|
* @param value Age of entity
|
||||||
*/
|
*/
|
||||||
public void setTicksLived(int value);
|
public void setTicksLived(int value);
|
||||||
|
@ -10,10 +10,10 @@ public interface ExperienceOrb extends Entity {
|
|||||||
* @return Amount of experience
|
* @return Amount of experience
|
||||||
*/
|
*/
|
||||||
public int getExperience();
|
public int getExperience();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets how much experience is contained within this orb
|
* Sets how much experience is contained within this orb
|
||||||
*
|
*
|
||||||
* @param value Amount of experience
|
* @param value Amount of experience
|
||||||
*/
|
*/
|
||||||
public void setExperience(int value);
|
public void setExperience(int value);
|
||||||
|
@ -6,24 +6,28 @@ package org.bukkit.entity;
|
|||||||
public interface Explosive extends Entity {
|
public interface Explosive extends Entity {
|
||||||
/**
|
/**
|
||||||
* Set the radius affected by this explosive's explosion
|
* Set the radius affected by this explosive's explosion
|
||||||
|
*
|
||||||
* @param yield The explosive yield
|
* @param yield The explosive yield
|
||||||
*/
|
*/
|
||||||
public void setYield(float yield);
|
public void setYield(float yield);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the radius or yield of this explosive's explosion
|
* Return the radius or yield of this explosive's explosion
|
||||||
|
*
|
||||||
* @return the radius of blocks affected
|
* @return the radius of blocks affected
|
||||||
*/
|
*/
|
||||||
public float getYield();
|
public float getYield();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether or not this explosive's explosion causes fire
|
* Set whether or not this explosive's explosion causes fire
|
||||||
|
*
|
||||||
* @param isIncendiary Whether it should cause fire
|
* @param isIncendiary Whether it should cause fire
|
||||||
*/
|
*/
|
||||||
public void setIsIncendiary(boolean isIncendiary);
|
public void setIsIncendiary(boolean isIncendiary);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether or not this explosive creates a fire when exploding
|
* Return whether or not this explosive creates a fire when exploding
|
||||||
|
*
|
||||||
* @return true if the explosive creates fire, false otherwise
|
* @return true if the explosive creates fire, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isIncendiary();
|
public boolean isIncendiary();
|
||||||
|
@ -39,14 +39,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
|
|||||||
*/
|
*/
|
||||||
public void setItemInHand(ItemStack item);
|
public void setItemInHand(ItemStack item);
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the item in hand to another of your 'action slots'.
|
|
||||||
*
|
|
||||||
* @param index The new index to use, only valid ones are 0-8.
|
|
||||||
*
|
|
||||||
public void selectItemInHand(int index);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this player is slumbering.
|
* Returns whether this player is slumbering.
|
||||||
*
|
*
|
||||||
|
@ -25,10 +25,10 @@ public interface LivingEntity extends Entity {
|
|||||||
* @throws IllegalArgumentException Thrown if the health is < 0 or > max
|
* @throws IllegalArgumentException Thrown if the health is < 0 or > max
|
||||||
*/
|
*/
|
||||||
public void setHealth(int health);
|
public void setHealth(int health);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum health this entity may have
|
* Gets the maximum health this entity may have
|
||||||
*
|
*
|
||||||
* @return Maximum health
|
* @return Maximum health
|
||||||
*/
|
*/
|
||||||
public int getMaxHealth();
|
public int getMaxHealth();
|
||||||
@ -86,12 +86,14 @@ public interface LivingEntity extends Entity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws an egg from the entity.
|
* Throws an egg from the entity.
|
||||||
|
*
|
||||||
* @return The egg thrown.
|
* @return The egg thrown.
|
||||||
*/
|
*/
|
||||||
public Egg throwEgg();
|
public Egg throwEgg();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws a snowball from the entity.
|
* Throws a snowball from the entity.
|
||||||
|
*
|
||||||
* @return The snowball thrown.
|
* @return The snowball thrown.
|
||||||
*/
|
*/
|
||||||
public Snowball throwSnowball();
|
public Snowball throwSnowball();
|
||||||
|
@ -23,7 +23,7 @@ public interface Minecart extends Vehicle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum speed of a minecart. The speed is unrelated to the velocity.
|
* Gets the maximum speed of a minecart. The speed is unrelated to the velocity.
|
||||||
*
|
*
|
||||||
* @return The max speed
|
* @return The max speed
|
||||||
*/
|
*/
|
||||||
public double getMaxSpeed();
|
public double getMaxSpeed();
|
||||||
@ -69,6 +69,7 @@ public interface Minecart extends Vehicle {
|
|||||||
* Gets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails.
|
* Gets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails.
|
||||||
*
|
*
|
||||||
* A derailed minecart's velocity is multiplied by this factor each tick.
|
* A derailed minecart's velocity is multiplied by this factor each tick.
|
||||||
|
*
|
||||||
* @return derailed visible speed
|
* @return derailed visible speed
|
||||||
*/
|
*/
|
||||||
public Vector getDerailedVelocityMod();
|
public Vector getDerailedVelocityMod();
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a mushroom {@link Cow}
|
* Represents a mushroom {@link Cow}
|
||||||
*/
|
*/
|
||||||
public interface MushroomCow extends Cow {
|
public interface MushroomCow extends Cow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a non-player character
|
* Represents a non-player character
|
||||||
*/
|
*/
|
||||||
public interface NPC extends Creature {
|
public interface NPC extends Creature {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,14 @@ import org.bukkit.material.Attachable;
|
|||||||
public interface Painting extends Entity, Attachable {
|
public interface Painting extends Entity, Attachable {
|
||||||
/**
|
/**
|
||||||
* Get the art on this painting
|
* Get the art on this painting
|
||||||
|
*
|
||||||
* @return The art
|
* @return The art
|
||||||
*/
|
*/
|
||||||
public Art getArt();
|
public Art getArt();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the art on this painting
|
* Set the art on this painting
|
||||||
|
*
|
||||||
* @param art The new art
|
* @param art The new art
|
||||||
* @return False if the new art won't fit at the painting's current location
|
* @return False if the new art won't fit at the painting's current location
|
||||||
*/
|
*/
|
||||||
@ -23,10 +25,11 @@ public interface Painting extends Entity, Attachable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the art on this painting
|
* Set the art on this painting
|
||||||
|
*
|
||||||
* @param art The new art
|
* @param art The new art
|
||||||
* @param force If true, force the new art regardless of whether it fits at the current location
|
* @param force If true, force the new art regardless of whether it fits at the current location
|
||||||
* Note that forcing it where it can't fit normally causes it to drop as an item unless you override
|
* Note that forcing it where it can't fit normally causes it to drop as an item unless you override
|
||||||
* this by catching the PAINTING_BREAK event.
|
* this by catching the PAINTING_BREAK event.
|
||||||
* @return False if force was false and the new art won't fit at the painting's current location
|
* @return False if force was false and the new art won't fit at the painting's current location
|
||||||
*/
|
*/
|
||||||
public boolean setArt(Art art, boolean force);
|
public boolean setArt(Art art, boolean force);
|
||||||
@ -34,6 +37,7 @@ public interface Painting extends Entity, Attachable {
|
|||||||
/**
|
/**
|
||||||
* Sets the direction of the painting, potentially overriding rules of placement. Note that if the result
|
* Sets the direction of the painting, potentially overriding rules of placement. Note that if the result
|
||||||
* is not valid the painting would normally drop as an item.
|
* is not valid the painting would normally drop as an item.
|
||||||
|
*
|
||||||
* @param face The new direction.
|
* @param face The new direction.
|
||||||
* @param force Whether to force it.
|
* @param force Whether to force it.
|
||||||
* @return False if force was false and there was no block for it to attach to in order to face the given direction.
|
* @return False if force was false and there was no block for it to attach to in order to face the given direction.
|
||||||
|
@ -6,7 +6,7 @@ package org.bukkit.entity;
|
|||||||
public interface Pig extends Animals, Vehicle {
|
public interface Pig extends Animals, Vehicle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the pig has a saddle.
|
* Check if the pig has a saddle.
|
||||||
*
|
*
|
||||||
* @return if the pig has been saddled.
|
* @return if the pig has been saddled.
|
||||||
*/
|
*/
|
||||||
|
@ -37,7 +37,7 @@ public interface Player extends HumanEntity, CommandSender, OfflinePlayer {
|
|||||||
* @param name The new display name.
|
* @param name The new display name.
|
||||||
*/
|
*/
|
||||||
public void setDisplayName(String name);
|
public void setDisplayName(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name that is shown on the player list.
|
* Gets the name that is shown on the player list.
|
||||||
*
|
*
|
||||||
@ -82,6 +82,7 @@ public interface Player extends HumanEntity, CommandSender, OfflinePlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the socket address of this player
|
* Gets the socket address of this player
|
||||||
|
*
|
||||||
* @return the player's address
|
* @return the player's address
|
||||||
*/
|
*/
|
||||||
public InetSocketAddress getAddress();
|
public InetSocketAddress getAddress();
|
||||||
@ -117,12 +118,14 @@ public interface Player extends HumanEntity, CommandSender, OfflinePlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the player is in sneak mode
|
* Returns if the player is in sneak mode
|
||||||
|
*
|
||||||
* @return true if player is in sneak mode
|
* @return true if player is in sneak mode
|
||||||
*/
|
*/
|
||||||
public boolean isSneaking();
|
public boolean isSneaking();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the sneak mode the player
|
* Sets the sneak mode the player
|
||||||
|
*
|
||||||
* @param sneak true if player should appear sneaking
|
* @param sneak true if player should appear sneaking
|
||||||
*/
|
*/
|
||||||
public void setSneaking(boolean sneak);
|
public void setSneaking(boolean sneak);
|
||||||
@ -214,7 +217,7 @@ public interface Player extends HumanEntity, CommandSender, OfflinePlayer {
|
|||||||
/**
|
/**
|
||||||
* Send a chunk change. This fakes a chunk change packet for a user at
|
* Send a chunk change. This fakes a chunk change packet for a user at
|
||||||
* a certain location. The updated cuboid must be entirely within a single
|
* a certain location. The updated cuboid must be entirely within a single
|
||||||
* chunk. This will not actually change the world in any way.
|
* chunk. This will not actually change the world in any way.
|
||||||
*
|
*
|
||||||
* At least one of the dimensions of the cuboid must be even. The size of the
|
* At least one of the dimensions of the cuboid must be even. The size of the
|
||||||
* data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51
|
* data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a small {@link Fireball}
|
* Represents a small {@link Fireball}
|
||||||
*/
|
*/
|
||||||
public interface SmallFireball extends Fireball {
|
public interface SmallFireball extends Fireball {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a snowman entity
|
* Represents a snowman entity
|
||||||
*/
|
*/
|
||||||
public interface Snowman extends Creature {
|
public interface Snowman extends Creature {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,14 @@ package org.bukkit.entity;
|
|||||||
public interface TNTPrimed extends Explosive {
|
public interface TNTPrimed extends Explosive {
|
||||||
/**
|
/**
|
||||||
* Set the number of ticks until the TNT blows up after being primed.
|
* Set the number of ticks until the TNT blows up after being primed.
|
||||||
|
*
|
||||||
* @param fuseTicks The fuse ticks
|
* @param fuseTicks The fuse ticks
|
||||||
*/
|
*/
|
||||||
public void setFuseTicks(int fuseTicks);
|
public void setFuseTicks(int fuseTicks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the number of ticks until the explosion of this TNTPrimed entity
|
* Retrieve the number of ticks until the explosion of this TNTPrimed entity
|
||||||
|
*
|
||||||
* @return the number of ticks until this TNTPrimed explodes
|
* @return the number of ticks until this TNTPrimed explodes
|
||||||
*/
|
*/
|
||||||
public int getFuseTicks();
|
public int getFuseTicks();
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a thrown potion bottle
|
* Represents a thrown potion bottle
|
||||||
*/
|
*/
|
||||||
public interface ThrownPotion extends Projectile {
|
public interface ThrownPotion extends Projectile {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ package org.bukkit.entity;
|
|||||||
* Represents a villager NPC
|
* Represents a villager NPC
|
||||||
*/
|
*/
|
||||||
public interface Villager extends NPC {
|
public interface Villager extends NPC {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Projectile;
|
|||||||
/**
|
/**
|
||||||
* Represents an event
|
* Represents an event
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public abstract class Event implements Serializable {
|
public abstract class Event implements Serializable {
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -146,128 +147,128 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerJoinEvent
|
* @see org.bukkit.event.player.PlayerJoinEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_JOIN (Category.PLAYER),
|
PLAYER_JOIN(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to connect to the server
|
* Called when a player is attempting to connect to the server
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerLoginEvent
|
* @see org.bukkit.event.player.PlayerLoginEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_LOGIN (Category.PLAYER),
|
PLAYER_LOGIN(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player has just been authenticated
|
* Called when a player has just been authenticated
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerPreLoginEvent
|
* @see org.bukkit.event.player.PlayerPreLoginEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_PRELOGIN (Category.PLAYER),
|
PLAYER_PRELOGIN(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player respawns
|
* Called when a player respawns
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerRespawnEvent
|
* @see org.bukkit.event.player.PlayerRespawnEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_RESPAWN (Category.PLAYER),
|
PLAYER_RESPAWN(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player gets kicked from the server
|
* Called when a player gets kicked from the server
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerKickEvent
|
* @see org.bukkit.event.player.PlayerKickEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_KICK (Category.PLAYER),
|
PLAYER_KICK(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player sends a chat message
|
* Called when a player sends a chat message
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerChatEvent
|
* @see org.bukkit.event.player.PlayerChatEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_CHAT (Category.PLAYER),
|
PLAYER_CHAT(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player uses a command (early in the command handling process)
|
* Called when a player uses a command (early in the command handling process)
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerCommandPreprocessEvent
|
* @see org.bukkit.event.player.PlayerCommandPreprocessEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_COMMAND_PREPROCESS (Category.PLAYER),
|
PLAYER_COMMAND_PREPROCESS(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player leaves the server
|
* Called when a player leaves the server
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerQuitEvent
|
* @see org.bukkit.event.player.PlayerQuitEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_QUIT (Category.PLAYER),
|
PLAYER_QUIT(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player moves position in the world
|
* Called when a player moves position in the world
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerMoveEvent
|
* @see org.bukkit.event.player.PlayerMoveEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_MOVE (Category.PLAYER),
|
PLAYER_MOVE(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called before a player gets a velocity vector sent, which will instruct him to
|
* Called before a player gets a velocity vector sent, which will instruct him to
|
||||||
* get "pushed" into a specific direction, e.g. after an explosion
|
* get "pushed" into a specific direction, e.g. after an explosion
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerVelocityEvent
|
* @see org.bukkit.event.player.PlayerVelocityEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_VELOCITY (Category.PLAYER),
|
PLAYER_VELOCITY(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player undergoes an animation (Arm Swing is the only animation currently supported)
|
* Called when a player undergoes an animation (Arm Swing is the only animation currently supported)
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerAnimationEvent
|
* @see org.bukkit.event.player.PlayerAnimationEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_ANIMATION (Category.PLAYER),
|
PLAYER_ANIMATION(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player toggles sneak mode
|
* Called when a player toggles sneak mode
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerToggleSneakEvent
|
* @see org.bukkit.event.player.PlayerToggleSneakEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_TOGGLE_SNEAK (Category.PLAYER),
|
PLAYER_TOGGLE_SNEAK(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player toggles sprint mode
|
* Called when a player toggles sprint mode
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerToggleSprintEvent
|
* @see org.bukkit.event.player.PlayerToggleSprintEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_TOGGLE_SPRINT (Category.PLAYER),
|
PLAYER_TOGGLE_SPRINT(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player interacts with an object or air
|
* Called when a player interacts with an object or air
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerInteractEvent
|
* @see org.bukkit.event.player.PlayerInteractEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_INTERACT (Category.PLAYER),
|
PLAYER_INTERACT(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player right clicks an entity
|
* Called when a player right clicks an entity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerInteractEntityEvent
|
* @see org.bukkit.event.player.PlayerInteractEntityEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_INTERACT_ENTITY (Category.PLAYER),
|
PLAYER_INTERACT_ENTITY(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player throws an egg
|
* Called when a player throws an egg
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerEggThrowEvent
|
* @see org.bukkit.event.player.PlayerEggThrowEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_EGG_THROW (Category.PLAYER),
|
PLAYER_EGG_THROW(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player teleports from one position to another
|
* Called when a player teleports from one position to another
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerTeleportEvent
|
* @see org.bukkit.event.player.PlayerTeleportEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_TELEPORT (Category.PLAYER),
|
PLAYER_TELEPORT(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player completes the portaling process by standing in a portal
|
* Called when a player completes the portaling process by standing in a portal
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerPortalEvent
|
* @see org.bukkit.event.player.PlayerPortalEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_PORTAL (Category.PLAYER),
|
PLAYER_PORTAL(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player changes their held item
|
* Called when a player changes their held item
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerItemHeldEvent
|
* @see org.bukkit.event.player.PlayerItemHeldEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_ITEM_HELD (Category.PLAYER),
|
PLAYER_ITEM_HELD(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player drops an item
|
* Called when a player drops an item
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerDropItemEvent
|
* @see org.bukkit.event.player.PlayerDropItemEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_DROP_ITEM (Category.PLAYER),
|
PLAYER_DROP_ITEM(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player picks an item up off the ground
|
* Called when a player picks an item up off the ground
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.player.PlayerPickupItemEvent
|
* @see org.bukkit.event.player.PlayerPickupItemEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_PICKUP_ITEM (Category.PLAYER),
|
PLAYER_PICKUP_ITEM(Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Called when a player empties a bucket
|
* Called when a player empties a bucket
|
||||||
*
|
*
|
||||||
@ -328,7 +329,7 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockDamageEvent
|
* @see org.bukkit.event.block.BlockDamageEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_DAMAGE (Category.BLOCK),
|
BLOCK_DAMAGE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block is undergoing a universe physics
|
* Called when a block is undergoing a universe physics
|
||||||
* check on whether it can be built
|
* check on whether it can be built
|
||||||
@ -337,21 +338,21 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockCanBuildEvent
|
* @see org.bukkit.event.block.BlockCanBuildEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_CANBUILD (Category.BLOCK),
|
BLOCK_CANBUILD(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block of water or lava attempts to flow into another
|
* Called when a block of water or lava attempts to flow into another
|
||||||
* block
|
* block
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockFromToEvent
|
* @see org.bukkit.event.block.BlockFromToEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_FROMTO (Category.BLOCK),
|
BLOCK_FROMTO(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block is being set on fire from another block, such as
|
* Called when a block is being set on fire from another block, such as
|
||||||
* an adjacent block of fire attempting to set fire to wood
|
* an adjacent block of fire attempting to set fire to wood
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockIgniteEvent
|
* @see org.bukkit.event.block.BlockIgniteEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_IGNITE (Category.BLOCK),
|
BLOCK_IGNITE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block undergoes a physics check
|
* Called when a block undergoes a physics check
|
||||||
*
|
*
|
||||||
@ -360,37 +361,37 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockPhysicsEvent
|
* @see org.bukkit.event.block.BlockPhysicsEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PHYSICS (Category.BLOCK),
|
BLOCK_PHYSICS(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to place a block
|
* Called when a player is attempting to place a block
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockPlaceEvent
|
* @see org.bukkit.event.block.BlockPlaceEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PLACE (Category.BLOCK),
|
BLOCK_PLACE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block dispenses something
|
* Called when a block dispenses something
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockDispenseEvent
|
* @see org.bukkit.event.block.BlockDispenseEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_DISPENSE (Category.BLOCK),
|
BLOCK_DISPENSE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block is destroyed from being burnt by fire
|
* Called when a block is destroyed from being burnt by fire
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockBurnEvent
|
* @see org.bukkit.event.block.BlockBurnEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_BURN (Category.BLOCK),
|
BLOCK_BURN(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when leaves are decaying naturally
|
* Called when leaves are decaying naturally
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.LeavesDecayEvent
|
* @see org.bukkit.event.block.LeavesDecayEvent
|
||||||
*/
|
*/
|
||||||
LEAVES_DECAY (Category.BLOCK),
|
LEAVES_DECAY(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a sign is changed
|
* Called when a sign is changed
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.SignChangeEvent
|
* @see org.bukkit.event.block.SignChangeEvent
|
||||||
*/
|
*/
|
||||||
SIGN_CHANGE (Category.BLOCK),
|
SIGN_CHANGE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block changes redstone current. Only triggered on blocks
|
* Called when a block changes redstone current. Only triggered on blocks
|
||||||
* that are actually capable of transmitting or carrying a redstone
|
* that are actually capable of transmitting or carrying a redstone
|
||||||
@ -398,43 +399,43 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockRedstoneEvent
|
* @see org.bukkit.event.block.BlockRedstoneEvent
|
||||||
*/
|
*/
|
||||||
REDSTONE_CHANGE (Category.BLOCK),
|
REDSTONE_CHANGE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken by a player
|
* Called when a block is broken by a player
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockBreakEvent
|
* @see org.bukkit.event.block.BlockBreakEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_BREAK (Category.BLOCK),
|
BLOCK_BREAK(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block is formed based on world conditions
|
* Called when a block is formed based on world conditions
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockFormEvent
|
* @see org.bukkit.event.block.BlockFormEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_FORM (Category.BLOCK),
|
BLOCK_FORM(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block spreads based on world conditions
|
* Called when a block spreads based on world conditions
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockSpreadEvent
|
* @see org.bukkit.event.block.BlockSpreadEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_SPREAD (Category.BLOCK),
|
BLOCK_SPREAD(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a block fades, melts or disappears based on world conditions
|
* Called when a block fades, melts or disappears based on world conditions
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockFadeEvent
|
* @see org.bukkit.event.block.BlockFadeEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_FADE (Category.BLOCK),
|
BLOCK_FADE(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a piston extends
|
* Called when a piston extends
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockPistonExtendEvent
|
* @see org.bukkit.event.block.BlockPistonExtendEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PISTON_EXTEND (Category.BLOCK),
|
BLOCK_PISTON_EXTEND(Category.BLOCK),
|
||||||
/**
|
/**
|
||||||
* Called when a piston retracts
|
* Called when a piston retracts
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.block.BlockPistonRetractEvent
|
* @see org.bukkit.event.block.BlockPistonRetractEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PISTON_RETRACT (Category.BLOCK),
|
BLOCK_PISTON_RETRACT(Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INVENTORY EVENTS
|
* INVENTORY EVENTS
|
||||||
@ -445,43 +446,43 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_OPEN (Category.INVENTORY),
|
INVENTORY_OPEN(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when a player closes an inventory
|
* Called when a player closes an inventory
|
||||||
*
|
*
|
||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CLOSE (Category.INVENTORY),
|
INVENTORY_CLOSE(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when a player clicks on an inventory slot
|
* Called when a player clicks on an inventory slot
|
||||||
*
|
*
|
||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CLICK (Category.INVENTORY),
|
INVENTORY_CLICK(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when an inventory slot changes values or type
|
* Called when an inventory slot changes values or type
|
||||||
*
|
*
|
||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CHANGE (Category.INVENTORY),
|
INVENTORY_CHANGE(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to perform an inventory transaction
|
* Called when a player is attempting to perform an inventory transaction
|
||||||
*
|
*
|
||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_TRANSACTION (Category.INVENTORY),
|
INVENTORY_TRANSACTION(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when an ItemStack is successfully smelted in a furnace.
|
* Called when an ItemStack is successfully smelted in a furnace.
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.inventory.FurnaceSmeltEvent
|
* @see org.bukkit.event.inventory.FurnaceSmeltEvent
|
||||||
*/
|
*/
|
||||||
FURNACE_SMELT (Category.INVENTORY),
|
FURNACE_SMELT(Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Called when an ItemStack is successfully burned as fuel in a furnace.
|
* Called when an ItemStack is successfully burned as fuel in a furnace.
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.inventory.FurnaceBurnEvent
|
* @see org.bukkit.event.inventory.FurnaceBurnEvent
|
||||||
*/
|
*/
|
||||||
FURNACE_BURN (Category.INVENTORY),
|
FURNACE_BURN(Category.INVENTORY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SERVER EVENTS
|
* SERVER EVENTS
|
||||||
@ -492,19 +493,19 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.server.PluginEnableEvent
|
* @see org.bukkit.event.server.PluginEnableEvent
|
||||||
*/
|
*/
|
||||||
PLUGIN_ENABLE (Category.SERVER),
|
PLUGIN_ENABLE(Category.SERVER),
|
||||||
/**
|
/**
|
||||||
* Called when a plugin is disabled
|
* Called when a plugin is disabled
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.server.PluginDisableEvent
|
* @see org.bukkit.event.server.PluginDisableEvent
|
||||||
*/
|
*/
|
||||||
PLUGIN_DISABLE (Category.SERVER),
|
PLUGIN_DISABLE(Category.SERVER),
|
||||||
/**
|
/**
|
||||||
* Called when a server command is called
|
* Called when a server command is called
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.server.ServerCommandEvent
|
* @see org.bukkit.event.server.ServerCommandEvent
|
||||||
*/
|
*/
|
||||||
SERVER_COMMAND (Category.SERVER),
|
SERVER_COMMAND(Category.SERVER),
|
||||||
/**
|
/**
|
||||||
* Called when a remote server command is called
|
* Called when a remote server command is called
|
||||||
*
|
*
|
||||||
@ -516,13 +517,13 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.server.MapInitializeEvent
|
* @see org.bukkit.event.server.MapInitializeEvent
|
||||||
*/
|
*/
|
||||||
MAP_INITIALIZE (Category.SERVER),
|
MAP_INITIALIZE(Category.SERVER),
|
||||||
/**
|
/**
|
||||||
* Called when a client pings a server.
|
* Called when a client pings a server.
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.server.ServerListPingEvent
|
* @see org.bukkit.event.server.ServerListPingEvent
|
||||||
*/
|
*/
|
||||||
SERVER_LIST_PING (Category.SERVER),
|
SERVER_LIST_PING(Category.SERVER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WORLD EVENTS
|
* WORLD EVENTS
|
||||||
@ -536,13 +537,13 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.ChunkLoadEvent
|
* @see org.bukkit.event.world.ChunkLoadEvent
|
||||||
*/
|
*/
|
||||||
CHUNK_LOAD (Category.WORLD),
|
CHUNK_LOAD(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a chunk is unloaded
|
* Called when a chunk is unloaded
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.ChunkUnloadEvent
|
* @see org.bukkit.event.world.ChunkUnloadEvent
|
||||||
*/
|
*/
|
||||||
CHUNK_UNLOAD (Category.WORLD),
|
CHUNK_UNLOAD(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a newly created chunk has been populated.
|
* Called when a newly created chunk has been populated.
|
||||||
*
|
*
|
||||||
@ -550,55 +551,55 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.ChunkPopulateEvent
|
* @see org.bukkit.event.world.ChunkPopulateEvent
|
||||||
*/
|
*/
|
||||||
CHUNK_POPULATED (Category.WORLD),
|
CHUNK_POPULATED(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when an ItemEntity spawns in the world
|
* Called when an ItemEntity spawns in the world
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.ItemSpawnEvent
|
* @see org.bukkit.event.entity.ItemSpawnEvent
|
||||||
*/
|
*/
|
||||||
ITEM_SPAWN (Category.WORLD),
|
ITEM_SPAWN(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a World's spawn is changed
|
* Called when a World's spawn is changed
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.SpawnChangeEvent
|
* @see org.bukkit.event.world.SpawnChangeEvent
|
||||||
*/
|
*/
|
||||||
SPAWN_CHANGE (Category.WORLD),
|
SPAWN_CHANGE(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a world is saved
|
* Called when a world is saved
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.WorldSaveEvent
|
* @see org.bukkit.event.world.WorldSaveEvent
|
||||||
*/
|
*/
|
||||||
WORLD_SAVE (Category.WORLD),
|
WORLD_SAVE(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a World is initializing
|
* Called when a World is initializing
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.WorldInitEvent
|
* @see org.bukkit.event.world.WorldInitEvent
|
||||||
*/
|
*/
|
||||||
WORLD_INIT (Category.WORLD),
|
WORLD_INIT(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a World is loaded
|
* Called when a World is loaded
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.WorldLoadEvent
|
* @see org.bukkit.event.world.WorldLoadEvent
|
||||||
*/
|
*/
|
||||||
WORLD_LOAD (Category.WORLD),
|
WORLD_LOAD(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when a World is unloaded
|
* Called when a World is unloaded
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.WorldUnloadEvent
|
* @see org.bukkit.event.world.WorldUnloadEvent
|
||||||
*/
|
*/
|
||||||
WORLD_UNLOAD (Category.WORLD),
|
WORLD_UNLOAD(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when world attempts to create a matching end to a portal
|
* Called when world attempts to create a matching end to a portal
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.world.PortalCreateEvent
|
* @see org.bukkit.event.world.PortalCreateEvent
|
||||||
*/
|
*/
|
||||||
PORTAL_CREATE (Category.WORLD),
|
PORTAL_CREATE(Category.WORLD),
|
||||||
/**
|
/**
|
||||||
* Called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
|
* Called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
|
||||||
*
|
*
|
||||||
+ * @see org.bukkit.event.world.TreeGrowEvent
|
* @see org.bukkit.event.world.TreeGrowEvent
|
||||||
*/
|
*/
|
||||||
STRUCTURE_GROW (Category.WORLD),
|
STRUCTURE_GROW(Category.WORLD),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ENTITY EVENTS
|
* ENTITY EVENTS
|
||||||
@ -609,19 +610,19 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.painting.PaintingPlaceEvent
|
* @see org.bukkit.event.painting.PaintingPlaceEvent
|
||||||
*/
|
*/
|
||||||
PAINTING_PLACE (Category.ENTITY),
|
PAINTING_PLACE(Category.ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a painting is removed
|
* Called when a painting is removed
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.painting.PaintingBreakEvent
|
* @see org.bukkit.event.painting.PaintingBreakEvent
|
||||||
*/
|
*/
|
||||||
PAINTING_BREAK (Category.ENTITY),
|
PAINTING_BREAK(Category.ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an entity touches a portal block
|
* Called when an entity touches a portal block
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityPortalEnterEvent
|
* @see org.bukkit.event.entity.EntityPortalEnterEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_PORTAL_ENTER (Category.ENTITY),
|
ENTITY_PORTAL_ENTER(Category.ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIVING_ENTITY EVENTS
|
* LIVING_ENTITY EVENTS
|
||||||
@ -633,31 +634,31 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.CreatureSpawnEvent
|
* @see org.bukkit.event.entity.CreatureSpawnEvent
|
||||||
*/
|
*/
|
||||||
CREATURE_SPAWN (Category.LIVING_ENTITY),
|
CREATURE_SPAWN(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is damaged with no source.
|
* Called when a LivingEntity is damaged with no source.
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityDamageEvent
|
* @see org.bukkit.event.entity.EntityDamageEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_DAMAGE (Category.LIVING_ENTITY),
|
ENTITY_DAMAGE(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity dies
|
* Called when a LivingEntity dies
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityDeathEvent
|
* @see org.bukkit.event.entity.EntityDeathEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_DEATH (Category.LIVING_ENTITY),
|
ENTITY_DEATH(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a Skeleton or Zombie catch fire due to the sun
|
* Called when a Skeleton or Zombie catch fire due to the sun
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityCombustEvent
|
* @see org.bukkit.event.entity.EntityCombustEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_COMBUST (Category.LIVING_ENTITY),
|
ENTITY_COMBUST(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
|
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityExplodeEvent
|
* @see org.bukkit.event.entity.EntityExplodeEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_EXPLODE (Category.LIVING_ENTITY),
|
ENTITY_EXPLODE(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an entity has made a decision to explode.
|
* Called when an entity has made a decision to explode.
|
||||||
*
|
*
|
||||||
@ -670,74 +671,74 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.ExplosionPrimeEvent
|
* @see org.bukkit.event.entity.ExplosionPrimeEvent
|
||||||
*/
|
*/
|
||||||
EXPLOSION_PRIME (Category.LIVING_ENTITY),
|
EXPLOSION_PRIME(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an entity targets another entity
|
* Called when an entity targets another entity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityTargetEvent
|
* @see org.bukkit.event.entity.EntityTargetEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_TARGET (Category.LIVING_ENTITY),
|
ENTITY_TARGET(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an entity interacts with a block
|
* Called when an entity interacts with a block
|
||||||
* This event specifically excludes player entities
|
* This event specifically excludes player entities
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityInteractEvent
|
* @see org.bukkit.event.entity.EntityInteractEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_INTERACT (Category.LIVING_ENTITY),
|
ENTITY_INTERACT(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a creeper gains or loses a power shell
|
* Called when a creeper gains or loses a power shell
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.CreeperPowerEvent
|
* @see org.bukkit.event.entity.CreeperPowerEvent
|
||||||
*/
|
*/
|
||||||
CREEPER_POWER (Category.LIVING_ENTITY),
|
CREEPER_POWER(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a pig is zapped, zombifying it
|
* Called when a pig is zapped, zombifying it
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.PigZapEvent
|
* @see org.bukkit.event.entity.PigZapEvent
|
||||||
*/
|
*/
|
||||||
PIG_ZAP (Category.LIVING_ENTITY),
|
PIG_ZAP(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is tamed
|
* Called when a LivingEntity is tamed
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityTameEvent
|
* @see org.bukkit.event.entity.EntityTameEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_TAME (Category.LIVING_ENTITY),
|
ENTITY_TAME(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a {@link Projectile} hits something
|
* Called when a {@link Projectile} hits something
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.ProjectileHitEvent
|
* @see org.bukkit.event.entity.ProjectileHitEvent
|
||||||
*/
|
*/
|
||||||
PROJECTILE_HIT (Category.ENTITY),
|
PROJECTILE_HIT(Category.ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a Slime splits into smaller Slimes upon death
|
* Called when a Slime splits into smaller Slimes upon death
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.SlimeSplitEvent
|
* @see org.bukkit.event.entity.SlimeSplitEvent
|
||||||
*/
|
*/
|
||||||
SLIME_SPLIT (Category.LIVING_ENTITY),
|
SLIME_SPLIT(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is regains health
|
* Called when a LivingEntity is regains health
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EntityRegainHealthEvent
|
* @see org.bukkit.event.entity.EntityRegainHealthEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_REGAIN_HEALTH (Category.LIVING_ENTITY),
|
ENTITY_REGAIN_HEALTH(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an Enderman picks a block up
|
* Called when an Enderman picks a block up
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EndermanPickupEvent
|
* @see org.bukkit.event.entity.EndermanPickupEvent
|
||||||
*/
|
*/
|
||||||
ENDERMAN_PICKUP (Category.LIVING_ENTITY),
|
ENDERMAN_PICKUP(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when an Enderman places a block
|
* Called when an Enderman places a block
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.EndermanPlaceEvent
|
* @see org.bukkit.event.entity.EndermanPlaceEvent
|
||||||
*/
|
*/
|
||||||
ENDERMAN_PLACE (Category.LIVING_ENTITY),
|
ENDERMAN_PLACE(Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a human entity's food level changes
|
* Called when a human entity's food level changes
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.entity.FoodLevelChangeEvent
|
* @see org.bukkit.event.entity.FoodLevelChangeEvent
|
||||||
*/
|
*/
|
||||||
FOOD_LEVEL_CHANGE (Category.LIVING_ENTITY),
|
FOOD_LEVEL_CHANGE(Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WEATHER EVENTS
|
* WEATHER EVENTS
|
||||||
@ -748,19 +749,19 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.weather.LightningStrikeEvent
|
* @see org.bukkit.event.weather.LightningStrikeEvent
|
||||||
*/
|
*/
|
||||||
LIGHTNING_STRIKE (Category.WEATHER),
|
LIGHTNING_STRIKE(Category.WEATHER),
|
||||||
/**
|
/**
|
||||||
* Called when the weather in a world changes
|
* Called when the weather in a world changes
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.weather.WeatherChangeEvent
|
* @see org.bukkit.event.weather.WeatherChangeEvent
|
||||||
*/
|
*/
|
||||||
WEATHER_CHANGE (Category.WEATHER),
|
WEATHER_CHANGE(Category.WEATHER),
|
||||||
/**
|
/**
|
||||||
* Called when the thunder state in a world changes
|
* Called when the thunder state in a world changes
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.weather.ThunderChangeEvent
|
* @see org.bukkit.event.weather.ThunderChangeEvent
|
||||||
*/
|
*/
|
||||||
THUNDER_CHANGE (Category.WEATHER),
|
THUNDER_CHANGE(Category.WEATHER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VEHICLE EVENTS
|
* VEHICLE EVENTS
|
||||||
@ -771,55 +772,55 @@ public abstract class Event implements Serializable {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleCreateEvent
|
* @see org.bukkit.event.vehicle.VehicleCreateEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_CREATE (Category.VEHICLE),
|
VEHICLE_CREATE(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is destroyed
|
* Called when a vehicle is destroyed
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleDestroyEvent
|
* @see org.bukkit.event.vehicle.VehicleDestroyEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_DESTROY (Category.VEHICLE),
|
VEHICLE_DESTROY(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is damaged by a LivingEntity
|
* Called when a vehicle is damaged by a LivingEntity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleDamageEvent
|
* @see org.bukkit.event.vehicle.VehicleDamageEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_DAMAGE (Category.VEHICLE),
|
VEHICLE_DAMAGE(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle collides with an Entity
|
* Called when a vehicle collides with an Entity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleCollisionEvent
|
* @see org.bukkit.event.vehicle.VehicleCollisionEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_COLLISION_ENTITY (Category.VEHICLE),
|
VEHICLE_COLLISION_ENTITY(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle collides with a Block
|
* Called when a vehicle collides with a Block
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
|
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_COLLISION_BLOCK (Category.VEHICLE),
|
VEHICLE_COLLISION_BLOCK(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is entered by a LivingEntity
|
* Called when a vehicle is entered by a LivingEntity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleEnterEvent
|
* @see org.bukkit.event.vehicle.VehicleEnterEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_ENTER (Category.VEHICLE),
|
VEHICLE_ENTER(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is exited by a LivingEntity
|
* Called when a vehicle is exited by a LivingEntity
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleExitEvent
|
* @see org.bukkit.event.vehicle.VehicleExitEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_EXIT (Category.VEHICLE),
|
VEHICLE_EXIT(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle moves position in the world
|
* Called when a vehicle moves position in the world
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleMoveEvent
|
* @see org.bukkit.event.vehicle.VehicleMoveEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_MOVE (Category.VEHICLE),
|
VEHICLE_MOVE(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is going through an update cycle, rechecking itself
|
* Called when a vehicle is going through an update cycle, rechecking itself
|
||||||
*
|
*
|
||||||
* @see org.bukkit.event.vehicle.VehicleUpdateEvent
|
* @see org.bukkit.event.vehicle.VehicleUpdateEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_UPDATE (Category.VEHICLE),
|
VEHICLE_UPDATE(Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* MISCELLANEOUS EVENTS
|
* MISCELLANEOUS EVENTS
|
||||||
*/
|
*/
|
||||||
@ -827,7 +828,7 @@ public abstract class Event implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Represents a custom event, isn't actually used
|
* Represents a custom event, isn't actually used
|
||||||
*/
|
*/
|
||||||
CUSTOM_EVENT (Category.MISCELLANEOUS);
|
CUSTOM_EVENT(Category.MISCELLANEOUS);
|
||||||
|
|
||||||
private final Category category;
|
private final Category category;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class EventException extends Exception {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new EventException with the given message
|
* Constructs a new EventException with the given message
|
||||||
|
*
|
||||||
* @param cause The exception that caused this
|
* @param cause The exception that caused this
|
||||||
* @param message The message
|
* @param message The message
|
||||||
*/
|
*/
|
||||||
@ -32,6 +33,7 @@ public class EventException extends Exception {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new EventException with the given message
|
* Constructs a new EventException with the given message
|
||||||
|
*
|
||||||
* @param message The message
|
* @param message The message
|
||||||
*/
|
*/
|
||||||
public EventException(String message) {
|
public EventException(String message) {
|
||||||
|
@ -6,13 +6,14 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken by a player.
|
* Called when a block is broken by a player.
|
||||||
*<p />
|
* <p />
|
||||||
* Note:
|
* Note:
|
||||||
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining
|
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining
|
||||||
* what the default drop for the block being broken is and what to do about it, if anything.
|
* what the default drop for the block being broken is and what to do about it, if anything.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Break event is cancelled, the block will not break.
|
* If a Block Break event is cancelled, the block will not break.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -5,9 +5,10 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is destroyed as a result of being burnt by fire.
|
* Called when a block is destroyed as a result of being burnt by fire.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
|
@ -5,13 +5,14 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when we try to place a block, to see if we can build it here or not.
|
* Called when we try to place a block, to see if we can build it here or not.
|
||||||
*<p />
|
* <p />
|
||||||
* Note:
|
* Note:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
||||||
* <li>If you want to figure out what is being placed, use {@link #getMaterial()} or {@link #getMaterialId()} instead.</li>
|
* <li>If you want to figure out what is being placed, use {@link #getMaterial()} or {@link #getMaterialId()} instead.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockCanBuildEvent extends BlockEvent {
|
public class BlockCanBuildEvent extends BlockEvent {
|
||||||
protected boolean buildable;
|
protected boolean buildable;
|
||||||
protected int material;
|
protected int material;
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
* <p />
|
* <p />
|
||||||
* If a Block Damage event is cancelled, the block will not be damaged.
|
* If a Block Damage event is cancelled, the block will not be damaged.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||||
private Player player;
|
private Player player;
|
||||||
private boolean instaBreak;
|
private boolean instaBreak;
|
||||||
|
@ -7,9 +7,10 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an item is dispensed from a block.
|
* Called when an item is dispensed from a block.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||||
|
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
@ -43,7 +44,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the velocity.
|
* Gets the velocity.
|
||||||
*<p />
|
* <p />
|
||||||
* Note: Modifying the returned Vector will not change the velocity, you must use {@link #setVelocity(org.bukkit.util.Vector)} instead.
|
* Note: Modifying the returned Vector will not change the velocity, you must use {@link #setVelocity(org.bukkit.util.Vector)} instead.
|
||||||
*
|
*
|
||||||
* @return A Vector for the dispensed item's velocity
|
* @return A Vector for the dispensed item's velocity
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.event.Event;
|
|||||||
/**
|
/**
|
||||||
* Represents a block related event.
|
* Represents a block related event.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockEvent extends Event {
|
public class BlockEvent extends Event {
|
||||||
protected Block block;
|
protected Block block;
|
||||||
|
|
||||||
|
@ -3,17 +3,19 @@ package org.bukkit.event.block;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block fades, melts or disappears based on world conditions
|
* Called when a block fades, melts or disappears based on world conditions
|
||||||
* <p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Snow melting due to being near a light source.</li>
|
* <li>Snow melting due to being near a light source.</li>
|
||||||
* <li>Ice melting due to being near a light source.</li>
|
* <li>Ice melting due to being near a light source.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p />
|
* <p />
|
||||||
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private BlockState newState;
|
private BlockState newState;
|
||||||
|
@ -7,16 +7,18 @@ import org.bukkit.event.Cancellable;
|
|||||||
/**
|
/**
|
||||||
* Called when a block is formed or spreads based on world conditions.
|
* Called when a block is formed or spreads based on world conditions.
|
||||||
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
||||||
*<p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
*<ul>
|
* <ul>
|
||||||
* <li>Snow forming due to a snow storm.</li>
|
* <li>Snow forming due to a snow storm.</li>
|
||||||
* <li>Ice forming in a snowy Biome like Taiga or Tundra.</li>
|
* <li>Ice forming in a snowy Biome like Taiga or Tundra.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Form event is cancelled, the block will not be formed.
|
* If a Block Form event is cancelled, the block will not be formed.
|
||||||
|
*
|
||||||
* @see BlockSpreadEvent
|
* @see BlockSpreadEvent
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockFormEvent extends BlockEvent implements Cancellable {
|
public class BlockFormEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private BlockState newState;
|
private BlockState newState;
|
||||||
|
@ -6,9 +6,10 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
|
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||||
protected Block to;
|
protected Block to;
|
||||||
protected BlockFace face;
|
protected BlockFace face;
|
||||||
|
@ -7,9 +7,10 @@ import org.bukkit.event.Event;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Ignite event is cancelled, the block will not be ignited.
|
* If a Block Ignite event is cancelled, the block will not be ignited.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||||
private IgniteCause cause;
|
private IgniteCause cause;
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
|
@ -23,11 +23,11 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when we try to place a block, to see if we can build it here or not.
|
* Called when we try to place a block, to see if we can build it here or not.
|
||||||
*<p />
|
* <p />
|
||||||
* Note:
|
* Note:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
||||||
* <li>If you want to figure out what is being placed, use {@link BlockCanBuildEvent#getMaterial()} or {@link BlockCanBuildEvent#getMaterialId()} instead.</li>
|
* <li>If you want to figure out what is being placed, use {@link BlockCanBuildEvent#getMaterial()} or {@link BlockCanBuildEvent#getMaterialId()} instead.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -36,7 +36,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
|
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -45,7 +45,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Ignite event is cancelled, the block will not be ignited.
|
* If a Block Ignite event is cancelled, the block will not be ignited.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -61,7 +61,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is placed by a player.
|
* Called when a block is placed by a player.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Place event is cancelled, the block will not be placed.
|
* If a Block Place event is cancelled, the block will not be placed.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -79,7 +79,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when leaves are decaying naturally.
|
* Called when leaves are decaying naturally.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Leaves Decay event is cancelled, the leaves will not decay.
|
* If a Leaves Decay event is cancelled, the leaves will not decay.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -97,7 +97,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is destroyed as a result of being burnt by fire.
|
* Called when a block is destroyed as a result of being burnt by fire.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -106,11 +106,11 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken by a player.
|
* Called when a block is broken by a player.
|
||||||
*<p />
|
* <p />
|
||||||
* Note:
|
* Note:
|
||||||
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining
|
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining
|
||||||
* what the default drop for the block being broken is and what to do about it, if anything.
|
* what the default drop for the block being broken is and what to do about it, if anything.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Break event is cancelled, the block will not break.
|
* If a Block Break event is cancelled, the block will not break.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -120,13 +120,13 @@ public class BlockListener implements Listener {
|
|||||||
/**
|
/**
|
||||||
* Called when a block is formed or spreads based on world conditions.
|
* Called when a block is formed or spreads based on world conditions.
|
||||||
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
||||||
*<p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
*<ul>
|
* <ul>
|
||||||
* <li>Snow forming due to a snow storm.</li>
|
* <li>Snow forming due to a snow storm.</li>
|
||||||
* <li>Ice forming in a snowy Biome like Tiga or Tundra.</li>
|
* <li>Ice forming in a snowy Biome like Tiga or Tundra.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Form event is cancelled, the block will not be formed or will not spread.
|
* If a Block Form event is cancelled, the block will not be formed or will not spread.
|
||||||
*
|
*
|
||||||
* @see BlockSpreadEvent
|
* @see BlockSpreadEvent
|
||||||
@ -137,13 +137,13 @@ public class BlockListener implements Listener {
|
|||||||
/**
|
/**
|
||||||
* Called when a block spreads based on world conditions.
|
* Called when a block spreads based on world conditions.
|
||||||
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
||||||
*<p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
*<ul>
|
* <ul>
|
||||||
* <li>Mushrooms spreading.</li>
|
* <li>Mushrooms spreading.</li>
|
||||||
* <li>Fire spreading.</li>
|
* <li>Fire spreading.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Spread event is cancelled, the block will not spread.
|
* If a Block Spread event is cancelled, the block will not spread.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
@ -155,8 +155,8 @@ public class BlockListener implements Listener {
|
|||||||
* <p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Snow melting due to being near a light source.</li>
|
* <li>Snow melting due to being near a light source.</li>
|
||||||
* <li>Ice melting due to being near a light source.</li>
|
* <li>Ice melting due to being near a light source.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p />
|
* <p />
|
||||||
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
||||||
@ -167,7 +167,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an item is dispensed from a block.
|
* Called when an item is dispensed from a block.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
|
|||||||
/**
|
/**
|
||||||
* Thrown when a block physics check is called
|
* Thrown when a block physics check is called
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||||
private final int changed;
|
private final int changed;
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
|
@ -4,9 +4,9 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.material.PistonBaseMaterial;
|
|
||||||
|
|
||||||
public abstract class BlockPistonEvent extends BlockEvent implements Cancellable {
|
@SuppressWarnings("serial")
|
||||||
|
public abstract class BlockPistonEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private BlockFace direction;
|
private BlockFace direction;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockPistonExtendEvent extends BlockPistonEvent {
|
public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||||
private int length;
|
private int length;
|
||||||
private List<Block> blocks;
|
private List<Block> blocks;
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockPistonRetractEvent extends BlockPistonEvent {
|
public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||||
public BlockPistonRetractEvent(Block block, BlockFace direction) {
|
public BlockPistonRetractEvent(Block block, BlockFace direction) {
|
||||||
super(Type.BLOCK_PISTON_RETRACT, block, direction);
|
super(Type.BLOCK_PISTON_RETRACT, block, direction);
|
||||||
|
@ -8,9 +8,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is placed by a player.
|
* Called when a block is placed by a player.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Place event is cancelled, the block will not be placed.
|
* If a Block Place event is cancelled, the block will not be placed.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||||
protected boolean cancel;
|
protected boolean cancel;
|
||||||
protected boolean canBuild;
|
protected boolean canBuild;
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.block.Block;
|
|||||||
/**
|
/**
|
||||||
* Called when a redstone current changes
|
* Called when a redstone current changes
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockRedstoneEvent extends BlockEvent {
|
public class BlockRedstoneEvent extends BlockEvent {
|
||||||
private int oldCurrent;
|
private int oldCurrent;
|
||||||
private int newCurrent;
|
private int newCurrent;
|
||||||
|
@ -2,19 +2,22 @@ package org.bukkit.event.block;
|
|||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block spreads based on world conditions.
|
* Called when a block spreads based on world conditions.
|
||||||
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
||||||
*<p />
|
* <p />
|
||||||
* Examples:
|
* Examples:
|
||||||
*<ul>
|
* <ul>
|
||||||
* <li>Mushrooms spreading.</li>
|
* <li>Mushrooms spreading.</li>
|
||||||
* <li>Fire spreading.</li>
|
* <li>Fire spreading.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*<p />
|
* <p />
|
||||||
* If a Block Spread event is cancelled, the block will not spread.
|
* If a Block Spread event is cancelled, the block will not spread.
|
||||||
|
*
|
||||||
* @see BlockFormEvent
|
* @see BlockFormEvent
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BlockSpreadEvent extends BlockFormEvent {
|
public class BlockSpreadEvent extends BlockFormEvent {
|
||||||
private Block source;
|
private Block source;
|
||||||
|
|
||||||
|
@ -5,9 +5,10 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when leaves are decaying naturally.
|
* Called when leaves are decaying naturally.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Leaves Decay event is cancelled, the leaves will not decay.
|
* If a Leaves Decay event is cancelled, the leaves will not decay.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.Cancellable;
|
|||||||
* <p />
|
* <p />
|
||||||
* If a Sign Change event is cancelled, the sign will not be changed.
|
* If a Sign Change event is cancelled, the sign will not be changed.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class SignChangeEvent extends BlockEvent implements Cancellable {
|
public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -7,9 +7,10 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a creature is spawned into a world.
|
* Called when a creature is spawned into a world.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Creature Spawn event is cancelled, the creature will not spawn.
|
* If a Creature Spawn event is cancelled, the creature will not spawn.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
private Location location;
|
private Location location;
|
||||||
|
@ -5,9 +5,10 @@ import org.bukkit.event.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a Creeper is struck by lightning.
|
* Called when a Creeper is struck by lightning.
|
||||||
*<p />
|
* <p />
|
||||||
* If a Creeper Power event is cancelled, the Creeper will not be powered.
|
* If a Creeper Power event is cancelled, the Creeper will not be powered.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
private boolean canceled;
|
private boolean canceled;
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class EndermanPickupEvent extends EntityEvent implements Cancellable {
|
public class EndermanPickupEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
|
public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
|
@ -3,6 +3,7 @@ package org.bukkit.event.entity;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class EntityCombustByBlockEvent extends EntityCombustEvent {
|
public class EntityCombustByBlockEvent extends EntityCombustEvent {
|
||||||
|
|
||||||
private Block combuster;
|
private Block combuster;
|
||||||
@ -16,6 +17,7 @@ public class EntityCombustByBlockEvent extends EntityCombustEvent {
|
|||||||
* The combuster can be lava or a block that is on fire.
|
* The combuster can be lava or a block that is on fire.
|
||||||
*
|
*
|
||||||
* WARNING: block may be null.
|
* WARNING: block may be null.
|
||||||
|
*
|
||||||
* @return the Block that set the combustee alight.
|
* @return the Block that set the combustee alight.
|
||||||
*/
|
*/
|
||||||
public Block getCombuster() {
|
public Block getCombuster() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user