diff --git a/paper-api/src/main/java/org/bukkit/Achievement.java b/paper-api/src/main/java/org/bukkit/Achievement.java index 38089baec8..4fcffa693c 100644 --- a/paper-api/src/main/java/org/bukkit/Achievement.java +++ b/paper-api/src/main/java/org/bukkit/Achievement.java @@ -1,4 +1,3 @@ - package org.bukkit; import java.util.HashMap; @@ -31,9 +30,9 @@ public enum Achievement { public final static int STATISTIC_OFFSET = 5242880; private final static Map achievements = new HashMap(); private final int id; - + private Achievement(int id) { - this.id = STATISTIC_OFFSET + id; + this.id = STATISTIC_OFFSET + id; } /** diff --git a/paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java b/paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java index 6dd9955555..1ec3177e05 100644 --- a/paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java +++ b/paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java @@ -4,13 +4,14 @@ package org.bukkit; * A delegate for handling block changes. This serves as a direct interface * between generation algorithms in the server implementation and utilizing * code. - * + * * @author sk89q */ public interface BlockChangeDelegate { + /** * Set a block type at the specified coordinates. - * + * * @param x * @param y * @param z @@ -21,7 +22,7 @@ public interface BlockChangeDelegate { /** * Set a block type and data at the specified coordinates. - * + * * @param x * @param y * @param z @@ -30,7 +31,7 @@ public interface BlockChangeDelegate { * @return true if the block was set successfully */ public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data); - + /** * Get the block type at the location. * @param x diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index 1f2c42c982..61a51d2ff3 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -1,4 +1,3 @@ - package org.bukkit; /** @@ -10,8 +9,7 @@ public final class Bukkit { /** * Static class cannot be initialized. */ - private Bukkit() { - } + private Bukkit() {} /** * Gets the current {@link Server} singleton diff --git a/paper-api/src/main/java/org/bukkit/ChatColor.java b/paper-api/src/main/java/org/bukkit/ChatColor.java index 2714f5f9db..ccadc3d624 100644 --- a/paper-api/src/main/java/org/bukkit/ChatColor.java +++ b/paper-api/src/main/java/org/bukkit/ChatColor.java @@ -7,6 +7,7 @@ import java.util.Map; * All supported color values for chat */ public enum ChatColor { + /** * Represents black */ @@ -110,9 +111,10 @@ public enum ChatColor { * @return A copy of the input string, without any coloring */ public static String stripColor(final String input) { - if (input == null) + if (input == null) { return null; - + } + return input.replaceAll("(?i)\u00A7[0-F]", ""); } @@ -121,4 +123,4 @@ public enum ChatColor { colors.put(color.getCode(), color); } } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/Chunk.java b/paper-api/src/main/java/org/bukkit/Chunk.java index cf97c5a589..3315bbea30 100644 --- a/paper-api/src/main/java/org/bukkit/Chunk.java +++ b/paper-api/src/main/java/org/bukkit/Chunk.java @@ -1,4 +1,3 @@ - package org.bukkit; import org.bukkit.block.Block; @@ -40,8 +39,8 @@ public interface Chunk { * @return the Block */ Block getBlock(int x, int y, int z); - + Entity[] getEntities(); - + BlockState[] getTileEntities(); } diff --git a/paper-api/src/main/java/org/bukkit/CropState.java b/paper-api/src/main/java/org/bukkit/CropState.java index 60de1e1375..5c17364410 100644 --- a/paper-api/src/main/java/org/bukkit/CropState.java +++ b/paper-api/src/main/java/org/bukkit/CropState.java @@ -8,6 +8,7 @@ import java.util.Map; * @author sunkid */ public enum CropState { + /** * State when first seeded */ diff --git a/paper-api/src/main/java/org/bukkit/DyeColor.java b/paper-api/src/main/java/org/bukkit/DyeColor.java index 594d23dcc9..b216dd8e4d 100644 --- a/paper-api/src/main/java/org/bukkit/DyeColor.java +++ b/paper-api/src/main/java/org/bukkit/DyeColor.java @@ -1,4 +1,3 @@ - package org.bukkit; import java.util.HashMap; @@ -8,6 +7,7 @@ import java.util.Map; * All supported color values for dyes and cloth */ public enum DyeColor { + /** * Represents white dye */ diff --git a/paper-api/src/main/java/org/bukkit/Location.java b/paper-api/src/main/java/org/bukkit/Location.java index 583cc0bce0..a98da8595c 100644 --- a/paper-api/src/main/java/org/bukkit/Location.java +++ b/paper-api/src/main/java/org/bukkit/Location.java @@ -1,4 +1,3 @@ - package org.bukkit; import org.bukkit.block.Block; @@ -207,8 +206,9 @@ public class Location implements Cloneable { vector.setY(-Math.sin(Math.toRadians(rotY))); double h = Math.cos(Math.toRadians(rotY)); - vector.setX(-h*Math.sin(Math.toRadians(rotX))); - vector.setZ(h*Math.cos(Math.toRadians(rotX))); + + vector.setX(-h * Math.sin(Math.toRadians(rotX))); + vector.setZ(h * Math.cos(Math.toRadians(rotX))); return vector; } @@ -222,6 +222,7 @@ public class Location implements Cloneable { return false; } final Location other = (Location) obj; + if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) { return false; } @@ -246,6 +247,7 @@ public class Location implements Cloneable { @Override public int hashCode() { int hash = 3; + hash = 19 * hash + (this.world != null ? this.world.hashCode() : 0); hash = 19 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32)); hash = 19 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32)); @@ -272,7 +274,8 @@ public class Location implements Cloneable { @Override public Location clone() { try { - Location l = (Location)super.clone(); + Location l = (Location) super.clone(); + l.world = world; l.x = x; l.y = y; @@ -293,6 +296,6 @@ public class Location implements Cloneable { * @return Block coordinate */ public static int locToBlock(double loc) { - return (int)Math.floor(loc); + return (int) Math.floor(loc); } } diff --git a/paper-api/src/main/java/org/bukkit/Material.java b/paper-api/src/main/java/org/bukkit/Material.java index a3d0d298de..4fe7b2ce79 100644 --- a/paper-api/src/main/java/org/bukkit/Material.java +++ b/paper-api/src/main/java/org/bukkit/Material.java @@ -237,7 +237,7 @@ public enum Material { private Material(final int id, final int stack, final int durability, final Class data) { this.id = id; - this.durability = (short)durability; + this.durability = (short) durability; this.maxStack = stack; this.data = data; } @@ -292,6 +292,7 @@ public enum Material { try { Constructor ctor = data.getConstructor(int.class, byte.class); + return ctor.newInstance(id, raw); } catch (InstantiationException ex) { Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex); @@ -354,11 +355,11 @@ public enum Material { try { result = getMaterial(Integer.parseInt(name)); - } catch (NumberFormatException ex) { - } + } catch (NumberFormatException ex) {} if (result == null) { String filtered = name.toUpperCase(); + filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", ""); result = lookupName.get(filtered); } diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 70ec509a44..8cdbc67732 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -1,4 +1,3 @@ - package org.bukkit; import com.avaje.ebean.config.ServerConfig; @@ -18,6 +17,7 @@ import org.bukkit.scheduler.BukkitScheduler; * Represents a server implementation */ public interface Server { + /** * Gets the name of this server implementation * diff --git a/paper-api/src/main/java/org/bukkit/Statistic.java b/paper-api/src/main/java/org/bukkit/Statistic.java index 827eade62a..97923b8c4a 100644 --- a/paper-api/src/main/java/org/bukkit/Statistic.java +++ b/paper-api/src/main/java/org/bukkit/Statistic.java @@ -1,4 +1,3 @@ - package org.bukkit; import java.util.HashMap; @@ -24,9 +23,9 @@ public enum Statistic { private final boolean isBlock; private Statistic(int id) { - this(id, false, false); + this(id, false, false); } - + private Statistic(int id, boolean isBlock) { this(id, true, isBlock); } diff --git a/paper-api/src/main/java/org/bukkit/TreeType.java b/paper-api/src/main/java/org/bukkit/TreeType.java index 76916f7722..c0d9e3ffed 100644 --- a/paper-api/src/main/java/org/bukkit/TreeType.java +++ b/paper-api/src/main/java/org/bukkit/TreeType.java @@ -2,7 +2,7 @@ package org.bukkit; /** * Tree type. - * + * * @author sk89q */ public enum TreeType { diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index ba262a5d22..6ce168cb38 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -1,4 +1,3 @@ - package org.bukkit; import java.util.List; @@ -11,6 +10,7 @@ import org.bukkit.util.Vector; * Represents a world, which may contain entities, chunks and blocks */ public interface World { + /** * Gets the {@link Block} at the given coordinates * @@ -21,7 +21,7 @@ public interface World { * @see #getBlockTypeIdAt(int, int, int) Returns the current type ID of the block */ public Block getBlockAt(int x, int y, int z); - + /** * Gets the {@link Block} at the given {@link Location} * @@ -300,24 +300,24 @@ public interface World { /** * Creates a creature at the given {@link Location} - * + * * @param loc The location to spawn the creature * @param type The creature to spawn * @return Resulting LivingEntity of this method, or null if it was unsuccessful */ public LivingEntity spawnCreature(Location loc, CreatureType type); - + /** * Strikes lightning at the given {@link Location} - * + * * @param loc The location to strike lightning * @return */ public LightningStrike strikeLightning(Location loc); - + /** * Strikes lightning at the given {@link Location} without doing damage - * + * * @param loc The location to strike lightning * @return */ @@ -353,7 +353,7 @@ public interface World { /** * Gets a semi-unique identifier for this world. - * + * * While it is highly unlikely that this may be shared with another World, * it is not guaranteed to be unique * @@ -370,7 +370,7 @@ public interface World { /** * Sets the spawn location of the world - * + * * @return True if it was successfully set. */ public boolean setSpawnLocation(int x, int y, int z); @@ -417,61 +417,61 @@ public interface World { * @see #setTime(long) Sets the relative time of this world */ public void setFullTime(long time); - + /** * Returns whether the world has an ongoing storm. - * + * * @return Whether there is an ongoing storm */ public boolean hasStorm(); - + /** * Set whether there is a storm. A duration will be set for the new * current conditions. - * + * * @param hasStorm Whether there is rain and snow */ public void setStorm(boolean hasStorm); - + /** * Get the remaining time in ticks of the current conditions. - * + * * @return Time in ticks */ public int getWeatherDuration(); - + /** * Set the remaining time in ticks of the current conditions. - * + * * @param duration Time in ticks */ public void setWeatherDuration(int duration); - + /** * Returns whether there is thunder. - * + * * @return Whether there is thunder */ public boolean isThundering(); - + /** * Set whether it is thundering. - * + * * @param thundering Whether it is thundering */ public void setThundering(boolean thundering); - + /** * Get the thundering duration. - * + * * @return Duration in ticks */ public int getThunderDuration(); - + /** * Set the thundering duration. - * - * @param duration Duration in ticks + * + * @param duration Duration in ticks */ public void setThunderDuration(int duration); @@ -486,11 +486,11 @@ public interface World { * Represents various map environment types that a world may be */ public enum Environment { + /** * Represents the "normal"/"surface world" map */ NORMAL, - /** * Represents a nether based map */ diff --git a/paper-api/src/main/java/org/bukkit/block/Biome.java b/paper-api/src/main/java/org/bukkit/block/Biome.java index 711dea71aa..b27c536596 100644 --- a/paper-api/src/main/java/org/bukkit/block/Biome.java +++ b/paper-api/src/main/java/org/bukkit/block/Biome.java @@ -1,4 +1,3 @@ - package org.bukkit.block; /** diff --git a/paper-api/src/main/java/org/bukkit/block/Block.java b/paper-api/src/main/java/org/bukkit/block/Block.java index 0ec7e0ed22..f66b3e0c41 100644 --- a/paper-api/src/main/java/org/bukkit/block/Block.java +++ b/paper-api/src/main/java/org/bukkit/block/Block.java @@ -12,6 +12,7 @@ import org.bukkit.Location; * block which will not be modified. */ public interface Block { + /** * Gets the metadata for this block * @@ -135,7 +136,7 @@ public interface Block { * @param data New block specific metadata */ void setData(byte data); - + void setData(byte data, boolean applyPhyiscs); /** @@ -152,9 +153,9 @@ public interface Block { * @return whether the block was changed */ boolean setTypeId(int type); - + boolean setTypeId(int type, boolean applyPhysics); - + boolean setTypeIdAndData(int type, byte data, boolean applyPhyiscs); /** @@ -220,19 +221,19 @@ public interface Block { * @return */ boolean isBlockFaceIndirectlyPowered(BlockFace face); - + /** * Returns the redstone power being provided to this block face - * + * * @param face the face of the block to query or BlockFace.SELF for the block itself - * @return + * @return */ int getBlockPower(BlockFace face); /** * Returns the redstone power being provided to this block - * - * @return + * + * @return */ int getBlockPower(); } diff --git a/paper-api/src/main/java/org/bukkit/block/BlockFace.java b/paper-api/src/main/java/org/bukkit/block/BlockFace.java index fb15fc911b..af9cc78f7c 100644 --- a/paper-api/src/main/java/org/bukkit/block/BlockFace.java +++ b/paper-api/src/main/java/org/bukkit/block/BlockFace.java @@ -55,33 +55,43 @@ public enum BlockFace { public int getModZ() { return modZ; } - + public BlockFace getOppositeFace() { switch (this) { case NORTH: return BlockFace.SOUTH; + case SOUTH: return BlockFace.NORTH; + case EAST: return BlockFace.WEST; + case WEST: return BlockFace.EAST; + case UP: return BlockFace.DOWN; + case DOWN: return BlockFace.UP; + case NORTH_EAST: return BlockFace.SOUTH_WEST; + case NORTH_WEST: return BlockFace.SOUTH_EAST; + case SOUTH_EAST: return BlockFace.NORTH_WEST; + case SOUTH_WEST: return BlockFace.NORTH_EAST; + case SELF: return BlockFace.SELF; } - + return BlockFace.SELF; } } diff --git a/paper-api/src/main/java/org/bukkit/block/BlockState.java b/paper-api/src/main/java/org/bukkit/block/BlockState.java index c4a4c16fa6..70f6ab6fab 100644 --- a/paper-api/src/main/java/org/bukkit/block/BlockState.java +++ b/paper-api/src/main/java/org/bukkit/block/BlockState.java @@ -1,4 +1,3 @@ - package org.bukkit.block; import org.bukkit.Chunk; @@ -15,6 +14,7 @@ import org.bukkit.material.MaterialData; * another type entirely, causing your BlockState to become invalid. */ public interface BlockState { + /** * Gets the block represented by this BlockState * diff --git a/paper-api/src/main/java/org/bukkit/block/Chest.java b/paper-api/src/main/java/org/bukkit/block/Chest.java index 9c12854fe7..4d0eea29de 100644 --- a/paper-api/src/main/java/org/bukkit/block/Chest.java +++ b/paper-api/src/main/java/org/bukkit/block/Chest.java @@ -2,8 +2,7 @@ package org.bukkit.block; /** * Represents a chest. - * + * * @author sk89q */ -public interface Chest extends BlockState, ContainerBlock { -} +public interface Chest extends BlockState, ContainerBlock {} diff --git a/paper-api/src/main/java/org/bukkit/block/ContainerBlock.java b/paper-api/src/main/java/org/bukkit/block/ContainerBlock.java index c6e83140db..9f8b74492f 100644 --- a/paper-api/src/main/java/org/bukkit/block/ContainerBlock.java +++ b/paper-api/src/main/java/org/bukkit/block/ContainerBlock.java @@ -4,13 +4,14 @@ import org.bukkit.inventory.Inventory; /** * Indicates a block type that has inventory. - * + * * @author sk89q */ public interface ContainerBlock { + /** * Get the block's inventory. - * + * * @return */ public Inventory getInventory(); diff --git a/paper-api/src/main/java/org/bukkit/block/CreatureSpawner.java b/paper-api/src/main/java/org/bukkit/block/CreatureSpawner.java index 7981c244fb..5ba4a39aef 100644 --- a/paper-api/src/main/java/org/bukkit/block/CreatureSpawner.java +++ b/paper-api/src/main/java/org/bukkit/block/CreatureSpawner.java @@ -2,52 +2,52 @@ package org.bukkit.block; import org.bukkit.entity.CreatureType; - /** * Represents a creature spawner. - * + * * @author sk89q * @author Cogito */ public interface CreatureSpawner extends BlockState { + /** * Get the spawner's creature type. - * + * * @return */ public CreatureType getCreatureType(); - + /** * Set the spawner creature type. - * + * * @param mobType */ public void setCreatureType(CreatureType creatureType); - + /** * Get the spawner's creature type. - * + * * @return */ public String getCreatureTypeId(); - + /** * Set the spawner mob type. - * + * * @param creatureType */ public void setCreatureTypeId(String creatureType); - + /** * Get the spawner's delay. - * + * * @return */ public int getDelay(); - + /** * Set the spawner's delay. - * + * * @param delay */ public void setDelay(int delay); diff --git a/paper-api/src/main/java/org/bukkit/block/Dispenser.java b/paper-api/src/main/java/org/bukkit/block/Dispenser.java index 3a04c0d8a5..f9f097564f 100644 --- a/paper-api/src/main/java/org/bukkit/block/Dispenser.java +++ b/paper-api/src/main/java/org/bukkit/block/Dispenser.java @@ -2,15 +2,16 @@ package org.bukkit.block; /** * Represents a dispenser. - * + * * @author sk89q */ public interface Dispenser extends BlockState, ContainerBlock { + /** * Attempts to dispense the contents of this block
*
* If the block is no longer a dispenser, this will return false - * + * * @return true if successful, otherwise false */ public boolean dispense(); diff --git a/paper-api/src/main/java/org/bukkit/block/Furnace.java b/paper-api/src/main/java/org/bukkit/block/Furnace.java index d272246755..84ff2c04f9 100644 --- a/paper-api/src/main/java/org/bukkit/block/Furnace.java +++ b/paper-api/src/main/java/org/bukkit/block/Furnace.java @@ -2,34 +2,35 @@ package org.bukkit.block; /** * Represents a furnace. - * + * * @author sk89q */ public interface Furnace extends BlockState, ContainerBlock { + /** * Get burn time. - * + * * @return */ public short getBurnTime(); - + /** * Set burn time. - * + * * @param burnTime */ public void setBurnTime(short burnTime); - + /** * Get cook time. - * + * * @return */ public short getCookTime(); - + /** * Set cook time. - * + * * @param cookTime */ public void setCookTime(short cookTime); diff --git a/paper-api/src/main/java/org/bukkit/block/NoteBlock.java b/paper-api/src/main/java/org/bukkit/block/NoteBlock.java index 86b4447fe8..bc704c12ad 100644 --- a/paper-api/src/main/java/org/bukkit/block/NoteBlock.java +++ b/paper-api/src/main/java/org/bukkit/block/NoteBlock.java @@ -4,24 +4,25 @@ import org.bukkit.entity.Player; /** * Represents a note. - * + * * @author sk89q */ public interface NoteBlock extends BlockState { + /** * Gets the note. - * + * * @return */ public byte getNote(); - + /** * Set the note. - * + * * @param note */ public void setNote(byte note); - + /** * Attempts to play the note at block
*
@@ -30,7 +31,7 @@ public interface NoteBlock extends BlockState { * @return true if successful, otherwise false */ public boolean play(); - + /** * Plays an arbitrary note with an arbitrary instrument * diff --git a/paper-api/src/main/java/org/bukkit/block/Sign.java b/paper-api/src/main/java/org/bukkit/block/Sign.java index 8731f6c279..3773574ba3 100644 --- a/paper-api/src/main/java/org/bukkit/block/Sign.java +++ b/paper-api/src/main/java/org/bukkit/block/Sign.java @@ -1,10 +1,10 @@ - package org.bukkit.block; /** * Represents either a SignPost or a WallSign */ public interface Sign extends BlockState { + /** * Gets all the lines of text currently on this sign. * diff --git a/paper-api/src/main/java/org/bukkit/command/Command.java b/paper-api/src/main/java/org/bukkit/command/Command.java index a6ad86d36c..f11655b813 100644 --- a/paper-api/src/main/java/org/bukkit/command/Command.java +++ b/paper-api/src/main/java/org/bukkit/command/Command.java @@ -30,7 +30,7 @@ public abstract class Command { /** * Returns the name of this command - * + * * @return Name of this command */ public String getName() { @@ -96,4 +96,4 @@ public abstract class Command { this.usageMessage = usage; return this; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/command/CommandException.java b/paper-api/src/main/java/org/bukkit/command/CommandException.java index 7111517c2f..2ea2c6f15c 100644 --- a/paper-api/src/main/java/org/bukkit/command/CommandException.java +++ b/paper-api/src/main/java/org/bukkit/command/CommandException.java @@ -1,4 +1,3 @@ - package org.bukkit.command; /** @@ -9,9 +8,7 @@ public class CommandException extends RuntimeException { /** * Creates a new instance of CommandException without detail message. */ - public CommandException() { - } - + public CommandException() {} /** * Constructs an instance of CommandException with the specified detail message. diff --git a/paper-api/src/main/java/org/bukkit/command/CommandExecutor.java b/paper-api/src/main/java/org/bukkit/command/CommandExecutor.java index 32847bfa67..c75586f775 100644 --- a/paper-api/src/main/java/org/bukkit/command/CommandExecutor.java +++ b/paper-api/src/main/java/org/bukkit/command/CommandExecutor.java @@ -1,10 +1,10 @@ - package org.bukkit.command; /** * Represents a class which contains a single method for executing commands */ public interface CommandExecutor { + /** * Executes the given command, returning its success * diff --git a/paper-api/src/main/java/org/bukkit/command/CommandMap.java b/paper-api/src/main/java/org/bukkit/command/CommandMap.java index 3e0bfd1785..e5a50467ca 100644 --- a/paper-api/src/main/java/org/bukkit/command/CommandMap.java +++ b/paper-api/src/main/java/org/bukkit/command/CommandMap.java @@ -3,6 +3,7 @@ package org.bukkit.command; import java.util.List; public interface CommandMap { + /** * Registers all the commands belonging to a certain plugin. * @param plugin diff --git a/paper-api/src/main/java/org/bukkit/command/CommandSender.java b/paper-api/src/main/java/org/bukkit/command/CommandSender.java index 8b67033839..fb70241d0b 100644 --- a/paper-api/src/main/java/org/bukkit/command/CommandSender.java +++ b/paper-api/src/main/java/org/bukkit/command/CommandSender.java @@ -2,8 +2,8 @@ package org.bukkit.command; import org.bukkit.Server; - public interface CommandSender { + /** * Sends this sender a message * @@ -24,4 +24,4 @@ public interface CommandSender { * @return Server instance */ public Server getServer(); -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/command/ConsoleCommandSender.java b/paper-api/src/main/java/org/bukkit/command/ConsoleCommandSender.java index d9ad6abe08..5ee6a2dd11 100644 --- a/paper-api/src/main/java/org/bukkit/command/ConsoleCommandSender.java +++ b/paper-api/src/main/java/org/bukkit/command/ConsoleCommandSender.java @@ -1,4 +1,3 @@ - package org.bukkit.command; import org.bukkit.ChatColor; diff --git a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java index bacf41cd2a..b5fd1bc3a2 100644 --- a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java @@ -39,10 +39,10 @@ public final class PluginCommand extends Command { if (!success && usageMessage.length() > 0) { for (String line: usageMessage.replace("", commandLabel).split("\n")) { - sender.sendMessage( line ); + sender.sendMessage(line); } } - + return success; } @@ -72,4 +72,4 @@ public final class PluginCommand extends Command { public Plugin getPlugin() { return owningPlugin; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/paper-api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java index 0bc86a7a44..fc23568027 100644 --- a/paper-api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java +++ b/paper-api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java @@ -13,20 +13,23 @@ public class PluginCommandYamlParser { public static List parse(Plugin plugin) { List pluginCmds = new ArrayList(); Object object = plugin.getDescription().getCommands(); - if (object == null) - return pluginCmds; - Map> map = (Map>)object; + if (object == null) { + return pluginCmds; + } + + Map> map = (Map>) object; if (map != null) { - for(Entry> entry : map.entrySet()) { - Command newCmd = new PluginCommand(entry.getKey(),plugin); + for (Entry> entry : map.entrySet()) { + Command newCmd = new PluginCommand(entry.getKey(), plugin); Object description = entry.getValue().get("description"); Object usage = entry.getValue().get("usage"); Object aliases = entry.getValue().get("aliases"); - if (description != null) + if (description != null) { newCmd.setDescription(description.toString()); + } if (usage != null) { newCmd.setUsage(usage.toString()); @@ -34,9 +37,9 @@ public class PluginCommandYamlParser { if (aliases != null) { List aliasList = new ArrayList(); - + if (aliases instanceof List) { - for (Object o : (List)aliases) { + for (Object o : (List) aliases) { aliasList.add(o.toString()); } } else { @@ -51,5 +54,4 @@ public class PluginCommandYamlParser { } return pluginCmds; } - } diff --git a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java index d77656220e..db8a3b918d 100644 --- a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -34,7 +34,7 @@ public final class SimpleCommandMap implements CommandMap { */ public void registerAll(String fallbackPrefix, List commands) { if (commands != null) { - for(Command c : commands) { + for (Command c : commands) { register(fallbackPrefix, c); } } @@ -42,6 +42,7 @@ public final class SimpleCommandMap implements CommandMap { private void register(String fallbackPrefix, Command command) { List names = new ArrayList(); + names.add(command.getName()); names.addAll(command.getAliases()); @@ -55,7 +56,7 @@ public final class SimpleCommandMap implements CommandMap { */ public boolean register(String name, String fallbackPrefix, Command command) { boolean nameInUse = (getCommand(name) != null); - + if (nameInUse) { name = fallbackPrefix + ":" + name; } @@ -63,7 +64,7 @@ public final class SimpleCommandMap implements CommandMap { knownCommands.put(name.toLowerCase(), command); return !nameInUse; } - + /** * {@inheritDoc} */ @@ -80,6 +81,7 @@ public final class SimpleCommandMap implements CommandMap { Command target = getCommand(sentCommandLabel); boolean isRegisteredCommand = (target != null); + if (isRegisteredCommand) { try { target.execute(sender, sentCommandLabel, args); @@ -117,8 +119,7 @@ public final class SimpleCommandMap implements CommandMap { @Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (args.length == 0) { - sender.sendMessage("This server is running " + ChatColor.GREEN - + server.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + server.getVersion()); + sender.sendMessage("This server is running " + ChatColor.GREEN + server.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + server.getVersion()); sender.sendMessage("This server is also sporting some funky dev build of Bukkit!"); } else { StringBuilder name = new StringBuilder(); @@ -134,6 +135,7 @@ public final class SimpleCommandMap implements CommandMap { if (plugin != null) { PluginDescriptionFile desc = plugin.getDescription(); + sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion()); if (desc.getDescription() != null) { @@ -242,4 +244,4 @@ public final class SimpleCommandMap implements CommandMap { return pluginList.toString(); } } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/entity/AnimalTamer.java b/paper-api/src/main/java/org/bukkit/entity/AnimalTamer.java index da958daddc..058f857963 100644 --- a/paper-api/src/main/java/org/bukkit/entity/AnimalTamer.java +++ b/paper-api/src/main/java/org/bukkit/entity/AnimalTamer.java @@ -1,5 +1,3 @@ package org.bukkit.entity; -public interface AnimalTamer { - -} +public interface AnimalTamer {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Animals.java b/paper-api/src/main/java/org/bukkit/entity/Animals.java index e41b3cc8c1..82736f23a5 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Animals.java +++ b/paper-api/src/main/java/org/bukkit/entity/Animals.java @@ -2,10 +2,8 @@ package org.bukkit.entity; /** * Represents an Animal. - * + * * @author Cogito * */ -public interface Animals extends Creature{ - -} +public interface Animals extends Creature {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Arrow.java b/paper-api/src/main/java/org/bukkit/entity/Arrow.java index 33c14a8648..79a8ac86aa 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Arrow.java +++ b/paper-api/src/main/java/org/bukkit/entity/Arrow.java @@ -2,8 +2,7 @@ package org.bukkit.entity; /** * Represents an arrow. - * + * * @author sk89q */ -public interface Arrow extends Entity { -} +public interface Arrow extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Boat.java b/paper-api/src/main/java/org/bukkit/entity/Boat.java index cec262ea65..b781b02eb4 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Boat.java +++ b/paper-api/src/main/java/org/bukkit/entity/Boat.java @@ -2,10 +2,11 @@ package org.bukkit.entity; /** * Represents a boat entity. - * + * * @author sk89q */ public interface Boat extends Vehicle { + /** * Gets the maximum speed of a boat. The speed is unrelated to the velocity. * diff --git a/paper-api/src/main/java/org/bukkit/entity/Chicken.java b/paper-api/src/main/java/org/bukkit/entity/Chicken.java index 6254911de4..26e9c71931 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Chicken.java +++ b/paper-api/src/main/java/org/bukkit/entity/Chicken.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Chicken. - * + * * @author Cogito * */ -public interface Chicken extends Animals { - -} +public interface Chicken extends Animals {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Cow.java b/paper-api/src/main/java/org/bukkit/entity/Cow.java index 4af61f095b..ccec6de954 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Cow.java +++ b/paper-api/src/main/java/org/bukkit/entity/Cow.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Cow. - * + * * @author Cogito * */ -public interface Cow extends Animals { - -} +public interface Cow extends Animals {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Creature.java b/paper-api/src/main/java/org/bukkit/entity/Creature.java index 156057323c..3a3912da2f 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Creature.java +++ b/paper-api/src/main/java/org/bukkit/entity/Creature.java @@ -5,6 +5,7 @@ package org.bukkit.entity; * have very simple abilities. */ public interface Creature extends LivingEntity { + /** * Instructs this Creature to set the specified LivingEntity as its target. * Hostile creatures may attack their target, and friendly creatures may diff --git a/paper-api/src/main/java/org/bukkit/entity/Creeper.java b/paper-api/src/main/java/org/bukkit/entity/Creeper.java index f83d39bd8a..a2f780997a 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Creeper.java +++ b/paper-api/src/main/java/org/bukkit/entity/Creeper.java @@ -1,10 +1,10 @@ - package org.bukkit.entity; /** * Represents a Creeper */ public interface Creeper extends Monster { + /** * Checks if this Creeper is powered (Electrocuted) * diff --git a/paper-api/src/main/java/org/bukkit/entity/Egg.java b/paper-api/src/main/java/org/bukkit/entity/Egg.java index 6de27264a5..29434d6f97 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Egg.java +++ b/paper-api/src/main/java/org/bukkit/entity/Egg.java @@ -2,8 +2,7 @@ package org.bukkit.entity; /** * Represents an egg. - * + * * @author sk89q */ -public interface Egg extends Entity { -} +public interface Egg extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Entity.java b/paper-api/src/main/java/org/bukkit/entity/Entity.java index 0d55f8ff16..82490047fb 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Entity.java +++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java @@ -1,4 +1,3 @@ - package org.bukkit.entity; import org.bukkit.Location; @@ -12,6 +11,7 @@ import java.util.List; * Represents a base entity in the world */ public interface Entity { + /** * Gets the entity's current position * @@ -109,7 +109,7 @@ public interface Entity { * @param ticks */ public void setFireTicks(int ticks); - + /** * Mark the entity's removal. */ @@ -130,14 +130,14 @@ public interface Entity { /** * Gets the primary passenger of a vehicle. For vehicles that could have * multiple passengers, this will only return the primary passenger. - * + * * @return an entity */ public abstract Entity getPassenger(); /** * Set the passenger of a vehicle. - * + * * @param passenger * @return false if it could not be done for whatever reason */ @@ -145,27 +145,27 @@ public interface Entity { /** * Returns true if the vehicle has no passengers. - * + * * @return */ public abstract boolean isEmpty(); /** * Eject any passenger. True if there was a passenger. - * + * * @return */ public abstract boolean eject(); - + /** * Returns the distance this entity has fallen - * @return + * @return */ public float getFallDistance(); - + /** * Sets the fall distance for this entity - * @param distance + * @param distance */ public void setFallDistance(float distance); diff --git a/paper-api/src/main/java/org/bukkit/entity/FallingSand.java b/paper-api/src/main/java/org/bukkit/entity/FallingSand.java index 3d4853fb5e..3f7a7bb773 100644 --- a/paper-api/src/main/java/org/bukkit/entity/FallingSand.java +++ b/paper-api/src/main/java/org/bukkit/entity/FallingSand.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents Falling Sand. - * + * * @author Cogito * */ -public interface FallingSand extends Entity { - -} +public interface FallingSand extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Fireball.java b/paper-api/src/main/java/org/bukkit/entity/Fireball.java index 180a762d5c..a149fb856a 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Fireball.java +++ b/paper-api/src/main/java/org/bukkit/entity/Fireball.java @@ -2,8 +2,7 @@ package org.bukkit.entity; /** * Represents a Fireball. - * + * * @author Cogito */ -public interface Fireball extends Entity { -} +public interface Fireball extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Fish.java b/paper-api/src/main/java/org/bukkit/entity/Fish.java index 1808db49ed..c12a82feb6 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Fish.java +++ b/paper-api/src/main/java/org/bukkit/entity/Fish.java @@ -2,8 +2,7 @@ package org.bukkit.entity; /** * Represents a Fish. - * + * * @author Cogito */ -public interface Fish extends Entity { -} +public interface Fish extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Flying.java b/paper-api/src/main/java/org/bukkit/entity/Flying.java index 115715474a..e9684c9b94 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Flying.java +++ b/paper-api/src/main/java/org/bukkit/entity/Flying.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Flying Entity. - * + * * @author Cogito * */ -public interface Flying extends LivingEntity { - -} +public interface Flying extends LivingEntity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Ghast.java b/paper-api/src/main/java/org/bukkit/entity/Ghast.java index 97d6cde23c..edd1eb874c 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Ghast.java +++ b/paper-api/src/main/java/org/bukkit/entity/Ghast.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Ghast. - * + * * @author Cogito * */ -public interface Ghast extends Flying { - -} +public interface Ghast extends Flying {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Giant.java b/paper-api/src/main/java/org/bukkit/entity/Giant.java index 05a595077b..4fece45fe7 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Giant.java +++ b/paper-api/src/main/java/org/bukkit/entity/Giant.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Giant. - * + * * @author Cogito * */ -public interface Giant extends Monster { - -} +public interface Giant extends Monster {} diff --git a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java index 75d028a2f9..cd788dbd73 100644 --- a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java @@ -1,4 +1,3 @@ - package org.bukkit.entity; import org.bukkit.inventory.ItemStack; @@ -8,6 +7,7 @@ import org.bukkit.inventory.PlayerInventory; * Represents a human entity, such as an NPC or a player */ public interface HumanEntity extends LivingEntity, AnimalTamer { + /** * Returns the name of this player * @@ -43,19 +43,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer { * * @param index The new index to use, only valid ones are 0-8. * - public void selectItemInHand( int index ); - */ - + public void selectItemInHand(int index); + */ + /** * Returns whether this player is slumbering. - * + * * @return slumber state */ public boolean isSleeping(); - + /** * Get the sleep ticks of the player. This value may be capped. - * + * * @return slumber ticks */ public int getSleepTicks(); diff --git a/paper-api/src/main/java/org/bukkit/entity/Item.java b/paper-api/src/main/java/org/bukkit/entity/Item.java index e66b14d46e..619b92b139 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Item.java +++ b/paper-api/src/main/java/org/bukkit/entity/Item.java @@ -4,7 +4,7 @@ import org.bukkit.inventory.ItemStack; /** * Represents an Item. - * + * * @author Cogito * */ @@ -12,15 +12,15 @@ public interface Item extends Entity { /** * Gets the item stack associated with this item drop. - * + * * @return */ public ItemStack getItemStack(); /** * Sets the item stack associated with this item drop. - * - * @param stack + * + * @param stack */ public void setItemStack(ItemStack stack); } diff --git a/paper-api/src/main/java/org/bukkit/entity/LightningStrike.java b/paper-api/src/main/java/org/bukkit/entity/LightningStrike.java index ea8d7d0f66..46eb09a94b 100644 --- a/paper-api/src/main/java/org/bukkit/entity/LightningStrike.java +++ b/paper-api/src/main/java/org/bukkit/entity/LightningStrike.java @@ -1,18 +1,17 @@ - package org.bukkit.entity; /** * Represents an instance of a lightning strike. May or may not do damage. - * + * * @author sk89q */ public interface LightningStrike extends Weather { - + /** * Returns whether the strike is an effect that does no damage. - * + * * @return whether the strike is an effect */ public boolean isEffect(); - + } diff --git a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java index 9fea43f583..8ad0b23b08 100644 --- a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1,4 +1,3 @@ - package org.bukkit.entity; import java.util.HashSet; @@ -11,6 +10,7 @@ import org.bukkit.block.Block; * Represents a living entity, such as a monster or player */ public interface LivingEntity extends Entity { + /** * Gets the entity's health from 0-20, where 0 is dead and 20 is full * @@ -57,7 +57,7 @@ public interface LivingEntity extends Entity { */ public List getLineOfSight(HashSet transparent, int maxDistance); - /** + /** * Gets the block that the player has targeted * * @param HashSet HashSet containing all transparent block IDs. If set to null only air is considered transparent. @@ -66,7 +66,7 @@ public interface LivingEntity extends Entity { */ public Block getTargetBlock(HashSet transparent, int maxDistance); - /** + /** * Gets the last two blocks along the player's line of sight. * The target block will be the last block in the list. * @@ -164,14 +164,14 @@ public interface LivingEntity extends Entity { * Returns the entities current maximum noDamageTicks * This is the time in ticks the entity will become unable to take * equal or less damage than the lastDamage - * + * * @return noDamageTicks */ public int getMaximumNoDamageTicks(); /** * Sets the entities current maximum noDamageTicks - * + * * @param ticks maximumNoDamageTicks */ public void setMaximumNoDamageTicks(int ticks); @@ -179,31 +179,30 @@ public interface LivingEntity extends Entity { /** * Returns the entities lastDamage taken in the current noDamageTicks time. * Only damage higher than this amount will further damage the entity. - * + * * @return lastDamage */ public int getLastDamage(); /** * Sets the entities current maximum noDamageTicks - * + * * @param damage last damage */ public void setLastDamage(int damage); /** * Returns the entities current noDamageTicks - * + * * @return noDamageTicks */ public int getNoDamageTicks(); /** * Sets the entities current noDamageTicks - * + * * @param ticks NoDamageTicks */ public void setNoDamageTicks(int ticks); - } diff --git a/paper-api/src/main/java/org/bukkit/entity/Minecart.java b/paper-api/src/main/java/org/bukkit/entity/Minecart.java index 4d51cbba83..66b9fbf60a 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Minecart.java +++ b/paper-api/src/main/java/org/bukkit/entity/Minecart.java @@ -4,20 +4,21 @@ import org.bukkit.util.Vector; /** * Represents a minecart entity. - * + * * @author sk89q */ public interface Minecart extends Vehicle { + /** * Sets a minecart's damage. - * + * * @param damage over 40 to "kill" a minecart */ public void setDamage(int damage); /** * Gets a minecart's damage. - * + * * @param damage */ public int getDamage(); diff --git a/paper-api/src/main/java/org/bukkit/entity/Monster.java b/paper-api/src/main/java/org/bukkit/entity/Monster.java index 86e4d29846..3acffbaff2 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Monster.java +++ b/paper-api/src/main/java/org/bukkit/entity/Monster.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Monster. - * + * * @author Cogito * */ -public interface Monster extends Creature { - -} +public interface Monster extends Creature {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Painting.java b/paper-api/src/main/java/org/bukkit/entity/Painting.java index 1aa654e8ce..3b12c35f40 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Painting.java +++ b/paper-api/src/main/java/org/bukkit/entity/Painting.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Painting. - * + * * @author Cogito * */ -public interface Painting extends Entity { - -} +public interface Painting extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Pig.java b/paper-api/src/main/java/org/bukkit/entity/Pig.java index 2a27393480..fc8b135338 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Pig.java +++ b/paper-api/src/main/java/org/bukkit/entity/Pig.java @@ -2,17 +2,18 @@ package org.bukkit.entity; /** * Represents a Pig. - * + * * @author Cogito * */ public interface Pig extends Animals { + /** * @author xPaw * @return if the pig has been saddled. */ public boolean hasSaddle(); - + /** * @author xPaw * @param saddled set if the pig has a saddle or not. diff --git a/paper-api/src/main/java/org/bukkit/entity/PigZombie.java b/paper-api/src/main/java/org/bukkit/entity/PigZombie.java index 721f7d2c8f..a48a79aa89 100644 --- a/paper-api/src/main/java/org/bukkit/entity/PigZombie.java +++ b/paper-api/src/main/java/org/bukkit/entity/PigZombie.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Pig Zombie. - * + * * @author Cogito * */ -public interface PigZombie extends Zombie { - -} +public interface PigZombie extends Zombie {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Player.java b/paper-api/src/main/java/org/bukkit/entity/Player.java index 52f230ba52..6b71698742 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Player.java +++ b/paper-api/src/main/java/org/bukkit/entity/Player.java @@ -1,4 +1,3 @@ - package org.bukkit.entity; import java.net.InetSocketAddress; @@ -13,6 +12,7 @@ import org.bukkit.command.CommandSender; * */ public interface Player extends HumanEntity, CommandSender { + /** * Checks if this player is currently online * @@ -59,7 +59,7 @@ public interface Player extends HumanEntity, CommandSender { * @return the player's address */ public InetSocketAddress getAddress(); - + /** * Sends this sender a message raw * @@ -112,53 +112,53 @@ public interface Player extends HumanEntity, CommandSender { * Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file. */ public void loadData(); - + /** * Sets whether the player is ignored as not sleeping. If everyone is * either sleeping or has this flag set, then time will advance to the * next day. If everyone has this flag set but no one is actually in bed, * then nothing will happen. - * + * * @param isSleeping */ public void setSleepingIgnored(boolean isSleeping); - + /** * Returns whether the player is sleeping ignored. - * + * * @return */ public boolean isSleepingIgnored(); - + /** * Play a note for a player at a location. This requires a note block * at the particular location (as far as the client is concerned). This * will not work without a note block. This will not work with cake. - * + * * @param loc * @param instrument * @param note * @return */ public void playNote(Location loc, byte instrument, byte note); - + /** * Send a block change. This fakes a block change packet for a user at * a certain location. This will not actually change the world in any way. - * + * * @param loc * @param material - * @param data + * @param data */ public void sendBlockChange(Location loc, Material material, byte data); - + /** * Send a block change. This fakes a block change packet for a user at * a certain location. This will not actually change the world in any way. - * + * * @param loc * @param material - * @param data + * @param data */ public void sendBlockChange(Location loc, int material, byte data); diff --git a/paper-api/src/main/java/org/bukkit/entity/PoweredMinecart.java b/paper-api/src/main/java/org/bukkit/entity/PoweredMinecart.java index 9a8f0285fb..deb21d49d1 100644 --- a/paper-api/src/main/java/org/bukkit/entity/PoweredMinecart.java +++ b/paper-api/src/main/java/org/bukkit/entity/PoweredMinecart.java @@ -2,9 +2,7 @@ package org.bukkit.entity; /** * Represents a powered minecart. - * + * * @author sk89q */ -public interface PoweredMinecart extends Minecart { - -} +public interface PoweredMinecart extends Minecart {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Sheep.java b/paper-api/src/main/java/org/bukkit/entity/Sheep.java index eb628a0b66..2cdb7fc9f6 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Sheep.java +++ b/paper-api/src/main/java/org/bukkit/entity/Sheep.java @@ -1,21 +1,24 @@ /** - * + * */ package org.bukkit.entity; + import org.bukkit.material.Colorable; /** * Represents a Sheep. - * + * * @author Cogito * */ public interface Sheep extends Animals, Colorable { + /** * @author Celtic Minstrel * @return Whether the sheep is sheared. */ public boolean isSheared(); + /** * @author Celtic Minstrel * @param flag Whether to shear the sheep diff --git a/paper-api/src/main/java/org/bukkit/entity/Skeleton.java b/paper-api/src/main/java/org/bukkit/entity/Skeleton.java index b9552cb4cd..fd14bde1d4 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Skeleton.java +++ b/paper-api/src/main/java/org/bukkit/entity/Skeleton.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Skeleton. - * + * * @author Cogito * */ -public interface Skeleton extends Monster { - -} +public interface Skeleton extends Monster {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Slime.java b/paper-api/src/main/java/org/bukkit/entity/Slime.java index 174222ec73..52fa8daf87 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Slime.java +++ b/paper-api/src/main/java/org/bukkit/entity/Slime.java @@ -1,20 +1,22 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Slime. - * + * * @author Cogito * */ public interface Slime extends LivingEntity { + /** * @author Celtic Minstrel * @return The size of the slime */ public int getSize(); + /** * @author Celtic Minstrel * @param sz The new size of the slime. diff --git a/paper-api/src/main/java/org/bukkit/entity/Snowball.java b/paper-api/src/main/java/org/bukkit/entity/Snowball.java index 4799c83aba..d51f01afe5 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Snowball.java +++ b/paper-api/src/main/java/org/bukkit/entity/Snowball.java @@ -2,8 +2,7 @@ package org.bukkit.entity; /** * Implements a snowball. - * + * * @author sk89q */ -public interface Snowball extends Entity { -} +public interface Snowball extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Spider.java b/paper-api/src/main/java/org/bukkit/entity/Spider.java index e36140405c..aa36d075b6 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Spider.java +++ b/paper-api/src/main/java/org/bukkit/entity/Spider.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Spider. - * + * * @author Cogito * */ -public interface Spider extends Monster { - -} +public interface Spider extends Monster {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Squid.java b/paper-api/src/main/java/org/bukkit/entity/Squid.java index d5b25aea4a..bb4764b61c 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Squid.java +++ b/paper-api/src/main/java/org/bukkit/entity/Squid.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Squid. - * + * * @author Cogito * */ -public interface Squid extends WaterMob { - -} +public interface Squid extends WaterMob {} diff --git a/paper-api/src/main/java/org/bukkit/entity/StorageMinecart.java b/paper-api/src/main/java/org/bukkit/entity/StorageMinecart.java index 6d4cfefe8b..ee973c5459 100644 --- a/paper-api/src/main/java/org/bukkit/entity/StorageMinecart.java +++ b/paper-api/src/main/java/org/bukkit/entity/StorageMinecart.java @@ -4,13 +4,14 @@ import org.bukkit.inventory.Inventory; /** * Represents a storage minecart. - * + * * @author sk89q */ public interface StorageMinecart extends Minecart { + /** * Return the inventory object for this StorageMinecart. - * + * * @return The inventory for this Minecart */ public Inventory getInventory(); diff --git a/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java b/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java index 160bfaf0a2..989c4e5710 100644 --- a/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java +++ b/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java @@ -1,14 +1,12 @@ /** - * + * */ package org.bukkit.entity; /** * Represents a Primed TNT. - * + * * @author Cogito * */ -public interface TNTPrimed extends Entity { - -} +public interface TNTPrimed extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Vehicle.java b/paper-api/src/main/java/org/bukkit/entity/Vehicle.java index 98435c6353..750b244da4 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Vehicle.java +++ b/paper-api/src/main/java/org/bukkit/entity/Vehicle.java @@ -4,20 +4,21 @@ import org.bukkit.util.Vector; /** * Represents a vehicle entity. - * + * * @author sk89q */ public interface Vehicle extends Entity { + /** * Gets the vehicle's velocity. - * + * * @return velocity vector */ public Vector getVelocity(); - + /** * Sets the vehicle's velocity. - * + * * @param vel velocity vector */ public void setVelocity(Vector vel); diff --git a/paper-api/src/main/java/org/bukkit/entity/WaterMob.java b/paper-api/src/main/java/org/bukkit/entity/WaterMob.java index f01a5a3f06..19a6d86cb5 100644 --- a/paper-api/src/main/java/org/bukkit/entity/WaterMob.java +++ b/paper-api/src/main/java/org/bukkit/entity/WaterMob.java @@ -1,5 +1,5 @@ /** - * + * */ package org.bukkit.entity; @@ -8,6 +8,4 @@ package org.bukkit.entity; * @author Cogito * */ -public interface WaterMob extends Creature { - -} +public interface WaterMob extends Creature {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Weather.java b/paper-api/src/main/java/org/bukkit/entity/Weather.java index 0d488eacbd..6d77851f9f 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Weather.java +++ b/paper-api/src/main/java/org/bukkit/entity/Weather.java @@ -1,9 +1,6 @@ - package org.bukkit.entity; /** * Represents a Weather related entity, such as a storm */ -public interface Weather extends Entity { - -} +public interface Weather extends Entity {} diff --git a/paper-api/src/main/java/org/bukkit/entity/Wolf.java b/paper-api/src/main/java/org/bukkit/entity/Wolf.java index eb9cf64a12..455a2e2824 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Wolf.java +++ b/paper-api/src/main/java/org/bukkit/entity/Wolf.java @@ -1,10 +1,10 @@ - package org.bukkit.entity; /** * Represents a Wolf */ public interface Wolf extends Animals, Tameable { + /** * Checks if this wolf is angry * diff --git a/paper-api/src/main/java/org/bukkit/entity/Zombie.java b/paper-api/src/main/java/org/bukkit/entity/Zombie.java index b58886558b..122b4a62c7 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Zombie.java +++ b/paper-api/src/main/java/org/bukkit/entity/Zombie.java @@ -2,10 +2,8 @@ package org.bukkit.entity; /** * Represents a Zombie. - * + * * @author Cogito * */ -public interface Zombie extends Monster{ - -} +public interface Zombie extends Monster {} diff --git a/paper-api/src/main/java/org/bukkit/event/CustomEventListener.java b/paper-api/src/main/java/org/bukkit/event/CustomEventListener.java index ca68bdb230..fc9a7b5fb5 100644 --- a/paper-api/src/main/java/org/bukkit/event/CustomEventListener.java +++ b/paper-api/src/main/java/org/bukkit/event/CustomEventListener.java @@ -6,14 +6,12 @@ import org.bukkit.event.Listener; * Handles all custom events */ public class CustomEventListener implements Listener { - public CustomEventListener() { - } + public CustomEventListener() {} /** * Called when a player joins a server * * @param event Relevant event details */ - public void onCustomEvent(Event event) { - } -} \ No newline at end of file + public void onCustomEvent(Event event) {} +} diff --git a/paper-api/src/main/java/org/bukkit/event/Event.java b/paper-api/src/main/java/org/bukkit/event/Event.java index 0efc0b9c7b..acd71adc65 100644 --- a/paper-api/src/main/java/org/bukkit/event/Event.java +++ b/paper-api/src/main/java/org/bukkit/event/Event.java @@ -31,7 +31,9 @@ public abstract class Event implements Serializable { } private void exAssert(boolean b, String s) { - if(!b) throw new IllegalArgumentException(s); + if (!b) { + throw new IllegalArgumentException(s); + } } /** @@ -40,40 +42,36 @@ public abstract class Event implements Serializable { * @return Name of this event */ public final String getEventName() { - return ( type != Type.CUSTOM_EVENT) ? type.toString() : name; + return (type != Type.CUSTOM_EVENT) ? type.toString() : name; } /** * Represents an events priority in execution */ public enum Priority { + /** * Event call is of very low importance and should be ran first, to allow * other plugins to further customise the outcome */ Lowest, - /** * Event call is of low importance */ Low, - /** * Event call is neither important or unimportant, and may be ran normally */ Normal, - /** * Event call is of high importance */ High, - /** * Event call is critical and must have the final say in what happens * to the event */ Highest, - /** * Event is listened to purely for monitoring the outcome of an event. * @@ -86,52 +84,44 @@ public abstract class Event implements Serializable { * Represents a category used by Type */ public enum Category { + /** * Represents Player-based events * @see Category.LIVING_ENTITY */ PLAYER, - /** * Represents Entity-based events */ ENTITY, - /** * Represents Block-based events */ BLOCK, - /** * Represents LivingEntity-based events */ LIVING_ENTITY, - /** * Represents Weather-based events */ WEATHER, - /** * Vehicle-based events */ VEHICLE, - /** * Represents World-based events */ WORLD, - /** * Represents Server and Plugin based events */ SERVER, - /** * Represents Inventory-based events */ INVENTORY, - /** * Any miscellaneous events */ @@ -144,6 +134,7 @@ public abstract class Event implements Serializable { * @see org.bukkit.event. */ public enum Type { + /** * PLAYER EVENTS */ @@ -154,154 +145,132 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.player.PlayerEvent */ PLAYER_JOIN (Category.PLAYER), - /** * Called when a player is attempting to connect to the server * * @see org.bukkit.event.player.PlayerLoginEvent */ PLAYER_LOGIN (Category.PLAYER), - /** * Called when a player has just been authenticated * * @see org.bukkit.event.player.PlayerPreLoginEvent */ PLAYER_PRELOGIN (Category.PLAYER), - /** * Called when a player respawns * * @see org.bukkit.event.player.PlayerEvent */ PLAYER_RESPAWN (Category.PLAYER), - /** * Called when a player gets kicked a server * * @see org.bukkit.event.player.PlayerEvent */ PLAYER_KICK (Category.PLAYER), - /** * Called when a player sends a chat message * * @see org.bukkit.event.player.PlayerChatEvent */ PLAYER_CHAT (Category.PLAYER), - /** * Called when a player early in the command handling process * * @see org.bukkit.event.player.PlayerChatEvent */ PLAYER_COMMAND_PREPROCESS (Category.PLAYER), - /** * Called when a player leaves a server * * @see org.bukkit.event.player.PlayerEvent */ PLAYER_QUIT (Category.PLAYER), - /** * Called when a player moves position in the world * * @see org.bukkit.event.player.PlayerMoveEvent */ PLAYER_MOVE (Category.PLAYER), - /** * Called when a player undergoes an animation, such as arm swinging * * @see org.bukkit.event.player.PlayerAnimationEvent */ PLAYER_ANIMATION (Category.PLAYER), - /** * Called when a player toggles sneak mode * * @todo: add javadoc see comment */ PLAYER_TOGGLE_SNEAK (Category.PLAYER), - /** * Called when a player uses an item * * @see org.bukkit.event.player.PlayerItemEvent */ PLAYER_INTERACT (Category.PLAYER), - /** * Called when a player right clicks an entity * * @see org.bukkit.event.player.PlayerInteractEntityEvent */ PLAYER_INTERACT_ENTITY (Category.PLAYER), - /** * Called when a player throws an egg and it might hatch * * @see org.bukkit.event.player.PlayerEggThrowEvent */ PLAYER_EGG_THROW (Category.PLAYER), - /** * Called when a player teleports from one position to another * * @see org.bukkit.event.player.PlayerMoveEvent */ PLAYER_TELEPORT (Category.PLAYER), - /** * Called when a player changes their held item * * @see org.bukkit.event.player.PlayerItemHeldEvent */ PLAYER_ITEM_HELD (Category.PLAYER), - /** * Called when a player drops an item * * @see org.bukkit.event.player.PlayerDropItemEvent */ PLAYER_DROP_ITEM (Category.PLAYER), - /** * Called when a player picks an item up off the ground * * @see org.bukkit.event.player.PlayerPickupItemEvent */ PLAYER_PICKUP_ITEM (Category.PLAYER), - /** * Called when a player empties a bucket * * @see org.bukkit.event.player.PlayerBucketEmptyEvent */ PLAYER_BUCKET_EMPTY(Category.PLAYER), - /** * Called when a player fills a bucket * * @see org.bukkit.event.player.PlayerBucketFillEvent */ PLAYER_BUCKET_FILL(Category.PLAYER), - /** * Called when a player interacts with the inventory * * @see org.bukkit.event.player.PlayerInventoryEvent */ PLAYER_INVENTORY(Category.PLAYER), - /** * Called when a player enter a bed * * @see org.bukkit.event.player.PlayerBedEnterEvent */ PLAYER_BED_ENTER(Category.PLAYER), - /** * Called when a player leaves a bed * @@ -319,7 +288,6 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockDamageEvent */ BLOCK_DAMAGE (Category.BLOCK), - /** * Called when a block is undergoing a universe physics * check on whether it can be built @@ -329,7 +297,6 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockCanBuildEvent */ BLOCK_CANBUILD (Category.BLOCK), - /** * Called when a block of water or lava attempts to flow into another * block @@ -337,7 +304,6 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockFromToEvent */ BLOCK_FROMTO (Category.BLOCK), - /** * 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 @@ -345,7 +311,6 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockIgniteEvent */ BLOCK_IGNITE (Category.BLOCK), - /** * Called when a block undergoes a physics check * @@ -355,42 +320,36 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockPhysicsEvent */ BLOCK_PHYSICS (Category.BLOCK), - /** * Called when a player is attempting to place a block * * @see org.bukkit.event.block.BlockPlaceEvent */ BLOCK_PLACE (Category.BLOCK), - /** * Called when a block dispenses something * * @see org.bukkit.event.block.BlockPlaceEvent */ BLOCK_DISPENSE (Category.BLOCK), - /** * Called when a block is destroyed from being burnt by fire * * @see org.bukkit.event.block.BlockBurnEvent */ BLOCK_BURN (Category.BLOCK), - /** * Called when leaves are decaying naturally * * @see org.bukkit.event.block.LeavesDecayEvent */ LEAVES_DECAY (Category.BLOCK), - /** * Called when a sign is changed * * @see org.bukkit.event.block.SignChangeEvent */ SIGN_CHANGE (Category.BLOCK), - /** * Called when a block changes redstone current. Only triggered on blocks * that are actually capable of transmitting or carrying a redstone @@ -399,14 +358,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.block.BlockFromToEvent */ REDSTONE_CHANGE (Category.BLOCK), - /** * Called when a block is destroyed by a player. * * @see org.bukkit.event.block.BlockBreakEvent */ BLOCK_BREAK (Category.BLOCK), - /** * Called when world attempts to place a snow block during a snowfall * @@ -424,28 +381,24 @@ public abstract class Event implements Serializable { * @todo: add javadoc see comment */ INVENTORY_OPEN (Category.INVENTORY), - /** * Called when a player closes an inventory * * @todo: add javadoc see comment */ INVENTORY_CLOSE (Category.INVENTORY), - /** * Called when a player clicks on an inventory slot * * @todo: add javadoc see comment */ INVENTORY_CLICK (Category.INVENTORY), - /** * Called when an inventory slot changes values or type * * @todo: add javadoc see comment */ INVENTORY_CHANGE (Category.INVENTORY), - /** * Called when a player is attempting to perform an inventory transaction * @@ -463,14 +416,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.server.PluginEvent */ PLUGIN_ENABLE (Category.SERVER), - /** * Called when a plugin is disabled * * @see org.bukkit.event.server.PluginEvent */ PLUGIN_DISABLE (Category.SERVER), - /** * Called when a server command is called * @@ -491,41 +442,35 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.world.ChunkLoadEvent */ CHUNK_LOAD (Category.WORLD), - /** * Called when a chunk is unloaded * * @see org.bukkit.event.world.ChunkUnloadEvent */ CHUNK_UNLOAD (Category.WORLD), - /** * Called when a chunk needs to be generated * * @todo: add javadoc see comment */ CHUNK_GENERATION (Category.WORLD), - /** * Called when an ItemEntity spawns in the world * * @todo: add javadoc see comment */ ITEM_SPAWN (Category.WORLD), - /** * Called when a World's spawn is changed * * @see org.bukkit.event.world.SpawnChangeEvent */ SPAWN_CHANGE (Category.WORLD), - /** * Called when a world is saved * */ WORLD_SAVE (Category.WORLD), - /** * Called when a World is loaded */ @@ -541,7 +486,6 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.painting.PaintingCreateEvent */ PAINTING_PLACE (Category.ENTITY), - /** * Called when a painting is removed * @@ -560,35 +504,30 @@ public abstract class Event implements Serializable { * @todo: add javadoc see comment */ CREATURE_SPAWN (Category.LIVING_ENTITY), - /** * Called when a LivingEntity is damaged with no source. * * @see org.bukkit.event.entity.EntityDamageEvent */ ENTITY_DAMAGE (Category.LIVING_ENTITY), - /** * Called when a LivingEntity dies * * @todo: add javadoc see comment */ ENTITY_DEATH (Category.LIVING_ENTITY), - /** * Called when a Skeleton or Zombie catch fire due to the sun * * @todo: add javadoc see comment */ ENTITY_COMBUST (Category.LIVING_ENTITY), - /** * Called when an entity explodes, either TNT, Creeper, or Ghast Fireball * * @todo: add javadoc see comment */ ENTITY_EXPLODE (Category.LIVING_ENTITY), - /** * Called when an entity has made a decision to explode. * @@ -602,14 +541,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.entity.EntityExplodeTriggerEvent */ EXPLOSION_PRIME (Category.LIVING_ENTITY), - /** * Called when an entity targets another entity * * @see org.bukkit.event.entity.EntityTargetEvent */ ENTITY_TARGET (Category.LIVING_ENTITY), - /** * Called when an entity interacts with a block * This event specifically excludes player entities @@ -617,14 +554,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.entity.EntityInteractEvent */ ENTITY_INTERACT (Category.LIVING_ENTITY), - /** * Called when a creeper gains or loses a power shell * * @see org.bukkit.event.entity.CreeperPowerEvent */ CREEPER_POWER (Category.LIVING_ENTITY), - /** * Called when a pig is zapped, zombifying it * @@ -642,14 +577,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.weather.LightningStrikeEvent */ LIGHTNING_STRIKE (Category.WEATHER), - /** * Called when the weather in a world changes * * @see org.bukkit.event.weather.WeatherChangeEvent */ WEATHER_CHANGE (Category.WEATHER), - /** * Called when the thunder state in a world changes * @@ -667,63 +600,54 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.vehicle.VehicleCreateEvent */ VEHICLE_CREATE (Category.VEHICLE), - /** * Called when a vehicle is destroyed * * @see org.bukkit.event.vehicle.VehicleDestroyEvent */ VEHICLE_DESTROY (Category.VEHICLE), - /** * Called when a vehicle is damaged by a LivingEntity * * @see org.bukkit.event.vehicle.VehicleDamageEvent */ VEHICLE_DAMAGE (Category.VEHICLE), - /** * Called when a vehicle collides with an Entity * * @see org.bukkit.event.vehicle.VehicleCollisionEvent */ VEHICLE_COLLISION_ENTITY (Category.VEHICLE), - /** * Called when a vehicle collides with a Block * * @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent */ VEHICLE_COLLISION_BLOCK (Category.VEHICLE), - /** * Called when a vehicle is entered by a LivingEntity * * @see org.bukkit.event.vehicle.VehicleEnterEvent */ VEHICLE_ENTER (Category.VEHICLE), - /** * Called when a vehicle is exited by a LivingEntity * * @see org.bukkit.event.vehicle.VehicleExitEvent */ VEHICLE_EXIT (Category.VEHICLE), - /** * Called when a vehicle moves position in the world * * @see org.bukkit.event.vehicle.VehicleMoveEvent */ VEHICLE_MOVE (Category.VEHICLE), - /** * Called when a vehicle is going through an update cycle, rechecking itself * * @see org.bukkit.event.vehicle.VehicleUpdateEvent */ VEHICLE_UPDATE (Category.VEHICLE), - /** * MISCELLANEOUS EVENTS */ @@ -750,19 +674,18 @@ public abstract class Event implements Serializable { } public enum Result { + /** * Deny the event. * Depending on the event, the action indicated by the event will either not take place or will be reverted. * Some actions may not be denied. */ DENY, - /** * Neither deny nor allow the event. * The server will proceed with its normal handling. */ DEFAULT, - /** * Allow / Force the event. * The action indicated by the event will take place if possible, even if the server would not normally allow the action. diff --git a/paper-api/src/main/java/org/bukkit/event/Listener.java b/paper-api/src/main/java/org/bukkit/event/Listener.java index 004d18edbb..ff083e62da 100644 --- a/paper-api/src/main/java/org/bukkit/event/Listener.java +++ b/paper-api/src/main/java/org/bukkit/event/Listener.java @@ -1,9 +1,6 @@ - package org.bukkit.event; /** * Simple interface for tagging all EventListeners */ -public interface Listener { - -} +public interface Listener {} diff --git a/paper-api/src/main/java/org/bukkit/event/block/Action.java b/paper-api/src/main/java/org/bukkit/event/block/Action.java index 097cd80007..b8d2bcb7dc 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/Action.java +++ b/paper-api/src/main/java/org/bukkit/event/block/Action.java @@ -1,6 +1,7 @@ package org.bukkit.event.block; public enum Action { + /** * Left-clicking a block */ diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockBurnEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockBurnEvent.java index ba8b64ff30..23e37f2304 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockBurnEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockBurnEvent.java @@ -1,5 +1,3 @@ - - package org.bukkit.event.block; import org.bukkit.block.Block; diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockDamageEvent.java index 3351dc399f..1cd489fa8a 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockDamageEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockDamageEvent.java @@ -39,7 +39,7 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { public boolean getInstaBreak() { return instaBreak; } - + /** * Set if the block should instantly break */ @@ -49,13 +49,12 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { /** * Returns the ItemStack in hand - * + * * @return Currently wielding itemstack */ public ItemStack getItemInHand() { return itemstack; } - public boolean isCancelled() { return cancel; diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java index 5a4cbbf1b0..55845a6f78 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java @@ -7,15 +7,15 @@ import org.bukkit.util.Vector; /** * Event called on dispense of an item from a block. - * + * * @author sk89q */ public class BlockDispenseEvent extends BlockEvent implements Cancellable { - + private boolean cancelled = false; private ItemStack item; private Vector velocity; - + public BlockDispenseEvent(Block block, ItemStack dispensed, Vector velocity) { super(Type.BLOCK_DISPENSE, block); this.item = dispensed; @@ -25,7 +25,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable { /** * Get the item that is being dispensed. Modifying the returned item * will have no effect. - * + * * @return */ public ItemStack getItem() { @@ -34,26 +34,26 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable { /** * Set the item being dispensed. - * + * * @param item */ public void setItem(ItemStack item) { this.item = item; } - + /** * Gets the velocity. Modifying the returned Vector will not * change the velocity. - * + * * @return */ public Vector getVelocity() { return velocity.clone(); } - + /** * Set the velocity. - * + * * @param vel */ public void setVelocity(Vector vel) { @@ -73,5 +73,4 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable { public void setCancelled(boolean cancel) { cancelled = cancel; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockFromToEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockFromToEvent.java index f9cf832eea..6aaa8448f5 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockFromToEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockFromToEvent.java @@ -29,7 +29,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable { /** * Convenience method for getting the faced block - * + * * @return Block the faced block */ public Block getToBlock() { diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java index 8fe75b673d..c0f6210eb6 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java @@ -55,8 +55,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable { * Gets the cause of block ignite. * @return An IgniteCause value detailing the cause of block ignition. */ - public IgniteCause getCause() - { + public IgniteCause getCause() { return cause; } @@ -73,6 +72,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable { * An enum to specify the cause of the ignite */ public enum IgniteCause { + /** * Block ignition caused by lava. */ @@ -90,5 +90,4 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable { */ LIGHTNING, } - } diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockListener.java b/paper-api/src/main/java/org/bukkit/event/block/BlockListener.java index cc3df223ef..2b501f8b46 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockListener.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockListener.java @@ -9,25 +9,23 @@ import org.bukkit.plugin.AuthorNagException; * @author durron597 */ public class BlockListener implements Listener { + /** * Default Constructor */ - public BlockListener() { - } + public BlockListener() {} /** * Called when a block is damaged (or broken) * * @param event Relevant event details */ - public void onBlockDamage(BlockDamageEvent event) { - } + public void onBlockDamage(BlockDamageEvent event) {} /** * Called when we try to place a block, to see if we can build it */ - public void onBlockCanBuild(BlockCanBuildEvent event) { - } + public void onBlockCanBuild(BlockCanBuildEvent event) {} /** * Called when a block flows (water/lava) @@ -48,24 +46,21 @@ public class BlockListener implements Listener { * * @param event Relevant event details */ - public void onBlockIgnite(BlockIgniteEvent event) { - } + public void onBlockIgnite(BlockIgniteEvent event) {} /** * Called when block physics occurs * * @param event Relevant event details */ - public void onBlockPhysics(BlockPhysicsEvent event) { - } + public void onBlockPhysics(BlockPhysicsEvent event) {} /** * Called when a player places a block * * @param event Relevant event details */ - public void onBlockPlace(BlockPlaceEvent event) { - } + public void onBlockPlace(BlockPlaceEvent event) {} /** * Called when redstone changes @@ -74,54 +69,47 @@ public class BlockListener implements Listener { * * @param event Relevant event details */ - public void onBlockRedstoneChange(BlockRedstoneEvent event) { - } + public void onBlockRedstoneChange(BlockRedstoneEvent event) {} /** * Called when leaves are decaying naturally * * @param event Relevant event details */ - public void onLeavesDecay(LeavesDecayEvent event) { - } + public void onLeavesDecay(LeavesDecayEvent event) {} /** * Called when a sign is changed * * @param event Relevant event details */ - public void onSignChange(SignChangeEvent event) { - } + public void onSignChange(SignChangeEvent event) {} /** * Called when a block is destroyed from burning * * @param event Relevant event details */ - public void onBlockBurn(BlockBurnEvent event) { - } + public void onBlockBurn(BlockBurnEvent event) {} /** * Called when a block is destroyed by a player. * * @param event Relevant event details */ - public void onBlockBreak(BlockBreakEvent event) { - } + public void onBlockBreak(BlockBreakEvent event) {} /** * Called when a world is attempting to place a block during a snowfall * * @param event Relevant event details */ - public void onSnowForm(SnowFormEvent event) { - } - + public void onSnowForm(SnowFormEvent event) {} + /** * Called when a block is dispensing an item - * + * * @param event Relevant event details */ - public void onBlockDispense(BlockDispenseEvent event) { - } + public void onBlockDispense(BlockDispenseEvent event) {} } diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java index 0db5a11643..b6eae10b53 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java @@ -75,7 +75,6 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable { return this.replacedBlockState; } - /** * Get the block that this block was placed against * diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockRedstoneEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockRedstoneEvent.java index 3c26b6e099..9691a6beec 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockRedstoneEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockRedstoneEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.block; import org.bukkit.block.Block; @@ -42,5 +41,4 @@ public class BlockRedstoneEvent extends BlockEvent { public void setNewCurrent(int newCurrent) { this.newCurrent = newCurrent; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java b/paper-api/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java index 74f90b4c2e..cefea9882b 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.block; import org.bukkit.block.Block; diff --git a/paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java b/paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java index dd2db53b91..d8d239c5bc 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java @@ -23,7 +23,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable { * * @return the material being placed by a snowfall */ - public Material getMaterial(){ + public Material getMaterial() { return material; } @@ -32,7 +32,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable { * * @param material the material to be placed during a snowfall */ - public void setMaterial(Material material){ + public void setMaterial(Material material) { this.material = material; } @@ -41,7 +41,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable { * * @return the data of the block being placed by a snowfall */ - public byte getData(){ + public byte getData() { return data; } @@ -50,7 +50,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable { * * @param data */ - public void setData(byte data){ + public void setData(byte data) { this.data = data; } @@ -73,4 +73,4 @@ public class SnowFormEvent extends BlockEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancel = cancel; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java index e741dff9ab..06621a0062 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java @@ -56,4 +56,4 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { public CreatureType getCreatureType() { return creatureType; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java index 54686f49fd..6b318e79a7 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java @@ -56,34 +56,33 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable { return bolt; } - /** - * Gets the cause of the creeper being (un)powered. - * @return A PowerCause value detailing the cause of change in power. - */ + /** + * Gets the cause of the creeper being (un)powered. + * @return A PowerCause value detailing the cause of change in power. + */ public PowerCause getCause() { return cause; } - /** - * An enum to specify the cause of the change in power - */ - public enum PowerCause { - /** - * Power change caused by a lightning bolt - * Powered state: true - */ - LIGHTNING, + /** + * An enum to specify the cause of the change in power + */ + public enum PowerCause { - /** - * Power change caused by something else (probably a plugin) - * Powered state: true - */ - SET_ON, - - /** - * Power change caused by something else (probably a plugin) - * Powered state: false - */ - SET_OFF - } + /** + * Power change caused by a lightning bolt + * Powered state: true + */ + LIGHTNING, + /** + * Power change caused by something else (probably a plugin) + * Powered state: true + */ + SET_ON, + /** + * Power change caused by something else (probably a plugin) + * Powered state: false + */ + SET_OFF + } } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java index 95ad80423b..6ea75bac4c 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java @@ -20,9 +20,7 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent implements Cance * Returns the block that damaged the player. * @return Block that damaged the player */ - public Block getDamager() - { + public Block getDamager() { return damager; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java index 8822fbb61a..73a2e5a984 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java @@ -19,9 +19,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent implements Canc * Returns the entity that damaged the defender. * @return Entity that damaged the defender. */ - public Entity getDamager() - { + public Entity getDamager() { return damager; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByProjectileEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByProjectileEvent.java index 383dd3b1a3..16420fde94 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByProjectileEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageByProjectileEvent.java @@ -13,6 +13,7 @@ public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent { super(damager, damagee, cause, damage); this.projectile = projectile; Random random = new Random(); + this.bounce = random.nextBoolean(); } @@ -24,12 +25,11 @@ public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent { return projectile; } - public void setBounce(boolean bounce){ + public void setBounce(boolean bounce) { this.bounce = bounce; } - public boolean getBounce(){ + public boolean getBounce() { return bounce; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java index d985515e23..3d14ac98f7 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java @@ -13,15 +13,13 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { private boolean cancelled; private DamageCause cause; - public EntityDamageEvent(Entity damagee, DamageCause cause, int damage) - { + public EntityDamageEvent(Entity damagee, DamageCause cause, int damage) { super(Event.Type.ENTITY_DAMAGE, damagee); this.cause = cause; this.damage = damage; } - protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage) - { + protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage) { super(type, damagee); this.cause = cause; this.damage = damage; @@ -57,8 +55,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { * Gets the amount of damage caused by the Block * @return The amount of damage caused by the Block */ - public int getDamage() - { + public int getDamage() { return damage; } @@ -74,16 +71,15 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { * Gets the cause of the damage. * @return A DamageCause value detailing the cause of the damage. */ - public DamageCause getCause() - { + public DamageCause getCause() { return cause; } /** * An enum to specify the cause of the damage */ - public enum DamageCause - { + public enum DamageCause { + /** * Damage caused when an entity contacts a block such as a Cactus. * @@ -152,7 +148,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { VOID, /** * Damage caused by being struck by lightning - * + * * Damage: 5 */ LIGHTNING, diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java index 83c6ee073b..8f8cfbae75 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.entity; import java.util.List; diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityEvent.java index a4f4911ce6..be47523e30 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityEvent.java @@ -9,8 +9,7 @@ import org.bukkit.event.Event; public class EntityEvent extends Event { protected Entity entity; - public EntityEvent(final Event.Type type, final Entity what) - { + public EntityEvent(final Event.Type type, final Entity what) { super(type); entity = what; } @@ -19,8 +18,7 @@ public class EntityEvent extends Event { * Returns the Entity involved in this event * @return Entity who is involved in this event */ - public final Entity getEntity() - { + public final Entity getEntity() { return entity; } } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java index 2d300e6caf..23888ba8c5 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.entity; import java.util.List; @@ -17,7 +16,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable { private List blocks; private float yield = 0.3F; - public EntityExplodeEvent (Entity what, Location location, List blocks) { + public EntityExplodeEvent(Entity what, Location location, List blocks) { super(Type.ENTITY_EXPLODE, what); this.location = location; this.cancel = false; @@ -51,12 +50,12 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable { /** * Returns the percentage of blocks to drop from this explosion - * @return + * @return */ public float getYield() { return yield; } - + /** * Sets the percentage of blocks to drop from this explosion */ diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityInteractEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityInteractEvent.java index 1e10a210f6..b8f23ca5f3 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityInteractEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityInteractEvent.java @@ -11,7 +11,7 @@ import org.bukkit.event.Cancellable; */ public class EntityInteractEvent extends EntityEvent implements Cancellable { protected Block block; - + private boolean cancelled; public EntityInteractEvent(Entity entity, Block block) { @@ -51,4 +51,4 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable { public Block getBlock() { return block; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java index 234a3daa3c..fc3e441c99 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java @@ -8,42 +8,29 @@ import org.bukkit.event.painting.PaintingBreakEvent; * Handles all events fired in relation to entities */ public class EntityListener implements Listener { - public EntityListener() { - } + public EntityListener() {} - public void onCreatureSpawn(CreatureSpawnEvent event) { - } + public void onCreatureSpawn(CreatureSpawnEvent event) {} - public void onEntityCombust(EntityCombustEvent event) { - } + public void onEntityCombust(EntityCombustEvent event) {} - public void onEntityDamage(EntityDamageEvent event) { - } + public void onEntityDamage(EntityDamageEvent event) {} - public void onEntityExplode(EntityExplodeEvent event) { - } + public void onEntityExplode(EntityExplodeEvent event) {} - public void onExplosionPrime(ExplosionPrimeEvent event) { - } + public void onExplosionPrime(ExplosionPrimeEvent event) {} - public void onEntityDeath(EntityDeathEvent event) { - } + public void onEntityDeath(EntityDeathEvent event) {} - public void onEntityTarget(EntityTargetEvent event) { - } + public void onEntityTarget(EntityTargetEvent event) {} - public void onEntityInteract(EntityInteractEvent event) { - } + public void onEntityInteract(EntityInteractEvent event) {} - public void onPaintingPlace(PaintingPlaceEvent event){ - } + public void onPaintingPlace(PaintingPlaceEvent event) {} - public void onPaintingBreak(PaintingBreakEvent event){ - } + public void onPaintingBreak(PaintingBreakEvent event) {} - public void onPigZap(PigZapEvent event) { - } + public void onPigZap(PigZapEvent event) {} - public void onCreeperPower(CreeperPowerEvent event) { - } + public void onCreeperPower(CreeperPowerEvent event) {} } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java index d291b3373e..4cbc49d6a1 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java @@ -66,8 +66,8 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable { /** * An enum to specify the reason for the targeting */ - public enum TargetReason - { + public enum TargetReason { + /** * When the entity's target has died, and so it no longer targets it */ diff --git a/paper-api/src/main/java/org/bukkit/event/entity/ExplosionPrimeEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/ExplosionPrimeEvent.java index ec9087a42e..630623b6e9 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/ExplosionPrimeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/ExplosionPrimeEvent.java @@ -22,11 +22,11 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancel = cancel; } - + public float getRadius() { return radius; } - + public void setRadius(float radius) { this.radius = radius; } @@ -38,5 +38,4 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable { public void setFire(boolean fire) { this.fire = fire; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakByWorldEvent.java b/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakByWorldEvent.java index 47c2738faf..39be0f5c42 100644 --- a/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakByWorldEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakByWorldEvent.java @@ -8,7 +8,7 @@ import org.bukkit.entity.Painting; * @author Tanel Suurhans */ -public class PaintingBreakByWorldEvent extends PaintingBreakEvent{ +public class PaintingBreakByWorldEvent extends PaintingBreakEvent { public PaintingBreakByWorldEvent(final Painting painting) { super(painting, RemoveCause.WORLD); } diff --git a/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakEvent.java b/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakEvent.java index 941f26322c..5e049c0c6a 100644 --- a/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/painting/PaintingBreakEvent.java @@ -20,7 +20,7 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable { this.cause = cause; } - public RemoveCause getCause(){ + public RemoveCause getCause() { return cause; } @@ -41,12 +41,10 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable { * Removed by an entity */ ENTITY, - /** * Removed by the world - block destroyed behind, water flowing over etc */ WORLD } - -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/painting/PaintingEvent.java b/paper-api/src/main/java/org/bukkit/event/painting/PaintingEvent.java index f6c6220d75..dec3646dc6 100644 --- a/paper-api/src/main/java/org/bukkit/event/painting/PaintingEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/painting/PaintingEvent.java @@ -25,5 +25,4 @@ public class PaintingEvent extends Event { public Painting getPainting() { return painting; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java index a42743d4bd..d803f5176a 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java @@ -30,4 +30,4 @@ public class PlayerAnimationEvent extends PlayerEvent { public PlayerAnimationType getAnimationType() { return animationType; } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java index 5f2d7bcd4d..20590781f0 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java @@ -4,5 +4,5 @@ package org.bukkit.event.player; * Differet types of player animations */ public enum PlayerAnimationType { - ARM_SWING + ARM_SWING } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java index 696778e0a7..6862969e58 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java @@ -7,11 +7,11 @@ import org.bukkit.event.Cancellable; /** * This event is fired when the player is almost about to enter the bed. * It can be cancelled. - * + * * @author sk89q */ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { - + private boolean cancel = false; private Block bed; @@ -37,14 +37,13 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancel = cancel; } - + /** * Returns the bed block. - * + * * @return */ public Block getBed() { return bed; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java index c0343c2784..70a4108fe7 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java @@ -5,25 +5,24 @@ import org.bukkit.entity.Player; /** * This event is fired when the player is leaving a bed. - * + * * @author sk89q */ public class PlayerBedLeaveEvent extends PlayerEvent { - + private Block bed; public PlayerBedLeaveEvent(Player who, Block bed) { super(Type.PLAYER_BED_LEAVE, who); this.bed = bed; } - + /** * Returns the bed block. - * + * * @return */ public Block getBed() { return bed; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java index ad33abc74d..850e0e2a31 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import java.util.Arrays; @@ -20,7 +19,7 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable { public PlayerChatEvent(final Player player, final String message) { this(Type.PLAYER_CHAT, player, message); } - + protected PlayerChatEvent(final Type type, final Player player, final String message) { super(type, player); recipients = new HashSet(Arrays.asList(player.getServer().getOnlinePlayers())); diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerEggThrowEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerEggThrowEvent.java index 5d2368acc9..9321e37ded 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerEggThrowEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerEggThrowEvent.java @@ -70,7 +70,6 @@ public class PlayerEggThrowEvent extends PlayerEvent { this.hatchType = hatchType; } - /** * Get the number of mob hatches from the egg. By default the number * will be he number the server would've done diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerEvent.java index d74bc5471d..753ac1adb9 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.entity.Player; diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java index 2796b59517..ffaa71e5cf 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java @@ -83,14 +83,16 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { * @return Material the material of the item used */ public Material getMaterial() { - if (!hasItem()) return Material.AIR; + if (!hasItem()) { + return Material.AIR; + } return item.getType(); } /** * Check if this event involved a block - * + * * return boolean true if it did */ public boolean hasBlock() { @@ -99,7 +101,7 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { /** * Check if this event involved an item - * + * * return boolean true if it did */ public boolean hasItem() { @@ -113,7 +115,9 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { * @return boolean true if the item in hand was a block */ public boolean isBlockInHand() { - if (!hasItem()) return false; + if (!hasItem()) { + return false; + } return item.getType().isBlock(); } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java index f99bf9a2b8..f75e2b584c 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.entity.Player; diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerItemHeldEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerItemHeldEvent.java index dcda3f7fa0..3f5adba904 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerItemHeldEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerItemHeldEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.entity.Player; diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java index 7dc90e9b25..c518cd97d8 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.event.Listener; @@ -8,8 +7,7 @@ import org.bukkit.plugin.AuthorNagException; * Handles all events thrown in relation to a Player */ public class PlayerListener implements Listener { - public PlayerListener() { - } + public PlayerListener() {} /** * Called when a player joins a server @@ -17,7 +15,7 @@ public class PlayerListener implements Listener { * @param event Relevant event details */ public void onPlayerJoin(PlayerJoinEvent event) { - onPlayerJoin((PlayerEvent)event); + onPlayerJoin((PlayerEvent) event); throw new AuthorNagException("onPlayerJoin has been replaced with a new signature, (PlayerJoinEvent)"); } @@ -27,7 +25,7 @@ public class PlayerListener implements Listener { * @param event Relevant event details */ public void onPlayerQuit(PlayerQuitEvent event) { - onPlayerQuit((PlayerEvent)event); + onPlayerQuit((PlayerEvent) event); throw new AuthorNagException("onPlayerQuit has been replaced with a new signature, (PlayerQuitEvent)"); } @@ -36,16 +34,14 @@ public class PlayerListener implements Listener { * * @param event Relevant event details */ - public void onPlayerKick(PlayerKickEvent event) { - } + public void onPlayerKick(PlayerKickEvent event) {} /** * Called when a player sends a chat message * * @param event Relevant event details */ - public void onPlayerChat(PlayerChatEvent event) { - } + public void onPlayerChat(PlayerChatEvent event) {} /** * Called early in the command handling process. This event is only @@ -54,7 +50,7 @@ public class PlayerListener implements Listener { * @param event Relevant event details */ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - onPlayerCommandPreprocess((PlayerChatEvent)event); + onPlayerCommandPreprocess((PlayerChatEvent) event); throw new AuthorNagException("onPlayerCommandPreprocess has been replaced with a new signature, (PlayerCommandPreprocessEvent)"); } @@ -63,8 +59,7 @@ public class PlayerListener implements Listener { * * @param event Relevant event details */ - public void onPlayerMove(PlayerMoveEvent event) { - } + public void onPlayerMove(PlayerMoveEvent event) {} /** * Called when a player attempts to teleport to a new location in a world @@ -72,7 +67,7 @@ public class PlayerListener implements Listener { * @param event Relevant event details */ public void onPlayerTeleport(PlayerTeleportEvent event) { - onPlayerTeleport((PlayerMoveEvent)event); + onPlayerTeleport((PlayerMoveEvent) event); throw new AuthorNagException("onPlayerTeleport has been replaced with a new signature, (PlayerTeleportEvent)"); } @@ -81,128 +76,112 @@ public class PlayerListener implements Listener { * * @param event Relevant event details */ - public void onPlayerRespawn(PlayerRespawnEvent event) { - } + public void onPlayerRespawn(PlayerRespawnEvent event) {} /** * Called when a player interacts * * @param event Relevant event details */ - public void onPlayerInteract(PlayerInteractEvent event) { - } + public void onPlayerInteract(PlayerInteractEvent event) {} /** * Called when a player right clicks an entity. * * @param event Relevant event details */ - public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - } + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {} /** * Called when a player attempts to log in to the server * * @param event Relevant event details */ - public void onPlayerLogin(PlayerLoginEvent event) { - } + public void onPlayerLogin(PlayerLoginEvent event) {} /** * Called when a player has just been authenticated * * @param event Relevant event details */ - public void onPlayerPreLogin(PlayerPreLoginEvent event) { - } + public void onPlayerPreLogin(PlayerPreLoginEvent event) {} /** * Called when a player throws an egg and it might hatch * * @param event Relevant event details */ - public void onPlayerEggThrow(PlayerEggThrowEvent event) { - } + public void onPlayerEggThrow(PlayerEggThrowEvent event) {} /** * Called when a player plays an animation, such as an arm swing * * @param event Relevant event details */ - public void onPlayerAnimation(PlayerAnimationEvent event) { - } + public void onPlayerAnimation(PlayerAnimationEvent event) {} /** * Called when a player opens an inventory * * @param event Relevant event details */ - public void onInventoryOpen(PlayerInventoryEvent event) { - } + public void onInventoryOpen(PlayerInventoryEvent event) {} /** * Called when a player changes their held item * * @param event Relevant event details */ - public void onItemHeldChange(PlayerItemHeldEvent event) { - } + public void onItemHeldChange(PlayerItemHeldEvent event) {} /** * Called when a player drops an item from their inventory * * @param event Relevant event details */ - public void onPlayerDropItem(PlayerDropItemEvent event) { - } + public void onPlayerDropItem(PlayerDropItemEvent event) {} /** * Called when a player picks an item up off the ground * * @param event Relevant event details */ - public void onPlayerPickupItem(PlayerPickupItemEvent event) { - } + public void onPlayerPickupItem(PlayerPickupItemEvent event) {} /** * Called when a player toggles sneak mode * * @param event Relevant event details */ - public void onPlayerToggleSneak(PlayerToggleSneakEvent event) { - } + public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {} /** * Called when a player fills a bucket * * @param event Relevant event details */ - public void onPlayerBucketFill(PlayerBucketFillEvent event) { - } + public void onPlayerBucketFill(PlayerBucketFillEvent event) {} /** * Called when a player empties a bucket * * @param event Relevant event details */ - public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { - } + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {} /** * Called when a player enters a bed * * @param event Relevant event details */ - public void onPlayerBedEnter(PlayerBedEnterEvent event) { - } + public void onPlayerBedEnter(PlayerBedEnterEvent event) {} /** * Called when a player leaves a bed * * @param event Relevant event details */ - public void onPlayerBedLeave(PlayerBedLeaveEvent event) { - } + public void onPlayerBedLeave(PlayerBedLeaveEvent event) {} // TODO: Remove after RB @Deprecated public void onPlayerQuit(PlayerEvent event) {} diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java index d94bffef7c..9ef98aac86 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.entity.Player; @@ -81,26 +80,23 @@ public class PlayerLoginEvent extends PlayerEvent { * Basic kick reasons for communicating to plugins */ public enum Result { + /** * The player is allowed to log in */ ALLOWED, - /** * The player is not allowed to log in, due to the server being full */ KICK_FULL, - /** * The player is not allowed to log in, due to them being banned */ KICK_BANNED, - /** * The player is not allowed to log in, due to them not being on the white list */ KICK_WHITELIST, - /** * The player is not allowed to log in, for reasons undefined */ diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java index 967ec56fa1..de421a0bda 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.Location; diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java index 9bf9493189..a8248d6fea 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import org.bukkit.entity.Item; diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java index ffa52ab5ed..9070740721 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.player; import java.net.InetAddress; @@ -75,19 +74,19 @@ public class PlayerPreLoginEvent extends Event { this.result = result; this.message = message; } - + /** * Gets the player name. - * + * * @return */ public String getName() { return name; } - + /** * Gets the player IP address. - * + * * @return */ public InetAddress getAddress() { @@ -98,26 +97,23 @@ public class PlayerPreLoginEvent extends Event { * Basic kick reasons for communicating to plugins */ public enum Result { + /** * The player is allowed to log in */ ALLOWED, - /** * The player is not allowed to log in, due to the server being full */ KICK_FULL, - /** * The player is not allowed to log in, due to them being banned */ KICK_BANNED, - /** * The player is not allowed to log in, due to them not being on the white list */ KICK_WHITELIST, - /** * The player is not allowed to log in, for reasons undefined */ diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java index bbeea60625..978018304c 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java @@ -28,5 +28,4 @@ public class PlayerQuitEvent extends PlayerEvent { public void setQuitMessage(String quitMessage) { this.quitMessage = quitMessage; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerToggleSneakEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerToggleSneakEvent.java index 6313ea7104..6df7091a4a 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerToggleSneakEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerToggleSneakEvent.java @@ -7,7 +7,7 @@ import org.bukkit.event.Cancellable; * * @author azi */ -public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{ +public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable { private boolean cancel = false; public PlayerToggleSneakEvent(final Player player) { @@ -24,7 +24,6 @@ public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{ return cancel; } - /** * Sets the cancellation state of this event. A cancelled event will not * be executed in the server, but will still pass to other plugins diff --git a/paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java b/paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java index 60c2c279cc..cdb614bbe7 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.server; import org.bukkit.plugin.Plugin; diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java index b3ff4e5ca4..2d79537364 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.server; import org.bukkit.event.Event; @@ -10,4 +9,4 @@ public class ServerCommandEvent extends Event { public ServerCommandEvent() { super(Type.SERVER_COMMAND); } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java index 3c32813701..6c2b374919 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.server; import org.bukkit.event.Event; diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerListener.java b/paper-api/src/main/java/org/bukkit/event/server/ServerListener.java index a492543423..67d78e7ff5 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerListener.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerListener.java @@ -1,4 +1,3 @@ - package org.bukkit.event.server; import org.bukkit.event.Listener; @@ -8,13 +7,14 @@ import org.bukkit.plugin.AuthorNagException; * Handles all miscellaneous server events */ public class ServerListener implements Listener { + /** * Called when a plugin is enabled * * @param event Relevant event details */ public void onPluginEnable(PluginEnableEvent event) { - onPluginEnable((PluginEvent)event); + onPluginEnable((PluginEvent) event); throw new AuthorNagException("onPluginEnable has been replaced with a new signature, (PluginEnableEvent)"); } @@ -24,7 +24,7 @@ public class ServerListener implements Listener { * @param event Relevant event details */ public void onPluginDisable(PluginDisableEvent event) { - onPluginDisable((PluginEvent)event); + onPluginDisable((PluginEvent) event); throw new AuthorNagException("onPluginDisable has been replaced with a new signature, (PluginDisableEvent)"); } @@ -33,10 +33,9 @@ public class ServerListener implements Listener { * * @param event Relevant event details */ - public void onServerCommand(ServerCommandEvent event) { - } + public void onServerCommand(ServerCommandEvent event) {} - // TODO: Remove after RB + // TODO: Remove after RB @Deprecated public void onPluginDisable(PluginEvent event) {} @Deprecated public void onPluginEnable(PluginEvent event) {} } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java index 82e7230f51..0be40465d9 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java @@ -5,17 +5,17 @@ import org.bukkit.entity.Vehicle; /** * Raised when a vehicle collides with a block. - * + * * @author sk89q */ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { private Block block; - + public VehicleBlockCollisionEvent(Vehicle vehicle, Block block) { super(Type.VEHICLE_COLLISION_BLOCK, vehicle); this.block = block; } - + public Block getBlock() { return block; } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java index 358ec3a0d3..aaa0848b07 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Vehicle; /** * Raised when a vehicle collides. - * + * * @author sk89q */ public class VehicleCollisionEvent extends VehicleEvent { diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java index 66f8c9f77c..4ab2ab9cbf 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Vehicle; /** * Raised when a vehicle is created. - * + * * @author sk89q */ public class VehicleCreateEvent extends VehicleEvent { diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDamageEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDamageEvent.java index 3b69361bf0..0aaf6ceed1 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDamageEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDamageEvent.java @@ -6,31 +6,31 @@ import org.bukkit.event.Cancellable; /** * Raised when a vehicle receives damage. - * + * * @author sk89q */ public class VehicleDamageEvent extends VehicleEvent implements Cancellable { private Entity attacker; private int damage; private boolean cancelled; - + public VehicleDamageEvent(Vehicle vehicle, Entity attacker, int damage) { super(Type.VEHICLE_DAMAGE, vehicle); this.attacker = attacker; this.damage = damage; } - + public Entity getAttacker() { return attacker; } - + public int getDamage() { return damage; } - + /** * Change the damage. - * + * * @param damage */ public void setDamage(int damage) { @@ -44,5 +44,4 @@ public class VehicleDamageEvent extends VehicleEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancelled = cancel; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java index 195158eaf6..7497a29a53 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java @@ -12,12 +12,12 @@ import org.bukkit.event.Cancellable; public class VehicleDestroyEvent extends VehicleEvent implements Cancellable { private Entity attacker; private boolean cancelled; - + public VehicleDestroyEvent(Vehicle vehicle, Entity attacker) { super(Type.VEHICLE_DESTROY, vehicle); this.attacker = attacker; } - + public Entity getAttacker() { return attacker; } @@ -29,5 +29,4 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancelled = cancel; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java index a3b2b9701a..92c479c6aa 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java @@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable; /** * Raised when an entity enters a vehicle. - * + * * @author sk89q */ public class VehicleEnterEvent extends VehicleEvent implements Cancellable { @@ -20,7 +20,7 @@ public class VehicleEnterEvent extends VehicleEvent implements Cancellable { /** * Get the entity that entered the vehicle. - * + * * @return */ public Entity getEntered() { diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java index 0fbae0845f..42631779dc 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java @@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable; /** * Raised when a vehicle collides with an entity. - * + * * @author sk89q */ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable { @@ -14,12 +14,12 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement private boolean cancelled = false; private boolean cancelledPickup = false; private boolean cancelledCollision = false; - + public VehicleEntityCollisionEvent(Vehicle vehicle, Entity entity) { super(Type.VEHICLE_COLLISION_ENTITY, vehicle); this.entity = entity; } - + public Entity getEntity() { return entity; } @@ -31,19 +31,19 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement public void setCancelled(boolean cancel) { this.cancelled = cancel; } - + public boolean isPickupCancelled() { return cancelledPickup; } - + public void setPickupCancelled(boolean cancel) { cancelledPickup = cancel; } - + public boolean isCollisionCancelled() { return cancelledCollision; } - + public void setCollisionCancelled(boolean cancel) { cancelledCollision = cancel; } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEvent.java index 292d6ee8ba..8a4aa88f75 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.Event; /** * Represents a vehicle-related event. - * + * * @author sk89q */ public class VehicleEvent extends Event { @@ -18,7 +18,7 @@ public class VehicleEvent extends Event { /** * Get the vehicle. - * + * * @return the vehicle */ public final Vehicle getVehicle() { diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java index 263efe8039..acde49cedb 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java @@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable; /** * Raised when a living entity exits a vehicle. - * + * * @author sk89q */ public class VehicleExitEvent extends VehicleEvent implements Cancellable { @@ -17,10 +17,10 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { super(Type.VEHICLE_EXIT, vehicle); this.exited = exited; } - + /** * Get the living entity that exited the vehicle. - * + * * @return */ public LivingEntity getExited() { diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleListener.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleListener.java index bacde32fe9..771b6cd02d 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleListener.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleListener.java @@ -5,77 +5,68 @@ import org.bukkit.plugin.AuthorNagException; /** * Listener for vehicle events. - * + * * @author sk89q */ public class VehicleListener implements Listener { - public VehicleListener() { - } - + public VehicleListener() {} + /** * Called when a vehicle is created by a player. This hook will be called * for all vehicles created. - * + * * @param event */ - public void onVehicleCreate(VehicleCreateEvent event) { - } - + public void onVehicleCreate(VehicleCreateEvent event) {} + /** * Called when a vehicle is damaged by the player. - * + * * @param event */ - public void onVehicleDamage(VehicleDamageEvent event) { - } - + public void onVehicleDamage(VehicleDamageEvent event) {} + /** * Called when a vehicle collides with a block. - * + * * @param event */ - public void onVehicleBlockCollision(VehicleBlockCollisionEvent event) { - } - + public void onVehicleBlockCollision(VehicleBlockCollisionEvent event) {} + /** * Called when a vehicle collides with an entity. - * + * * @param event */ - public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) { - } - + public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {} + /** * Called when an entity enters a vehicle. - * + * * @param event */ - public void onVehicleEnter(VehicleEnterEvent event) { - } - + public void onVehicleEnter(VehicleEnterEvent event) {} + /** * Called when an entity exits a vehicle. - * + * * @param event */ - public void onVehicleExit(VehicleExitEvent event) { - } + public void onVehicleExit(VehicleExitEvent event) {} /** * Called when an vehicle moves. * * @param event */ - public void onVehicleMove(VehicleMoveEvent event) { - } + public void onVehicleMove(VehicleMoveEvent event) {} /** * Called when a vehicle is destroyed. * * @param event */ - public void onVehicleDestroy(VehicleDestroyEvent event) { - } + public void onVehicleDestroy(VehicleDestroyEvent event) {} /** * Called when a vehicle goes through an update cycle @@ -83,7 +74,7 @@ public class VehicleListener implements Listener { * @param event */ public void onVehicleUpdate(VehicleUpdateEvent event) { - onVehicleUpdate((VehicleEvent)event); + onVehicleUpdate((VehicleEvent) event); throw new AuthorNagException("onVehicleUpdate has been replaced with a new signature, (VehicleUpdateEvent)"); } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java index 61c401d3a3..056042da71 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Vehicle; /** * Raised when a vehicle moves. - * + * * @author sk89q */ public class VehicleMoveEvent extends VehicleEvent { @@ -18,19 +18,19 @@ public class VehicleMoveEvent extends VehicleEvent { this.from = from; this.to = to; } - + /** * Get the previous position. - * + * * @return */ public Location getFrom() { return from; } - + /** * Get the next position. - * + * * @return */ public Location getTo() { diff --git a/paper-api/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java b/paper-api/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java index fd16e17274..f3c78a5038 100644 --- a/paper-api/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java @@ -48,5 +48,4 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable { public LightningStrike getLightning() { return bolt; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/paper-api/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java index 6d7e07e570..ff42faf14d 100644 --- a/paper-api/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java @@ -46,5 +46,4 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { public boolean toThunderState() { return to; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/paper-api/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java index be52a09cdc..dd5759143b 100644 --- a/paper-api/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java @@ -46,5 +46,4 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { public boolean toWeatherState() { return to; } - } diff --git a/paper-api/src/main/java/org/bukkit/event/weather/WeatherListener.java b/paper-api/src/main/java/org/bukkit/event/weather/WeatherListener.java index 271a7896ef..d65eb5e4ad 100644 --- a/paper-api/src/main/java/org/bukkit/event/weather/WeatherListener.java +++ b/paper-api/src/main/java/org/bukkit/event/weather/WeatherListener.java @@ -6,16 +6,11 @@ import org.bukkit.event.Listener; * Handles all events fired in relation to weather */ public class WeatherListener implements Listener { - public WeatherListener() { - } + public WeatherListener() {} - public void onWeatherChange(WeatherChangeEvent event) { - } + public void onWeatherChange(WeatherChangeEvent event) {} - public void onThunderChange(ThunderChangeEvent event) { - } - - public void onLightningStrike(LightningStrikeEvent event) { - } + public void onThunderChange(ThunderChangeEvent event) {} + public void onLightningStrike(LightningStrikeEvent event) {} } diff --git a/paper-api/src/main/java/org/bukkit/event/world/ChunkLoadEvent.java b/paper-api/src/main/java/org/bukkit/event/world/ChunkLoadEvent.java index 29c7137483..207c1b55da 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/ChunkLoadEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/ChunkLoadEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.world; import org.bukkit.Chunk; diff --git a/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java b/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java index 365d179e23..981a6f7b5b 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.world; import org.bukkit.Chunk; diff --git a/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java b/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java index d877758a99..5f42fb761f 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java @@ -1,4 +1,3 @@ - package org.bukkit.event.world; import org.bukkit.World; diff --git a/paper-api/src/main/java/org/bukkit/event/world/WorldListener.java b/paper-api/src/main/java/org/bukkit/event/world/WorldListener.java index ef70af8389..262facc4a9 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/WorldListener.java +++ b/paper-api/src/main/java/org/bukkit/event/world/WorldListener.java @@ -1,4 +1,3 @@ - package org.bukkit.event.world; import org.bukkit.event.Listener; @@ -8,37 +7,35 @@ import org.bukkit.plugin.AuthorNagException; * Handles all World related events */ public class WorldListener implements Listener { + /** * Called when a chunk is loaded * * @param event Relevant event details */ - public void onChunkLoad(ChunkLoadEvent event) { - } + public void onChunkLoad(ChunkLoadEvent event) {} /** * Called when a chunk is unloaded * * @param event Relevant event details */ - public void onChunkUnload(ChunkUnloadEvent event) { - } + public void onChunkUnload(ChunkUnloadEvent event) {} /** * Called when a World's spawn is changed * * @param event Relevant event details */ - public void onSpawnChange(SpawnChangeEvent event) { - } + public void onSpawnChange(SpawnChangeEvent event) {} /** - * Called when a world is saved - * - * @param event Relevant event details - */ + * Called when a world is saved + * + * @param event Relevant event details + */ public void onWorldSave(WorldSaveEvent event) { - onWorldSave((WorldEvent)event); + onWorldSave((WorldEvent) event); throw new AuthorNagException("onWorldSave has been replaced with a new signature, (WorldSaveEvent)"); } @@ -48,7 +45,7 @@ public class WorldListener implements Listener { * @param event Relevant event details */ public void onWorldLoad(WorldLoadEvent event) { - onWorldLoad((WorldEvent)event); + onWorldLoad((WorldEvent) event); throw new AuthorNagException("onWorldLoad has been replaced with a new signature, (WorldLoadEvent)"); } diff --git a/paper-api/src/main/java/org/bukkit/fillr/Checker.java b/paper-api/src/main/java/org/bukkit/fillr/Checker.java index a4c587685f..fac496c915 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Checker.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Checker.java @@ -7,96 +7,103 @@ import org.bukkit.command.CommandSender; import org.bukkit.plugin.*; public class Checker { - private static String DIRECTORY = Fillr.DIRECTORY; + private static String DIRECTORY = Fillr.DIRECTORY; - /** - * Checks all the plugins in plugins/ for updates - * - * @param sender - * The player to send info to - */ - void check(CommandSender sender) { - File folder = new File(DIRECTORY); - File[] files = folder.listFiles(new PluginFilter()); - if (files.length == 0) { - sender.sendMessage("No plugins to update."); - } else { - sender.sendMessage("Status for " + files.length + " plugins:"); - for (File file : files) { - PluginDescriptionFile pdfFile = Checker.getPDF(file); - if (pdfFile == null) { - continue; - } - checkForUpdate(file, sender); - } - } - } + /** + * Checks all the plugins in plugins/ for updates + * + * @param sender + * The player to send info to + */ + void check(CommandSender sender) { + File folder = new File(DIRECTORY); + File[] files = folder.listFiles(new PluginFilter()); - /** - * Checks for an update for a given plugin - * - * @param file - * The plugin file to check for an update - * @param sender - * The player to send info to - */ - private void checkForUpdate(File file, CommandSender sender) { - PluginDescriptionFile pdfFile = Checker.getPDF(file); - FillReader reader = needsUpdate(pdfFile); - if (reader != null) { - sender.sendMessage(ChatColor.RED + reader.getName() + " " + pdfFile.getVersion() + " has an update to " + reader.getCurrVersion()); - } else { - sender.sendMessage(pdfFile.getName() + " " + pdfFile.getVersion() + " is up to date!"); - } - } + if (files.length == 0) { + sender.sendMessage("No plugins to update."); + } else { + sender.sendMessage("Status for " + files.length + " plugins:"); + for (File file : files) { + PluginDescriptionFile pdfFile = Checker.getPDF(file); - /** - * Checks if a given plugin needs an update - * - * @param file - * The .yml file to check - * @return The FillReader for the online repo info on the plugin if the plugin needs an update - * Returns null if no update is needed. - */ - static FillReader needsUpdate(PluginDescriptionFile file) { - FillReader reader = new FillReader(file.getName()); - String version = file.getVersion(); - String currVersion = reader.getCurrVersion(); - String name = reader.getName(); - if (currVersion.equalsIgnoreCase(version) && new File(DIRECTORY, name + ".jar").exists()) { - return null; - } else { - return reader; - } - } + if (pdfFile == null) { + continue; + } + checkForUpdate(file, sender); + } + } + } - /** - * Will grab the plugin's .yml file from the give file (hopefully a plugin). - * It'll throw it into a PluginDescriptionFile - * - * @param file - * The plugin (jar) file - * @return The PluginDescriptionFile representing the .yml - */ - static PluginDescriptionFile getPDF(File file) { - // TODO supports only jar files for now. how will yml's be stored in - // different languages? - if (file.getName().endsWith(".jar")) { - JarFile jarFile; - try { - jarFile = new JarFile(file); - JarEntry entry = jarFile.getJarEntry("plugin.yml"); - InputStream input = jarFile.getInputStream(entry); - return new PluginDescriptionFile(input); - } catch (IOException e) { - e.printStackTrace(); - return null; - } catch (InvalidDescriptionException e) { - e.printStackTrace(); - return null; - } - } else { - return null; - } - } + /** + * Checks for an update for a given plugin + * + * @param file + * The plugin file to check for an update + * @param sender + * The player to send info to + */ + private void checkForUpdate(File file, CommandSender sender) { + PluginDescriptionFile pdfFile = Checker.getPDF(file); + FillReader reader = needsUpdate(pdfFile); + + if (reader != null) { + sender.sendMessage(ChatColor.RED + reader.getName() + " " + pdfFile.getVersion() + " has an update to " + reader.getCurrVersion()); + } else { + sender.sendMessage(pdfFile.getName() + " " + pdfFile.getVersion() + " is up to date!"); + } + } + + /** + * Checks if a given plugin needs an update + * + * @param file + * The .yml file to check + * @return The FillReader for the online repo info on the plugin if the plugin needs an update + * Returns null if no update is needed. + */ + static FillReader needsUpdate(PluginDescriptionFile file) { + FillReader reader = new FillReader(file.getName()); + String version = file.getVersion(); + String currVersion = reader.getCurrVersion(); + String name = reader.getName(); + + if (currVersion.equalsIgnoreCase(version) && new File(DIRECTORY, name + ".jar").exists()) { + return null; + } else { + return reader; + } + } + + /** + * Will grab the plugin's .yml file from the give file (hopefully a plugin). + * It'll throw it into a PluginDescriptionFile + * + * @param file + * The plugin (jar) file + * @return The PluginDescriptionFile representing the .yml + */ + static PluginDescriptionFile getPDF(File file) { + // TODO supports only jar files for now. how will yml's be stored in + // different languages? + + if (file.getName().endsWith(".jar")) { + JarFile jarFile; + + try { + jarFile = new JarFile(file); + JarEntry entry = jarFile.getJarEntry("plugin.yml"); + InputStream input = jarFile.getInputStream(entry); + + return new PluginDescriptionFile(input); + } catch (IOException e) { + e.printStackTrace(); + return null; + } catch (InvalidDescriptionException e) { + e.printStackTrace(); + return null; + } + } else { + return null; + } + } } diff --git a/paper-api/src/main/java/org/bukkit/fillr/Downloader.java b/paper-api/src/main/java/org/bukkit/fillr/Downloader.java index 8cc76fec1a..c42d8aa7b8 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Downloader.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Downloader.java @@ -7,135 +7,139 @@ import java.io.*; import java.net.URL; public class Downloader { - private final static String DIRECTORY = Fillr.DIRECTORY; - private final static String DOWNLOAD_DIR = DIRECTORY + File.separator + "downloads"; - private final static String BACKUP = DIRECTORY + File.separator + "backups"; + private final static String DIRECTORY = Fillr.DIRECTORY; + private final static String DOWNLOAD_DIR = DIRECTORY + File.separator + "downloads"; + private final static String BACKUP = DIRECTORY + File.separator + "backups"; - /** - * Downloads the jar from a given url. If it is a compressed archive, it - * tries to get the .jars out of it - * - * @param url - * The url to download from - */ - static void downloadJar(String url) throws Exception { - int index = url.lastIndexOf('/'); - String name = url.substring(index + 1); + /** + * Downloads the jar from a given url. If it is a compressed archive, it + * tries to get the .jars out of it + * + * @param url + * The url to download from + */ + static void downloadJar(String url) throws Exception { + int index = url.lastIndexOf('/'); + String name = url.substring(index + 1); - File file = new File(DIRECTORY, name); - if (url.endsWith(".jar") && file.exists()) { - backupFile(file); - } + File file = new File(DIRECTORY, name); - download(new URL(url), name, DIRECTORY); - file = new File("plugins", name); - } + if (url.endsWith(".jar") && file.exists()) { + backupFile(file); + } - /** - * Downloads the file for a given plugin - * - * @param name - * The name of the plugin to download - * @param player - * The player to send info to - */ - void downloadFile(String name, Player player) throws Exception { - File file = new File(DIRECTORY, name + ".jar"); - if (file.exists()) { - player.sendMessage("Downloading " + name + "'s file"); - PluginDescriptionFile pdfFile = Checker.getPDF(file); - FillReader reader = Checker.needsUpdate(pdfFile); - downloadFile(new URL(reader.getFile())); - player.sendMessage("Finished download"); - } else { - System.out.println("Can't find " + name); - } - } + download(new URL(url), name, DIRECTORY); + file = new File("plugins", name); + } - /** - * Downloads the file to the plugin/downloads directory - * - * @param u - * The url of the file to download - */ - private void downloadFile(URL u) throws Exception { - String name = u.getFile(); - int index = name.lastIndexOf('/'); - name = name.substring(index + 1); - download(u, name, DOWNLOAD_DIR); - } + /** + * Downloads the file for a given plugin + * + * @param name + * The name of the plugin to download + * @param player + * The player to send info to + */ + void downloadFile(String name, Player player) throws Exception { + File file = new File(DIRECTORY, name + ".jar"); - /** - * Downloads the file to a given directory with a given name - * - * @param u - * The url of the file to download - * @param name - * The name to give the file - * @param directory - * The directory to put the file - */ - private static void download(URL u, String name, String directory) throws Exception { - InputStream inputStream = null; - // try { - inputStream = u.openStream(); + if (file.exists()) { + player.sendMessage("Downloading " + name + "'s file"); + PluginDescriptionFile pdfFile = Checker.getPDF(file); + FillReader reader = Checker.needsUpdate(pdfFile); - if (!new File(directory).exists()) { - new File(directory).mkdir(); - } + downloadFile(new URL(reader.getFile())); + player.sendMessage("Finished download"); + } else { + System.out.println("Can't find " + name); + } + } - File f = new File(directory, name); - if (f.exists()) { - f.delete(); - } - f.createNewFile(); + /** + * Downloads the file to the plugin/downloads directory + * + * @param u + * The url of the file to download + */ + private void downloadFile(URL u) throws Exception { + String name = u.getFile(); + int index = name.lastIndexOf('/'); - copyInputStream(inputStream, new BufferedOutputStream(new FileOutputStream(f))); + name = name.substring(index + 1); + download(u, name, DOWNLOAD_DIR); + } - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException ioe) { - System.out.println("[UPDATR]: Error closing inputStream"); - } - // } - } + /** + * Downloads the file to a given directory with a given name + * + * @param u + * The url of the file to download + * @param name + * The name to give the file + * @param directory + * The directory to put the file + */ + private static void download(URL u, String name, String directory) throws Exception { + InputStream inputStream = null; - /** - * Copies an InputStream to an OutputStream! - * - * @param in - * InputStream - * @param out - * OutputStream - * @throws IOException - */ - private static final void copyInputStream(InputStream in, OutputStream out) throws IOException { - byte[] buffer = new byte[1024]; - int len; + inputStream = u.openStream(); - while ((len = in.read(buffer)) >= 0) { - out.write(buffer, 0, len); - } + if (!new File(directory).exists()) { + new File(directory).mkdir(); + } - in.close(); - out.close(); - } + File f = new File(directory, name); - /** - * Moves the file to the backup folder. - * - * @param file - * The file to backup - */ - private static void backupFile(File file) { - if (file != null && file.exists()) { - System.out.println("Backing up old file: " + file.getName()); - if (!new File(BACKUP).exists()) { - new File(BACKUP).mkdir(); - } - file.renameTo(new File(BACKUP, file.getName() + ".bak")); - } - } + if (f.exists()) { + f.delete(); + } + f.createNewFile(); + + copyInputStream(inputStream, new BufferedOutputStream(new FileOutputStream(f))); + + try { + if (inputStream != null) { + inputStream.close(); + } + } catch (IOException ioe) { + System.out.println("[UPDATR]: Error closing inputStream"); + } + } + + /** + * Copies an InputStream to an OutputStream! + * + * @param in + * InputStream + * @param out + * OutputStream + * @throws IOException + */ + private static final void copyInputStream(InputStream in, OutputStream out) throws IOException { + byte[] buffer = new byte[1024]; + int len; + + while ((len = in.read(buffer)) >= 0) { + out.write(buffer, 0, len); + } + + in.close(); + out.close(); + } + + /** + * Moves the file to the backup folder. + * + * @param file + * The file to backup + */ + private static void backupFile(File file) { + if (file != null && file.exists()) { + System.out.println("Backing up old file: " + file.getName()); + if (!new File(BACKUP).exists()) { + new File(BACKUP).mkdir(); + } + file.renameTo(new File(BACKUP, file.getName() + ".bak")); + } + } } diff --git a/paper-api/src/main/java/org/bukkit/fillr/FillReader.java b/paper-api/src/main/java/org/bukkit/fillr/FillReader.java index d32e8a4e50..0020932645 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/FillReader.java +++ b/paper-api/src/main/java/org/bukkit/fillr/FillReader.java @@ -12,7 +12,8 @@ import org.json.simple.parser.ParseException; * Grabs the latest info for a given plugin from fill.bukkit.org */ public class FillReader { - //TODO change this to what it will actually be... + // TODO change this to what it will actually be... + private static final String BASE_URL = "http://taylorkelly.me/pnfo.php"; private String currVersion; private String file; @@ -23,14 +24,16 @@ public class FillReader { public FillReader(String name) { try { String result = ""; + try { URL url = new URL(BASE_URL + "?name=" + name); + System.out.println(BASE_URL + "?name=" + name); URLConnection conn = url.openConnection(); StringBuilder buf = new StringBuilder(); - BufferedReader rd = new BufferedReader(new InputStreamReader( - conn.getInputStream())); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; + while ((line = rd.readLine()) != null) { buf.append(line); } @@ -38,8 +41,10 @@ public class FillReader { rd.close(); JSONParser parser = new JSONParser(); Object obj; + obj = parser.parse(result); JSONObject jsonObj = (JSONObject) obj; + this.currVersion = (String) jsonObj.get("plugin_version"); this.name = (String) jsonObj.get("plugin_name"); this.file = (String) jsonObj.get("plugin_file"); diff --git a/paper-api/src/main/java/org/bukkit/fillr/Fillr.java b/paper-api/src/main/java/org/bukkit/fillr/Fillr.java index 55d6ee09f9..50d1cc6b97 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Fillr.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Fillr.java @@ -9,14 +9,11 @@ public class Fillr extends JavaPlugin { public static final String VERSION = "1.0"; public static final String DIRECTORY = "plugins"; - public void onDisable() { - } + public void onDisable() {} - public void onEnable() { - } + public void onEnable() {} - public void onLoad() { - } + public void onLoad() {} @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { diff --git a/paper-api/src/main/java/org/bukkit/fillr/Getter.java b/paper-api/src/main/java/org/bukkit/fillr/Getter.java index c3111d5b4a..10ead681fe 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Getter.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Getter.java @@ -19,8 +19,8 @@ public class Getter { public void get(String string, CommandSender sender) { FillReader reader = new FillReader(string); - sender.sendMessage("Downloading " + reader.getName() + " " - + reader.getCurrVersion()); + + sender.sendMessage("Downloading " + reader.getName() + " " + reader.getCurrVersion()); try { Downloader.downloadJar(reader.getFile()); if (reader.getNotes() != null && !reader.getNotes().equals("")) { @@ -36,8 +36,10 @@ public class Getter { private void enablePlugin(FillReader update) { final String name = update.getName(); - //TODO again with the implicit jar support... + // TODO again with the implicit jar support... + File plugin = new File(DIRECTORY, name + ".jar"); + try { server.getPluginManager().loadPlugin(plugin); } catch (UnknownDependencyException ex) { diff --git a/paper-api/src/main/java/org/bukkit/fillr/Updater.java b/paper-api/src/main/java/org/bukkit/fillr/Updater.java index e9b171b87c..ce9e3f3b3f 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Updater.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Updater.java @@ -24,17 +24,19 @@ public class Updater { void updateAll(CommandSender sender) { File folder = new File(DIRECTORY); File[] files = folder.listFiles(new PluginFilter()); + if (files.length == 0) { sender.sendMessage("No plugins to update."); } else { - sender.sendMessage("Updating " - + files.length + " plugins:"); + sender.sendMessage("Updating " + files.length + " plugins:"); for (File file : files) { PluginDescriptionFile pdfFile = Checker.getPDF(file); + if (pdfFile == null) { continue; } FillReader reader = Checker.needsUpdate(pdfFile); + if (reader != null) { update(reader, sender); } @@ -51,11 +53,14 @@ public class Updater { * The player to send info to */ void update(String string, CommandSender player) { - //TODO so much .jars + // TODO so much .jars + File file = new File(DIRECTORY, string + ".jar"); + if (file.exists()) { PluginDescriptionFile pdfFile = Checker.getPDF(file); FillReader reader = Checker.needsUpdate(pdfFile); + if (reader != null) { update(reader, player); } else { @@ -76,8 +81,7 @@ public class Updater { private void update(FillReader update, CommandSender sender) { disablePlugin(update); sender.sendMessage("Disabling " + update.getName() + " for update"); - sender.sendMessage("Downloading " + update.getName() + " " - + update.getCurrVersion()); + sender.sendMessage("Downloading " + update.getName() + " " + update.getCurrVersion()); try { Downloader.downloadJar(update.getFile()); if (update.getNotes() != null && !update.getNotes().equals("")) { @@ -93,8 +97,9 @@ public class Updater { void enablePlugin(FillReader update) { final String name = update.getName(); - //TODO again with the implicit jar support... + File plugin = new File(DIRECTORY, name + ".jar"); + try { server.getPluginManager().loadPlugin(plugin); } catch (UnknownDependencyException ex) { @@ -109,6 +114,7 @@ public class Updater { private void disablePlugin(FillReader update) { String name = update.getName(); Plugin plugin = server.getPluginManager().getPlugin(name); + server.getPluginManager().disablePlugin(plugin); } } diff --git a/paper-api/src/main/java/org/bukkit/inventory/Inventory.java b/paper-api/src/main/java/org/bukkit/inventory/Inventory.java index 01c9160c00..81cebe82e9 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/Inventory.java +++ b/paper-api/src/main/java/org/bukkit/inventory/Inventory.java @@ -7,6 +7,7 @@ import org.bukkit.Material; * Interface to the various inventories */ public interface Inventory { + /** * Returns the size of the inventory * @@ -35,7 +36,7 @@ public interface Inventory { * @param index The index where to put the ItemStack * @param item The ItemStack to set */ - public void setItem(int index, ItemStack item); + public void setItem(int index, ItemStack item); /** * Stores the given ItemStacks in the inventory. @@ -46,7 +47,7 @@ public interface Inventory { * @param items The ItemStacks to add * @return */ - public HashMap addItem(ItemStack... items); + public HashMap addItem(ItemStack... items); /** * Removes the given ItemStacks from the inventory. @@ -57,7 +58,7 @@ public interface Inventory { * @param items The ItemStacks to remove * @return */ - public HashMap removeItem(ItemStack... items); + public HashMap removeItem(ItemStack... items); /** * Get all ItemStacks from the inventory @@ -97,28 +98,28 @@ public interface Inventory { * @return If any matching ItemStacks were found */ public boolean contains(ItemStack item); - + /** * Check if the inventory contains any ItemStacks with the given materialId and at least the minimum amount specified - * + * * @param materialId The materialId to check for * @param amount The minimum amount to look for * @return If any ItemStacks were found */ - public boolean contains(int materialId, int amount); - + public boolean contains(int materialId, int amount); + /** * Check if the inventory contains any ItemStacks with the given material and at least the minimum amount specified - * + * * @param material The material to check for * @return If any ItemStacks were found */ - public boolean contains(Material material, int amount); - + public boolean contains(Material material, int amount); + /** * Check if the inventory contains any ItemStacks matching the given ItemStack and at least the minimum amount specified * This will only match if both the type and the amount of the stack match - * + * * @param item The ItemStack to match against * @return If any matching ItemStacks were found */ diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java index 4168387040..8c9fc1cbc5 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java @@ -1,4 +1,3 @@ - package org.bukkit.inventory; import org.bukkit.Material; @@ -89,7 +88,7 @@ public class ItemStack { */ public void setTypeId(int type) { this.type = type; - createData((byte)0); + createData((byte) 0); } /** @@ -117,7 +116,7 @@ public class ItemStack { */ public MaterialData getData() { if (Material.getMaterial(getTypeId()).getData() != null) { - data = Material.getMaterial(getTypeId()).getNewData((byte)this.durability); + data = Material.getMaterial(getTypeId()).getNewData((byte) this.durability); } return data; @@ -137,8 +136,7 @@ public class ItemStack { if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) { this.data = data; } else { - throw new IllegalArgumentException("Provided data is not of type " - + mat.getData().getName() + ", found " + data.getClass().getName()); + throw new IllegalArgumentException("Provided data is not of type " + mat.getData().getName() + ", found " + data.getClass().getName()); } } } @@ -164,7 +162,7 @@ public class ItemStack { /** * Get the maximum stacksize for the material hold in this ItemStack * Returns -1 if it has no idea. - * + * * @return The maximum you can stack this material to. */ public int getMaxStackSize() { @@ -173,6 +171,7 @@ public class ItemStack { private void createData(final byte data) { Material mat = Material.getMaterial(type); + if (mat == null) { this.data = new MaterialData(type, data); } else { @@ -182,28 +181,31 @@ public class ItemStack { @Override public String toString() { - return "ItemStack{"+getType().name()+" x "+getAmount()+"}"; + return "ItemStack{" + getType().name() + " x " + getAmount() + "}"; } @Override public boolean equals(Object obj) { - if (!(obj instanceof ItemStack)) + if (!(obj instanceof ItemStack)) { return false; - - ItemStack item = (ItemStack)obj; + } + + ItemStack item = (ItemStack) obj; + return item.getAmount() == getAmount() && item.getTypeId() == getTypeId(); } - + @Override public ItemStack clone() { return new ItemStack(type, amount, durability); - } - + } + @Override public int hashCode() { int hash = 11; - hash = hash * 19 + 7 * getTypeId(); // Overriding hashCode since equals is overridden, it's just + + hash = hash * 19 + 7 * getTypeId(); // Overriding hashCode since equals is overridden, it's just hash = hash * 7 + 23 * getAmount(); // too bad these are mutable values... Q_Q return hash; - } + } } diff --git a/paper-api/src/main/java/org/bukkit/inventory/PlayerInventory.java b/paper-api/src/main/java/org/bukkit/inventory/PlayerInventory.java index 34b3ee3f6d..db655bce56 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/PlayerInventory.java +++ b/paper-api/src/main/java/org/bukkit/inventory/PlayerInventory.java @@ -4,37 +4,38 @@ package org.bukkit.inventory; * Includes interface to the 4 armor slots */ public interface PlayerInventory extends Inventory { + /** * Get all ItemStacks from the armor slots - * + * * @return All the ItemStacks from the armor slots */ public ItemStack[] getArmorContents(); /** * Return the ItemStack from the helmet slot - * + * * @return The ItemStack in the helmet slot */ public ItemStack getHelmet(); /** * Return the ItemStack from the chestplate slot - * + * * @return The ItemStack in the chestplate slot */ public ItemStack getChestplate(); /** * Return the ItemStack from the leg slot - * + * * @return The ItemStack in the leg slot */ public ItemStack getLeggings(); /** * Return the ItemStack from the boots slot - * + * * @return The ItemStack in the boots slot */ public ItemStack getBoots(); @@ -49,7 +50,7 @@ public interface PlayerInventory extends Inventory { /** * Put the given ItemStack into the helmet slot * This does not check if the ItemStack is a helmet - * + * * @param helmet The ItemStack to use as helmet */ public void setHelmet(ItemStack helmet); @@ -57,7 +58,7 @@ public interface PlayerInventory extends Inventory { /** * Put the given ItemStack into the chestplate slot * This does not check if the ItemStack is a chestplate - * + * * @param chestplate The ItemStack to use as chestplate */ public void setChestplate(ItemStack chestplate); @@ -65,7 +66,7 @@ public interface PlayerInventory extends Inventory { /** * Put the given ItemStack into the leg slot * This does not check if the ItemStack is a pair of leggings - * + * * @param leggings The ItemStack to use as leggings */ public void setLeggings(ItemStack leggings); @@ -73,28 +74,28 @@ public interface PlayerInventory extends Inventory { /** * Put the given ItemStack into the boots slot * This does not check if the ItemStack is a boots - * + * * @param boots The ItemStack to use as boots */ public void setBoots(ItemStack boots); /** * Returns the ItemStack currently hold - * + * * @return The currently held ItemStack */ public ItemStack getItemInHand(); /** * Sets the item in hand - * - * @param stack Stack to set + * + * @param stack Stack to set */ public void setItemInHand(ItemStack stack); /** * Get the slot number of the currently held item - * + * * @return Held item slot number */ public int getHeldItemSlot(); diff --git a/paper-api/src/main/java/org/bukkit/inventory/Recipe.java b/paper-api/src/main/java/org/bukkit/inventory/Recipe.java index 7d1466855d..7a0198537c 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/Recipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/Recipe.java @@ -4,6 +4,7 @@ package org.bukkit.inventory; * Represents some type of crafting recipe. */ public interface Recipe { + /** * Get the result of this recipe. * @return The result stack diff --git a/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java index 1693db8a66..9df52a8741 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java @@ -42,14 +42,15 @@ public class ShapedRecipe implements Recipe { } } this.rows = shape; + // Remove character mappings for characters that no longer exist in the shape HashMap ingredientsTemp = this.ingredients; + this.ingredients = new HashMap(); for (char key : ingredientsTemp.keySet()) { try { setIngredient(key, ingredientsTemp.get(key)); - } catch (IllegalArgumentException e) { - } + } catch (IllegalArgumentException e) {} } return this; } @@ -87,6 +88,7 @@ public class ShapedRecipe implements Recipe { */ public ShapedRecipe setIngredient(char key, Material ingredient, int raw) { MaterialData data = ingredient.getNewData((byte) raw); + if (data == null) { data = new MaterialData(ingredient, (byte) raw); } @@ -95,6 +97,7 @@ public class ShapedRecipe implements Recipe { private boolean hasKey(char c) { String key = Character.toString(c); + for (String row : rows) { if (row.contains(key)) { return true; diff --git a/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java index c8f9a2b56b..4cb92668a0 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java @@ -87,6 +87,7 @@ public class ShapelessRecipe implements Recipe { */ public ShapelessRecipe addIngredient(int count, Material ingredient, int rawdata) { MaterialData data = ingredient.getNewData((byte) rawdata); + if (data == null) { data = new MaterialData(ingredient, (byte) rawdata); } diff --git a/paper-api/src/main/java/org/bukkit/inventory/Slot.java b/paper-api/src/main/java/org/bukkit/inventory/Slot.java index fff14a961c..0e546ca63e 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/Slot.java +++ b/paper-api/src/main/java/org/bukkit/inventory/Slot.java @@ -4,6 +4,7 @@ package org.bukkit.inventory; * Represents a slot in an inventory */ public interface Slot { + /** * Gets the inventory this slot belongs to * diff --git a/paper-api/src/main/java/org/bukkit/material/Attachable.java b/paper-api/src/main/java/org/bukkit/material/Attachable.java index ea988bcabc..1d3f1076dc 100644 --- a/paper-api/src/main/java/org/bukkit/material/Attachable.java +++ b/paper-api/src/main/java/org/bukkit/material/Attachable.java @@ -6,10 +6,11 @@ import org.bukkit.block.BlockFace; * Indicates that a block can be attached to another block */ public interface Attachable extends Directional { - /** - * Gets the face that this block is attached on - * - * @return BlockFace attached to - */ - public BlockFace getAttachedFace(); + + /** + * Gets the face that this block is attached on + * + * @return BlockFace attached to + */ + public BlockFace getAttachedFace(); } diff --git a/paper-api/src/main/java/org/bukkit/material/Bed.java b/paper-api/src/main/java/org/bukkit/material/Bed.java index 948e1f7bf4..48ff8ed7e9 100644 --- a/paper-api/src/main/java/org/bukkit/material/Bed.java +++ b/paper-api/src/main/java/org/bukkit/material/Bed.java @@ -5,18 +5,18 @@ import org.bukkit.block.BlockFace; /** * Represents a bed. - * + * * @author sunkid */ public class Bed extends MaterialData implements Directional { - + /** * Default constructor for a bed. */ public Bed() { super(Material.BED_BLOCK); } - + /** * Instantiate a bed facing in a particular direction. * @param direction the direction the bed's head is facing @@ -25,7 +25,7 @@ public class Bed extends MaterialData implements Directional { this(); setFacingDirection(direction); } - + public Bed(final int type) { super(type); } @@ -44,7 +44,7 @@ public class Bed extends MaterialData implements Directional { /** * Determine if this block represents the head of the bed - * + * * @return true if this is the head of the bed, false if it is the foot */ public boolean isHeadOfBed() { @@ -57,16 +57,20 @@ public class Bed extends MaterialData implements Directional { */ public void setFacingDirection(BlockFace face) { byte data; + switch (face) { case WEST: data = 0x0; break; + case NORTH: data = 0x1; break; + case EAST: data = 0x2; break; + case SOUTH: default: data = 0x3; @@ -81,24 +85,28 @@ public class Bed extends MaterialData implements Directional { /** * Get the direction that this bed's head is facing toward - * + * * @return the direction the head of the bed is facing */ public BlockFace getFacing() { byte data = (byte) (getData() & 0x7); + switch (data) { case 0x0: return BlockFace.WEST; + case 0x1: return BlockFace.NORTH; + case 0x2: return BlockFace.EAST; + case 0x3: default: return BlockFace.SOUTH; } } - + @Override public String toString() { return (isHeadOfBed() ? "HEAD" : "FOOT") + " of " + super.toString() + " facing " + getFacing(); diff --git a/paper-api/src/main/java/org/bukkit/material/Button.java b/paper-api/src/main/java/org/bukkit/material/Button.java index 7c7f96d543..fbdc121ae9 100644 --- a/paper-api/src/main/java/org/bukkit/material/Button.java +++ b/paper-api/src/main/java/org/bukkit/material/Button.java @@ -10,7 +10,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { public Button() { super(Material.STONE_BUTTON); } - + public Button(final int type) { super(type); } @@ -30,7 +30,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { /** * Gets the current state of this Material, indicating if it's powered or * unpowered - * + * * @return true if powered, otherwise false */ public boolean isPowered() { @@ -39,7 +39,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { /** * Sets the current state of this button - * + * * @param bool * whether or not the button is powered */ @@ -49,7 +49,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { /** * Gets the face that this block is attached on - * + * * @return BlockFace attached to */ public BlockFace getAttachedFace() { @@ -58,10 +58,13 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { switch (data) { case 0x1: return BlockFace.NORTH; + case 0x2: return BlockFace.SOUTH; + case 0x3: return BlockFace.EAST; + case 0x4: return BlockFace.WEST; } @@ -79,12 +82,15 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { case SOUTH: data |= 0x1; break; + case NORTH: data |= 0x2; break; + case WEST: data |= 0x3; break; + case EAST: data |= 0x4; break; @@ -92,10 +98,9 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { setData(data); } - + @Override public String toString() { return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED"; } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Cake.java b/paper-api/src/main/java/org/bukkit/material/Cake.java index 86f3209645..c9a047dd4c 100644 --- a/paper-api/src/main/java/org/bukkit/material/Cake.java +++ b/paper-api/src/main/java/org/bukkit/material/Cake.java @@ -25,7 +25,7 @@ public class Cake extends MaterialData { /** * Gets the number of slices eaten from this cake - * + * * @return The number of slices eaten */ public int getSlicesEaten() { @@ -34,7 +34,7 @@ public class Cake extends MaterialData { /** * Gets the number of slices remaining on this cake - * + * * @return The number of slices remaining */ public int getSlicesRemaining() { @@ -43,7 +43,7 @@ public class Cake extends MaterialData { /** * Sets the number of slices eaten from this cake - * + * * @param n The number of slices eaten */ public void setSlicesEaten(int n) { @@ -54,17 +54,18 @@ public class Cake extends MaterialData { /** * Sets the number of slices remaining on this cake - * + * * @param n The number of slices remaining */ public void setSlicesRemaining(int n) { - if (n > 6) n = 6; + if (n > 6) { + n = 6; + } setData((byte) (6 - n)); } - + @Override public String toString() { return super.toString() + " " + getSlicesEaten() + "/" + getSlicesRemaining() + " slices eaten/remaining"; } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Coal.java b/paper-api/src/main/java/org/bukkit/material/Coal.java index 72aa7141b4..f6ae1bc05e 100644 --- a/paper-api/src/main/java/org/bukkit/material/Coal.java +++ b/paper-api/src/main/java/org/bukkit/material/Coal.java @@ -8,63 +8,62 @@ import org.bukkit.Material; * @author sunkid */ public class Coal extends MaterialData { - public Coal() { - super(Material.COAL); - } - - public Coal(CoalType type) { - this(); - setType(type); - } - - public Coal(final int type) { - super(type); - } + public Coal() { + super(Material.COAL); + } - public Coal(final Material type) { - super(type); - } + public Coal(CoalType type) { + this(); + setType(type); + } - public Coal(final int type, final byte data) { - super(type, data); - } + public Coal(final int type) { + super(type); + } - public Coal(final Material type, final byte data) { - super(type, data); - } + public Coal(final Material type) { + super(type); + } - /** - * Gets the current type of this coal - * - * @return CoalType of this coal - */ - public CoalType getType() { - return CoalType.getByData(getData()); - } + public Coal(final int type, final byte data) { + super(type, data); + } - /** - * Sets the type of this coal - * - * @param type New type of this coal - * @deprecated use {@link #setType(CoalType)} instead - */ - @Deprecated - public void setSpecies(CoalType type) { - setType(type); - } - - /** - * Sets the type of this coal - * - * @param type New type of this coal - */ - public void setType(CoalType type) { - setData(type.getData()); - } + public Coal(final Material type, final byte data) { + super(type, data); + } - @Override - public String toString() { - return getType() + " " + super.toString(); - } + /** + * Gets the current type of this coal + * + * @return CoalType of this coal + */ + public CoalType getType() { + return CoalType.getByData(getData()); + } + /** + * Sets the type of this coal + * + * @param type New type of this coal + * @deprecated use {@link #setType(CoalType)} instead + */ + @Deprecated + public void setSpecies(CoalType type) { + setType(type); + } + + /** + * Sets the type of this coal + * + * @param type New type of this coal + */ + public void setType(CoalType type) { + setData(type.getData()); + } + + @Override + public String toString() { + return getType() + " " + super.toString(); + } } diff --git a/paper-api/src/main/java/org/bukkit/material/Colorable.java b/paper-api/src/main/java/org/bukkit/material/Colorable.java index ab9608c958..06cf088890 100644 --- a/paper-api/src/main/java/org/bukkit/material/Colorable.java +++ b/paper-api/src/main/java/org/bukkit/material/Colorable.java @@ -4,7 +4,7 @@ import org.bukkit.DyeColor; /** * An object that can be colored. - * + * * @author Cogito * */ @@ -12,14 +12,14 @@ public interface Colorable { /** * Gets the color of this object. - * + * * @return The DyeColor of this object. */ public DyeColor getColor(); /** * Sets the color of this object to the specified DyeColor. - * + * * @param color The color of the object, as a DyeColor. */ public void setColor(DyeColor color); diff --git a/paper-api/src/main/java/org/bukkit/material/Crops.java b/paper-api/src/main/java/org/bukkit/material/Crops.java index acbe21c43d..6a09b98ce8 100644 --- a/paper-api/src/main/java/org/bukkit/material/Crops.java +++ b/paper-api/src/main/java/org/bukkit/material/Crops.java @@ -11,12 +11,12 @@ public class Crops extends MaterialData { public Crops() { super(Material.CROPS); } - + public Crops(CropState state) { this(); setState(state); } - + public Crops(final int type) { super(type); } @@ -43,7 +43,7 @@ public class Crops extends MaterialData { public CropState getSpecies() { return getState(); } - + /** * Gets the current growth state of this crop * @@ -63,7 +63,7 @@ public class Crops extends MaterialData { public void setSpecies(CropState state) { setState(state); } - + /** * Sets the growth state of this crop * @@ -72,10 +72,9 @@ public class Crops extends MaterialData { public void setState(CropState state) { setData(state.getData()); } - + @Override public String toString() { return getState() + " " + super.toString(); } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Diode.java b/paper-api/src/main/java/org/bukkit/material/Diode.java index 4ffb650196..788bc4833a 100644 --- a/paper-api/src/main/java/org/bukkit/material/Diode.java +++ b/paper-api/src/main/java/org/bukkit/material/Diode.java @@ -26,20 +26,25 @@ public class Diode extends MaterialData implements Directional { /** * Sets the delay of the repeater - * + * * @param delay * The new delay (1-4) */ public void setDelay(int delay) { - if (delay > 4) delay = 4; - if (delay < 1) delay = 1; + if (delay > 4) { + delay = 4; + } + if (delay < 1) { + delay = 1; + } byte newData = (byte) (getData() & 0x3); + setData((byte) (newData | ((delay - 1) << 2))); } /** * Gets the delay of the repeater in ticks - * + * * @return The delay (1-4) */ public int getDelay() { @@ -49,16 +54,20 @@ public class Diode extends MaterialData implements Directional { public void setFacingDirection(BlockFace face) { int delay = getDelay(); byte data; + switch (face) { case SOUTH: data = 0x1; break; + case WEST: data = 0x2; break; + case NORTH: data = 0x3; break; + case EAST: default: data = 0x0; @@ -70,19 +79,23 @@ public class Diode extends MaterialData implements Directional { public BlockFace getFacing() { byte data = (byte) (getData() & 0x3); + switch (data) { case 0x0: default: return BlockFace.EAST; + case 0x1: return BlockFace.SOUTH; + case 0x2: return BlockFace.WEST; + case 0x3: return BlockFace.NORTH; } } - + @Override public String toString() { return super.toString() + " facing " + getFacing() + " with " + getDelay() + " ticks delay"; diff --git a/paper-api/src/main/java/org/bukkit/material/Directional.java b/paper-api/src/main/java/org/bukkit/material/Directional.java index ca8e805e61..8ad23b2dca 100644 --- a/paper-api/src/main/java/org/bukkit/material/Directional.java +++ b/paper-api/src/main/java/org/bukkit/material/Directional.java @@ -11,7 +11,7 @@ public interface Directional { /** * Gets the direction this block is facing - * + * * @return the direction this block is facing */ public BlockFace getFacing(); diff --git a/paper-api/src/main/java/org/bukkit/material/Dispenser.java b/paper-api/src/main/java/org/bukkit/material/Dispenser.java index 4ded9023f4..790e71d6b5 100644 --- a/paper-api/src/main/java/org/bukkit/material/Dispenser.java +++ b/paper-api/src/main/java/org/bukkit/material/Dispenser.java @@ -5,20 +5,20 @@ import org.bukkit.block.BlockFace; /** * Represents a dispenser. - * + * * @author sunkid */ public class Dispenser extends FurnaceAndDispenser { - + public Dispenser() { super(Material.DISPENSER); } - + public Dispenser(BlockFace direction) { this(); setFacingDirection(direction); } - + public Dispenser(final int type) { super(type); } diff --git a/paper-api/src/main/java/org/bukkit/material/Door.java b/paper-api/src/main/java/org/bukkit/material/Door.java index f2c827be50..92aa041264 100644 --- a/paper-api/src/main/java/org/bukkit/material/Door.java +++ b/paper-api/src/main/java/org/bukkit/material/Door.java @@ -8,60 +8,60 @@ import org.bukkit.block.BlockFace; * @author sunkid */ public class Door extends MaterialData { - public Door() { - super(Material.WOODEN_DOOR); - } - - public Door(final int type) { - super(type); + public Door() { + super(Material.WOODEN_DOOR); + } + + public Door(final int type) { + super(type); + } + + public Door(final Material type) { + super(type); + } + + public Door(final int type, final byte data) { + super(type, data); + } + + public Door(final Material type, final byte data) { + super(type, data); + } + + /** + * Check to see if the door is open. + * @return true if the door has swung counterclockwise around its hinge. + */ + public boolean isOpen() { + return ((getData() & 0x4) == 0x4); + } + + /** + * @return whether this is the top half of the door + */ + public boolean isTopHalf() { + return ((getData() & 0x8) == 0x8); + } + + /** + * @return the location of the hinges + */ + public BlockFace getHingeCorner() { + byte d = getData(); + + if ((d & 0x3) == 0x3) { + return BlockFace.NORTH_WEST; + } else if ((d & 0x1) == 0x1) { + return BlockFace.SOUTH_EAST; + } else if ((d & 0x2) == 0x2) { + return BlockFace.SOUTH_WEST; } - public Door(final Material type) { - super(type); - } - - public Door(final int type, final byte data) { - super(type, data); - } - - public Door(final Material type, final byte data) { - super(type, data); - } - - /** - * Check to see if the door is open. - * @return true if the door has swung counterclockwise around its hinge. - */ - public boolean isOpen() { - return ((getData() & 0x4) == 0x4); - } - - /** - * @return whether this is the top half of the door - */ - public boolean isTopHalf() { - return ((getData() & 0x8) == 0x8); - } - - /** - * @return the location of the hinges - */ - public BlockFace getHingeCorner() { - byte d = getData(); - if ((d & 0x3) == 0x3) { - return BlockFace.NORTH_WEST; - } else if ((d & 0x1) == 0x1) { - return BlockFace.SOUTH_EAST; - } else if ((d & 0x2) == 0x2) { - return BlockFace.SOUTH_WEST; - } - - return BlockFace.NORTH_EAST; - } - - @Override - public String toString() { - return (isTopHalf() ? "TOP" : "BOTTOM") + " half of " + (isOpen() ? "an OPEN " : "a CLOSED ") + super.toString() + " with hinges " + getHingeCorner(); - } + return BlockFace.NORTH_EAST; + } + @Override + public String toString() { + return (isTopHalf() ? "TOP" : "BOTTOM") + " half of " + (isOpen() ? "an OPEN " : "a CLOSED ") + super.toString() + " with hinges " + getHingeCorner(); + } } diff --git a/paper-api/src/main/java/org/bukkit/material/Dye.java b/paper-api/src/main/java/org/bukkit/material/Dye.java index ccf5a633f5..347dc8ebe3 100644 --- a/paper-api/src/main/java/org/bukkit/material/Dye.java +++ b/paper-api/src/main/java/org/bukkit/material/Dye.java @@ -1,4 +1,3 @@ - package org.bukkit.material; import org.bukkit.DyeColor; @@ -11,7 +10,7 @@ public class Dye extends MaterialData implements Colorable { public Dye() { super(Material.INK_SACK); } - + public Dye(final int type) { super(type); } @@ -45,7 +44,7 @@ public class Dye extends MaterialData implements Colorable { public void setColor(DyeColor color) { setData((byte) (15 - color.getData())); } - + @Override public String toString() { return getColor() + " DYE(" + getData() + ")"; diff --git a/paper-api/src/main/java/org/bukkit/material/Furnace.java b/paper-api/src/main/java/org/bukkit/material/Furnace.java index cdfe2a4395..4fad7c55f8 100644 --- a/paper-api/src/main/java/org/bukkit/material/Furnace.java +++ b/paper-api/src/main/java/org/bukkit/material/Furnace.java @@ -5,15 +5,15 @@ import org.bukkit.block.BlockFace; /** * Represents a furnace. - * + * * @author sunkid */ public class Furnace extends FurnaceAndDispenser { - + public Furnace() { super(Material.FURNACE); } - + /** * Instantiate a furnace facing in a particular direction. * @param direction the direction the furnace's "opening" is facing @@ -22,7 +22,7 @@ public class Furnace extends FurnaceAndDispenser { this(); setFacingDirection(direction); } - + public Furnace(final int type) { super(type); } diff --git a/paper-api/src/main/java/org/bukkit/material/FurnaceAndDispenser.java b/paper-api/src/main/java/org/bukkit/material/FurnaceAndDispenser.java index 24cefbec15..08d7e4c77d 100644 --- a/paper-api/src/main/java/org/bukkit/material/FurnaceAndDispenser.java +++ b/paper-api/src/main/java/org/bukkit/material/FurnaceAndDispenser.java @@ -26,16 +26,20 @@ public class FurnaceAndDispenser extends MaterialData implements Directional { public void setFacingDirection(BlockFace face) { byte data; + switch (face) { case EAST: data = 0x2; break; + case WEST: data = 0x3; break; + case NORTH: data = 0x4; break; + case SOUTH: default: data = 0x5; @@ -46,19 +50,23 @@ public class FurnaceAndDispenser extends MaterialData implements Directional { public BlockFace getFacing() { byte data = getData(); + switch (data) { case 0x2: return BlockFace.EAST; + case 0x3: return BlockFace.WEST; + case 0x4: return BlockFace.NORTH; + case 0x5: default: return BlockFace.SOUTH; } } - + @Override public String toString() { return super.toString() + " facing " + getFacing(); diff --git a/paper-api/src/main/java/org/bukkit/material/Jukebox.java b/paper-api/src/main/java/org/bukkit/material/Jukebox.java index a11f12aa18..53b51adf32 100644 --- a/paper-api/src/main/java/org/bukkit/material/Jukebox.java +++ b/paper-api/src/main/java/org/bukkit/material/Jukebox.java @@ -10,7 +10,7 @@ public class Jukebox extends MaterialData { recordTypes.add(Material.GOLD_RECORD); recordTypes.add(Material.GREEN_RECORD); } - + public Jukebox() { super(Material.JUKEBOX); } @@ -21,8 +21,9 @@ public class Jukebox extends MaterialData { public Jukebox(Material type) { super((recordTypes.contains(type)) ? Material.JUKEBOX : type); - if(recordTypes.contains(type)) + if (recordTypes.contains(type)) { setPlaying(type); + } } public Jukebox(int type, byte data) { @@ -35,7 +36,7 @@ public class Jukebox extends MaterialData { /** * Gets the type of record currently playing - * + * * @return The type of record (Material.GOLD_RECORD or Material.GREEN_RECORD), or null for none. */ public Material getPlaying() { @@ -43,8 +44,10 @@ public class Jukebox extends MaterialData { default: case 0x0: return null; + case 0x1: return Material.GOLD_RECORD; + case 0x2: return Material.GREEN_RECORD; } @@ -52,26 +55,30 @@ public class Jukebox extends MaterialData { /** * Sets the type of record currently playing - * + * * @param rec The type of record (Material.GOLD_RECORD or Material.GREEN_RECORD), or null for none. */ public void setPlaying(Material rec) { - if (rec == null) setData((byte) 0x0); - else switch (rec) { - case GOLD_RECORD: - setData((byte) 0x1); - break; - case GREEN_RECORD: - setData((byte) 0x2); - break; - default: + if (rec == null) { setData((byte) 0x0); + } else { + switch (rec) { + case GOLD_RECORD: + setData((byte) 0x1); + break; + + case GREEN_RECORD: + setData((byte) 0x2); + break; + + default: + setData((byte) 0x0); + } } } - + @Override public String toString() { return super.toString() + " playing " + getPlaying(); } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Ladder.java b/paper-api/src/main/java/org/bukkit/material/Ladder.java index 74bc74e568..ae791c6854 100644 --- a/paper-api/src/main/java/org/bukkit/material/Ladder.java +++ b/paper-api/src/main/java/org/bukkit/material/Ladder.java @@ -10,7 +10,7 @@ public class Ladder extends SimpleAttachableMaterialData { public Ladder() { super(Material.LADDER); } - + public Ladder(final int type) { super(type); } @@ -29,7 +29,7 @@ public class Ladder extends SimpleAttachableMaterialData { /** * Gets the face that this block is attached on - * + * * @return BlockFace attached to */ public BlockFace getAttachedFace() { @@ -38,10 +38,13 @@ public class Ladder extends SimpleAttachableMaterialData { switch (data) { case 0x2: return BlockFace.WEST; + case 0x3: return BlockFace.EAST; + case 0x4: return BlockFace.SOUTH; + case 0x5: return BlockFace.NORTH; } @@ -59,12 +62,15 @@ public class Ladder extends SimpleAttachableMaterialData { case WEST: data = 0x2; break; + case EAST: data = 0x3; break; + case SOUTH: data = 0x4; break; + case NORTH: data = 0x5; break; @@ -73,4 +79,4 @@ public class Ladder extends SimpleAttachableMaterialData { setData(data); } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/material/Leaves.java b/paper-api/src/main/java/org/bukkit/material/Leaves.java index ec27d4a414..e57b6847ff 100644 --- a/paper-api/src/main/java/org/bukkit/material/Leaves.java +++ b/paper-api/src/main/java/org/bukkit/material/Leaves.java @@ -11,12 +11,12 @@ public class Leaves extends MaterialData { public Leaves() { super(Material.LEAVES); } - + public Leaves(TreeSpecies species) { this(); setSpecies(species); } - + public Leaves(final int type) { super(type); } @@ -50,7 +50,7 @@ public class Leaves extends MaterialData { public void setSpecies(TreeSpecies species) { setData(species.getData()); } - + @Override public String toString() { return getSpecies() + " " + super.toString(); diff --git a/paper-api/src/main/java/org/bukkit/material/Lever.java b/paper-api/src/main/java/org/bukkit/material/Lever.java index fa9a881717..a543c27d82 100644 --- a/paper-api/src/main/java/org/bukkit/material/Lever.java +++ b/paper-api/src/main/java/org/bukkit/material/Lever.java @@ -10,7 +10,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { public Lever() { super(Material.LEVER); } - + public Lever(final int type) { super(type); } @@ -30,7 +30,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { /** * Gets the current state of this Material, indicating if it's powered or * unpowered - * + * * @return true if powered, otherwise false */ public boolean isPowered() { @@ -39,7 +39,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { /** * Gets the face that this block is attached on - * + * * @return BlockFace attached to */ public BlockFace getAttachedFace() { @@ -48,12 +48,16 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { switch (data) { case 0x1: return BlockFace.NORTH; + case 0x2: return BlockFace.SOUTH; + case 0x3: return BlockFace.EAST; + case 0x4: return BlockFace.WEST; + case 0x5: case 0x6: return BlockFace.DOWN; @@ -74,6 +78,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { case EAST: data |= 0x5; break; + case SOUTH: case NORTH: data |= 0x6; @@ -84,12 +89,15 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { case SOUTH: data |= 0x1; break; + case NORTH: data |= 0x2; break; + case WEST: data |= 0x3; break; + case EAST: data |= 0x4; break; @@ -97,10 +105,9 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { } setData(data); } - + @Override public String toString() { return super.toString() + " facing " + getFacing() + " " + (isPowered() ? "" : "NOT ") + "POWERED"; } - } diff --git a/paper-api/src/main/java/org/bukkit/material/MaterialData.java b/paper-api/src/main/java/org/bukkit/material/MaterialData.java index abbcb2336c..642e54ef86 100644 --- a/paper-api/src/main/java/org/bukkit/material/MaterialData.java +++ b/paper-api/src/main/java/org/bukkit/material/MaterialData.java @@ -1,4 +1,3 @@ - package org.bukkit.material; import org.bukkit.inventory.ItemStack; @@ -12,11 +11,11 @@ public class MaterialData { private byte data = 0; public MaterialData(final int type) { - this(type, (byte)0); + this(type, (byte) 0); } public MaterialData(final Material type) { - this(type, (byte)0); + this(type, (byte) 0); } public MaterialData(final int type, final byte data) { @@ -81,7 +80,7 @@ public class MaterialData { public ItemStack toItemStack(int amount) { return new ItemStack(type, amount, data); } - + @Override public String toString() { return getItemType() + "(" + getData() + ")"; diff --git a/paper-api/src/main/java/org/bukkit/material/PressurePlate.java b/paper-api/src/main/java/org/bukkit/material/PressurePlate.java index c0ec55fabc..3946cbc9f0 100644 --- a/paper-api/src/main/java/org/bukkit/material/PressurePlate.java +++ b/paper-api/src/main/java/org/bukkit/material/PressurePlate.java @@ -34,4 +34,4 @@ public class PressurePlate extends MaterialData implements PressureSensor { public String toString() { return super.toString() + (isPressed() ? " PRESSED" : ""); } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/material/Pumpkin.java b/paper-api/src/main/java/org/bukkit/material/Pumpkin.java index 6550adcd3d..b5993863f7 100644 --- a/paper-api/src/main/java/org/bukkit/material/Pumpkin.java +++ b/paper-api/src/main/java/org/bukkit/material/Pumpkin.java @@ -5,15 +5,15 @@ import org.bukkit.block.BlockFace; /** * Represents a pumpkin. - * + * * @author sunkid */ public class Pumpkin extends MaterialData implements Directional { - + public Pumpkin() { super(Material.PUMPKIN); } - + /** * Instantiate a pumpkin facing in a particular direction. * @param direction the direction the pumkin's face is facing @@ -22,7 +22,7 @@ public class Pumpkin extends MaterialData implements Directional { this(); setFacingDirection(direction); } - + public Pumpkin(final int type) { super(type); } @@ -45,16 +45,20 @@ public class Pumpkin extends MaterialData implements Directional { public void setFacingDirection(BlockFace face) { byte data; + switch (face) { case EAST: data = 0x0; break; + case SOUTH: data = 0x1; break; + case WEST: data = 0x2; break; + case NORTH: default: data = 0x3; @@ -65,19 +69,23 @@ public class Pumpkin extends MaterialData implements Directional { public BlockFace getFacing() { byte data = getData(); + switch (data) { case 0x0: return BlockFace.EAST; + case 0x1: return BlockFace.SOUTH; + case 0x2: return BlockFace.WEST; + case 0x3: default: return BlockFace.SOUTH; } } - + @Override public String toString() { return super.toString() + " facing " + getFacing() + " " + (isLit() ? "" : "NOT ") + "LIT"; diff --git a/paper-api/src/main/java/org/bukkit/material/Rails.java b/paper-api/src/main/java/org/bukkit/material/Rails.java index d5e975213c..db2953280f 100644 --- a/paper-api/src/main/java/org/bukkit/material/Rails.java +++ b/paper-api/src/main/java/org/bukkit/material/Rails.java @@ -33,6 +33,7 @@ public class Rails extends MaterialData { */ public boolean isOnSlope() { byte d = getConvertedData(); + return (d == 0x2 || d == 0x3 || d == 0x4 || d == 0x5); } @@ -41,6 +42,7 @@ public class Rails extends MaterialData { */ public boolean isCurve() { byte d = getConvertedData(); + return (d == 0x6 || d == 0x7 || d == 0x8 || d == 0x9); } @@ -53,26 +55,36 @@ public class Rails extends MaterialData { */ public BlockFace getDirection() { byte d = getConvertedData(); + switch (d) { case 0x0: default: return BlockFace.WEST; + case 0x1: return BlockFace.SOUTH; + case 0x2: return BlockFace.SOUTH; + case 0x3: return BlockFace.NORTH; + case 0x4: return BlockFace.EAST; + case 0x5: return BlockFace.WEST; + case 0x6: return BlockFace.NORTH_EAST; + case 0x7: return BlockFace.SOUTH_EAST; + case 0x8: return BlockFace.SOUTH_WEST; + case 0x9: return BlockFace.NORTH_WEST; } diff --git a/paper-api/src/main/java/org/bukkit/material/Redstone.java b/paper-api/src/main/java/org/bukkit/material/Redstone.java index 295fb02b6c..3e46603f8c 100644 --- a/paper-api/src/main/java/org/bukkit/material/Redstone.java +++ b/paper-api/src/main/java/org/bukkit/material/Redstone.java @@ -1,10 +1,10 @@ - package org.bukkit.material; /** * Indicated a Material that may carry or create a Redstone current */ public interface Redstone { + /** * Gets the current state of this Material, indicating if it's powered or * unpowered diff --git a/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java b/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java index a10652048a..85ee722d9a 100644 --- a/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java +++ b/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java @@ -1,4 +1,3 @@ - package org.bukkit.material; import org.bukkit.Material; @@ -10,7 +9,7 @@ public class RedstoneTorch extends Torch implements Redstone { public RedstoneTorch() { super(Material.REDSTONE_TORCH_ON); } - + public RedstoneTorch(final int type) { super(type); } @@ -36,7 +35,7 @@ public class RedstoneTorch extends Torch implements Redstone { public boolean isPowered() { return getItemType() == Material.REDSTONE_TORCH_ON; } - + @Override public String toString() { return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED"; diff --git a/paper-api/src/main/java/org/bukkit/material/RedstoneWire.java b/paper-api/src/main/java/org/bukkit/material/RedstoneWire.java index 9e4594f0bb..1b6264d519 100644 --- a/paper-api/src/main/java/org/bukkit/material/RedstoneWire.java +++ b/paper-api/src/main/java/org/bukkit/material/RedstoneWire.java @@ -1,4 +1,3 @@ - package org.bukkit.material; import org.bukkit.Material; @@ -10,7 +9,7 @@ public class RedstoneWire extends MaterialData implements Redstone { public RedstoneWire() { super(Material.REDSTONE_WIRE); } - + public RedstoneWire(final int type) { super(type); } @@ -36,7 +35,7 @@ public class RedstoneWire extends MaterialData implements Redstone { public boolean isPowered() { return getData() > 0; } - + @Override public String toString() { return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED"; diff --git a/paper-api/src/main/java/org/bukkit/material/Sign.java b/paper-api/src/main/java/org/bukkit/material/Sign.java index 50ef8a0087..f12caacbc3 100644 --- a/paper-api/src/main/java/org/bukkit/material/Sign.java +++ b/paper-api/src/main/java/org/bukkit/material/Sign.java @@ -10,7 +10,7 @@ public class Sign extends MaterialData implements Attachable { public Sign() { super(Material.SIGN_POST); } - + public Sign(final int type) { super(type); } @@ -29,7 +29,7 @@ public class Sign extends MaterialData implements Attachable { /** * Check if this sign is attached to a wall - * + * * @return true if this sign is attached to a wall, false if set on top of a * block */ @@ -39,7 +39,7 @@ public class Sign extends MaterialData implements Attachable { /** * Gets the face that this block is attached on - * + * * @return BlockFace attached to */ public BlockFace getAttachedFace() { @@ -49,10 +49,13 @@ public class Sign extends MaterialData implements Attachable { switch (data) { case 0x2: return BlockFace.WEST; + case 0x3: return BlockFace.EAST; + case 0x4: return BlockFace.SOUTH; + case 0x5: return BlockFace.NORTH; } @@ -65,7 +68,7 @@ public class Sign extends MaterialData implements Attachable { /** * Gets the direction that this sign is currently facing - * + * * @return BlockFace indicating where this sign is facing */ public BlockFace getFacing() { @@ -76,24 +79,31 @@ public class Sign extends MaterialData implements Attachable { case 0x0: case 0x1: return BlockFace.WEST; + case 0x2: case 0x3: return BlockFace.NORTH_WEST; + case 0x4: case 0x5: return BlockFace.NORTH; + case 0x6: case 0x7: return BlockFace.NORTH_EAST; + case 0x8: case 0x9: return BlockFace.EAST; + case 0xA: case 0xB: return BlockFace.SOUTH_EAST; + case 0xC: case 0xD: return BlockFace.SOUTH; + case 0xE: case 0xF: return BlockFace.SOUTH_WEST; @@ -107,17 +117,21 @@ public class Sign extends MaterialData implements Attachable { public void setFacingDirection(BlockFace face) { byte data; + if (isWallSign()) { switch (face) { case EAST: data = 0x2; break; + case WEST: data = 0x3; break; + case NORTH: data = 0x4; break; + case SOUTH: default: data = 0x5; @@ -127,24 +141,31 @@ public class Sign extends MaterialData implements Attachable { case WEST: data = 0x1; break; + case NORTH_WEST: data = 0x3; break; + case NORTH: data = 0x5; break; + case NORTH_EAST: data = 0x7; break; + case EAST: data = 0x9; break; + case SOUTH_EAST: data = 0xB; break; + case SOUTH: data = 0xD; break; + case SOUTH_WEST: default: data = 0xF; @@ -153,7 +174,7 @@ public class Sign extends MaterialData implements Attachable { setData(data); } - + @Override public String toString() { return super.toString() + " facing " + getFacing(); diff --git a/paper-api/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java b/paper-api/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java index 3de02b943e..265816bd2a 100644 --- a/paper-api/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java +++ b/paper-api/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java @@ -13,7 +13,7 @@ public abstract class SimpleAttachableMaterialData extends MaterialData implemen public SimpleAttachableMaterialData(int type) { super(type); } - + public SimpleAttachableMaterialData(int type, BlockFace direction) { this(type); setFacingDirection(direction); @@ -44,5 +44,4 @@ public abstract class SimpleAttachableMaterialData extends MaterialData implemen public String toString() { return super.toString() + " facing " + getFacing(); } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Stairs.java b/paper-api/src/main/java/org/bukkit/material/Stairs.java index caeae3958c..d1c7b9676e 100644 --- a/paper-api/src/main/java/org/bukkit/material/Stairs.java +++ b/paper-api/src/main/java/org/bukkit/material/Stairs.java @@ -5,7 +5,7 @@ import org.bukkit.block.BlockFace; /** * Represents stairs. - * + * * @author sunkid */ public class Stairs extends MaterialData implements Directional { @@ -31,14 +31,18 @@ public class Stairs extends MaterialData implements Directional { */ public BlockFace getAscendingDirection() { byte data = getData(); + switch (data) { case 0x0: default: return BlockFace.SOUTH; + case 0x1: return BlockFace.NORTH; + case 0x2: return BlockFace.WEST; + case 0x3: return BlockFace.EAST; } @@ -56,22 +60,26 @@ public class Stairs extends MaterialData implements Directional { */ public void setFacingDirection(BlockFace face) { byte data; + switch (face) { case NORTH: default: data = 0x0; break; + case SOUTH: data = 0x1; break; + case EAST: data = 0x2; break; + case WEST: data = 0x3; break; } - + setData(data); } @@ -81,10 +89,9 @@ public class Stairs extends MaterialData implements Directional { public BlockFace getFacing() { return getDescendingDirection(); } - + @Override public String toString() { return super.toString() + " facing " + getFacing(); } - } diff --git a/paper-api/src/main/java/org/bukkit/material/Step.java b/paper-api/src/main/java/org/bukkit/material/Step.java index b0a177c7ca..c57f0c3f7e 100644 --- a/paper-api/src/main/java/org/bukkit/material/Step.java +++ b/paper-api/src/main/java/org/bukkit/material/Step.java @@ -16,19 +16,20 @@ public class Step extends MaterialData { stepTypes.add(Material.COBBLESTONE); stepTypes.add(Material.STONE); } - + public Step() { super(Material.STEP); } - + public Step(final int type) { super(type); } public Step(final Material type) { super((stepTypes.contains(type)) ? Material.STEP : type); - if(stepTypes.contains(type)) + if (stepTypes.contains(type)) { setMaterial(type); + } } public Step(final int type, final byte data) { @@ -48,10 +49,13 @@ public class Step extends MaterialData { switch ((int) getData()) { case 1: return Material.SANDSTONE; + case 2: return Material.WOOD; + case 3: return Material.COBBLESTONE; + case 0: default: return Material.STONE; @@ -68,18 +72,21 @@ public class Step extends MaterialData { case SANDSTONE: setData((byte) 0x1); break; + case WOOD: setData((byte) 0x2); break; + case COBBLESTONE: setData((byte) 0x3); break; + case STONE: default: setData((byte) 0x0); } } - + @Override public String toString() { return getMaterial() + " " + super.toString(); diff --git a/paper-api/src/main/java/org/bukkit/material/Torch.java b/paper-api/src/main/java/org/bukkit/material/Torch.java index 8e44073efb..3105a13065 100644 --- a/paper-api/src/main/java/org/bukkit/material/Torch.java +++ b/paper-api/src/main/java/org/bukkit/material/Torch.java @@ -10,7 +10,7 @@ public class Torch extends SimpleAttachableMaterialData { public Torch() { super(Material.TORCH); } - + public Torch(final int type) { super(type); } @@ -29,7 +29,7 @@ public class Torch extends SimpleAttachableMaterialData { /** * Gets the face that this block is attached on - * + * * @return BlockFace attached to */ public BlockFace getAttachedFace() { @@ -38,12 +38,16 @@ public class Torch extends SimpleAttachableMaterialData { switch (data) { case 0x1: return BlockFace.NORTH; + case 0x2: return BlockFace.SOUTH; + case 0x3: return BlockFace.EAST; + case 0x4: return BlockFace.WEST; + case 0x5: return BlockFace.DOWN; } @@ -53,19 +57,24 @@ public class Torch extends SimpleAttachableMaterialData { public void setFacingDirection(BlockFace face) { byte data; + switch (face) { case SOUTH: data = 0x1; break; + case NORTH: data = 0x2; break; + case WEST: data = 0x3; break; + case EAST: data = 0x4; break; + case UP: default: data = 0x5; diff --git a/paper-api/src/main/java/org/bukkit/material/Tree.java b/paper-api/src/main/java/org/bukkit/material/Tree.java index 540a1fec05..22ac386f5f 100644 --- a/paper-api/src/main/java/org/bukkit/material/Tree.java +++ b/paper-api/src/main/java/org/bukkit/material/Tree.java @@ -11,12 +11,12 @@ public class Tree extends MaterialData { public Tree() { super(Material.LOG); } - + public Tree(TreeSpecies species) { this(); setSpecies(species); } - + public Tree(final int type) { super(type); } @@ -50,7 +50,7 @@ public class Tree extends MaterialData { public void setSpecies(TreeSpecies species) { setData(species.getData()); } - + @Override public String toString() { return getSpecies() + " " + super.toString(); diff --git a/paper-api/src/main/java/org/bukkit/material/Wool.java b/paper-api/src/main/java/org/bukkit/material/Wool.java index 79f91235b3..8f398ac725 100644 --- a/paper-api/src/main/java/org/bukkit/material/Wool.java +++ b/paper-api/src/main/java/org/bukkit/material/Wool.java @@ -1,4 +1,3 @@ - package org.bukkit.material; import org.bukkit.DyeColor; @@ -11,12 +10,12 @@ public class Wool extends MaterialData implements Colorable { public Wool() { super(Material.WOOL); } - + public Wool(DyeColor color) { this(); setColor(color); } - + public Wool(final int type) { super(type); } @@ -50,9 +49,9 @@ public class Wool extends MaterialData implements Colorable { public void setColor(DyeColor color) { setData(color.getData()); } - + @Override public String toString() { return getColor() + " " + super.toString(); } -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java b/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java index ecbdfb7ca0..aad7f14098 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java +++ b/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import org.bukkit.event.Event; @@ -8,5 +7,5 @@ import org.bukkit.event.Listener; * Interface which defines the class for event call backs to plugins */ public interface EventExecutor { - public void execute( Listener listener, Event event ); -} \ No newline at end of file + public void execute(Listener listener, Event event); +} diff --git a/paper-api/src/main/java/org/bukkit/plugin/IllegalPluginAccessException.java b/paper-api/src/main/java/org/bukkit/plugin/IllegalPluginAccessException.java index e438d09df1..88e6cb7eb8 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/IllegalPluginAccessException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/IllegalPluginAccessException.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; /** @@ -9,9 +8,7 @@ public class IllegalPluginAccessException extends RuntimeException { /** * Creates a new instance of IllegalPluginAccessException without detail message. */ - public IllegalPluginAccessException() { - } - + public IllegalPluginAccessException() {} /** * Constructs an instance of IllegalPluginAccessException with the specified detail message. diff --git a/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java b/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java index ce1f7e3e12..c2de542c74 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; /** diff --git a/paper-api/src/main/java/org/bukkit/plugin/InvalidPluginException.java b/paper-api/src/main/java/org/bukkit/plugin/InvalidPluginException.java index 5ac8107966..033ff922bd 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/InvalidPluginException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/InvalidPluginException.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; /** diff --git a/paper-api/src/main/java/org/bukkit/plugin/Plugin.java b/paper-api/src/main/java/org/bukkit/plugin/Plugin.java index 6c392ef49c..908c5b84ad 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/Plugin.java +++ b/paper-api/src/main/java/org/bukkit/plugin/Plugin.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import com.avaje.ebean.EbeanServer; @@ -11,6 +10,7 @@ import org.bukkit.util.config.Configuration; * Represents a Plugin */ public interface Plugin extends CommandExecutor { + /** * Returns the folder that the plugin data's files are located in. The * folder may not yet exist. diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index f1574f951d..a0034cdacc 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import java.io.InputStream; @@ -28,7 +27,7 @@ public final class PluginDescriptionFile { @SuppressWarnings("unchecked") public PluginDescriptionFile(final InputStream stream) throws InvalidDescriptionException { - loadMap((Map)yaml.load(stream)); + loadMap((Map) yaml.load(stream)); } /** @@ -37,7 +36,7 @@ public final class PluginDescriptionFile { */ @SuppressWarnings("unchecked") public PluginDescriptionFile(final Reader reader) throws InvalidDescriptionException { - loadMap((Map)yaml.load(reader)); + loadMap((Map) yaml.load(reader)); } /** @@ -139,7 +138,7 @@ public final class PluginDescriptionFile { name = map.get("name").toString(); if (!name.matches("^[A-Za-z0-9 _.-]+$")) { - throw new InvalidDescriptionException("name '" + name + "' contains invalid characters."); + throw new InvalidDescriptionException("name '" + name + "' contains invalid characters."); } } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "name is not defined"); @@ -176,7 +175,7 @@ public final class PluginDescriptionFile { if (map.containsKey("depend")) { try { - depend = (ArrayList)map.get("depend"); + depend = (ArrayList) map.get("depend"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "depend is of wrong type"); } @@ -184,7 +183,7 @@ public final class PluginDescriptionFile { if (map.containsKey("softdepend")) { try { - softDepend = (ArrayList)map.get("softdepend"); + softDepend = (ArrayList) map.get("softdepend"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "softdepend is of wrong type"); } @@ -192,7 +191,7 @@ public final class PluginDescriptionFile { if (map.containsKey("database")) { try { - database = (Boolean)map.get("database"); + database = (Boolean) map.get("database"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "database is of wrong type"); } @@ -200,7 +199,7 @@ public final class PluginDescriptionFile { if (map.containsKey("website")) { try { - website = (String)map.get("website"); + website = (String) map.get("website"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "website is of wrong type"); } @@ -208,7 +207,7 @@ public final class PluginDescriptionFile { if (map.containsKey("description")) { try { - description = (String)map.get("description"); + description = (String) map.get("description"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "description is of wrong type"); } @@ -216,7 +215,8 @@ public final class PluginDescriptionFile { if (map.containsKey("author")) { try { - String extra = (String)map.get("author"); + String extra = (String) map.get("author"); + authors.add(extra); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "author is of wrong type"); @@ -225,7 +225,8 @@ public final class PluginDescriptionFile { if (map.containsKey("authors")) { try { - ArrayList extra = (ArrayList)map.get("authors"); + ArrayList extra = (ArrayList) map.get("authors"); + authors.addAll(extra); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "authors are of wrong type"); @@ -235,16 +236,27 @@ public final class PluginDescriptionFile { private Map saveMap() { Map map = new HashMap(); + map.put("name", name); map.put("main", main); map.put("version", version); map.put("database", database); - if (commands != null) map.put("command", commands); - if (depend != null) map.put("depend", depend); - if (softDepend != null) map.put("softdepend", softDepend); - if (website != null) map.put("website", website); - if (description != null) map.put("description", description); + if (commands != null) { + map.put("command", commands); + } + if (depend != null) { + map.put("depend", depend); + } + if (softDepend != null) { + map.put("softdepend", softDepend); + } + if (website != null) { + map.put("website", website); + } + if (description != null) { + map.put("description", description); + } if (authors.size() == 1) { map.put("author", authors.get(0)); diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/PluginLoader.java index 5deafa5c55..50e663e8ea 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginLoader.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import java.io.File; @@ -12,6 +11,7 @@ import org.bukkit.event.Listener; * of plugins */ public interface PluginLoader { + /** * Loads the plugin contained in the specified file * diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java index 18e8916e71..0d9781ab14 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import java.io.File; diff --git a/paper-api/src/main/java/org/bukkit/plugin/RegisteredListener.java b/paper-api/src/main/java/org/bukkit/plugin/RegisteredListener.java index b281f29283..8bb4b9be80 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/RegisteredListener.java +++ b/paper-api/src/main/java/org/bukkit/plugin/RegisteredListener.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import org.bukkit.event.Event; @@ -13,18 +12,18 @@ public class RegisteredListener { private final Plugin plugin; private final EventExecutor executor; - public RegisteredListener(final Listener pluginListener, final EventExecutor eventExecutor, final Event.Priority eventPriority, final Plugin registeredPlugin ) { + public RegisteredListener(final Listener pluginListener, final EventExecutor eventExecutor, final Event.Priority eventPriority, final Plugin registeredPlugin) { listener = pluginListener; priority = eventPriority; plugin = registeredPlugin; executor = eventExecutor; } - public RegisteredListener(final Listener pluginListener, final Event.Priority eventPriority, final Plugin registeredPlugin, Event.Type type ) { + public RegisteredListener(final Listener pluginListener, final Event.Priority eventPriority, final Plugin registeredPlugin, Event.Type type) { listener = pluginListener; priority = eventPriority; plugin = registeredPlugin; - executor = registeredPlugin.getPluginLoader().createExecutor( type, pluginListener ); + executor = registeredPlugin.getPluginLoader().createExecutor(type, pluginListener); } /** @@ -56,6 +55,6 @@ public class RegisteredListener { * @return Registered Priority */ public void callEvent(Event event) { - executor.execute( listener, event ); + executor.execute(listener, event); } } diff --git a/paper-api/src/main/java/org/bukkit/plugin/RegisteredServiceProvider.java b/paper-api/src/main/java/org/bukkit/plugin/RegisteredServiceProvider.java index 54c9ffc129..06e12f9dc5 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/RegisteredServiceProvider.java +++ b/paper-api/src/main/java/org/bukkit/plugin/RegisteredServiceProvider.java @@ -2,18 +2,17 @@ package org.bukkit.plugin; /** * A registered service provider. - * + * * @author sk89q * @param Service */ -public class RegisteredServiceProvider - implements Comparable> { +public class RegisteredServiceProvider implements Comparable> { private Class service; private Plugin plugin; private T provider; private ServicePriority priority; - + public RegisteredServiceProvider(Class service, T provider, ServicePriority priority, Plugin plugin) { @@ -22,7 +21,7 @@ public class RegisteredServiceProvider this.provider = provider; this.priority = priority; } - + public Class getService() { return service; } @@ -46,5 +45,4 @@ public class RegisteredServiceProvider return priority.ordinal() < other.getPriority().ordinal() ? 1 : -1; } } - } diff --git a/paper-api/src/main/java/org/bukkit/plugin/ServicePriority.java b/paper-api/src/main/java/org/bukkit/plugin/ServicePriority.java index df0a4e79de..4afe0fb32a 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/ServicePriority.java +++ b/paper-api/src/main/java/org/bukkit/plugin/ServicePriority.java @@ -9,4 +9,4 @@ public enum ServicePriority { Normal, High, Highest -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/plugin/ServicesManager.java b/paper-api/src/main/java/org/bukkit/plugin/ServicesManager.java index 63b5da7bdb..e801121964 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/ServicesManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/ServicesManager.java @@ -7,17 +7,17 @@ import java.util.List; * Manages services and service providers. Services are an interface specifying * a list of methods that a provider must implement. Providers are * implementations of these services. A provider can be queried from the - * services manager in order to use a service (if one is available). If + * services manager in order to use a service (if one is available). If * multiple plugins register a service, then the service with the highest * priority takes precedence. - * + * * @author sk89q */ public interface ServicesManager { /** * Register a provider of a service. - * + * * @param Provider * @param service service class * @param provider provider to register @@ -29,22 +29,22 @@ public interface ServicesManager { /** * Unregister all the providers registered by a particular plugin. - * + * * @param plugin */ public void unregisterAll(Plugin plugin); /** * Unregister a particular provider for a particular service. - * - * @param service + * + * @param service * @param provider */ public void unregister(Class service, Object provider); /** * Unregister a particular provider. - * + * * @param provider */ public void unregister(Object provider); @@ -52,7 +52,7 @@ public interface ServicesManager { /** * Queries for a provider. This may return if no provider has been * registered for a service. The highest priority provider is returned. - * + * * @param * @param service * @return provider or null @@ -62,7 +62,7 @@ public interface ServicesManager { /** * Queries for a provider registration. This may return if no provider * has been registered for a service. - * + * * @param * @param service * @return provider registration or null @@ -71,7 +71,7 @@ public interface ServicesManager { /** * Get registrations of providers for a plugin. - * + * * @param plugin * @return provider registration or null */ @@ -80,7 +80,7 @@ public interface ServicesManager { /** * Get registrations of providers for a service. The returned list is * unmodifiable. - * + * * @param * @param service * @return list of registrations @@ -91,7 +91,7 @@ public interface ServicesManager { /** * Get a list of known services. A service is known if it has registered * providers for it. - * + * * @return list of known services */ public Collection> getKnownServices(); @@ -99,12 +99,12 @@ public interface ServicesManager { /** * Returns whether a provider has been registered for a service. Do not * check this first only to call load(service) later, as that - * would be a non-thread safe situation. - * + * would be a non-thread safe situation. + * * @param service * @param service service to check * @return whether there has been a registered provider */ public boolean isProvidedFor(Class service); -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java index eb8d47d071..b450b2089e 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; import java.io.File; @@ -63,12 +62,14 @@ public final class SimplePluginManager implements PluginManager { if (PluginLoader.class.isAssignableFrom(loader)) { Constructor constructor; + try { constructor = loader.getConstructor(Server.class); instance = constructor.newInstance(server); } catch (NoSuchMethodException ex) { String className = loader.getName(); - throw new IllegalArgumentException(String.format("Class %s does not have a public %s(Server) constructor", className,className), ex); + + throw new IllegalArgumentException(String.format("Class %s does not have a public %s(Server) constructor", className, className), ex); } catch (Exception ex) { throw new IllegalArgumentException(String.format("Unexpected exception %s while attempting to construct a new instance of %s", ex.getClass().getName(), loader.getName()), ex); } @@ -100,14 +101,15 @@ public final class SimplePluginManager implements PluginManager { LinkedList filesList = new LinkedList(Arrays.asList(files)); - if (!(server.getUpdateFolder().equals(""))) { - updateDirectory = new File(directory, server.getUpdateFolder()); - } + if (!(server.getUpdateFolder().equals(""))) { + updateDirectory = new File(directory, server.getUpdateFolder()); + } - while(!allFailed || finalPass) { + while (!allFailed || finalPass) { allFailed = true; Iterator itr = filesList.iterator(); - while(itr.hasNext()) { + + while (itr.hasNext()) { File file = itr.next(); Plugin plugin = null; @@ -115,7 +117,7 @@ public final class SimplePluginManager implements PluginManager { plugin = loadPlugin(file, finalPass); itr.remove(); } catch (UnknownDependencyException ex) { - if(finalPass) { + if (finalPass) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': " + ex.getMessage(), ex); itr.remove(); } else { @@ -135,9 +137,9 @@ public final class SimplePluginManager implements PluginManager { finalPass = false; } } - if(finalPass) { + if (finalPass) { break; - } else if(allFailed) { + } else if (allFailed) { finalPass = true; } } @@ -171,12 +173,12 @@ public final class SimplePluginManager implements PluginManager { * @throws InvalidDescriptionException Thrown when the specified file contains an invalid description */ public synchronized Plugin loadPlugin(File file, boolean ignoreSoftDependencies) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException { - File updateFile = null; + File updateFile = null; - if (updateDirectory != null && updateDirectory.isDirectory() && (updateFile = new File(updateDirectory, file.getName())).isFile()) { - if (FileUtil.copy(updateFile, file)) { - updateFile.delete(); - } + if (updateDirectory != null && updateDirectory.isDirectory() && (updateFile = new File(updateDirectory, file.getName())).isFile()) { + if (FileUtil.copy(updateFile, file)) { + updateFile.delete(); + } } Set filters = fileAssociations.keySet(); @@ -188,6 +190,7 @@ public final class SimplePluginManager implements PluginManager { if (match.find()) { PluginLoader loader = fileAssociations.get(filter); + result = loader.loadPlugin(file, ignoreSoftDependencies); } } @@ -255,7 +258,7 @@ public final class SimplePluginManager implements PluginManager { } public void disablePlugins() { - for(Plugin plugin: getPlugins()) { + for (Plugin plugin: getPlugins()) { disablePlugin(plugin); } } @@ -265,9 +268,9 @@ public final class SimplePluginManager implements PluginManager { try { plugin.getPluginLoader().disablePlugin(plugin); } catch (Throwable ex) { - server.getLogger().log(Level.SEVERE, "Error occurredd (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); + server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); } - + // Forced disable server.getScheduler().cancelTasks(plugin); server.getServicesManager().unregisterAll(plugin); @@ -296,13 +299,15 @@ public final class SimplePluginManager implements PluginManager { if (eventListeners != null) { for (RegisteredListener registration : eventListeners) { try { - registration.callEvent( event ); + registration.callEvent(event); } catch (AuthorNagException ex) { Plugin plugin = registration.getPlugin(); + if (plugin.isNaggable()) { plugin.setNaggable(false); String author = ""; + if (plugin.getDescription().getAuthors().size() > 0) { author = plugin.getDescription().getAuthors().get(0); } @@ -333,7 +338,7 @@ public final class SimplePluginManager implements PluginManager { throw new IllegalPluginAccessException("Plugin attempted to register " + type + " while not enabled"); } - getEventListeners( type ).add(new RegisteredListener(listener, priority, plugin, type)); + getEventListeners(type).add(new RegisteredListener(listener, priority, plugin, type)); } /** @@ -350,7 +355,7 @@ public final class SimplePluginManager implements PluginManager { throw new IllegalPluginAccessException("Plugin attempted to register " + type + " while not enabled"); } - getEventListeners( type ).add(new RegisteredListener(listener, executor, priority, plugin)); + getEventListeners(type).add(new RegisteredListener(listener, executor, priority, plugin)); } /** diff --git a/paper-api/src/main/java/org/bukkit/plugin/SimpleServicesManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimpleServicesManager.java index ae08acc49f..4fe91e3b5e 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimpleServicesManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/SimpleServicesManager.java @@ -11,7 +11,7 @@ import java.util.NoSuchElementException; /** * A simple services manager. - * + * * @author sk89q */ public class SimpleServicesManager implements ServicesManager { @@ -19,12 +19,11 @@ public class SimpleServicesManager implements ServicesManager { /** * Map of providers. */ - private final Map, List>> providers = - new HashMap, List>>(); + private final Map, List>> providers = new HashMap, List>>(); /** * Register a provider of a service. - * + * * @param Provider * @param service service class * @param provider provider to register @@ -33,19 +32,17 @@ public class SimpleServicesManager implements ServicesManager { */ public void register(Class service, T provider, Plugin plugin, ServicePriority priority) { - + synchronized (providers) { - List> registered = - providers.get(service); - + List> registered = providers.get(service); + if (registered == null) { registered = new ArrayList>(); providers.put(service, registered); } - - registered.add(new RegisteredServiceProvider( - service, provider, priority, plugin)); - + + registered.add(new RegisteredServiceProvider(service, provider, priority, plugin)); + // Make sure that providers are in the right order in order // for priorities to work correctly Collections.sort(registered); @@ -54,123 +51,117 @@ public class SimpleServicesManager implements ServicesManager { /** * Unregister all the providers registered by a particular plugin. - * + * * @param plugin */ public void unregisterAll(Plugin plugin) { synchronized (providers) { - Iterator, List>>> it = - providers.entrySet().iterator(); + Iterator, List>>> it = providers.entrySet().iterator(); try { while (it.hasNext()) { Map.Entry, List>> entry = it.next(); Iterator> it2 = entry.getValue().iterator(); - + try { // Removed entries that are from this plugin + while (it2.hasNext()) { if (it2.next().getPlugin() == plugin) { it2.remove(); } } - } catch (NoSuchElementException e) { - // Why does Java suck + } catch (NoSuchElementException e) { // Why does Java suck } - + // Get rid of the empty list if (entry.getValue().size() == 0) { it.remove(); } } - } catch (NoSuchElementException e) { - } + } catch (NoSuchElementException e) {} } } /** * Unregister a particular provider for a particular service. - * - * @param service + * + * @param service * @param provider */ public void unregister(Class service, Object provider) { synchronized (providers) { - Iterator, List>>> it = - providers.entrySet().iterator(); + Iterator, List>>> it = providers.entrySet().iterator(); try { while (it.hasNext()) { Map.Entry, List>> entry = it.next(); - + // We want a particular service if (entry.getKey() != service) { continue; } - + Iterator> it2 = entry.getValue().iterator(); - + try { // Removed entries that are from this plugin + while (it2.hasNext()) { if (it2.next().getProvider() == provider) { it2.remove(); } } - } catch (NoSuchElementException e) { - // Why does Java suck + } catch (NoSuchElementException e) { // Why does Java suck } - + // Get rid of the empty list if (entry.getValue().size() == 0) { it.remove(); } } - } catch (NoSuchElementException e) { - } + } catch (NoSuchElementException e) {} } } /** * Unregister a particular provider. - * + * * @param provider */ public void unregister(Object provider) { synchronized (providers) { - Iterator, List>>> it = - providers.entrySet().iterator(); + Iterator, List>>> it = providers.entrySet().iterator(); try { while (it.hasNext()) { Map.Entry, List>> entry = it.next(); Iterator> it2 = entry.getValue().iterator(); - + try { // Removed entries that are from this plugin + while (it2.hasNext()) { if (it2.next().getProvider() == provider) { it2.remove(); } } - } catch (NoSuchElementException e) { - // Why does Java suck + } catch (NoSuchElementException e) { // Why does Java suck } - + // Get rid of the empty list if (entry.getValue().size() == 0) { it.remove(); } } - } catch (NoSuchElementException e) { - } + } catch (NoSuchElementException e) {} } } - + /** * Queries for a provider. This may return if no provider has been * registered for a service. The highest priority provider is returned. - * + * * @param * @param service * @return provider or null @@ -179,11 +170,11 @@ public class SimpleServicesManager implements ServicesManager { public T load(Class service) { synchronized (providers) { List> registered = providers.get(service); - + if (registered == null) { return null; } - + // This should not be null! return (T) registered.get(0).getProvider(); } @@ -192,7 +183,7 @@ public class SimpleServicesManager implements ServicesManager { /** * Queries for a provider registration. This may return if no provider * has been registered for a service. - * + * * @param * @param service * @return provider registration or null @@ -201,11 +192,11 @@ public class SimpleServicesManager implements ServicesManager { public RegisteredServiceProvider getRegistration(Class service) { synchronized (providers) { List> registered = providers.get(service); - + if (registered == null) { return null; } - + // This should not be null! return (RegisteredServiceProvider) registered.get(0); } @@ -213,15 +204,14 @@ public class SimpleServicesManager implements ServicesManager { /** * Get registrations of providers for a plugin. - * + * * @param plugin * @return provider registration or null */ public List> getRegistrations(Plugin plugin) { synchronized (providers) { - List> ret = - new ArrayList>(); - + List> ret = new ArrayList>(); + for (List> registered : providers.values()) { for (RegisteredServiceProvider provider : registered) { if (provider.getPlugin() == plugin) { @@ -229,7 +219,7 @@ public class SimpleServicesManager implements ServicesManager { } } } - + return ret; } } @@ -237,7 +227,7 @@ public class SimpleServicesManager implements ServicesManager { /** * Get registrations of providers for a service. The returned list is * unmodifiable. - * + * * @param * @param service * @return list of registrations @@ -246,19 +236,17 @@ public class SimpleServicesManager implements ServicesManager { public Collection> getRegistrations(Class service) { synchronized (providers) { List> registered = providers.get(service); - + if (registered == null) { - return Collections.unmodifiableList( - new ArrayList>()); + return Collections.unmodifiableList(new ArrayList>()); } - - List> ret = - new ArrayList>(); - + + List> ret = new ArrayList>(); + for (RegisteredServiceProvider provider : registered) { ret.add((RegisteredServiceProvider) provider); } - + return Collections.unmodifiableList(ret); } } @@ -266,7 +254,7 @@ public class SimpleServicesManager implements ServicesManager { /** * Get a list of known services. A service is known if it has registered * providers for it. - * + * * @return list of known services */ public Collection> getKnownServices() { @@ -276,8 +264,8 @@ public class SimpleServicesManager implements ServicesManager { /** * Returns whether a provider has been registered for a service. Do not * check this first only to call load(service) later, as that - * would be a non-thread safe situation. - * + * would be a non-thread safe situation. + * * @param service * @param service service to check * @return whether there has been a registered provider diff --git a/paper-api/src/main/java/org/bukkit/plugin/UnknownDependencyException.java b/paper-api/src/main/java/org/bukkit/plugin/UnknownDependencyException.java index dc5da65181..db476d40f5 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/UnknownDependencyException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/UnknownDependencyException.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin; /** diff --git a/paper-api/src/main/java/org/bukkit/plugin/UnknownSoftDependencyException.java b/paper-api/src/main/java/org/bukkit/plugin/UnknownSoftDependencyException.java index 99fdb4fa4e..8a39dd0ec7 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/UnknownSoftDependencyException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/UnknownSoftDependencyException.java @@ -41,5 +41,4 @@ public class UnknownSoftDependencyException extends UnknownDependencyException { public UnknownSoftDependencyException() { this(null, "Unknown dependency"); } - } diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index ad64876ca4..3609fdc5fe 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -1,4 +1,3 @@ - package org.bukkit.plugin.java; import com.avaje.ebean.EbeanServer; @@ -35,8 +34,7 @@ public abstract class JavaPlugin implements Plugin { private boolean naggable = true; private EbeanServer ebean = null; - public JavaPlugin() { - } + public JavaPlugin() {} /** * Returns the folder that the plugin data's files are located in. The @@ -125,7 +123,7 @@ public abstract class JavaPlugin implements Plugin { if (isEnabled) { onEnable(); - } else { + } else { onDisable(); } } @@ -167,10 +165,12 @@ public abstract class JavaPlugin implements Plugin { server.configureDbConfig(db); DataSourceConfig ds = db.getDataSourceConfig(); + ds.setUrl(replaceDatabaseString(ds.getUrl())); getDataFolder().mkdirs(); ClassLoader previous = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(classLoader); ebean = EbeanServerFactory.create(db); Thread.currentThread().setContextClassLoader(previous); @@ -230,16 +230,14 @@ public abstract class JavaPlugin implements Plugin { } } - public void onLoad() { - // Empty! - } + public void onLoad() {} // Empty! public final boolean isNaggable() { return naggable; } public final void setNaggable(boolean canNag) { - this.naggable = canNag;; + this.naggable = canNag; } public EbeanServer getDatabase() { @@ -247,14 +245,14 @@ public abstract class JavaPlugin implements Plugin { } protected void installDDL() { - SpiEbeanServer serv = (SpiEbeanServer)getDatabase(); + SpiEbeanServer serv = (SpiEbeanServer) getDatabase(); DdlGenerator gen = serv.getDdlGenerator(); gen.runScript(false, gen.generateCreateDdl()); } protected void removeDDL() { - SpiEbeanServer serv = (SpiEbeanServer)getDatabase(); + SpiEbeanServer serv = (SpiEbeanServer) getDatabase(); DdlGenerator gen = serv.getDdlGenerator(); gen.runScript(true, gen.generateDropDdl()); diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index fa54be7215..4448cbaf7d 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -35,7 +35,7 @@ import org.yaml.snakeyaml.error.YAMLException; public final class JavaPluginLoader implements PluginLoader { private final Server server; private final Pattern[] fileFilters = new Pattern[] { - Pattern.compile("\\.jar$"), + Pattern.compile("\\.jar$"), }; private final Map> classes = new HashMap>(); private final Map loaders = new HashMap(); @@ -64,6 +64,7 @@ public final class JavaPluginLoader implements PluginLoader { } InputStream stream = jar.getInputStream(entry); + description = new PluginDescriptionFile(stream); stream.close(); @@ -81,7 +82,7 @@ public final class JavaPluginLoader implements PluginLoader { if (dataFolder.equals(oldDataFolder)) { // They are equal -- nothing needs to be done! } else if (dataFolder.isDirectory() && oldDataFolder.isDirectory()) { - server.getLogger().log( Level.INFO, String.format( + server.getLogger().log(Level.INFO, String.format( "While loading %s (%s) found old-data folder: %s next to the new one: %s", description.getName(), file, @@ -92,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader { if (!oldDataFolder.renameTo(dataFolder)) { throw new InvalidPluginException(new Exception("Unable to rename old data folder: '" + oldDataFolder + "' to: '" + dataFolder + "'")); } - server.getLogger().log( Level.INFO, String.format( + server.getLogger().log(Level.INFO, String.format( "While loading %s (%s) renamed data folder: '%s' to '%s'", description.getName(), file, @@ -111,34 +112,37 @@ public final class JavaPluginLoader implements PluginLoader { } ArrayList depend; + try { - depend = (ArrayList)description.getDepend(); - if(depend == null) { + depend = (ArrayList) description.getDepend(); + if (depend == null) { depend = new ArrayList(); } } catch (ClassCastException ex) { - throw new InvalidPluginException(ex); + throw new InvalidPluginException(ex); } - for(String pluginName : depend) { - if(loaders == null) { + for (String pluginName : depend) { + if (loaders == null) { throw new UnknownDependencyException(pluginName); } PluginClassLoader current = loaders.get(pluginName); - if(current == null) { + + if (current == null) { throw new UnknownDependencyException(pluginName); } } if (!ignoreSoftDependencies) { ArrayList softDepend; + try { - softDepend = (ArrayList)description.getSoftDepend(); + softDepend = (ArrayList) description.getSoftDepend(); if (softDepend == null) { softDepend = new ArrayList(); } } catch (ClassCastException ex) { - throw new InvalidPluginException(ex); + throw new InvalidPluginException(ex); } for (String pluginName : softDepend) { @@ -146,6 +150,7 @@ public final class JavaPluginLoader implements PluginLoader { throw new UnknownSoftDependencyException(pluginName); } PluginClassLoader current = loaders.get(pluginName); + if (current == null) { throw new UnknownSoftDependencyException(pluginName); } @@ -153,14 +158,17 @@ public final class JavaPluginLoader implements PluginLoader { } PluginClassLoader loader = null; + try { URL[] urls = new URL[1]; + urls[0] = file.toURI().toURL(); loader = new PluginClassLoader(this, urls, getClass().getClassLoader()); Class jarClass = Class.forName(description.getMain(), true, loader); Class plugin = jarClass.asSubclass(JavaPlugin.class); Constructor constructor = plugin.getConstructor(); + result = constructor.newInstance(); result.initialize(this, server, description, dataFolder, file, loader); @@ -168,9 +176,9 @@ public final class JavaPluginLoader implements PluginLoader { throw new InvalidPluginException(ex); } - loaders.put(description.getName(), (PluginClassLoader)loader); + loaders.put(description.getName(), (PluginClassLoader) loader); - return (Plugin)result; + return (Plugin) result; } private File getDataFolder(File file) { @@ -181,15 +189,15 @@ public final class JavaPluginLoader implements PluginLoader { if (index != -1) { String name = filename.substring(0, index); + dataFolder = new File(file.getParentFile(), name); } else { // This is if there is no extension, which should not happen // Using _ to prevent name collision + dataFolder = new File(file.getParentFile(), filename + "_"); } - //dataFolder.mkdirs(); - return dataFolder; } @@ -199,16 +207,17 @@ public final class JavaPluginLoader implements PluginLoader { public Class getClassByName(final String name) { Class cachedClass = classes.get(name); - if(cachedClass != null) { + + if (cachedClass != null) { return cachedClass; } else { - for(String current : loaders.keySet()) { + for (String current : loaders.keySet()) { PluginClassLoader loader = loaders.get(current); + try { cachedClass = loader.findClass(name, false); - } catch (ClassNotFoundException cnfe) { - } - if(cachedClass != null) { + } catch (ClassNotFoundException cnfe) {} + if (cachedClass != null) { return cachedClass; } } @@ -222,142 +231,166 @@ public final class JavaPluginLoader implements PluginLoader { } } - public EventExecutor createExecutor(Event.Type type, Listener listener ) { + public EventExecutor createExecutor(Event.Type type, Listener listener) { // TODO: remove multiple Listener type and hence casts + switch (type) { // Player Events + case PLAYER_JOIN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerJoin((PlayerJoinEvent) event); } }; + case PLAYER_QUIT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerQuit((PlayerQuitEvent) event); } }; + case PLAYER_RESPAWN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerRespawn((PlayerRespawnEvent) event); } }; + case PLAYER_KICK: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerKick((PlayerKickEvent) event); } }; + case PLAYER_COMMAND_PREPROCESS: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerCommandPreprocess((PlayerCommandPreprocessEvent) event); } }; + case PLAYER_CHAT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerChat((PlayerChatEvent) event); } }; + case PLAYER_MOVE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerMove((PlayerMoveEvent) event); } }; + case PLAYER_TELEPORT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerTeleport((PlayerTeleportEvent) event); } }; + case PLAYER_INTERACT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerInteract((PlayerInteractEvent) event); } }; + case PLAYER_INTERACT_ENTITY: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerInteractEntity((PlayerInteractEntityEvent) event); } }; + case PLAYER_LOGIN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerLogin((PlayerLoginEvent) event); } }; + case PLAYER_PRELOGIN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerPreLogin((PlayerPreLoginEvent) event); } }; + case PLAYER_EGG_THROW: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerEggThrow((PlayerEggThrowEvent) event); } }; + case PLAYER_ANIMATION: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerAnimation((PlayerAnimationEvent) event); } }; + case INVENTORY_OPEN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onInventoryOpen((PlayerInventoryEvent) event); } }; + case PLAYER_ITEM_HELD: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onItemHeldChange((PlayerItemHeldEvent) event); } }; + case PLAYER_DROP_ITEM: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerDropItem((PlayerDropItemEvent) event); } }; + case PLAYER_PICKUP_ITEM: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerPickupItem((PlayerPickupItemEvent) event); } }; + case PLAYER_TOGGLE_SNEAK: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerToggleSneak((PlayerToggleSneakEvent) event); } }; + case PLAYER_BUCKET_EMPTY: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerBucketEmpty((PlayerBucketEmptyEvent) event); } }; + case PLAYER_BUCKET_FILL: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerBucketFill((PlayerBucketFillEvent) event); } }; + case PLAYER_BED_ENTER: return new EventExecutor() { public void execute(Listener listener, Event event) { ((PlayerListener) listener).onPlayerBedEnter((PlayerBedEnterEvent) event); } }; + case PLAYER_BED_LEAVE: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -372,72 +405,84 @@ public final class JavaPluginLoader implements PluginLoader { ((BlockListener) listener).onBlockPhysics((BlockPhysicsEvent) event); } }; + case BLOCK_CANBUILD: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockCanBuild((BlockCanBuildEvent) event); } }; + case BLOCK_PLACE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockPlace((BlockPlaceEvent) event); } }; + case BLOCK_DAMAGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockDamage((BlockDamageEvent) event); } }; + case BLOCK_FROMTO: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockFromTo((BlockFromToEvent) event); } }; + case LEAVES_DECAY: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onLeavesDecay((LeavesDecayEvent) event); } }; + case SIGN_CHANGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onSignChange((SignChangeEvent) event); } }; + case BLOCK_IGNITE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockIgnite((BlockIgniteEvent) event); } }; + case REDSTONE_CHANGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockRedstoneChange((BlockRedstoneEvent) event); } }; + case BLOCK_BURN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockBurn((BlockBurnEvent) event); } }; + case BLOCK_BREAK: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onBlockBreak((BlockBreakEvent) event); } }; + case SNOW_FORM: return new EventExecutor() { public void execute(Listener listener, Event event) { ((BlockListener) listener).onSnowForm((SnowFormEvent) event); } }; + case BLOCK_DISPENSE: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -452,12 +497,14 @@ public final class JavaPluginLoader implements PluginLoader { ((ServerListener) listener).onPluginEnable((PluginEnableEvent) event); } }; + case PLUGIN_DISABLE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((ServerListener) listener).onPluginDisable((PluginDisableEvent) event); } }; + case SERVER_COMMAND: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -472,24 +519,28 @@ public final class JavaPluginLoader implements PluginLoader { ((WorldListener) listener).onChunkLoad((ChunkLoadEvent) event); } }; + case CHUNK_UNLOAD: return new EventExecutor() { public void execute(Listener listener, Event event) { ((WorldListener) listener).onChunkUnload((ChunkUnloadEvent) event); } }; + case SPAWN_CHANGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((WorldListener) listener).onSpawnChange((SpawnChangeEvent) event); } }; + case WORLD_SAVE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((WorldListener) listener).onWorldSave((WorldSaveEvent) event); } }; + case WORLD_LOAD: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -497,13 +548,14 @@ public final class JavaPluginLoader implements PluginLoader { } }; - //Painting Events + // Painting Events case PAINTING_PLACE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onPaintingPlace((PaintingPlaceEvent) event); } }; + case PAINTING_BREAK: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -518,54 +570,63 @@ public final class JavaPluginLoader implements PluginLoader { ((EntityListener) listener).onEntityDamage((EntityDamageEvent) event); } }; + case ENTITY_DEATH: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onEntityDeath((EntityDeathEvent) event); } }; + case ENTITY_COMBUST: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onEntityCombust((EntityCombustEvent) event); } }; + case ENTITY_EXPLODE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onEntityExplode((EntityExplodeEvent) event); } }; + case EXPLOSION_PRIME: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onExplosionPrime((ExplosionPrimeEvent) event); } }; + case ENTITY_TARGET: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onEntityTarget((EntityTargetEvent) event); } }; + case ENTITY_INTERACT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onEntityInteract((EntityInteractEvent) event); } }; + case CREATURE_SPAWN: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onCreatureSpawn((CreatureSpawnEvent) event); } }; + case PIG_ZAP: return new EventExecutor() { public void execute(Listener listener, Event event) { ((EntityListener) listener).onPigZap((PigZapEvent) event); } }; + case CREEPER_POWER: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -580,47 +641,56 @@ public final class JavaPluginLoader implements PluginLoader { ((VehicleListener) listener).onVehicleCreate((VehicleCreateEvent) event); } }; + case VEHICLE_DAMAGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleDamage((VehicleDamageEvent) event); } }; + case VEHICLE_DESTROY: - return new EventExecutor() { public void execute( Listener listener, Event event ) { - ((VehicleListener)listener).onVehicleDestroy( (VehicleDestroyEvent)event ); + return new EventExecutor() { + public void execute(Listener listener, Event event) { + ((VehicleListener) listener).onVehicleDestroy((VehicleDestroyEvent) event); } }; + case VEHICLE_COLLISION_BLOCK: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleBlockCollision((VehicleBlockCollisionEvent) event); } }; + case VEHICLE_COLLISION_ENTITY: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleEntityCollision((VehicleEntityCollisionEvent) event); } }; + case VEHICLE_ENTER: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleEnter((VehicleEnterEvent) event); } }; + case VEHICLE_EXIT: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleExit((VehicleExitEvent) event); } }; + case VEHICLE_MOVE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((VehicleListener) listener).onVehicleMove((VehicleMoveEvent) event); } }; + case VEHICLE_UPDATE: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -635,12 +705,14 @@ public final class JavaPluginLoader implements PluginLoader { ((WeatherListener) listener).onWeatherChange((WeatherChangeEvent) event); } }; + case THUNDER_CHANGE: return new EventExecutor() { public void execute(Listener listener, Event event) { ((WeatherListener) listener).onThunderChange((ThunderChangeEvent) event); } }; + case LIGHTNING_STRIKE: return new EventExecutor() { public void execute(Listener listener, Event event) { @@ -657,7 +729,7 @@ public final class JavaPluginLoader implements PluginLoader { }; } - throw new IllegalArgumentException( "Event " + type + " is not supported" ); + throw new IllegalArgumentException("Event " + type + " is not supported"); } public void enablePlugin(final Plugin plugin) { @@ -666,11 +738,12 @@ public final class JavaPluginLoader implements PluginLoader { } if (!plugin.isEnabled()) { - JavaPlugin jPlugin = (JavaPlugin)plugin; + JavaPlugin jPlugin = (JavaPlugin) plugin; String pluginName = jPlugin.getDescription().getName(); - if(!loaders.containsKey(pluginName)) { - loaders.put(pluginName, (PluginClassLoader)jPlugin.getClassLoader()); + + if (!loaders.containsKey(pluginName)) { + loaders.put(pluginName, (PluginClassLoader) jPlugin.getClassLoader()); } try { @@ -678,10 +751,9 @@ public final class JavaPluginLoader implements PluginLoader { } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); } - + // Perhaps abort here, rather than continue going, but as it stands, // an abort is not possible the way it's currently written - server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } } @@ -692,7 +764,7 @@ public final class JavaPluginLoader implements PluginLoader { } if (plugin.isEnabled()) { - JavaPlugin jPlugin = (JavaPlugin)plugin; + JavaPlugin jPlugin = (JavaPlugin) plugin; ClassLoader cloader = jPlugin.getClassLoader(); try { @@ -706,7 +778,7 @@ public final class JavaPluginLoader implements PluginLoader { loaders.remove(jPlugin.getDescription().getName()); if (cloader instanceof PluginClassLoader) { - PluginClassLoader loader = (PluginClassLoader)cloader; + PluginClassLoader loader = (PluginClassLoader) cloader; Set names = loader.getClasses(); for (String name : names) { @@ -716,4 +788,3 @@ public final class JavaPluginLoader implements PluginLoader { } } } - diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 085b201209..a3ca5999f1 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -29,15 +29,16 @@ public class PluginClassLoader extends URLClassLoader { // 1. Local first, this avoids IllegalAccessError exceptions for duplicate classes // 2. Global cache second which prevents ClassCastException's apparently Class result = classes.get(name); - if ( null == result ) { + + if (null == result) { try { result = super.findClass(name); classes.put(name, result); loader.setClass(name, result); - } catch ( ClassNotFoundException e ) { - if ( checkGlobal ) { + } catch (ClassNotFoundException e) { + if (checkGlobal) { result = loader.getClassByName(name); - if ( null == result ) { + if (null == result) { // We really couldnt find it throw new ClassNotFoundException(name); } @@ -53,7 +54,6 @@ public class PluginClassLoader extends URLClassLoader { return result; } - public Set getClasses() { return classes.keySet(); } diff --git a/paper-api/src/main/java/org/bukkit/util/BlockIterator.java b/paper-api/src/main/java/org/bukkit/util/BlockIterator.java index ce2407ff32..0a2fa5be36 100644 --- a/paper-api/src/main/java/org/bukkit/util/BlockIterator.java +++ b/paper-api/src/main/java/org/bukkit/util/BlockIterator.java @@ -21,7 +21,7 @@ public class BlockIterator implements Iterator { private final World world; private final int maxDistance; - private static final int gridSize = 1<<24; + private static final int gridSize = 1 << 24; private boolean end = false; @@ -56,74 +56,74 @@ public class BlockIterator implements Iterator { this.maxDistance = maxDistance; Vector startClone = start.clone(); - startClone.setY(startClone.getY( )+ yOffset); + + startClone.setY(startClone.getY() + yOffset); currentDistance = 0; - double mainDirection = 0; + double mainDirection = 0; double secondDirection = 0; - double thirdDirection = 0; + double thirdDirection = 0; - double mainPosition = 0; - double secondPosition = 0; - double thirdPosition = 0; + double mainPosition = 0; + double secondPosition = 0; + double thirdPosition = 0; - Block startBlock = world.getBlockAt((int)Math.floor(startClone.getX()), (int)Math.floor(startClone.getY()), (int)Math.floor(startClone.getZ())); + Block startBlock = world.getBlockAt((int) Math.floor(startClone.getX()), (int) Math.floor(startClone.getY()), (int) Math.floor(startClone.getZ())); if (getXLength(direction) > mainDirection) { - mainFace = getXFace(direction); - mainDirection = getXLength(direction); - mainPosition = getXPosition(direction, startClone, startBlock); + mainFace = getXFace(direction); + mainDirection = getXLength(direction); + mainPosition = getXPosition(direction, startClone, startBlock); - secondFace = getYFace(direction); + secondFace = getYFace(direction); secondDirection = getYLength(direction); - secondPosition = getYPosition(direction, startClone, startBlock); + secondPosition = getYPosition(direction, startClone, startBlock); - thirdFace = getZFace(direction); - thirdDirection = getZLength(direction); - thirdPosition = getZPosition(direction, startClone, startBlock); + thirdFace = getZFace(direction); + thirdDirection = getZLength(direction); + thirdPosition = getZPosition(direction, startClone, startBlock); } if (getYLength(direction) > mainDirection) { - mainFace = getYFace(direction); - mainDirection = getYLength(direction); - mainPosition = getYPosition(direction, startClone, startBlock); + mainFace = getYFace(direction); + mainDirection = getYLength(direction); + mainPosition = getYPosition(direction, startClone, startBlock); - secondFace = getZFace(direction); + secondFace = getZFace(direction); secondDirection = getZLength(direction); - secondPosition = getZPosition(direction, startClone, startBlock); + secondPosition = getZPosition(direction, startClone, startBlock); - thirdFace = getXFace(direction); - thirdDirection = getXLength(direction); - thirdPosition = getXPosition(direction, startClone, startBlock); + thirdFace = getXFace(direction); + thirdDirection = getXLength(direction); + thirdPosition = getXPosition(direction, startClone, startBlock); } if (getZLength(direction) > mainDirection) { - mainFace = getZFace(direction); - mainDirection = getZLength(direction); - mainPosition = getZPosition(direction, startClone, startBlock); + mainFace = getZFace(direction); + mainDirection = getZLength(direction); + mainPosition = getZPosition(direction, startClone, startBlock); - secondFace = getXFace(direction); + secondFace = getXFace(direction); secondDirection = getXLength(direction); - secondPosition = getXPosition(direction, startClone, startBlock); + secondPosition = getXPosition(direction, startClone, startBlock); - thirdFace = getYFace(direction); - thirdDirection = getYLength(direction); - thirdPosition = getYPosition(direction, startClone, startBlock); + thirdFace = getYFace(direction); + thirdDirection = getYLength(direction); + thirdPosition = getYPosition(direction, startClone, startBlock); } // trace line backwards to find intercept with plane perpendicular to the main axis - double d = mainPosition/mainDirection; // how far to hit face behind - double secondd = secondPosition - secondDirection*d; - double thirdd = thirdPosition - thirdDirection*d; - - secondError = (int)(Math.floor(secondd*gridSize)); - secondStep = (int)(Math.round(secondDirection/mainDirection*gridSize)); - thirdError = (int)(Math.floor(thirdd*gridSize)); - thirdStep = (int)(Math.round(thirdDirection/mainDirection*gridSize)); + double d = mainPosition / mainDirection; // how far to hit face behind + double secondd = secondPosition - secondDirection * d; + double thirdd = thirdPosition - thirdDirection * d; // Guarantee that the ray will pass though the start block. // It is possible that it would miss due to rounding // This should only move the ray by 1 grid position + secondError = (int) (Math.floor(secondd * gridSize)); + secondStep = (int) (Math.round(secondDirection / mainDirection * gridSize)); + thirdError = (int) (Math.floor(thirdd * gridSize)); + thirdStep = (int) (Math.round(thirdDirection / mainDirection * gridSize)); if (secondError + secondStep <= 0) { secondError = -secondStep + 1; @@ -134,6 +134,7 @@ public class BlockIterator implements Iterator { } Block lastBlock; + lastBlock = startBlock.getFace(reverseFace(mainFace)); if (secondError < 0) { @@ -157,7 +158,7 @@ public class BlockIterator implements Iterator { boolean startBlockFound = false; - for (int cnt=currentBlock; cnt>=0; cnt--) { + for (int cnt = currentBlock; cnt >= 0; cnt--) { if (blockEquals(blockQueue[cnt], startBlock)) { currentBlock = cnt; startBlockFound = true; @@ -170,7 +171,7 @@ public class BlockIterator implements Iterator { } // Calculate the number of planes passed to give max distance - maxDistanceInt = (int)Math.round(maxDistance/(Math.sqrt(mainDirection*mainDirection + secondDirection*secondDirection + thirdDirection*thirdDirection)/mainDirection)); + maxDistanceInt = (int) Math.round(maxDistance / (Math.sqrt(mainDirection * mainDirection + secondDirection * secondDirection + thirdDirection * thirdDirection) / mainDirection)); } @@ -179,14 +180,27 @@ public class BlockIterator implements Iterator { } private BlockFace reverseFace(BlockFace face) { - switch(face) { - case UP: return BlockFace.DOWN; - case DOWN: return BlockFace.UP; - case NORTH: return BlockFace.SOUTH; - case SOUTH: return BlockFace.NORTH; - case EAST: return BlockFace.WEST; - case WEST: return BlockFace.EAST; - default: return null; + switch (face) { + case UP: + return BlockFace.DOWN; + + case DOWN: + return BlockFace.UP; + + case NORTH: + return BlockFace.SOUTH; + + case SOUTH: + return BlockFace.NORTH; + + case EAST: + return BlockFace.WEST; + + case WEST: + return BlockFace.EAST; + + default: + return null; } } @@ -215,7 +229,7 @@ public class BlockIterator implements Iterator { } private double getPosition(double direction, double position, int blockPosition) { - return direction > 0 ? (position-blockPosition) : (blockPosition + 1 - position); + return direction > 0 ? (position - blockPosition) : (blockPosition + 1 - position); } private double getXPosition(Vector direction, Vector position, Block block) { @@ -278,7 +292,6 @@ public class BlockIterator implements Iterator { this(entity.getLocation(), entity.getEyeHeight(), maxDistance); } - /** * Constructs the BlockIterator. * @@ -300,7 +313,7 @@ public class BlockIterator implements Iterator { return currentBlock != -1; } - /** + /** * Returns the next Block in the trace * * @return the next Block in the trace @@ -311,7 +324,7 @@ public class BlockIterator implements Iterator { if (currentBlock <= -1) { throw new NoSuchElementException(); } else { - return blockQueue[currentBlock--]; + return blockQueue[currentBlock--]; } } @@ -338,7 +351,7 @@ public class BlockIterator implements Iterator { if (secondError > 0 && thirdError > 0) { blockQueue[2] = blockQueue[0].getFace(mainFace); - if (((long)secondStep) * ((long)thirdError) < ((long)thirdStep) * ((long)secondError)) { + if (((long) secondStep) * ((long) thirdError) < ((long) thirdStep) * ((long) secondError)) { blockQueue[1] = blockQueue[2].getFace(secondFace); blockQueue[0] = blockQueue[1].getFace(thirdFace); } else { diff --git a/paper-api/src/main/java/org/bukkit/util/BlockVector.java b/paper-api/src/main/java/org/bukkit/util/BlockVector.java index fc1a49ac14..4bd3fdc945 100644 --- a/paper-api/src/main/java/org/bukkit/util/BlockVector.java +++ b/paper-api/src/main/java/org/bukkit/util/BlockVector.java @@ -5,10 +5,11 @@ package org.bukkit.util; * BlockVector in WorldEdit. BlockVectors can be used in hash sets and * hash maps. Be aware that BlockVectors are mutable, but it is important * that BlockVectors are never changed once put into a hash set or hash map. - * + * * @author sk89q */ public class BlockVector extends Vector { + /** * Construct the vector with all components as 0. */ @@ -65,7 +66,7 @@ public class BlockVector extends Vector { this.y = y; this.z = z; } - + /** * Checks if another object is equivalent. * @@ -77,9 +78,9 @@ public class BlockVector extends Vector { if (!(obj instanceof BlockVector)) { return false; } - BlockVector other = (BlockVector)obj; - return (int)other.getX() == (int)this.x && (int)other.getY() == (int)this.y - && (int)other.getZ() == (int)this.z; + BlockVector other = (BlockVector) obj; + + return (int) other.getX() == (int) this.x && (int) other.getY() == (int) this.y && (int) other.getZ() == (int) this.z; } @@ -90,9 +91,7 @@ public class BlockVector extends Vector { */ @Override public int hashCode() { - return (Integer.valueOf((int)x).hashCode() >> 13) ^ - (Integer.valueOf((int)y).hashCode() >> 7) ^ - Integer.valueOf((int)z).hashCode(); + return (Integer.valueOf((int) x).hashCode() >> 13) ^ (Integer.valueOf((int) y).hashCode() >> 7) ^ Integer.valueOf((int) z).hashCode(); } /** @@ -102,7 +101,8 @@ public class BlockVector extends Vector { */ @Override public BlockVector clone() { - BlockVector v = (BlockVector)super.clone(); + BlockVector v = (BlockVector) super.clone(); + v.x = x; v.y = y; v.z = z; diff --git a/paper-api/src/main/java/org/bukkit/util/FileUtil.java b/paper-api/src/main/java/org/bukkit/util/FileUtil.java index 66129c3985..2e1376759f 100644 --- a/paper-api/src/main/java/org/bukkit/util/FileUtil.java +++ b/paper-api/src/main/java/org/bukkit/util/FileUtil.java @@ -36,7 +36,7 @@ public class FileUtil { long size = in.size(); while (pos < size) { - pos += in.transferTo(pos, 10*1024*1024, out); + pos += in.transferTo(pos, 10 * 1024 * 1024, out); } } catch (IOException ioe) { return false; diff --git a/paper-api/src/main/java/org/bukkit/util/Java15Compat.java b/paper-api/src/main/java/org/bukkit/util/Java15Compat.java index d56169a16d..c119742435 100644 --- a/paper-api/src/main/java/org/bukkit/util/Java15Compat.java +++ b/paper-api/src/main/java/org/bukkit/util/Java15Compat.java @@ -8,8 +8,9 @@ public class Java15Compat { if (original.length >= start && 0 <= start) { if (start <= end) { int length = end - start; - int copyLength = Math.min( length, original.length - start); + int copyLength = Math.min(length, original.length - start); T[] copy = (T[]) Array.newInstance(original.getClass().getComponentType(), length); + System.arraycopy(original, start, copy, 0, copyLength); return copy; } diff --git a/paper-api/src/main/java/org/bukkit/util/Vector.java b/paper-api/src/main/java/org/bukkit/util/Vector.java index 1d2181da1d..980c162f48 100644 --- a/paper-api/src/main/java/org/bukkit/util/Vector.java +++ b/paper-api/src/main/java/org/bukkit/util/Vector.java @@ -171,8 +171,7 @@ public class Vector implements Cloneable { * @return the distance */ public double distance(Vector o) { - return Math.sqrt(Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) - + Math.pow(z - o.z, 2)); + return Math.sqrt(Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2)); } /** @@ -181,8 +180,7 @@ public class Vector implements Cloneable { * @return the distance */ public double distanceSquared(Vector o) { - return Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) - + Math.pow(z - o.z, 2); + return Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2); } /** @@ -193,7 +191,8 @@ public class Vector implements Cloneable { */ public float angle(Vector other) { double dot = dot(other) / (length() * other.length()); - return (float)Math.acos(dot); + + return (float) Math.acos(dot); } /** @@ -287,6 +286,7 @@ public class Vector implements Cloneable { double newX = y * o.z - o.y * z; double newY = z * o.x - o.z * x; double newZ = x * o.y - o.x * y; + x = newX; y = newY; z = newZ; @@ -330,9 +330,7 @@ public class Vector implements Cloneable { * @return whether this vector is in the AABB */ public boolean isInAABB(Vector min, Vector max) { - return x >= min.x && x <= max.x - && y >= min.y && y <= max.y - && z >= min.z && z <= max.z; + return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; } /** @@ -343,10 +341,7 @@ public class Vector implements Cloneable { * @return whether this vector is in the sphere */ public boolean isInSphere(Vector origin, double radius) { - return (Math.pow(origin.x - x, 2) - + Math.pow(origin.y - y, 2) - + Math.pow(origin.z - z, 2)) - <= Math.pow(radius, 2); + return (Math.pow(origin.x - x, 2) + Math.pow(origin.y - y, 2) + Math.pow(origin.z - z, 2)) <= Math.pow(radius, 2); } /** @@ -365,7 +360,7 @@ public class Vector implements Cloneable { * @return block X */ public int getBlockX() { - return (int)Math.floor(x); + return (int) Math.floor(x); } /** @@ -384,7 +379,7 @@ public class Vector implements Cloneable { * @return block y */ public int getBlockY() { - return (int)Math.floor(y); + return (int) Math.floor(y); } /** @@ -403,7 +398,7 @@ public class Vector implements Cloneable { * @return block z */ public int getBlockZ() { - return (int)Math.floor(z); + return (int) Math.floor(z); } /** @@ -518,11 +513,9 @@ public class Vector implements Cloneable { return false; } - Vector other = (Vector)obj; + Vector other = (Vector) obj; - return Math.abs(x - other.x) < epsilon - && Math.abs(y - other.y) < epsilon - && Math.abs(z - other.z) < epsilon && (this.getClass().equals(obj.getClass())); + return Math.abs(x - other.x) < epsilon && Math.abs(y - other.y) < epsilon && Math.abs(z - other.z) < epsilon && (this.getClass().equals(obj.getClass())); } /** @@ -533,6 +526,7 @@ public class Vector implements Cloneable { @Override public int hashCode() { int hash = 7; + hash = 79 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32)); hash = 79 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32)); hash = 79 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32)); @@ -547,11 +541,12 @@ public class Vector implements Cloneable { @Override public Vector clone() { try { - Vector v = (Vector)super.clone(); + Vector v = (Vector) super.clone(); + v.x = x; v.y = y; v.z = z; - return v; + return v; } catch (CloneNotSupportedException e) { e.printStackTrace(); } @@ -586,10 +581,10 @@ public class Vector implements Cloneable { public Location toLocation(World world, float yaw, float pitch) { return new Location(world, x, y, z, yaw, pitch); } - + /** * Get the block vector of this vector. - * + * * @return */ public BlockVector toBlockVector() { @@ -613,10 +608,7 @@ public class Vector implements Cloneable { * @return minimum */ public static Vector getMinimum(Vector v1, Vector v2) { - return new Vector( - Math.min(v1.x, v2.x), - Math.min(v1.y, v2.y), - Math.min(v1.z, v2.z)); + return new Vector(Math.min(v1.x, v2.x), Math.min(v1.y, v2.y), Math.min(v1.z, v2.z)); } /** @@ -627,10 +619,7 @@ public class Vector implements Cloneable { * @return maximum */ public static Vector getMaximum(Vector v1, Vector v2) { - return new Vector( - Math.max(v1.x, v2.x), - Math.max(v1.y, v2.y), - Math.max(v1.z, v2.z)); + return new Vector(Math.max(v1.x, v2.x), Math.max(v1.y, v2.y), Math.max(v1.z, v2.z)); } /** @@ -640,9 +629,6 @@ public class Vector implements Cloneable { * @return */ public static Vector getRandom() { - return new Vector( - random.nextDouble(), - random.nextDouble(), - random.nextDouble()); + return new Vector(random.nextDouble(), random.nextDouble(), random.nextDouble()); } } diff --git a/paper-api/src/main/java/org/bukkit/util/config/Configuration.java b/paper-api/src/main/java/org/bukkit/util/config/Configuration.java index a1cb28785d..34d3e09179 100644 --- a/paper-api/src/main/java/org/bukkit/util/config/Configuration.java +++ b/paper-api/src/main/java/org/bukkit/util/config/Configuration.java @@ -18,10 +18,10 @@ import org.yaml.snakeyaml.representer.Representer; * a file and call its load() method. For specifying node paths in the * various get*() methods, they support SK's path notation, allowing you to * select child nodes by delimiting node names with periods. - * + * *

* For example, given the following configuration file:

- * + * *
members:
  *     - Hollie
  *     - Jason
@@ -36,38 +36,39 @@ import org.yaml.snakeyaml.representer.Representer;
  *     cool: false
  *     eats:
  *         babies: true
- * + * *

Calling code could access sturmeh's baby eating state by using * getBoolean("sturmeh.eats.babies", false). For lists, there are * methods such as getStringList that will return a type safe list. - * + * *

This class is currently incomplete. It is not yet possible to get a node. *

- * + * * @author sk89q */ public class Configuration extends ConfigurationNode { private Yaml yaml; private File file; - + public Configuration(File file) { super(new HashMap()); - + DumperOptions options = new DumperOptions(); + options.setIndent(4); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); yaml = new Yaml(new SafeConstructor(), new Representer(), options); - + this.file = file; } - + /** * Loads the configuration file. All errors are thrown away. */ - public void load() { + public void load() { FileInputStream stream = null; - + try { stream = new FileInputStream(file); read(yaml.load(new UnicodeReader(stream))); @@ -80,56 +81,54 @@ public class Configuration extends ConfigurationNode { if (stream != null) { stream.close(); } - } catch (IOException e) { - } + } catch (IOException e) {} } } - + /** * Saves the configuration to disk. All errors are clobbered. - * - * @return true if it was successful + * + * @return true if it was successful */ public boolean save() { FileOutputStream stream = null; - + File parent = file.getParentFile(); + if (parent != null) { parent.mkdirs(); } - + try { stream = new FileOutputStream(file); yaml.dump(root, new OutputStreamWriter(stream, "UTF-8")); return true; - } catch (IOException e) { - } finally { + } catch (IOException e) {} finally { try { if (stream != null) { stream.close(); } - } catch (IOException e) { - } + } catch (IOException e) {} } - + return false; } - + @SuppressWarnings("unchecked") private void read(Object input) throws ConfigurationException { try { - if ( null == input ) { + if (null == input) { root = new HashMap(); } else { - root = (Map)input; + root = (Map) input; } } catch (ClassCastException e) { throw new ConfigurationException("Root document must be an key-value structure"); } } - + /** - * This method returns an empty ConfigurationNode for using as a + * This method returns an empty ConfigurationNode for using as a * default in methods that select a node from a node list. * @return */ diff --git a/paper-api/src/main/java/org/bukkit/util/config/ConfigurationException.java b/paper-api/src/main/java/org/bukkit/util/config/ConfigurationException.java index 6854566903..bad67ab70f 100644 --- a/paper-api/src/main/java/org/bukkit/util/config/ConfigurationException.java +++ b/paper-api/src/main/java/org/bukkit/util/config/ConfigurationException.java @@ -2,16 +2,16 @@ package org.bukkit.util.config; /** * Configuration exception. - * + * * @author sk89q */ public class ConfigurationException extends Exception { private static final long serialVersionUID = -2442886939908724203L; - + public ConfigurationException() { super(); } - + public ConfigurationException(String msg) { super(msg); } diff --git a/paper-api/src/main/java/org/bukkit/util/config/ConfigurationNode.java b/paper-api/src/main/java/org/bukkit/util/config/ConfigurationNode.java index c9b7942dac..79a8932ff7 100644 --- a/paper-api/src/main/java/org/bukkit/util/config/ConfigurationNode.java +++ b/paper-api/src/main/java/org/bukkit/util/config/ConfigurationNode.java @@ -7,23 +7,23 @@ import java.util.Map; /** * Represents a configuration node. - * + * * @author sk89q */ public class ConfigurationNode { protected Map root; - + protected ConfigurationNode(Map root) { this.root = root; } - + /** * Gets a property at a location. This will either return an Object * or null, with null meaning that no configuration value exists at * that location. This could potentially return a default value (not yet * implemented) as defined by a plugin, if this is a plugin-tied * configuration. - * + * * @param path path to node (dot notation) * @return object or null */ @@ -31,40 +31,41 @@ public class ConfigurationNode { public Object getProperty(String path) { if (!path.contains(".")) { Object val = root.get(path); + if (val == null) { return null; } return val; } - + String[] parts = path.split("\\."); Map node = root; - + for (int i = 0; i < parts.length; i++) { Object o = node.get(parts[i]); - + if (o == null) { return null; } - + if (i == parts.length - 1) { return o; } - + try { - node = (Map)o; + node = (Map) o; } catch (ClassCastException e) { return null; } } - + return null; } - + /** * Set the property at a location. This will override existing * configuration data to have it conform to key/value mappings. - * + * * @param path * @param value */ @@ -74,26 +75,26 @@ public class ConfigurationNode { root.put(path, value); return; } - + String[] parts = path.split("\\."); Map node = root; - + for (int i = 0; i < parts.length; i++) { Object o = node.get(parts[i]); - + // Found our target! if (i == parts.length - 1) { node.put(parts[i], value); return; } - + if (o == null || !(o instanceof Map)) { // This will override existing configuration data! o = new HashMap(); node.put(parts[i], o); } - - node = (Map)o; + + node = (Map) o; } } @@ -102,12 +103,13 @@ public class ConfigurationNode { * or null, with null meaning that no configuration value exists at * that location. If the object at the particular location is not actually * a string, it will be converted to its string representation. - * + * * @param path path to node (dot notation) * @return string or null */ public String getString(String path) { Object o = getProperty(path); + if (o == null) { return null; } @@ -118,13 +120,14 @@ public class ConfigurationNode { * Gets a string at a location. This will either return an String * or the default value. If the object at the particular location is not * actually a string, it will be converted to its string representation. - * + * * @param path path to node (dot notation) * @param def default value * @return string or default */ public String getString(String path, String def) { String o = getString(path); + if (o == null) { setProperty(path, def); return def; @@ -137,13 +140,14 @@ public class ConfigurationNode { * or the default value. If the object at the particular location is not * actually a integer, the default value will be returned. However, other * number types will be casted to an integer. - * + * * @param path path to node (dot notation) * @param def default value * @return int or default */ public int getInt(String path, int def) { Integer o = castInt(getProperty(path)); + if (o == null) { setProperty(path, def); return def; @@ -157,13 +161,14 @@ public class ConfigurationNode { * or the default value. If the object at the particular location is not * actually a double, the default value will be returned. However, other * number types will be casted to an double. - * + * * @param path path to node (dot notation) * @param def default value * @return double or default */ public double getDouble(String path, double def) { Double o = castDouble(getProperty(path)); + if (o == null) { setProperty(path, def); return def; @@ -176,13 +181,14 @@ public class ConfigurationNode { * Gets a boolean at a location. This will either return an boolean * or the default value. If the object at the particular location is not * actually a boolean, the default value will be returned. - * + * * @param path path to node (dot notation) * @param def default value * @return boolean or default */ public boolean getBoolean(String path, boolean def) { Boolean o = castBoolean(getProperty(path)); + if (o == null) { setProperty(path, def); return def; @@ -190,22 +196,25 @@ public class ConfigurationNode { return o; } } - + /** * Get a list of keys at a location. If the map at the particular location * does not exist or it is not a map, null will be returned. - * + * * @param path path to node (dot notation) * @return list of keys */ @SuppressWarnings("unchecked") public List getKeys(String path) { - if (path == null) return new ArrayList(root.keySet()); + if (path == null) { + return new ArrayList(root.keySet()); + } Object o = getProperty(path); + if (o == null) { return null; } else if (o instanceof Map) { - return new ArrayList(((Map)o).keySet()); + return new ArrayList(((Map) o).keySet()); } else { return null; } @@ -214,22 +223,23 @@ public class ConfigurationNode { /** * Gets a list of objects at a location. If the list is not defined, * null will be returned. The node must be an actual list. - * + * * @param path path to node (dot notation) * @return boolean or default */ @SuppressWarnings("unchecked") public List getList(String path) { Object o = getProperty(path); + if (o == null) { return null; } else if (o instanceof List) { - return (List)o; + return (List) o; } else { return null; } } - + /** * Gets a list of strings. Non-valid entries will not be in the list. * There will be no null slots. If the list is not defined, the @@ -237,120 +247,131 @@ public class ConfigurationNode { * and an empty list will be returned instead. If an item in the list * is not a string, it will be converted to a string. The node must be * an actual list and not just a string. - * + * * @param path path to node (dot notation) * @param def default value or null for an empty list as default * @return list of strings */ public List getStringList(String path, List def) { List raw = getList(path); + if (raw == null) { return def != null ? def : new ArrayList(); } List list = new ArrayList(); + for (Object o : raw) { if (o == null) { continue; } - + list.add(o.toString()); } - + return list; } - + /** * Gets a list of integers. Non-valid entries will not be in the list. * There will be no null slots. If the list is not defined, the * default will be returned. 'null' can be passed for the default * and an empty list will be returned instead. The node must be * an actual list and not just an integer. - * + * * @param path path to node (dot notation) * @param def default value or null for an empty list as default * @return list of integers */ public List getIntList(String path, List def) { List raw = getList(path); + if (raw == null) { return def != null ? def : new ArrayList(); } List list = new ArrayList(); + for (Object o : raw) { Integer i = castInt(o); + if (i != null) { list.add(i); } } - + return list; } - + /** * Gets a list of doubles. Non-valid entries will not be in the list. * There will be no null slots. If the list is not defined, the * default will be returned. 'null' can be passed for the default * and an empty list will be returned instead. The node must be * an actual list and cannot be just a double. - * + * * @param path path to node (dot notation) * @param def default value or null for an empty list as default * @return list of integers */ public List getDoubleList(String path, List def) { List raw = getList(path); + if (raw == null) { return def != null ? def : new ArrayList(); } List list = new ArrayList(); + for (Object o : raw) { Double i = castDouble(o); + if (i != null) { list.add(i); } } - + return list; } - + /** * Gets a list of booleans. Non-valid entries will not be in the list. * There will be no null slots. If the list is not defined, the * default will be returned. 'null' can be passed for the default * and an empty list will be returned instead. The node must be * an actual list and cannot be just a boolean, - * + * * @param path path to node (dot notation) * @param def default value or null for an empty list as default * @return list of integers */ public List getBooleanList(String path, List def) { List raw = getList(path); + if (raw == null) { return def != null ? def : new ArrayList(); } List list = new ArrayList(); + for (Object o : raw) { Boolean tetsu = castBoolean(o); + if (tetsu != null) { list.add(tetsu); } } - + return list; } - + /** * Gets a list of nodes. Non-valid entries will not be in the list. * There will be no null slots. If the list is not defined, the * default will be returned. 'null' can be passed for the default * and an empty list will be returned instead. The node must be * an actual node and cannot be just a boolean, - * + * * @param path path to node (dot notation) * @param def default value or null for an empty list as default * @return list of integers @@ -358,70 +379,72 @@ public class ConfigurationNode { @SuppressWarnings("unchecked") public List getNodeList(String path, List def) { List raw = getList(path); + if (raw == null) { return def != null ? def : new ArrayList(); } List list = new ArrayList(); + for (Object o : raw) { if (o instanceof Map) { - list.add(new ConfigurationNode((Map)o)); + list.add(new ConfigurationNode((Map) o)); } } - + return list; } - + /** * Get a configuration node at a path. If the node doesn't exist or the * path does not lead to a node, null will be returned. A node has * key/value mappings. - * + * * @param path * @return node or null */ @SuppressWarnings("unchecked") public ConfigurationNode getNode(String path) { Object raw = getProperty(path); + if (raw instanceof Map) { - return new ConfigurationNode((Map)raw); + return new ConfigurationNode((Map) raw); } - + return null; } - + /** * Get a list of nodes at a location. If the map at the particular location * does not exist or it is not a map, null will be returned. - * + * * @param path path to node (dot notation) * @return map of nodes */ @SuppressWarnings("unchecked") public Map getNodes(String path) { Object o = getProperty(path); + if (o == null) { return null; } else if (o instanceof Map) { - Map nodes = - new HashMap(); - - for (Map.Entry entry : ((Map)o).entrySet()) { + Map nodes = new HashMap(); + + for (Map.Entry entry : ((Map) o).entrySet()) { if (entry.getValue() instanceof Map) { - nodes.put(entry.getKey(), - new ConfigurationNode((Map) entry.getValue())); + nodes.put(entry.getKey(), new ConfigurationNode((Map) entry.getValue())); } } - + return nodes; } else { return null; } } - + /** * Casts a value to an integer. May return null. - * + * * @param o * @return */ @@ -429,23 +452,23 @@ public class ConfigurationNode { if (o == null) { return null; } else if (o instanceof Byte) { - return (int)(Byte)o; + return (int) (Byte) o; } else if (o instanceof Integer) { - return (Integer)o; + return (Integer) o; } else if (o instanceof Double) { - return (int)(double)(Double)o; + return (int) (double) (Double) o; } else if (o instanceof Float) { - return (int)(float)(Float)o; + return (int) (float) (Float) o; } else if (o instanceof Long) { - return (int)(long)(Long)o; + return (int) (long) (Long) o; } else { return null; } } - + /** * Casts a value to a double. May return null. - * + * * @param o * @return */ @@ -453,23 +476,23 @@ public class ConfigurationNode { if (o == null) { return null; } else if (o instanceof Float) { - return (double)(Float)o; + return (double) (Float) o; } else if (o instanceof Double) { - return (Double)o; + return (Double) o; } else if (o instanceof Byte) { - return (double)(Byte)o; + return (double) (Byte) o; } else if (o instanceof Integer) { - return (double)(Integer)o; + return (double) (Integer) o; } else if (o instanceof Long) { - return (double)(Long)o; + return (double) (Long) o; } else { return null; } } - + /** * Casts a value to a boolean. May return null. - * + * * @param o * @return */ @@ -477,16 +500,16 @@ public class ConfigurationNode { if (o == null) { return null; } else if (o instanceof Boolean) { - return (Boolean)o; + return (Boolean) o; } else { return null; } } - + /** * Remove the property at a location. This will override existing * configuration data to have it conform to key/value mappings. - * + * * @param path */ @SuppressWarnings("unchecked") @@ -495,20 +518,20 @@ public class ConfigurationNode { root.remove(path); return; } - + String[] parts = path.split("\\."); Map node = root; - + for (int i = 0; i < parts.length; i++) { Object o = node.get(parts[i]); - + // Found our target! if (i == parts.length - 1) { node.remove(parts[i]); return; } - - node = (Map)o; + + node = (Map) o; } } -} \ No newline at end of file +} diff --git a/paper-api/src/site/apt/index.apt b/paper-api/src/site/apt/index.apt index 35980bf0e3..0a7880a6ff 100644 --- a/paper-api/src/site/apt/index.apt +++ b/paper-api/src/site/apt/index.apt @@ -3,7 +3,7 @@ Welcome to the Bukkit Maven mini-site! This website is automatically generated by Maven 3. As such, it is updated when the main build system (http://ci.bukkit.org) executes the site lifecycle on the Maven job. For more information about Bukkit, please see the links above. - + Javadocs For Javadocs, please select the "Project Reports" then "JavaDocs" option on the left-hand menu.