- * It is used in {@link org.bukkit.event.entity.EntityPortalEvent} and in - * {@link org.bukkit.event.player.PlayerPortalEvent} to help developers - * reproduce and/or modify Vanilla behaviour. - */ -public interface TravelAgent { - - /** - * Set the Block radius to search in for available portals. - * - * @param radius the radius in which to search for a portal from the - * location - * @return this travel agent - */ - @NotNull - public TravelAgent setSearchRadius(int radius); - - /** - * Gets the search radius value for finding an available portal. - * - * @return the currently set search radius - */ - public int getSearchRadius(); - - /** - * Sets the maximum radius from the given location to create a portal. - * - * @param radius the radius in which to create a portal from the location - * @return this travel agent - */ - @NotNull - public TravelAgent setCreationRadius(int radius); - - /** - * Gets the maximum radius from the given location to create a portal. - * - * @return the currently set creation radius - */ - public int getCreationRadius(); - - /** - * Returns whether the TravelAgent will attempt to create a destination - * portal or not. - * - * @return whether the TravelAgent should create a destination portal or - * not - */ - public boolean getCanCreatePortal(); - - /** - * Sets whether the TravelAgent should attempt to create a destination - * portal or not. - * - * @param create Sets whether the TravelAgent should create a destination - * portal or not - */ - public void setCanCreatePortal(boolean create); - - /** - * Attempt to find a portal near the given location, if a portal is not - * found it will attempt to create one. - * - * @param location the location where the search for a portal should begin - * @return the location of a portal which has been found or returns the - * location passed to the method if unsuccessful - * @see #createPortal(Location) - */ - @NotNull - public Location findOrCreate(@NotNull Location location); - - /** - * Attempt to find a portal near the given location. - * - * @param location the desired location of the portal - * @return the location of the nearest portal to the location - */ - @NotNull - public Location findPortal(@NotNull Location location); - - /** - * Attempt to create a portal near the given location. - *
- * In the case of a Nether portal teleportation, this will attempt to - * create a Nether portal. - *
- * In the case of an Ender portal teleportation, this will (re-)create the - * obsidian platform and clean blocks above it. - * - * @param location the desired location of the portal - * @return true if a portal was successfully created - */ - public boolean createPortal(@NotNull Location location); -} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java index a4aabfe7..247d194f 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -28,6 +28,8 @@ public interface UnsafeValues { BlockData fromLegacy(Material material, byte data); + Material getMaterial(String material, int version); + int getDataVersion(); ItemStack modifyItemStack(ItemStack stack, String arguments); diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index 0c84737a..3abeab09 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -169,7 +169,11 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param z Z-coordinate of the chunk * @return true if the chunk is loaded and in use by one or more players, * otherwise false + * @deprecated This method was added to facilitate chunk garbage collection. + * As of the current Minecraft version chunks are now strictly managed and + * will not be loaded for more than 1 tick unless they are in use. */ + @Deprecated public boolean isChunkInUse(int x, int z); /** @@ -199,8 +203,8 @@ public interface World extends PluginMessageRecipient, Metadatable { /** * Safely unloads and saves the {@link Chunk} at the specified coordinates *
- * This method is analogous to {@link #unloadChunk(int, int, boolean, - * boolean)} where safe and save is true + * This method is analogous to {@link #unloadChunk(int, int, boolean)} + * where save is true. * * @param chunk the chunk to unload * @return true if the chunk has unloaded successfully, otherwise false @@ -210,8 +214,8 @@ public interface World extends PluginMessageRecipient, Metadatable { /** * Safely unloads and saves the {@link Chunk} at the specified coordinates *
- * This method is analogous to {@link #unloadChunk(int, int, boolean, - * boolean)} where safe and saveis true + * This method is analogous to {@link #unloadChunk(int, int, boolean)} + * where save is true. * * @param x X-coordinate of the chunk * @param z Z-coordinate of the chunk @@ -221,10 +225,7 @@ public interface World extends PluginMessageRecipient, Metadatable { /** * Safely unloads and optionally saves the {@link Chunk} at the specified - * coordinates - *
- * This method is analogous to {@link #unloadChunk(int, int, boolean, - * boolean)} where save is true + * coordinates. * * @param x X-coordinate of the chunk * @param z Z-coordinate of the chunk @@ -233,27 +234,9 @@ public interface World extends PluginMessageRecipient, Metadatable { */ public boolean unloadChunk(int x, int z, boolean save); - /** - * Unloads and optionally saves the {@link Chunk} at the specified - * coordinates - * - * @param x X-coordinate of the chunk - * @param z Z-coordinate of the chunk - * @param save Controls whether the chunk is saved - * @param safe Controls whether to unload the chunk when players are - * nearby - * @return true if the chunk has unloaded successfully, otherwise false - * @deprecated it is never safe to remove a chunk in use - */ - @Deprecated - public boolean unloadChunk(int x, int z, boolean save, boolean safe); - /** * Safely queues the {@link Chunk} at the specified coordinates for - * unloading - *
- * This method is analogous to {@link #unloadChunkRequest(int, int,
- * boolean)} where safe is true
+ * unloading.
*
* @param x X-coordinate of the chunk
* @param z Z-coordinate of the chunk
@@ -261,18 +244,6 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public boolean unloadChunkRequest(int x, int z);
- /**
- * Queues the {@link Chunk} at the specified coordinates for unloading
- *
- * @param x X-coordinate of the chunk
- * @param z Z-coordinate of the chunk
- * @param safe Controls whether to queue the chunk when players are nearby
- * @return Whether the chunk was actually queued
- * @deprecated it is never safe to remove a chunk in use
- */
- @Deprecated
- public boolean unloadChunkRequest(int x, int z, boolean safe);
-
/**
* Regenerates the {@link Chunk} at the specified coordinates
*
diff --git a/src/main/java/org/bukkit/block/Barrel.java b/src/main/java/org/bukkit/block/Barrel.java
new file mode 100644
index 00000000..5eacc44a
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Barrel.java
@@ -0,0 +1,8 @@
+package org.bukkit.block;
+
+import org.bukkit.loot.Lootable;
+
+/**
+ * Represents a captured state of a Barrel.
+ */
+public interface Barrel extends Container, Lootable { }
diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java
index e5332c0a..8814730b 100644
--- a/src/main/java/org/bukkit/block/Beacon.java
+++ b/src/main/java/org/bukkit/block/Beacon.java
@@ -3,7 +3,6 @@ package org.bukkit.block;
import java.util.Collection;
import org.bukkit.Nameable;
import org.bukkit.entity.LivingEntity;
-import org.bukkit.inventory.BeaconInventory;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
@@ -12,15 +11,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a captured state of a beacon.
*/
-public interface Beacon extends Container, Nameable {
-
- @NotNull
- @Override
- BeaconInventory getInventory();
-
- @NotNull
- @Override
- BeaconInventory getSnapshotInventory();
+public interface Beacon extends BlockState, Lockable, Nameable {
/**
* Returns the list of players within the beacon's range of effect.
diff --git a/src/main/java/org/bukkit/block/Bell.java b/src/main/java/org/bukkit/block/Bell.java
new file mode 100644
index 00000000..43f64148
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Bell.java
@@ -0,0 +1,6 @@
+package org.bukkit.block;
+
+/**
+ * Represents a captured state of Bell.
+ */
+public interface Bell extends BlockState { }
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
index a3b310b7..55386ffe 100644
--- a/src/main/java/org/bukkit/block/Biome.java
+++ b/src/main/java/org/bukkit/block/Biome.java
@@ -1,9 +1,14 @@
package org.bukkit.block;
+import java.util.Locale;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.jetbrains.annotations.NotNull;
+
/**
* Holds all accepted Biomes in the default server
*/
-public enum Biome {
+public enum Biome implements Keyed {
OCEAN,
PLAINS,
DESERT,
@@ -76,5 +81,19 @@ public enum Biome {
SHATTERED_SAVANNA_PLATEAU,
ERODED_BADLANDS,
MODIFIED_WOODED_BADLANDS_PLATEAU,
- MODIFIED_BADLANDS_PLATEAU
+ MODIFIED_BADLANDS_PLATEAU,
+ BAMBOO_JUNGLE,
+ BAMBOO_JUNGLE_HILLS;
+
+ private final NamespacedKey key;
+
+ private Biome() {
+ this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
+ }
+
+ @NotNull
+ @Override
+ public NamespacedKey getKey() {
+ return key;
+ }
}
diff --git a/src/main/java/org/bukkit/block/BlastFurnace.java b/src/main/java/org/bukkit/block/BlastFurnace.java
new file mode 100644
index 00000000..3c4d8571
--- /dev/null
+++ b/src/main/java/org/bukkit/block/BlastFurnace.java
@@ -0,0 +1,6 @@
+package org.bukkit.block;
+
+/**
+ * Represents a captured state of a blast furnace.
+ */
+public interface BlastFurnace extends Furnace { }
diff --git a/src/main/java/org/bukkit/block/BrewingStand.java b/src/main/java/org/bukkit/block/BrewingStand.java
index 7611a126..fe155f14 100644
--- a/src/main/java/org/bukkit/block/BrewingStand.java
+++ b/src/main/java/org/bukkit/block/BrewingStand.java
@@ -1,13 +1,12 @@
package org.bukkit.block;
-import org.bukkit.Nameable;
import org.bukkit.inventory.BrewerInventory;
import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a brewing stand.
*/
-public interface BrewingStand extends Container, Nameable {
+public interface BrewingStand extends Container {
/**
* How much time is left in the brewing cycle.
diff --git a/src/main/java/org/bukkit/block/Campfire.java b/src/main/java/org/bukkit/block/Campfire.java
new file mode 100644
index 00000000..1d3584c8
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Campfire.java
@@ -0,0 +1,69 @@
+package org.bukkit.block;
+
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a captured state of a campfire.
+ */
+public interface Campfire extends BlockState {
+
+ /**
+ * @see Inventory#getSize()
+ *
+ * @return The size of the inventory
+ */
+ int getSize();
+
+ /**
+ * @see Inventory#getItem(int)
+ *
+ * @param index The index of the Slot's ItemStack to return
+ * @return The ItemStack in the slot
+ */
+ @Nullable
+ ItemStack getItem(int index);
+
+ /**
+ * @see Inventory#setItem(int, org.bukkit.inventory.ItemStack)
+ *
+ * @param index The index where to put the ItemStack
+ * @param item The ItemStack to set
+ */
+ void setItem(int index, @Nullable ItemStack item);
+
+ /**
+ * Get cook time.This is the amount of time the item has been cooking for.
+ *
+ * @param index
+ * @return Cook time
+ */
+ int getCookTime(int index);
+
+ /**
+ * Set cook time.This is the amount of time the item has been cooking for.
+ *
+ * @param index
+ * @param cookTime Cook time
+ */
+ void setCookTime(int index, int cookTime);
+
+ /**
+ * Get cook time total.This is the amount of time the item is required to
+ * cook for.
+ *
+ * @param index
+ * @return Cook time total
+ */
+ int getCookTimeTotal(int index);
+
+ /**
+ * Set cook time.This is the amount of time the item is required to cook
+ * for.
+ *
+ * @param index
+ * @param cookTimeTotal Cook time total
+ */
+ void setCookTimeTotal(int index, int cookTimeTotal);
+}
diff --git a/src/main/java/org/bukkit/block/Chest.java b/src/main/java/org/bukkit/block/Chest.java
index c553891e..c67d7110 100644
--- a/src/main/java/org/bukkit/block/Chest.java
+++ b/src/main/java/org/bukkit/block/Chest.java
@@ -1,6 +1,5 @@
package org.bukkit.block;
-import org.bukkit.Nameable;
import org.bukkit.inventory.Inventory;
import org.bukkit.loot.Lootable;
import org.jetbrains.annotations.NotNull;
@@ -8,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a chest.
*/
-public interface Chest extends Container, Nameable, Lootable {
+public interface Chest extends Container, Lootable {
/**
* Gets the inventory of the chest block represented by this block state.
diff --git a/src/main/java/org/bukkit/block/Container.java b/src/main/java/org/bukkit/block/Container.java
index 96888ba8..a03bdfd3 100644
--- a/src/main/java/org/bukkit/block/Container.java
+++ b/src/main/java/org/bukkit/block/Container.java
@@ -1,13 +1,14 @@
package org.bukkit.block;
+import org.bukkit.Nameable;
+import org.bukkit.inventory.BlockInventoryHolder;
import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.InventoryHolder;
import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a container block.
*/
-public interface Container extends BlockState, InventoryHolder, Lockable {
+public interface Container extends BlockState, BlockInventoryHolder, Lockable, Nameable {
/**
* Gets the inventory of the block represented by this block state.
diff --git a/src/main/java/org/bukkit/block/Dropper.java b/src/main/java/org/bukkit/block/Dropper.java
index 2e8c3f71..d68401b7 100644
--- a/src/main/java/org/bukkit/block/Dropper.java
+++ b/src/main/java/org/bukkit/block/Dropper.java
@@ -1,12 +1,11 @@
package org.bukkit.block;
-import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
/**
* Represents a captured state of a dropper.
*/
-public interface Dropper extends Container, Nameable, Lootable {
+public interface Dropper extends Container, Lootable {
/**
* Tries to drop a randomly selected item from the dropper's inventory,
diff --git a/src/main/java/org/bukkit/block/Furnace.java b/src/main/java/org/bukkit/block/Furnace.java
index db3d22fa..c5a8c96f 100644
--- a/src/main/java/org/bukkit/block/Furnace.java
+++ b/src/main/java/org/bukkit/block/Furnace.java
@@ -1,13 +1,12 @@
package org.bukkit.block;
-import org.bukkit.Nameable;
import org.bukkit.inventory.FurnaceInventory;
import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a furnace.
*/
-public interface Furnace extends Container, Nameable {
+public interface Furnace extends Container {
/**
* Get burn time.
diff --git a/src/main/java/org/bukkit/block/Hopper.java b/src/main/java/org/bukkit/block/Hopper.java
index 73fce5f3..58e49309 100644
--- a/src/main/java/org/bukkit/block/Hopper.java
+++ b/src/main/java/org/bukkit/block/Hopper.java
@@ -1,9 +1,8 @@
package org.bukkit.block;
-import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
/**
* Represents a captured state of a hopper.
*/
-public interface Hopper extends Container, Nameable, Lootable { }
+public interface Hopper extends Container, Lootable { }
diff --git a/src/main/java/org/bukkit/block/Jigsaw.java b/src/main/java/org/bukkit/block/Jigsaw.java
new file mode 100644
index 00000000..b5296e0d
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Jigsaw.java
@@ -0,0 +1,6 @@
+package org.bukkit.block;
+
+/**
+ * Represents a captured state of a jigsaw.
+ */
+public interface Jigsaw extends BlockState { }
diff --git a/src/main/java/org/bukkit/block/Lectern.java b/src/main/java/org/bukkit/block/Lectern.java
new file mode 100644
index 00000000..d3066044
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Lectern.java
@@ -0,0 +1,45 @@
+package org.bukkit.block;
+
+import org.bukkit.inventory.BlockInventoryHolder;
+import org.bukkit.inventory.Inventory;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a captured state of a lectern.
+ */
+public interface Lectern extends BlockState, BlockInventoryHolder {
+
+ /**
+ * Get the current lectern page.
+ *
+ * @return current page
+ */
+ int getPage();
+
+ /**
+ * Set the current lectern page.
+ *
+ * If the page is greater than the number of pages of the book currently in
+ * the inventory, then behavior is undefined.
+ *
+ * @param page new page
+ */
+ void setPage(int page);
+
+ /**
+ * @see Container#getInventory()
+ *
+ * @return inventory
+ */
+ @NotNull
+ @Override
+ Inventory getInventory();
+
+ /**
+ * @see Container#getSnapshotInventory()
+ *
+ * @return snapshot inventory
+ */
+ @NotNull
+ Inventory getSnapshotInventory();
+}
diff --git a/src/main/java/org/bukkit/block/ShulkerBox.java b/src/main/java/org/bukkit/block/ShulkerBox.java
index 5a6bed64..938f9aea 100644
--- a/src/main/java/org/bukkit/block/ShulkerBox.java
+++ b/src/main/java/org/bukkit/block/ShulkerBox.java
@@ -1,14 +1,13 @@
package org.bukkit.block;
import org.bukkit.DyeColor;
-import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a ShulkerBox.
*/
-public interface ShulkerBox extends Container, Nameable, Lootable {
+public interface ShulkerBox extends Container, Lootable {
/**
* Get the {@link DyeColor} corresponding to this ShulkerBox
diff --git a/src/main/java/org/bukkit/block/Smoker.java b/src/main/java/org/bukkit/block/Smoker.java
new file mode 100644
index 00000000..7601c30d
--- /dev/null
+++ b/src/main/java/org/bukkit/block/Smoker.java
@@ -0,0 +1,6 @@
+package org.bukkit.block;
+
+/**
+ * Represents a captured state of a smoker.
+ */
+public interface Smoker extends Furnace { }
diff --git a/src/main/java/org/bukkit/block/data/type/Bamboo.java b/src/main/java/org/bukkit/block/data/type/Bamboo.java
new file mode 100644
index 00000000..96b5add2
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Bamboo.java
@@ -0,0 +1,44 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Ageable;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * 'leaves' represents the size of the leaves on this bamboo block.
+ */
+public interface Bamboo extends Ageable, Sapling {
+
+ /**
+ * Gets the value of the 'leaves' property.
+ *
+ * @return the 'leaves' value
+ */
+ @NotNull
+ Leaves getLeaves();
+
+ /**
+ * Sets the value of the 'leaves' property.
+ *
+ * @param leaves the new 'leaves' value
+ */
+ void setLeaves(@NotNull Leaves leaves);
+
+ /**
+ * Bamboo leaf size.
+ */
+ public enum Leaves {
+
+ /**
+ * No leaves.
+ */
+ NONE,
+ /**
+ * Small leaves.
+ */
+ SMALL,
+ /**
+ * Large leaves.
+ */
+ LARGE;
+ }
+}
diff --git a/src/main/java/org/bukkit/block/data/type/Bell.java b/src/main/java/org/bukkit/block/data/type/Bell.java
new file mode 100644
index 00000000..a786eda0
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Bell.java
@@ -0,0 +1,32 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Directional;
+
+/**
+ * 'attachment' denotes how the bell is attached to its block.
+ */
+public interface Bell extends Directional {
+
+ /**
+ * What the bell is attached to.
+ */
+ public enum Attachment {
+
+ /**
+ * Placed on floor.
+ */
+ FLOOR,
+ /**
+ * Placed on ceiling.
+ */
+ CEILING,
+ /**
+ * Placed on one wall.
+ */
+ SINGLE_WALL,
+ /**
+ * Placed between two walls.
+ */
+ DOUBLE_WALL;
+ }
+}
diff --git a/src/main/java/org/bukkit/block/data/type/Campfire.java b/src/main/java/org/bukkit/block/data/type/Campfire.java
new file mode 100644
index 00000000..bc5159b4
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Campfire.java
@@ -0,0 +1,25 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Lightable;
+import org.bukkit.block.data.Waterlogged;
+
+/**
+ * 'signal_fire' denotes whether the fire is extra smokey due to having a hay
+ * bale placed beneath it.
+ */
+public interface Campfire extends Lightable, Waterlogged {
+
+ /**
+ * Gets the value of the 'signal_fire' property.
+ *
+ * @return the 'signal_fire' value
+ */
+ boolean isSignalFire();
+
+ /**
+ * Sets the value of the 'signal_fire' property.
+ *
+ * @param signalFire the new 'signal_fire' value
+ */
+ void setSignalFire(boolean signalFire);
+}
diff --git a/src/main/java/org/bukkit/block/data/type/Lantern.java b/src/main/java/org/bukkit/block/data/type/Lantern.java
new file mode 100644
index 00000000..2ae2cf59
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Lantern.java
@@ -0,0 +1,21 @@
+package org.bukkit.block.data.type;
+
+/**
+ * 'hanging' denotes whether the lantern is hanging from a block.
+ */
+public interface Lantern {
+
+ /**
+ * Gets the value of the 'hanging' property.
+ *
+ * @return the 'hanging' value
+ */
+ boolean isHanging();
+
+ /**
+ * Sets the value of the 'hanging' property.
+ *
+ * @param hanging the new 'hanging' value
+ */
+ void setHanging(boolean hanging);
+}
diff --git a/src/main/java/org/bukkit/block/data/type/Lectern.java b/src/main/java/org/bukkit/block/data/type/Lectern.java
new file mode 100644
index 00000000..11b4a173
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Lectern.java
@@ -0,0 +1,18 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Directional;
+import org.bukkit.block.data.Powerable;
+
+/**
+ * 'has_book' is a quick flag to check whether this lectern has a book inside
+ * it.
+ */
+public interface Lectern extends Directional, Powerable {
+
+ /**
+ * Gets the value of the 'has_book' property.
+ *
+ * @return the 'has_book' value
+ */
+ boolean hasBook();
+}
diff --git a/src/main/java/org/bukkit/block/data/type/Scaffolding.java b/src/main/java/org/bukkit/block/data/type/Scaffolding.java
new file mode 100644
index 00000000..1f6859ee
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/Scaffolding.java
@@ -0,0 +1,49 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Waterlogged;
+
+/**
+ * 'bottom' indicates whether the scaffolding is floating or not.
+ *
- * If this is set to true, the TravelAgent will try to find a Portal at
- * the {@link #getTo()} Location, and will try to create one if there is
- * none.
- *
- * If this is set to false, the {@link #getEntity()} will only be
- * teleported to the {@link #getTo()} Location.
- *
- * @param useTravelAgent whether to use the Travel Agent
- */
- public void useTravelAgent(boolean useTravelAgent) {
- this.useTravelAgent = useTravelAgent;
- }
-
- /**
- * Gets whether or not the Travel Agent will be used.
- *
- * If this is set to true, the TravelAgent will try to find a Portal at
- * the {@link #getTo()} Location, and will try to create one if there is
- * none.
- *
- * If this is set to false, the {@link #getEntity()} will only be
- * teleported to the {@link #getTo()} Location.
- *
- * @return whether to use the Travel Agent
- */
- public boolean useTravelAgent() {
- return useTravelAgent;
- }
-
- /**
- * Gets the Travel Agent used (or not) in this event.
- *
- * @return the Travel Agent used (or not) in this event
- */
- @NotNull
- public TravelAgent getPortalTravelAgent() {
- return this.travelAgent;
- }
-
- /**
- * Sets the Travel Agent used (or not) in this event.
- *
- * @param travelAgent the Travel Agent used (or not) in this event
- */
- public void setPortalTravelAgent(@NotNull TravelAgent travelAgent) {
- this.travelAgent = travelAgent;
}
@NotNull
diff --git a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
index 57f6203d..ec12b57e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
@@ -2,7 +2,6 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Projectile;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
@@ -19,7 +18,7 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
private final float force;
private boolean cancelled;
- public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Projectile projectile, final float force) {
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
super(shooter);
this.bow = bow;
this.projectile = projectile;
diff --git a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java
index 37d0ffa1..db667785 100644
--- a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java
@@ -151,6 +151,10 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
* entity
*/
CLOSEST_ENTITY,
+ /**
+ * When a raiding entity selects the same target as one of its compatriots.
+ */
+ FOLLOW_LEADER,
/**
* When another entity tempts this entity by having a desired item such
* as wheat in it's hand.
diff --git a/src/main/java/org/bukkit/event/entity/VillagerAcquireTradeEvent.java b/src/main/java/org/bukkit/event/entity/VillagerAcquireTradeEvent.java
index 95740eb7..58155105 100644
--- a/src/main/java/org/bukkit/event/entity/VillagerAcquireTradeEvent.java
+++ b/src/main/java/org/bukkit/event/entity/VillagerAcquireTradeEvent.java
@@ -1,6 +1,6 @@
package org.bukkit.event.entity;
-import org.bukkit.entity.Villager;
+import org.bukkit.entity.AbstractVillager;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.MerchantRecipe;
@@ -16,7 +16,7 @@ public class VillagerAcquireTradeEvent extends EntityEvent implements Cancellabl
//
private MerchantRecipe recipe;
- public VillagerAcquireTradeEvent(@NotNull Villager what, @NotNull MerchantRecipe recipe) {
+ public VillagerAcquireTradeEvent(@NotNull AbstractVillager what, @NotNull MerchantRecipe recipe) {
super(what);
this.recipe = recipe;
}
@@ -52,8 +52,8 @@ public class VillagerAcquireTradeEvent extends EntityEvent implements Cancellabl
@NotNull
@Override
- public Villager getEntity() {
- return (Villager) super.getEntity();
+ public AbstractVillager getEntity() {
+ return (AbstractVillager) super.getEntity();
}
@NotNull
diff --git a/src/main/java/org/bukkit/event/entity/VillagerReplenishTradeEvent.java b/src/main/java/org/bukkit/event/entity/VillagerReplenishTradeEvent.java
index 738469dd..ff5f484c 100644
--- a/src/main/java/org/bukkit/event/entity/VillagerReplenishTradeEvent.java
+++ b/src/main/java/org/bukkit/event/entity/VillagerReplenishTradeEvent.java
@@ -1,6 +1,6 @@
package org.bukkit.event.entity;
-import org.bukkit.entity.Villager;
+import org.bukkit.entity.AbstractVillager;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.MerchantRecipe;
@@ -20,7 +20,7 @@ public class VillagerReplenishTradeEvent extends EntityEvent implements Cancella
private MerchantRecipe recipe;
private int bonus;
- public VillagerReplenishTradeEvent(@NotNull Villager what, @NotNull MerchantRecipe recipe, int bonus) {
+ public VillagerReplenishTradeEvent(@NotNull AbstractVillager what, @NotNull MerchantRecipe recipe, int bonus) {
super(what);
this.recipe = recipe;
this.bonus = bonus;
@@ -77,8 +77,8 @@ public class VillagerReplenishTradeEvent extends EntityEvent implements Cancella
@NotNull
@Override
- public Villager getEntity() {
- return (Villager) super.getEntity();
+ public AbstractVillager getEntity() {
+ return (AbstractVillager) super.getEntity();
}
@NotNull
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
index 98196837..066e7dd9 100644
--- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
@@ -1,73 +1,16 @@
package org.bukkit.event.inventory;
import org.bukkit.block.Block;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.block.BlockEvent;
+import org.bukkit.event.block.BlockCookEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
/**
* Called when an ItemStack is successfully smelted in a furnace.
*/
-public class FurnaceSmeltEvent extends BlockEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private final ItemStack source;
- private ItemStack result;
- private boolean cancelled;
+public class FurnaceSmeltEvent extends BlockCookEvent {
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) {
- super(furnace);
- this.source = source;
- this.result = result;
- this.cancelled = false;
- }
-
- /**
- * Gets the smelted ItemStack for this event
- *
- * @return smelting source ItemStack
- */
- @NotNull
- public ItemStack getSource() {
- return source;
- }
-
- /**
- * Gets the resultant ItemStack for this event
- *
- * @return smelting result ItemStack
- */
- @NotNull
- public ItemStack getResult() {
- return result;
- }
-
- /**
- * Sets the resultant ItemStack for this event
- *
- * @param result new result ItemStack
- */
- public void setResult(@NotNull ItemStack result) {
- this.result = result;
- }
-
- public boolean isCancelled() {
- return cancelled;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
+ super(furnace, source, result);
}
}
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
index d69ce3ec..a0a5c21a 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -92,6 +92,39 @@ public enum InventoryType {
* A shulker box inventory, with 27 slots of type CONTAINER.
*/
SHULKER_BOX(27, "Shulker Box"),
+ /**
+ * A barrel box inventory, with 27 slots of type CONTAINER.
+ */
+ BARREL(27, "Barrel"),
+ /**
+ * A blast furnace inventory, with a RESULT slot, a CRAFTING slot, and a
+ * FUEL slot.
+ */
+ BLAST_FURNACE(3, "Blast Furnace"),
+ /**
+ * A lectern inventory, with 1 BOOK slot.
+ */
+ LECTERN(1, "Lectern", false),
+ /**
+ * A smoker inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot.
+ */
+ SMOKER(3, "Smoker"),
+ /**
+ * Loom inventory, with 3 INPUT slots, and 1 RESULT slot.
+ */
+ LOOM(4, "Loom"),
+ /**
+ * Cartography inventory with 2 INPUT slots, and 1 RESULT slot.
+ */
+ CARTOGRAPHY(3, "Cartography Table"),
+ /**
+ * Grindstone inventory with 2 INPUT slots, and 1 RESULT slot.
+ */
+ GRINDSTONE(3, "Repair & Disenchant"),
+ /**
+ * Stonecutter inventory with 1 INPUT slot, and 1 RESULT slot.
+ */
+ STONECUTTER(2, "Stonecutter")
;
private final int size;
diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
index f8821c78..5b755078 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
@@ -1,7 +1,6 @@
package org.bukkit.event.player;
import org.bukkit.Location;
-import org.bukkit.TravelAgent;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
@@ -15,68 +14,13 @@ import org.jetbrains.annotations.Nullable;
*/
public class PlayerPortalEvent extends PlayerTeleportEvent {
private static final HandlerList handlers = new HandlerList();
- protected boolean useTravelAgent = true;
- protected TravelAgent travelAgent;
- public PlayerPortalEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TravelAgent pta) {
+ public PlayerPortalEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to) {
super(player, from, to);
- this.travelAgent = pta;
}
- public PlayerPortalEvent(@NotNull Player player, @NotNull Location from, @Nullable Location to, @NotNull TravelAgent pta, @NotNull TeleportCause cause) {
+ public PlayerPortalEvent(@NotNull Player player, @NotNull Location from, @Nullable Location to, @NotNull TeleportCause cause) {
super(player, from, to, cause);
- this.travelAgent = pta;
- }
-
- /**
- * Sets whether or not the Travel Agent will be used.
- *
- * If this is set to true, the TravelAgent will try to find a Portal at
- * the {@link #getTo()} Location, and will try to create one if there is
- * none.
- *
- * If this is set to false, the {@link #getPlayer()} will only be
- * teleported to the {@link #getTo()} Location.
- *
- * @param useTravelAgent whether to use the Travel Agent
- */
- public void useTravelAgent(boolean useTravelAgent) {
- this.useTravelAgent = useTravelAgent;
- }
-
- /**
- * Gets whether or not the Travel Agent will be used.
- *
- * If this is set to true, the TravelAgent will try to find a Portal at
- * the {@link #getTo()} Location, and will try to create one if there is
- * none.
- *
- * If this is set to false, the {@link #getPlayer()}} will only be
- * teleported to the {@link #getTo()} Location.
- *
- * @return whether to use the Travel Agent
- */
- public boolean useTravelAgent() {
- return useTravelAgent && travelAgent != null;
- }
-
- /**
- * Gets the Travel Agent used (or not) in this event.
- *
- * @return the Travel Agent used (or not) in this event
- */
- @NotNull
- public TravelAgent getPortalTravelAgent() {
- return this.travelAgent;
- }
-
- /**
- * Sets the Travel Agent used (or not) in this event.
- *
- * @param travelAgent the Travel Agent used (or not) in this event
- */
- public void setPortalTravelAgent(@NotNull TravelAgent travelAgent) {
- this.travelAgent = travelAgent;
}
@NotNull
diff --git a/src/main/java/org/bukkit/event/server/ServerEvent.java b/src/main/java/org/bukkit/event/server/ServerEvent.java
index eb00d6af..46b11901 100644
--- a/src/main/java/org/bukkit/event/server/ServerEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerEvent.java
@@ -6,4 +6,12 @@ import org.bukkit.event.Event;
* Miscellaneous server events
*/
public abstract class ServerEvent extends Event {
+
+ public ServerEvent() {
+ super();
+ }
+
+ public ServerEvent(boolean isAsync) {
+ super(isAsync);
+ }
}
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index d873763d..f8c89cca 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -23,6 +23,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ *
+ * @return true if this has custom model data
+ */
+ boolean hasCustomModelData();
+
+ /**
+ * Gets the custom model data that is set.
+ *
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ *
+ * Plugins should check that hasCustomModelData() returns
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ *
+ * @param data the data to set, or null to clear
+ */
+ void setCustomModelData(@Nullable Integer data);
+
/**
* Checks for the existence of any enchantments.
*
@@ -340,6 +373,15 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
@NotNull
CustomItemTagContainer getCustomTagContainer();
+ /**
+ * Internal use only! Do not use under any circumstances!
+ *
+ * @param version
+ * @deprecated
+ */
+ @Deprecated
+ void setVersion(int version);
+
@SuppressWarnings("javadoc")
@NotNull
ItemMeta clone();
diff --git a/src/main/java/org/bukkit/map/MapView.java b/src/main/java/org/bukkit/map/MapView.java
index 29dd573a..23b55174 100644
--- a/src/main/java/org/bukkit/map/MapView.java
+++ b/src/main/java/org/bukkit/map/MapView.java
@@ -173,4 +173,22 @@ public interface MapView {
* @param unlimited tracking state
*/
void setUnlimitedTracking(boolean unlimited);
+
+ /**
+ * Gets whether the map is locked or not.
+ *
+ * A locked map may not be explored further.
+ *
+ * @return lock status
+ */
+ boolean isLocked();
+
+ /**
+ * Gets whether the map is locked or not.
+ *
+ * A locked map may not be explored further.
+ *
+ * @param locked status
+ */
+ void setLocked(boolean locked);
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 08d890c1..657d9692 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -487,6 +487,9 @@ public final class SimplePluginManager implements PluginManager {
}
fireEvent(event);
} else {
+ if (!server.isPrimaryThread()) {
+ throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from another thread.");
+ }
synchronized (this) {
fireEvent(event);
}
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
index 059c77d3..941eeab9 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
@@ -165,6 +165,16 @@ public abstract class PotionEffectType {
*/
public static final PotionEffectType DOLPHINS_GRACE = new PotionEffectTypeWrapper(30);
+ /**
+ * oof.
+ */
+ public static final PotionEffectType BAD_OMEN = new PotionEffectTypeWrapper(31);
+
+ /**
+ * \o/.
+ */
+ public static final PotionEffectType HERO_OF_THE_VILLAGE = new PotionEffectTypeWrapper(32);
+
private final int id;
protected PotionEffectType(int id) {
@@ -189,7 +199,9 @@ public abstract class PotionEffectType {
* Returns the duration modifier applied to effects of this type.
*
* @return duration modifier
+ * @deprecated unused, always 1.0
*/
+ @Deprecated
public abstract double getDurationModifier();
/**
@@ -251,7 +263,7 @@ public abstract class PotionEffectType {
return "PotionEffectType[" + id + ", " + getName() + "]";
}
- private static final PotionEffectType[] byId = new PotionEffectType[31];
+ private static final PotionEffectType[] byId = new PotionEffectType[33];
private static final Map
+ * 'distance' indicates the distance from a scaffolding block placed above a
+ * 'bottom' scaffold.
+ *
+ * When 'distance' reaches {@link #getMaximumDistance()} the block will drop.
+ */
+public interface Scaffolding extends Waterlogged {
+
+ /**
+ * Gets the value of the 'bottom' property.
+ *
+ * @return the 'bottom' value
+ */
+ boolean isBottom();
+
+ /**
+ * Sets the value of the 'bottom' property.
+ *
+ * @param bottom the new 'bottom' value
+ */
+ void setBottom(boolean bottom);
+
+ /**
+ * Gets the value of the 'distance' property.
+ *
+ * @return the 'distance' value
+ */
+ int getDistance();
+
+ /**
+ * Sets the value of the 'distance' property.
+ *
+ * @param distance the new 'distance' value
+ */
+ void setDistance(int distance);
+
+ /**
+ * Gets the maximum allowed value of the 'distance' property.
+ *
+ * @return the maximum 'distance' value
+ */
+ int getMaximumDistance();
+}
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 88bde6a9..b8126985 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -44,8 +44,7 @@ public class VersionCommand extends BukkitCommand {
if (args.length == 0) {
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
- sender.sendMessage(ChatColor.YELLOW + "This is a final build for 1.13.2. Please see https://www.spigotmc.org/go/1.13.2 for details about upgrading.");
- // sendVersion(sender);
+ sendVersion(sender);
} else {
StringBuilder name = new StringBuilder();
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
index 705b948e..f871cfce 100644
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
@@ -176,6 +176,21 @@ public abstract class Enchantment implements Keyed {
*/
public static final Enchantment CHANNELING = new EnchantmentWrapper("channeling");
+ /**
+ * Shoot multiple arrows from crossbows
+ */
+ public static final Enchantment MULTISHOT = new EnchantmentWrapper("multishot");
+
+ /**
+ * Charges crossbows quickly
+ */
+ public static final Enchantment QUICK_CHARGE = new EnchantmentWrapper("quick_charge");
+
+ /**
+ * Crossbow projectiles pierce entities
+ */
+ public static final Enchantment PIERCING = new EnchantmentWrapper("piercing");
+
/**
* Allows mending the item using experience orbs
*/
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
index 9f30c869..8ff0901c 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
@@ -191,6 +191,16 @@ public enum EnchantmentTarget {
public boolean includes(@NotNull Material item) {
return item.equals(Material.TRIDENT);
}
+ },
+
+ /**
+ * Allow the Enchantment to be placed on crossbows.
+ */
+ CROSSBOW {
+ @Override
+ public boolean includes(@NotNull Material item) {
+ return item.equals(Material.CROSSBOW);
+ }
};
/**
diff --git a/src/main/java/org/bukkit/entity/AbstractVillager.java b/src/main/java/org/bukkit/entity/AbstractVillager.java
new file mode 100644
index 00000000..8fde1f4b
--- /dev/null
+++ b/src/main/java/org/bukkit/entity/AbstractVillager.java
@@ -0,0 +1,24 @@
+package org.bukkit.entity;
+
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.Merchant;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a villager NPC
+ */
+public interface AbstractVillager extends Ageable, NPC, InventoryHolder, Merchant {
+
+ /**
+ * Gets this villager's inventory.
+ *
+ * Note that this inventory is not the Merchant inventory, rather, it is the
+ * items that a villager might have collected (from harvesting crops, etc.)
+ *
+ * {@inheritDoc}
+ */
+ @NotNull
+ @Override
+ Inventory getInventory();
+}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
new file mode 100644
index 00000000..c2566104
--- /dev/null
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -0,0 +1,41 @@
+package org.bukkit.entity;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Meow.
+ */
+public interface Cat extends Animals, Tameable, Sittable {
+
+ /**
+ * Gets the current type of this cat.
+ *
+ * @return Type of the cat.
+ */
+ @NotNull
+ public Type getCatType();
+
+ /**
+ * Sets the current type of this cat.
+ *
+ * @param type New type of this cat.
+ */
+ public void setCatType(@NotNull Type type);
+
+ /**
+ * Represents the various different cat types there are.
+ */
+ public enum Type {
+ TABBY,
+ BLACK,
+ RED,
+ SIAMESE,
+ BRITISH_SHORTHAIR,
+ CALICO,
+ PERSIAN,
+ RAGDOLL,
+ WHITE,
+ JELLIE,
+ ALL_BLACK;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
index 395f74c1..ea342b28 100644
--- a/src/main/java/org/bukkit/entity/EntityType.java
+++ b/src/main/java/org/bukkit/entity/EntityType.java
@@ -1,8 +1,10 @@
package org.bukkit.entity;
+import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
+import org.bukkit.Keyed;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.SpawnerMinecart;
@@ -12,12 +14,14 @@ import org.bukkit.entity.minecart.PoweredMinecart;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Location;
+import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public enum EntityType {
+public enum EntityType implements Keyed {
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
/**
@@ -62,7 +66,7 @@ public enum EntityType {
/**
* An arrow projectile; may get stuck in the ground.
*/
- ARROW("arrow", Arrow.class, 10),
+ ARROW("arrow", TippedArrow.class, 10),
/**
* A flying snowball.
*/
@@ -86,7 +90,7 @@ public enum EntityType {
/**
* A flying splash potion.
*/
- SPLASH_POTION("potion", SplashPotion.class, 16, false),
+ SPLASH_POTION("potion", ThrownPotion.class, 16, false),
/**
* A flying experience bottle.
*/
@@ -116,7 +120,7 @@ public enum EntityType {
*/
HUSK("husk", Husk.class, 23),
/**
- * Like {@link #TIPPED_ARROW} but causes the {@link PotionEffectType#GLOWING} effect on all team members.
+ * Like {@link #ARROW} but causes the {@link PotionEffectType#GLOWING} effect on all team members.
*/
SPECTRAL_ARROW("spectral_arrow", SpectralArrow.class, 24),
/**
@@ -250,11 +254,13 @@ public enum EntityType {
TROPICAL_FISH("tropical_fish", TropicalFish.class, -1),
DROWNED("drowned", Drowned.class, -1),
DOLPHIN("dolphin", Dolphin.class, -1),
- // These don't have an entity ID in nms.EntityTypes.
- /**
- * A flying lingering potion
- */
- LINGERING_POTION(null, LingeringPotion.class, -1, false),
+ CAT("cat", Cat.class, -1),
+ PANDA("panda", Panda.class, -1),
+ PILLAGER("pillager", Pillager.class, -1),
+ RAVAGER("ravager", Ravager.class, -1),
+ TRADER_LLAMA("trader_llama", TraderLlama.class, -1),
+ WANDERING_TRADER("wandering_trader", WanderingTrader.class, -1),
+ FOX("fox", Fox.class, -1),
/**
* A fishing line and bobber.
*/
@@ -265,23 +271,17 @@ public enum EntityType {
* Spawn with {@link World#strikeLightning(Location)}.
*/
LIGHTNING("lightning_bolt", LightningStrike.class, -1, false),
- WEATHER(null, Weather.class, -1, false),
PLAYER("player", Player.class, -1, false),
- COMPLEX_PART(null, ComplexEntityPart.class, -1, false),
- /**
- * Like {@link #ARROW} but tipped with a specific potion which is applied on
- * contact.
- */
- TIPPED_ARROW(null, TippedArrow.class, -1),
/**
* An unknown entity without an Entity Class
*/
UNKNOWN(null, null, -1, false);
- private String name;
- private Class extends Entity> clazz;
- private short typeId;
- private boolean independent, living;
+ private final String name;
+ private final Class extends Entity> clazz;
+ private final short typeId;
+ private final boolean independent, living;
+ private final NamespacedKey key;
private static final Map
- * Note that this inventory is not the Merchant inventory, rather, it is the
- * items that a villager might have collected (from harvesting crops, etc.)
- *
- * {@inheritDoc}
- */
- @NotNull
- @Override
- Inventory getInventory();
-
- /**
- * Gets this villager's riches, the number of emeralds this villager has
- * been given.
- *
- * @return the villager's riches
- */
- int getRiches();
-
- /**
- * Sets this villager's riches.
- *
- * @see Villager#getRiches()
- *
- * @param riches the new riches
- */
- void setRiches(int riches);
-
/**
* Represents the various different Villager professions there may be.
* Villagers have different trading options depending on their profession,
*/
public enum Profession {
+ NONE,
/**
- * Normal. Reserved for Zombies.
- * @deprecated Unused
- */
- @Deprecated
- NORMAL(true),
- /**
- * Farmer profession. Wears a brown robe.
- */
- FARMER(false),
- /**
- * Librarian profession. Wears a white robe.
- */
- LIBRARIAN(false),
- /**
- * Priest profession. Wears a purple robe.
- */
- PRIEST(false),
- /**
- * Blacksmith profession. Wears a black apron.
- */
- BLACKSMITH(false),
- /**
- * Butcher profession. Wears a white apron.
- */
- BUTCHER(false),
- /**
- * Nitwit profession. Wears a green apron, cannot trade.
- */
- NITWIT(false),
- /**
- * Husk. Reserved for Zombies
- * @deprecated Unused
- */
- @Deprecated
- HUSK(true);
- private final boolean zombie;
-
- private Profession(boolean zombie) {
- this.zombie = zombie;
- }
-
- /**
- * Returns if this profession can only be used by zombies.
- *
- * @return zombie profession status
- * @deprecated Unused
- */
- @Deprecated
- public boolean isZombie() {
- return zombie;
- }
-
- /**
- * Get an immutable list of {@link Career} belonging to this Profession.
- *
- * @return an immutable list of careers for this profession, or an empty
- * map if this Profession has no careers.
- */
- @NotNull
- public Listtrue
+ * before calling this method.
+ *
+ * @return the localized name that is set
+ */
+ int getCustomModelData();
+
+ /**
+ * Sets the custom model data.
+ *