GAMEMODE_NAMES = ImmutableList.of("adventure", "creative", "survival", "spectator");
public GameModeCommand() {
super("gamemode");
@@ -55,6 +55,8 @@ public class GameModeCommand extends VanillaCommand {
mode = GameMode.CREATIVE;
} else if (modeArg.equalsIgnoreCase("adventure") || modeArg.equalsIgnoreCase("a")) {
mode = GameMode.ADVENTURE;
+ } else if (modeArg.equalsIgnoreCase("spectator") || modeArg.equalsIgnoreCase("sp")) {
+ mode = GameMode.SPECTATOR;
} else {
mode = GameMode.SURVIVAL;
}
diff --git a/paper-api/src/main/java/org/bukkit/entity/ArmorStand.java b/paper-api/src/main/java/org/bukkit/entity/ArmorStand.java
new file mode 100644
index 0000000000..b323e73580
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -0,0 +1,261 @@
+package org.bukkit.entity;
+
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.EulerAngle;
+
+public interface ArmorStand extends LivingEntity {
+
+ /**
+ * Returns the item the armor stand is
+ * currently holding
+ *
+ * @return the held item
+ */
+ ItemStack getItemInHand();
+
+ /**
+ * Sets the item the armor stand is currently
+ * holding
+ *
+ * @param item the item to hold
+ */
+ void setItemInHand(ItemStack item);
+
+ /**
+ * Returns the item currently being worn
+ * by the armor stand on its feet
+ *
+ * @return the worn item
+ */
+ ItemStack getBoots();
+
+ /**
+ * Sets the item currently being worn
+ * by the armor stand on its feet
+ *
+ * @param item the item to wear
+ */
+ void setBoots(ItemStack item);
+
+ /**
+ * Returns the item currently being worn
+ * by the armor stand on its legs
+ *
+ * @return the worn item
+ */
+ ItemStack getLeggings();
+
+ /**
+ * Sets the item currently being worn
+ * by the armor stand on its legs
+ *
+ * @param item the item to wear
+ */
+ void setLeggings(ItemStack item);
+
+ /**
+ * Returns the item currently being worn
+ * by the armor stand on its chest
+ *
+ * @return the worn item
+ */
+ ItemStack getChestplate();
+
+ /**
+ * Sets the item currently being worn
+ * by the armor stand on its chest
+ *
+ * @param item the item to wear
+ */
+ void setChestplate(ItemStack item);
+
+ /**
+ * Returns the item currently being worn
+ * by the armor stand on its head
+ *
+ * @return the worn item
+ */
+ ItemStack getHelmet();
+
+ /**
+ * Sets the item currently being worn
+ * by the armor stand on its head
+ *
+ * @param item the item to wear
+ */
+ void setHelmet(ItemStack item);
+
+ /**
+ * Returns the armor stand's body's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getBodyPose();
+
+ /**
+ * Sets the armor stand's body's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setBodyPose(EulerAngle pose);
+
+ /**
+ * Returns the armor stand's left arm's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getLeftArmPose();
+
+ /**
+ * Sets the armor stand's left arm's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setLeftArmPose(EulerAngle pose);
+
+ /**
+ * Returns the armor stand's right arm's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getRightArmPose();
+
+ /**
+ * Sets the armor stand's right arm's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setRightArmPose(EulerAngle pose);
+
+ /**
+ * Returns the armor stand's left leg's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getLeftLegPose();
+
+ /**
+ * Sets the armor stand's left leg's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setLeftLegPose(EulerAngle pose);
+
+ /**
+ * Returns the armor stand's right leg's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getRightLegPose();
+
+ /**
+ * Sets the armor stand's right leg's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setRightLegPose(EulerAngle pose);
+
+ /**
+ * Returns the armor stand's head's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @return the current pose
+ */
+ EulerAngle getHeadPose();
+
+ /**
+ * Sets the armor stand's head's
+ * current pose as a {@link org.bukkit.util.EulerAngle}
+ *
+ * @param pose the current pose
+ */
+ void setHeadPose(EulerAngle pose);
+
+ /**
+ * Returns whether the armor stand has
+ * a base plate
+ *
+ * @return whether it has a base plate
+ */
+ boolean hasBasePlate();
+
+ /**
+ * Sets whether the armor stand has a
+ * base plate
+ *
+ * @param basePlate whether is has a base plate
+ */
+ void setBasePlate(boolean basePlate);
+
+ /**
+ * Returns whether gravity applies to
+ * this armor stand
+ *
+ * @return whether gravity applies
+ */
+ boolean hasGravity();
+
+ /**
+ * Sets whether gravity applies to
+ * this armor stand
+ *
+ * @param gravity whether gravity should apply
+ */
+ void setGravity(boolean gravity);
+
+ /**
+ * Returns whether the armor stand should be
+ * visible or not
+ *
+ * @return whether the stand is visible or not
+ */
+ boolean isVisible();
+
+ /**
+ * Sets whether the armor stand should be
+ * visible or not
+ *
+ * @param visible whether the stand is visible or not
+ */
+ void setVisible(boolean visible);
+
+ /**
+ * Returns whether this armor stand has arms
+ *
+ * @return whether this has arms or not
+ */
+ boolean hasArms();
+
+ /**
+ * Sets whether this armor stand has arms
+ *
+ * @param arms whether this has arms or not
+ */
+ void setArms(boolean arms);
+
+ /**
+ * Returns whether this armor stand is scaled
+ * down
+ *
+ * @return whether this is scaled down
+ */
+ boolean isSmall();
+
+ /**
+ * Sets whether this armor stand is scaled
+ * down
+ *
+ * @param small whether this is scaled down
+ */
+ void setSmall(boolean small);
+}
diff --git a/paper-api/src/main/java/org/bukkit/entity/CreatureType.java b/paper-api/src/main/java/org/bukkit/entity/CreatureType.java
index fd23093351..48ff687ad1 100644
--- a/paper-api/src/main/java/org/bukkit/entity/CreatureType.java
+++ b/paper-api/src/main/java/org/bukkit/entity/CreatureType.java
@@ -26,6 +26,8 @@ public enum CreatureType {
BLAZE("Blaze", Blaze.class, 61),
MAGMA_CUBE("LavaSlime", MagmaCube.class, 62),
ENDER_DRAGON("EnderDragon", EnderDragon.class, 63),
+ ENDERMITE("Endermite", Endermite.class, 67),
+ GUARDIAN("Guardian", Guardian.class, 68),
PIG("Pig", Pig.class, 90),
SHEEP("Sheep", Sheep.class, 91),
COW("Cow", Cow.class, 92),
@@ -34,6 +36,7 @@ public enum CreatureType {
WOLF("Wolf", Wolf.class, 95),
MUSHROOM_COW("MushroomCow", MushroomCow.class, 96),
SNOWMAN("SnowMan", Snowman.class, 97),
+ RABBIT("Rabbit", Rabbit.class, 101),
VILLAGER("Villager", Villager.class, 120);
private String name;
diff --git a/paper-api/src/main/java/org/bukkit/entity/Endermite.java b/paper-api/src/main/java/org/bukkit/entity/Endermite.java
new file mode 100644
index 0000000000..dc1fa5426b
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/entity/Endermite.java
@@ -0,0 +1,4 @@
+package org.bukkit.entity;
+
+public interface Endermite extends Monster {
+}
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 a60172df41..39c35c05ad 100644
--- a/paper-api/src/main/java/org/bukkit/entity/Entity.java
+++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java
@@ -295,4 +295,49 @@ public interface Entity extends Metadatable {
* @return The current vehicle.
*/
public Entity getVehicle();
+
+ /**
+ * Sets a custom name on a mob. This name will be used in death messages
+ * and can be sent to the client as a nameplate over the mob.
+ *
+ * Setting the name to null or an empty string will clear it.
+ *
+ * This value has no effect on players, they will always use their real
+ * name.
+ *
+ * @param name the name to set
+ */
+ public void setCustomName(String name);
+
+ /**
+ * Gets the custom name on a mob. If there is no name this method will
+ * return null.
+ *
+ * This value has no effect on players, they will always use their real
+ * name.
+ *
+ * @return name of the mob or null
+ */
+ public String getCustomName();
+
+ /**
+ * Sets whether or not to display the mob's custom name client side. The
+ * name will be displayed above the mob similarly to a player.
+ *
+ * This value has no effect on players, they will always display their
+ * name.
+ *
+ * @param flag custom name or not
+ */
+ public void setCustomNameVisible(boolean flag);
+
+ /**
+ * Gets whether or not the mob's custom name is displayed client side.
+ *
+ * This value has no effect on players, they will always display their
+ * name.
+ *
+ * @return if the custom name is displayed
+ */
+ public boolean isCustomNameVisible();
}
diff --git a/paper-api/src/main/java/org/bukkit/entity/EntityType.java b/paper-api/src/main/java/org/bukkit/entity/EntityType.java
index 39ecb130a8..2a69367d2b 100644
--- a/paper-api/src/main/java/org/bukkit/entity/EntityType.java
+++ b/paper-api/src/main/java/org/bukkit/entity/EntityType.java
@@ -81,6 +81,7 @@ public enum EntityType {
*/
FALLING_BLOCK("FallingSand", FallingBlock.class, 21, false),
FIREWORK("FireworksRocketEntity", Firework.class, 22, false),
+ ARMOR_STAND("ArmorStand", ArmorStand.class, 30, false),
/**
* @see CommandMinecart
*/
@@ -130,6 +131,8 @@ public enum EntityType {
WITHER("WitherBoss", Wither.class, 64),
BAT("Bat", Bat.class, 65),
WITCH("Witch", Witch.class, 66),
+ ENDERMITE("Endermite", Endermite.class, 67),
+ GUARDIAN("Guardian", Guardian.class, 68),
PIG("Pig", Pig.class, 90),
SHEEP("Sheep", Sheep.class, 91),
COW("Cow", Cow.class, 92),
@@ -141,6 +144,7 @@ public enum EntityType {
OCELOT("Ozelot", Ocelot.class, 98),
IRON_GOLEM("VillagerGolem", IronGolem.class, 99),
HORSE("EntityHorse", Horse.class, 100),
+ RABBIT("Rabbit", Rabbit.class, 101),
VILLAGER("Villager", Villager.class, 120),
ENDER_CRYSTAL("EnderCrystal", EnderCrystal.class, 200),
// These don't have an entity ID in nms.EntityTypes.
diff --git a/paper-api/src/main/java/org/bukkit/entity/Guardian.java b/paper-api/src/main/java/org/bukkit/entity/Guardian.java
new file mode 100644
index 0000000000..2b2f496b7a
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/entity/Guardian.java
@@ -0,0 +1,4 @@
+package org.bukkit.entity;
+
+public interface Guardian extends Monster {
+}
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 6c8b4f869a..5e2a41ae27 100644
--- a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -320,51 +320,6 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
*/
public boolean getCanPickupItems();
- /**
- * Sets a custom name on a mob. This name will be used in death messages
- * and can be sent to the client as a nameplate over the mob.
- *
- * Setting the name to null or an empty string will clear it.
- *
- * This value has no effect on players, they will always use their real
- * name.
- *
- * @param name the name to set
- */
- public void setCustomName(String name);
-
- /**
- * Gets the custom name on a mob. If there is no name this method will
- * return null.
- *
- * This value has no effect on players, they will always use their real
- * name.
- *
- * @return name of the mob or null
- */
- public String getCustomName();
-
- /**
- * Sets whether or not to display the mob's custom name client side. The
- * name will be displayed above the mob similarly to a player.
- *
- * This value has no effect on players, they will always display their
- * name.
- *
- * @param flag custom name or not
- */
- public void setCustomNameVisible(boolean flag);
-
- /**
- * Gets whether or not the mob's custom name is displayed client side.
- *
- * This value has no effect on players, they will always display their
- * name.
- *
- * @return if the custom name is displayed
- */
- public boolean isCustomNameVisible();
-
/**
* Returns whether the entity is currently leashed.
*
diff --git a/paper-api/src/main/java/org/bukkit/entity/Rabbit.java b/paper-api/src/main/java/org/bukkit/entity/Rabbit.java
new file mode 100644
index 0000000000..7c3e3daa42
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/entity/Rabbit.java
@@ -0,0 +1,4 @@
+package org.bukkit.entity;
+
+public interface Rabbit extends Animals {
+}
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 62b4e89d05..3e89ca0c52 100644
--- a/paper-api/src/main/java/org/bukkit/entity/WaterMob.java
+++ b/paper-api/src/main/java/org/bukkit/entity/WaterMob.java
@@ -3,4 +3,4 @@ package org.bukkit.entity;
/**
* Represents a Water Mob
*/
-public interface WaterMob extends Creature {}
+public interface WaterMob extends LivingEntity {}
diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockPistonExtendEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockPistonExtendEvent.java
index 1058b8b87b..682ce60aef 100644
--- a/paper-api/src/main/java/org/bukkit/event/block/BlockPistonExtendEvent.java
+++ b/paper-api/src/main/java/org/bukkit/event/block/BlockPistonExtendEvent.java
@@ -16,17 +16,28 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
private final int length;
private List blocks;
+ @Deprecated
public BlockPistonExtendEvent(final Block block, final int length, final BlockFace direction) {
super(block, direction);
this.length = length;
}
+ public BlockPistonExtendEvent(final Block block, final List blocks, final BlockFace direction) {
+ super(block, direction);
+
+ this.length = blocks.size();
+ this.blocks = blocks;
+ }
+
/**
* Get the amount of blocks which will be moved while extending.
*
* @return the amount of moving blocks
+ * @deprecated slime blocks make the value of this method
+ * inaccurate due to blocks being pushed at the side
*/
+ @Deprecated
public int getLength() {
return this.length;
}
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 1f7af4dbc3..cf67251367 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
@@ -136,6 +136,15 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
/**
* For custom calls to the event.
*/
- CUSTOM
+ CUSTOM,
+ /**
+ * When the entity doesn't have a target, so it attacks the nearest
+ * entity
+ */
+ CLOSEST_ENTITY,
+ /**
+ * A currently unknown reason for the entity changing target.
+ */
+ UNKNOWN;
}
}
diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryType.java b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryType.java
index b83580a46b..c36e046728 100644
--- a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -30,10 +30,10 @@ public enum InventoryType {
*/
CRAFTING(5,"Crafting"),
/**
- * An enchantment table inventory, with one CRAFTING slot and three
+ * An enchantment table inventory, with two CRAFTING slots and three
* enchanting buttons.
*/
- ENCHANTING(1,"Enchanting"),
+ ENCHANTING(2,"Enchanting"),
/**
* A brewing stand inventory, with one FUEL slot and three CRAFTING slots.
*/
diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java
new file mode 100644
index 0000000000..db5678eec6
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java
@@ -0,0 +1,22 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+/**
+ * Represents an event that is called when a player right clicks an entity
+ * with a location on the entity the was clicked.
+ */
+public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent {
+ private final Vector position;
+
+ public PlayerInteractAtEntityEvent(Player who, Entity clickedEntity, Vector position) {
+ super(who, clickedEntity);
+ this.position = position;
+ }
+
+ public Vector getClickedPosition() {
+ return position.clone();
+ }
+}
diff --git a/paper-api/src/main/java/org/bukkit/inventory/EnchantingInventory.java b/paper-api/src/main/java/org/bukkit/inventory/EnchantingInventory.java
index 74a863e1c7..6551a16aa2 100644
--- a/paper-api/src/main/java/org/bukkit/inventory/EnchantingInventory.java
+++ b/paper-api/src/main/java/org/bukkit/inventory/EnchantingInventory.java
@@ -18,4 +18,18 @@ public interface EnchantingInventory extends Inventory {
* @return The current item.
*/
ItemStack getItem();
+
+ /**
+ * Set the secondary item being used for the enchant.
+ *
+ * @param item The new item
+ */
+ void setSecondary(ItemStack item);
+
+ /**
+ * Get the secondary item being used for the enchant.
+ *
+ * @return The second item
+ */
+ ItemStack getSecondary();
}
diff --git a/paper-api/src/main/java/org/bukkit/inventory/meta/BannerMeta.java b/paper-api/src/main/java/org/bukkit/inventory/meta/BannerMeta.java
new file mode 100644
index 0000000000..6bf33c59cf
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/inventory/meta/BannerMeta.java
@@ -0,0 +1,76 @@
+package org.bukkit.inventory.meta;
+
+import java.util.List;
+import org.bukkit.DyeColor;
+import org.bukkit.block.banner.Pattern;
+
+public interface BannerMeta extends ItemMeta {
+
+ /**
+ * Returns the base color for this banner
+ *
+ * @return the base color
+ */
+ DyeColor getBaseColor();
+
+ /**
+ * Sets the base color for this banner
+ *
+ * @param color the base color
+ */
+ void setBaseColor(DyeColor color);
+
+ /**
+ * Returns a list of patterns on this banner
+ *
+ * @return the patterns
+ */
+ List getPatterns();
+
+ /**
+ * Sets the patterns used on this banner
+ *
+ * @param patterns the new list of patterns
+ */
+ void setPatterns(List patterns);
+
+ /**
+ * Adds a new pattern on top of the existing
+ * patterns
+ *
+ * @param pattern the new pattern to add
+ */
+ void addPattern(Pattern pattern);
+
+ /**
+ * Returns the pattern at the specified index
+ *
+ * @param i the index
+ * @return the pattern
+ */
+ Pattern getPattern(int i);
+
+ /**
+ * Removes the pattern at the specified index
+ *
+ * @param i the index
+ * @return the removed pattern
+ */
+ Pattern removePattern(int i);
+
+ /**
+ * Sets the pattern at the specified index
+ *
+ * @param i the index
+ * @param pattern the new pattern
+ */
+ void setPattern(int i, Pattern pattern);
+
+ /**
+ * Returns the number of patterns on this
+ * banner
+ *
+ * @return the number of patterns
+ */
+ int numberOfPatterns();
+}
diff --git a/paper-api/src/main/java/org/bukkit/material/Banner.java b/paper-api/src/main/java/org/bukkit/material/Banner.java
new file mode 100644
index 0000000000..e5a9d1c8b6
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/material/Banner.java
@@ -0,0 +1,232 @@
+package org.bukkit.material;
+
+import org.bukkit.Material;
+import org.bukkit.block.BlockFace;
+
+public class Banner extends MaterialData implements Attachable {
+
+ public Banner() {
+ super(Material.BANNER);
+ }
+
+ public Banner(Material type) {
+ super(type);
+ }
+
+ /**
+ *
+ * @deprecated Magic value
+ */
+ @Deprecated
+ public Banner(int type) {
+ super(type);
+ }
+
+ /**
+ *
+ * @deprecated Magic value
+ */
+ @Deprecated
+ public Banner(Material type, byte data) {
+ super(type, data);
+ }
+
+ /**
+ *
+ * @deprecated Magic value
+ */
+ @Deprecated
+ public Banner(int type, byte data) {
+ super(type, data);
+ }
+
+ public boolean isWallBanner() {
+ return getItemType() == Material.WALL_BANNER;
+ }
+
+ public BlockFace getAttachedFace() {
+ if (isWallBanner()) {
+ byte data = getData();
+
+ switch (data) {
+ case 0x2:
+ return BlockFace.SOUTH;
+
+ case 0x3:
+ return BlockFace.NORTH;
+
+ case 0x4:
+ return BlockFace.EAST;
+
+ case 0x5:
+ return BlockFace.WEST;
+ }
+
+ return null;
+ } else {
+ return BlockFace.DOWN;
+ }
+ }
+
+ public BlockFace getFacing() {
+ byte data = getData();
+
+ if (!isWallBanner()) {
+ switch (data) {
+ case 0x0:
+ return BlockFace.SOUTH;
+
+ case 0x1:
+ return BlockFace.SOUTH_SOUTH_WEST;
+
+ case 0x2:
+ return BlockFace.SOUTH_WEST;
+
+ case 0x3:
+ return BlockFace.WEST_SOUTH_WEST;
+
+ case 0x4:
+ return BlockFace.WEST;
+
+ case 0x5:
+ return BlockFace.WEST_NORTH_WEST;
+
+ case 0x6:
+ return BlockFace.NORTH_WEST;
+
+ case 0x7:
+ return BlockFace.NORTH_NORTH_WEST;
+
+ case 0x8:
+ return BlockFace.NORTH;
+
+ case 0x9:
+ return BlockFace.NORTH_NORTH_EAST;
+
+ case 0xA:
+ return BlockFace.NORTH_EAST;
+
+ case 0xB:
+ return BlockFace.EAST_NORTH_EAST;
+
+ case 0xC:
+ return BlockFace.EAST;
+
+ case 0xD:
+ return BlockFace.EAST_SOUTH_EAST;
+
+ case 0xE:
+ return BlockFace.SOUTH_EAST;
+
+ case 0xF:
+ return BlockFace.SOUTH_SOUTH_EAST;
+ }
+
+ return null;
+ } else {
+ return getAttachedFace().getOppositeFace();
+ }
+ }
+
+ public void setFacingDirection(BlockFace face) {
+ byte data;
+
+ if (isWallBanner()) {
+ switch (face) {
+ case NORTH:
+ data = 0x2;
+ break;
+
+ case SOUTH:
+ data = 0x3;
+ break;
+
+ case WEST:
+ data = 0x4;
+ break;
+
+ case EAST:
+ default:
+ data = 0x5;
+ }
+ } else {
+ switch (face) {
+ case SOUTH:
+ data = 0x0;
+ break;
+
+ case SOUTH_SOUTH_WEST:
+ data = 0x1;
+ break;
+
+ case SOUTH_WEST:
+ data = 0x2;
+ break;
+
+ case WEST_SOUTH_WEST:
+ data = 0x3;
+ break;
+
+ case WEST:
+ data = 0x4;
+ break;
+
+ case WEST_NORTH_WEST:
+ data = 0x5;
+ break;
+
+ case NORTH_WEST:
+ data = 0x6;
+ break;
+
+ case NORTH_NORTH_WEST:
+ data = 0x7;
+ break;
+
+ case NORTH:
+ data = 0x8;
+ break;
+
+ case NORTH_NORTH_EAST:
+ data = 0x9;
+ break;
+
+ case NORTH_EAST:
+ data = 0xA;
+ break;
+
+ case EAST_NORTH_EAST:
+ data = 0xB;
+ break;
+
+ case EAST:
+ data = 0xC;
+ break;
+
+ case EAST_SOUTH_EAST:
+ data = 0xD;
+ break;
+
+ case SOUTH_SOUTH_EAST:
+ data = 0xF;
+ break;
+
+ case SOUTH_EAST:
+ default:
+ data = 0xE;
+ }
+ }
+
+ setData(data);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " facing " + getFacing();
+ }
+
+ @Override
+ public Banner clone() {
+ return (Banner) super.clone();
+ }
+}
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 b178c0d11a..fb0bfba5a0 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
@@ -232,11 +232,12 @@ public final class JavaPluginLoader implements PluginLoader {
Set methods;
try {
Method[] publicMethods = listener.getClass().getMethods();
- methods = new HashSet(publicMethods.length, Float.MAX_VALUE);
+ Method[] privateMethods = listener.getClass().getDeclaredMethods();
+ methods = new HashSet(publicMethods.length + privateMethods.length, 1.0f);
for (Method method : publicMethods) {
methods.add(method);
}
- for (Method method : listener.getClass().getDeclaredMethods()) {
+ for (Method method : privateMethods) {
methods.add(method);
}
} catch (NoClassDefFoundError e) {
diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionType.java b/paper-api/src/main/java/org/bukkit/potion/PotionType.java
index a02b6a8134..b9949d966a 100644
--- a/paper-api/src/main/java/org/bukkit/potion/PotionType.java
+++ b/paper-api/src/main/java/org/bukkit/potion/PotionType.java
@@ -14,6 +14,7 @@ public enum PotionType {
INSTANT_DAMAGE(12, PotionEffectType.HARM, 2),
WATER_BREATHING(13, PotionEffectType.WATER_BREATHING, 1),
INVISIBILITY(14, PotionEffectType.INVISIBILITY, 1),
+ JUMP(15, PotionEffectType.JUMP, 2)
;
private final int damageValue, maxLevel;
diff --git a/paper-api/src/main/java/org/bukkit/util/EulerAngle.java b/paper-api/src/main/java/org/bukkit/util/EulerAngle.java
new file mode 100644
index 0000000000..7778710cf4
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/util/EulerAngle.java
@@ -0,0 +1,147 @@
+package org.bukkit.util;
+
+/**
+ * EulerAngle is used to represent 3 angles, one for each
+ * axis (x, y, z). The angles are in radians
+ */
+public class EulerAngle {
+
+ /**
+ * A EulerAngle with every axis set to 0
+ */
+ public static final EulerAngle ZERO = new EulerAngle(0, 0, 0);
+
+ private final double x;
+ private final double y;
+ private final double z;
+
+ /**
+ * Creates a EularAngle with each axis set to the
+ * passed angle in radians
+ *
+ * @param x the angle for the x axis in radians
+ * @param y the angle for the x axis in radians
+ * @param z the angle for the x axis in radians
+ */
+ public EulerAngle(double x, double y, double z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /**
+ * Returns the angle on the x axis in radians
+ *
+ * @return the angle in radians
+ */
+ public double getX() {
+ return x;
+ }
+
+ /**
+ * Returns the angle on the y axis in radians
+ *
+ * @return the angle in radians
+ */
+ public double getY() {
+ return y;
+ }
+
+ /**
+ * Returns the angle on the z axis in radians
+ *
+ * @return the angle in radians
+ */
+ public double getZ() {
+ return z;
+ }
+
+ /**
+ * Return a EulerAngle which is the result of changing
+ * the x axis to the passed angle
+ *
+ * @param x the angle in radians
+ * @return the resultant EulerAngle
+ */
+ public EulerAngle setX(double x) {
+ return new EulerAngle(x, y, z);
+ }
+
+ /**
+ * Return a EulerAngle which is the result of changing
+ * the y axis to the passed angle
+ *
+ * @param y the angle in radians
+ * @return the resultant EulerAngle
+ */
+ public EulerAngle setY(double y) {
+ return new EulerAngle(x, y, z);
+ }
+
+ /**
+ * Return a EulerAngle which is the result of changing
+ * the z axis to the passed angle
+ *
+ * @param z the angle in radians
+ * @return the resultant EulerAngle
+ */
+ public EulerAngle setZ(double z) {
+ return new EulerAngle(x, y, z);
+ }
+
+ /**
+ * Creates a new EulerAngle which is the result of adding
+ * the x, y, z components to this EulerAngle
+ *
+ * @param x the angle to add to the x axis in radians
+ * @param y the angle to add to the y axis in radians
+ * @param z the angle to add to the z axis in radians
+ * @return the resultant EulerAngle
+ */
+ public EulerAngle add(double x, double y, double z) {
+ return new EulerAngle(
+ this.x + x,
+ this.y + y,
+ this.z + z
+ );
+ }
+
+ /**
+ * Creates a new EulerAngle which is the result of subtracting
+ * the x, y, z components to this EulerAngle
+ *
+ * @param x the angle to subtract to the x axis in radians
+ * @param y the angle to subtract to the y axis in radians
+ * @param z the angle to subtract to the z axis in radians
+ * @return the resultant EulerAngle
+ */
+ public EulerAngle subtract(double x, double y, double z) {
+ return add(-x, -y, -z);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ EulerAngle that = (EulerAngle) o;
+
+ return Double.compare(that.x, x) == 0
+ && Double.compare(that.y, y) == 0
+ && Double.compare(that.z, z) == 0;
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ temp = Double.doubleToLongBits(x);
+ result = (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(y);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(z);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+}