entry) {
tileEntityTypeSet.add(entry.getKey());
return pair(
- String.valueOf(entry.getKey().getId()),
+ String.valueOf(entry.getKey().ordinal()),
entry.getValue().count()
);
}
diff --git a/api/src/main/java/co/aikar/timings/TimingsExport.java b/api/src/main/java/co/aikar/timings/TimingsExport.java
index 65d312b02..23eb8c65c 100644
--- a/api/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/api/src/main/java/co/aikar/timings/TimingsExport.java
@@ -111,7 +111,7 @@ class TimingsExport extends Thread {
);
if (!TimingsManager.privacy) {
appendObjectData(parent,
- pair("server", Bukkit.getServerName()),
+ pair("server", Bukkit.getUnsafe().getTimingsServerName()),
pair("motd", Bukkit.getServer().getMotd()),
pair("online-mode", Bukkit.getServer().getOnlineMode()),
pair("icon", Bukkit.getServer().getServerIcon().getData())
@@ -184,9 +184,9 @@ class TimingsExport extends Thread {
pair("handlers", handlers),
pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))),
pair("tileentity",
- toObjectMapper(tileEntityTypeSet, input -> pair(input.getId(), input.name()))),
+ toObjectMapper(tileEntityTypeSet, input -> pair(input.ordinal(), input.name()))),
pair("entity",
- toObjectMapper(entityTypeSet, input -> pair(input.getTypeId(), input.name())))
+ toObjectMapper(entityTypeSet, input -> pair(input.ordinal(), input.name())))
));
// Information about loaded plugins
@@ -288,8 +288,8 @@ class TimingsExport extends Thread {
String hostName = "BrokenHost";
try {
hostName = InetAddress.getLocalHost().getHostName();
- } catch(Exception ignored) {}
- con.setRequestProperty("User-Agent", "Paper/" + Bukkit.getServerName() + "/" + hostName);
+ } catch (Exception ignored) {}
+ con.setRequestProperty("User-Agent", "Paper/" + Bukkit.getUnsafe().getTimingsServerName() + "/" + hostName);
con.setRequestMethod("POST");
con.setInstanceFollowRedirects(false);
diff --git a/api/src/main/java/com/destroystokyo/paper/HeightmapType.java b/api/src/main/java/com/destroystokyo/paper/HeightmapType.java
new file mode 100644
index 000000000..4cd9b5ed0
--- /dev/null
+++ b/api/src/main/java/com/destroystokyo/paper/HeightmapType.java
@@ -0,0 +1,35 @@
+package com.destroystokyo.paper;
+
+import org.bukkit.World;
+
+/**
+ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster
+ * than using an iterative search for a block in a given x, z coordinate.
+ */
+public enum HeightmapType {
+
+ /**
+ * The highest block used for lighting in the world. Also the block returned by {@link World#getHighestBlockYAt(int, int)}}
+ */
+ LIGHT_BLOCKING,
+
+ /**
+ * References the highest block in the world.
+ */
+ ANY,
+
+ /**
+ * References the highest solid block in a world.
+ */
+ SOLID,
+
+ /**
+ * References the highest solid or liquid block in a world.
+ */
+ SOLID_OR_LIQUID,
+
+ /**
+ * References the highest solid or liquid block in a world, excluding leaves.
+ */
+ SOLID_OR_LIQUID_NO_LEAVES;
+}
diff --git a/api/src/main/java/com/destroystokyo/paper/MaterialTags.java b/api/src/main/java/com/destroystokyo/paper/MaterialTags.java
index 660191c24..ef1e2c191 100644
--- a/api/src/main/java/com/destroystokyo/paper/MaterialTags.java
+++ b/api/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -100,14 +100,6 @@ public class MaterialTags {
*/
public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes"))
.endsWith("_DYE")
- .add(Material.BONE_MEAL,
- Material.CACTUS_GREEN,
- Material.COCOA_BEANS,
- Material.DANDELION_YELLOW,
- Material.INK_SAC,
- Material.LAPIS_LAZULI,
- Material.ROSE_RED
- )
.ensureSize("DYES", 16);
/**
@@ -181,7 +173,7 @@ public class MaterialTags {
*/
public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors"))
.endsWith("_HORSE_ARMOR")
- .ensureSize("HORSE_ARMORS", 3);
+ .ensureSize("HORSE_ARMORS", 4);
/**
* Covers the 6 variants of infested blocks.
@@ -316,7 +308,7 @@ public class MaterialTags {
*/
public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
.endsWith("_SPAWN_EGG")
- .ensureSize("SPAWN_EGGS", 51);
+ .ensureSize("SPAWN_EGGS", 58);
/**
* Covers all 16 colors of stained glass.
@@ -364,8 +356,8 @@ public class MaterialTags {
.ensureSize("PURPUR", 4);
public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
- .add(Material.SIGN, Material.WALL_SIGN)
- .ensureSize("SIGNS", 2);
+ .endsWith("_SIGN")
+ .ensureSize("SIGNS", 12);
public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch"))
.add(Material.TORCH, Material.WALL_TORCH)
diff --git a/api/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/api/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
deleted file mode 100644
index 648b247ef..000000000
--- a/api/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package com.destroystokyo.paper;
-
-import com.google.common.base.MoreObjects;
-import com.google.gson.Gson;
-import com.google.gson.JsonSyntaxException;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardOpenOption;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.bukkit.Bukkit;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public enum VersionHistoryManager {
- INSTANCE;
-
- private final Gson gson = new Gson();
-
- private final Logger logger = Bukkit.getLogger();
-
- private VersionData currentData = null;
-
- VersionHistoryManager() {
- final Path path = Paths.get("version_history.json");
-
- if (Files.exists(path)) {
- // Basic file santiy checks
- if (!Files.isRegularFile(path)) {
- if (Files.isDirectory(path)) {
- logger.severe(path + " is a directory, cannot be used for version history");
- } else {
- logger.severe(path + " is not a regular file, cannot be used for version history");
- }
- // We can't continue
- return;
- }
-
- try (final BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
- currentData = gson.fromJson(reader, VersionData.class);
- } catch (final IOException e) {
- logger.log(Level.SEVERE, "Failed to read version history file '" + path + "'", e);
- return;
- } catch (final JsonSyntaxException e) {
- logger.log(Level.SEVERE, "Invalid json syntax for file '" + path + "'", e);
- return;
- }
-
- final String version = Bukkit.getVersion();
- if (version == null) {
- logger.severe("Failed to retrieve current version");
- return;
- }
-
- if (!version.equals(currentData.getCurrentVersion())) {
- // The version appears to have changed
- currentData.setOldVersion(currentData.getCurrentVersion());
- currentData.setCurrentVersion(version);
- writeFile(path);
- }
- } else {
- // File doesn't exist, start fresh
- currentData = new VersionData();
- // oldVersion is null
- currentData.setCurrentVersion(Bukkit.getVersion());
- writeFile(path);
- }
- }
-
- private void writeFile(@NotNull final Path path) {
- try (final BufferedWriter writer = Files.newBufferedWriter(
- path,
- StandardCharsets.UTF_8,
- StandardOpenOption.WRITE,
- StandardOpenOption.CREATE,
- StandardOpenOption.TRUNCATE_EXISTING
- )) {
- gson.toJson(currentData, writer);
- } catch (final IOException e) {
- logger.log(Level.SEVERE, "Failed to write to version history file", e);
- }
- }
-
- @Nullable
- public VersionData getVersionData() {
- return currentData;
- }
-
- public static class VersionData {
- private String oldVersion;
-
- private String currentVersion;
-
- @Nullable
- public String getOldVersion() {
- return oldVersion;
- }
-
- public void setOldVersion(@Nullable String oldVersion) {
- this.oldVersion = oldVersion;
- }
-
- @Nullable
- public String getCurrentVersion() {
- return currentVersion;
- }
-
- public void setCurrentVersion(@Nullable String currentVersion) {
- this.currentVersion = currentVersion;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("oldVersion", oldVersion)
- .add("currentVersion", currentVersion)
- .toString();
- }
-
- @Override
- public boolean equals(@Nullable Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final VersionData versionData = (VersionData) o;
- return Objects.equals(oldVersion, versionData.oldVersion) &&
- Objects.equals(currentVersion, versionData.currentVersion);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(oldVersion, currentVersion);
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
new file mode 100644
index 000000000..8cf87d228
--- /dev/null
+++ b/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
@@ -0,0 +1,52 @@
+package com.destroystokyo.paper.block;
+
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents the sounds that a {@link Block} makes in certain situations
+ *
+ * The sound group includes break, step, place, hit, and fall sounds.
+ */
+public interface BlockSoundGroup {
+ /**
+ * Gets the sound that plays when breaking this block
+ *
+ * @return The break sound
+ */
+ @NotNull
+ Sound getBreakSound();
+
+ /**
+ * Gets the sound that plays when stepping on this block
+ *
+ * @return The step sound
+ */
+ @NotNull
+ Sound getStepSound();
+
+ /**
+ * Gets the sound that plays when placing this block
+ *
+ * @return The place sound
+ */
+ @NotNull
+ Sound getPlaceSound();
+
+ /**
+ * Gets the sound that plays when hitting this block
+ *
+ * @return The hit sound
+ */
+ @NotNull
+ Sound getHitSound();
+
+ /**
+ * Gets the sound that plays when this block falls
+ *
+ * @return The fall sound
+ */
+ @NotNull
+ Sound getFallSound();
+}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
index 46d6f6ad6..f0bb4e31c 100644
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
+++ b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
@@ -36,6 +36,7 @@ public class PlayerHandshakeEvent extends Event implements Cancellable {
* @param cancelled if this event is enabled
*/
public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
+ super(true);
this.originalHandshake = originalHandshake;
this.cancelled = cancelled;
}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
index 2ead0466e..77a19995f 100644
--- a/api/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
+++ b/api/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
@@ -27,6 +27,7 @@ public final class GS4QueryEvent extends Event {
private QueryResponse response;
public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) {
+ super(true); // should always be called async
this.queryType = Preconditions.checkNotNull(queryType, "queryType");
this.querierAddress = Preconditions.checkNotNull(querierAddress, "querierAddress");
this.response = Preconditions.checkNotNull(response, "response");
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
index d3b00f741..2f573299a 100644
--- a/api/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
+++ b/api/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
@@ -2,6 +2,7 @@ package com.destroystokyo.paper.event.server;
import com.google.common.base.Preconditions;
import org.apache.commons.lang.Validate;
+import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.destroystokyo.paper.exception.ServerException;
@@ -15,6 +16,7 @@ public class ServerExceptionEvent extends Event {
@NotNull private ServerException exception;
public ServerExceptionEvent(@NotNull ServerException exception) {
+ super(!Bukkit.isPrimaryThread());
this.exception = Preconditions.checkNotNull(exception, "exception");
}
diff --git a/api/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/api/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
new file mode 100644
index 000000000..2a2651299
--- /dev/null
+++ b/api/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
@@ -0,0 +1,44 @@
+package com.destroystokyo.paper.util;
+
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
+
+public interface VersionFetcher {
+ /**
+ * Amount of time to cache results for in milliseconds
+ *
+ * Negative values will never cache.
+ *
+ * @return cache time
+ */
+ long getCacheTime();
+
+ /**
+ * Gets the version message to cache and show to command senders. Multiple messages can be sent using newlines (\n)
+ * in the string. The string will be split on these newlines and sent as individual messages.
+ *
+ * NOTE: This is run in a new thread separate from that of the command processing thread
+ *
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
+ * @return the message to show when requesting a version
+ */
+ @NotNull
+ String getVersionMessage(@NotNull String serverVersion);
+
+ class DummyVersionFetcher implements VersionFetcher {
+
+ @Override
+ public long getCacheTime() {
+ return -1;
+ }
+
+ @NotNull
+ @Override
+ public String getVersionMessage(@NotNull String serverVersion) {
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
+ new Throwable().printStackTrace();
+ return "Unable to check for updates. No version provider set.";
+ }
+ }
+}
diff --git a/api/src/main/java/io/akarin/server/api/event/PlayerAttachedEvent.java b/api/src/main/java/io/akarin/server/api/event/PlayerAttachedEvent.java
deleted file mode 100644
index 47c19b026..000000000
--- a/api/src/main/java/io/akarin/server/api/event/PlayerAttachedEvent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package io.akarin.server.api.event;
-
-import org.bukkit.entity.Player;
-
-/**
- * Represents event with a player attached
- */
-public interface PlayerAttachedEvent {
- public Player getPlayer();
-}
diff --git a/api/src/main/java/io/akarin/server/api/event/WorldAttachedEvent.java b/api/src/main/java/io/akarin/server/api/event/WorldAttachedEvent.java
deleted file mode 100644
index 15908bd69..000000000
--- a/api/src/main/java/io/akarin/server/api/event/WorldAttachedEvent.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package io.akarin.server.api.event;
-
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-
-/**
- * Represents event with a world attached
- */
-public interface WorldAttachedEvent {
- public World getWorld();
-}
diff --git a/api/src/main/java/io/akarin/server/api/structure/Village.java b/api/src/main/java/io/akarin/server/api/structure/Village.java
deleted file mode 100644
index 85383f950..000000000
--- a/api/src/main/java/io/akarin/server/api/structure/Village.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package io.akarin.server.api.structure;
-
-/**
- * Represents a village structure
- */
-public interface Village {
-}
diff --git a/api/src/main/java/io/akarin/server/core/AkarinGlobalConfig.java b/api/src/main/java/io/akarin/server/core/AkarinGlobalConfig.java
deleted file mode 100644
index b8c2f9760..000000000
--- a/api/src/main/java/io/akarin/server/core/AkarinGlobalConfig.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package io.akarin.server.core;
-
-import com.google.common.base.Throwables;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.bukkit.configuration.file.YamlConfiguration;
-
-@SuppressWarnings({"UnusedIsStillUsed", "unused"})
-public class AkarinGlobalConfig {
- private final static Logger LOGGER = Logger.getLogger("Akarin");
-
- private static File CONFIG_FILE;
- private static final String HEADER = "This is the global configuration file for Akarin.\n"
- + "Some options may impact gameplay, so use with caution,\n"
- + "and make sure you know what each option does before configuring.\n"
- + "\n"
- + "Akarin website: https://akarin.io/ \n";
- /*========================================================================*/
- public static YamlConfiguration config;
- static int version;
- /*========================================================================*/
- public static void init(File configFile) {
- CONFIG_FILE = configFile;
- config = new YamlConfiguration();
- try {
- config.load(CONFIG_FILE);
- } catch (IOException ex) {
- } catch (InvalidConfigurationException ex) {
- LOGGER.log(Level.SEVERE, "Could not load akarin.yml, please correct your syntax errors");
- ex.printStackTrace();
- throw Throwables.propagate(ex);
- }
- config.options().header(HEADER);
- config.options().copyDefaults(true);
-
- version = getInt("config-version", 3);
- set("config-version", 3);
- readConfig(AkarinGlobalConfig.class, null);
- }
-
- static void readConfig(Class> clazz, Object instance) {
- for (Method method : clazz.getDeclaredMethods()) {
- if (Modifier.isPrivate(method.getModifiers())) {
- if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
- try {
- method.setAccessible(true);
- method.invoke(instance);
- } catch (InvocationTargetException ex) {
- throw Throwables.propagate(ex.getCause());
- } catch (Exception ex) {
- LOGGER.log(Level.SEVERE, "Error invoking " + method);
- ex.printStackTrace();
- }
- }
- }
- }
-
- try {
- config.save(CONFIG_FILE);
- } catch (IOException ex) {
- LOGGER.log(Level.SEVERE, "Could not save " + CONFIG_FILE);
- ex.printStackTrace();
- }
- }
-
- private static final Pattern SPACE = Pattern.compile(" ");
- private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
- public static int getSeconds(String str) {
- str = SPACE.matcher(str).replaceAll("");
- final char unit = str.charAt(str.length() - 1);
- str = NOT_NUMERIC.matcher(str).replaceAll("");
- double num;
- try {
- num = Double.parseDouble(str);
- } catch (Exception e) {
- num = 0D;
- }
- switch (unit) {
- case 'd': num *= (double) 60*60*24; break;
- case 'h': num *= (double) 60*60; break;
- case 'm': num *= 60; break;
- default: case 's': break;
- }
- return (int) num;
- }
-
- protected static String timeSummary(int seconds) {
- String time = "";
-
- if (seconds > 60 * 60 * 24) {
- time += TimeUnit.SECONDS.toDays(seconds) + "d";
- seconds %= 60 * 60 * 24;
- }
-
- if (seconds > 60 * 60) {
- time += TimeUnit.SECONDS.toHours(seconds) + "h";
- seconds %= 60 * 60;
- }
-
- if (seconds > 0) {
- time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
- }
- return time;
- }
-
- public static void set(String path, Object val) {
- config.set(path, val);
- }
-
- private static boolean getBoolean(String path, boolean def) {
- config.addDefault(path, def);
- return config.getBoolean(path, config.getBoolean(path));
- }
-
- private static double getDouble(String path, double def) {
- config.addDefault(path, def);
- return config.getDouble(path, config.getDouble(path));
- }
-
- private static float getFloat(String path, float def) {
- // TODO: Figure out why getFloat() always returns the default value.
- return (float) getDouble(path, def);
- }
-
- private static int getInt(String path, int def) {
- config.addDefault(path, def);
- return config.getInt(path, config.getInt(path));
- }
-
- private static List getList(String path, T def) {
- config.addDefault(path, def);
- return config.getList(path, config.getList(path));
- }
-
- private static String getString(String path, String def) {
- config.addDefault(path, def);
- return config.getString(path, config.getString(path));
- }
- /*========================================================================*/
- public static boolean noResponseDoGC = true;
- private static void noResponseDoGC() {
- noResponseDoGC = getBoolean("alternative.gc-before-stuck-restart", noResponseDoGC);
- }
-
- public static String serverBrandName = "";
- private static void serverBrandName() {
- serverBrandName = getString("alternative.modified-server-brand-name", serverBrandName);
- }
-
- public static int fileIOThreads = 2;
- private static void fileIOThreads() {
- fileIOThreads = getInt("core.chunk-save-threads", fileIOThreads);
- fileIOThreads = fileIOThreads < 1 ? 1 : fileIOThreads;
- fileIOThreads = fileIOThreads > 8 ? 8 : fileIOThreads;
- }
-
- public static boolean fixPhysicsEventBehaviour = false;
- private static void fixPhysicsEventBehavior() {
- fixPhysicsEventBehaviour = getBoolean("alternative.fix-physics-event-behaviour", fixPhysicsEventBehaviour);
- }
-
- public static boolean lazyThreadAssertion = true;
- private static void lazyThreadAssertion() {
- lazyThreadAssertion = getBoolean("core.lazy-thread-assertion", lazyThreadAssertion);
- }
-
- public static double blockbreakAnimationVisibleDistance = 1024;
- private static void blockbreakAnimationVisibleDistance() {
- double def = 32.00;
- if (version == 2)
- def = getDouble("alternative.block-break-animation-visible-distance", def);
-
- blockbreakAnimationVisibleDistance = Math.sqrt(getDouble("core.block-break-animation-visible-distance", def));
- }
-
- public static boolean enableAsyncLighting = true;
- private static void enableAsyncLighting() {
- enableAsyncLighting = getBoolean("core.async-lighting.enable", enableAsyncLighting);
- }
-
- public static String yggdrasilServerURL = "https://api.mojang.com/";
- private static void yggdrasilServerURL() {
- yggdrasilServerURL = getString("alternative.yggdrasil.url", yggdrasilServerURL);
- }
-
- public static boolean disallowBeforeLogin = false;
- private static void disallowBeforeLogin() {
- disallowBeforeLogin = getBoolean("alternative.disallow-before-login-event", disallowBeforeLogin);
- }
-
- public static boolean allowExcessiveSigns = false;
- private static void allowExcessiveSigns() {
- allowExcessiveSigns = getBoolean("alternative.allow-excessive-signs", allowExcessiveSigns);
- }
-
- public static boolean ignoreRayTraceForSeatableBlocks = false;
- private static void ignoreRayTraceForSeatableBlocks() {
- ignoreRayTraceForSeatableBlocks = getBoolean("alternative.ignore-ray-trace-for-seatable-blocks", ignoreRayTraceForSeatableBlocks);
- }
-
- public static boolean improvedMobSpawnMechanics = false;
- private static void improvedMobSpawnMechanics() {
- improvedMobSpawnMechanics = getBoolean("core.improved-mob-spawn-mechanics.enable", improvedMobSpawnMechanics);
- }
-
- public static int userCacheExpireDays = 30;
- private static void enableModernUserCaches() {
- userCacheExpireDays = getSeconds(getString("core.user-cache-expire-time", "30d"));
- }
-
- public static boolean spinningAwaitTicking = true;
- private static void spinningAwaitTicking() {
- spinningAwaitTicking = getBoolean("core.spinning-tick-await", spinningAwaitTicking);
- }
-}
\ No newline at end of file
diff --git a/api/src/main/java/org/bukkit/Achievement.java b/api/src/main/java/org/bukkit/Achievement.java
index edc388ffe..0080e0fea 100644
--- a/api/src/main/java/org/bukkit/Achievement.java
+++ b/api/src/main/java/org/bukkit/Achievement.java
@@ -56,7 +56,7 @@ public enum Achievement {
/**
* Returns whether or not this achievement has a parent achievement.
- *
+ *
* @return whether the achievement has a parent achievement
*/
public boolean hasParent() {
@@ -65,7 +65,7 @@ public enum Achievement {
/**
* Returns the parent achievement of this achievement, or null if none.
- *
+ *
* @return the parent achievement or null
*/
@Nullable
diff --git a/api/src/main/java/org/bukkit/Art.java b/api/src/main/java/org/bukkit/Art.java
index cfbcaf72d..e7563acf4 100644
--- a/api/src/main/java/org/bukkit/Art.java
+++ b/api/src/main/java/org/bukkit/Art.java
@@ -1,17 +1,15 @@
package org.bukkit;
-import java.util.HashMap;
-
-import org.apache.commons.lang.Validate;
-
import com.google.common.collect.Maps;
+import java.util.HashMap;
+import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents the art on a painting
*/
-public enum Art {
+public enum Art implements Keyed {
KEBAB(0, 1, 1),
AZTEC(1, 1, 1),
ALBAN(2, 1, 1),
@@ -39,7 +37,8 @@ public enum Art {
SKELETON(24, 4, 3),
DONKEY_KONG(25, 4, 3);
- private int id, width, height;
+ private final int id, width, height;
+ private final NamespacedKey key;
private static final HashMap BY_NAME = Maps.newHashMap();
private static final HashMap BY_ID = Maps.newHashMap();
@@ -47,6 +46,7 @@ public enum Art {
this.id = id;
this.width = width;
this.height = height;
+ this.key = NamespacedKey.minecraft(name().toLowerCase(java.util.Locale.ENGLISH));
}
/**
@@ -78,6 +78,12 @@ public enum Art {
return id;
}
+ @NotNull
+ @Override
+ public NamespacedKey getKey() {
+ return key;
+ }
+
/**
* Get a painting by its numeric ID
*
diff --git a/api/src/main/java/org/bukkit/BanEntry.java b/api/src/main/java/org/bukkit/BanEntry.java
index 30c8b0a0c..2cf11ca4f 100644
--- a/api/src/main/java/org/bukkit/BanEntry.java
+++ b/api/src/main/java/org/bukkit/BanEntry.java
@@ -1,10 +1,9 @@
package org.bukkit;
+import java.util.Date;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.Date;
-
/**
* A single entry from a ban list. This may represent either a player ban or
* an IP ban.
diff --git a/api/src/main/java/org/bukkit/BanList.java b/api/src/main/java/org/bukkit/BanList.java
index f506b644a..96ef22fe8 100644
--- a/api/src/main/java/org/bukkit/BanList.java
+++ b/api/src/main/java/org/bukkit/BanList.java
@@ -1,10 +1,9 @@
package org.bukkit;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import java.util.Date;
import java.util.Set;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* A ban list, containing bans of some {@link Type}.
diff --git a/api/src/main/java/org/bukkit/Bukkit.java b/api/src/main/java/org/bukkit/Bukkit.java
index 5ed9726c8..231bc6e31 100644
--- a/api/src/main/java/org/bukkit/Bukkit.java
+++ b/api/src/main/java/org/bukkit/Bukkit.java
@@ -1,5 +1,6 @@
package org.bukkit;
+import com.google.common.collect.ImmutableList;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.Serializable;
@@ -12,8 +13,8 @@ import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.logging.Logger;
-
import org.bukkit.Warning.WarningState;
+import org.bukkit.advancement.Advancement;
import org.bukkit.block.data.BlockData;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
@@ -28,12 +29,15 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.server.ServerListPingEvent;
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.Recipe;
+import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.loot.LootTable;
import org.bukkit.map.MapView;
import org.bukkit.permissions.Permissible;
@@ -43,13 +47,6 @@ import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.util.CachedServerIcon;
-
-import com.google.common.collect.ImmutableList;
-import org.bukkit.advancement.Advancement;
-import org.bukkit.generator.ChunkGenerator;
-
-import org.bukkit.inventory.ItemFactory;
-import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -192,31 +189,6 @@ public final class Bukkit {
return server.getIp();
}
- /**
- * Get the name of this server.
- *
- * @return the name of this server
- * @deprecated not a standard server property
- */
- @Deprecated
- @NotNull
- public static String getServerName() {
- return server.getServerName();
- }
-
- /**
- * Get an ID of this server. The ID is a simple generally alphanumeric ID
- * that can be used for uniquely identifying this server.
- *
- * @return the ID of this server
- * @deprecated not a standard server property
- */
- @Deprecated
- @NotNull
- public static String getServerId() {
- return server.getServerId();
- }
-
/**
* Get world type (level-type setting) for default world.
*
@@ -981,11 +953,9 @@ public final class Bukkit {
}
/**
- * Creates an empty inventory with the specified type and title. If the type
+ * Creates an empty inventory with the specified type. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
- * otherwise the new inventory has the normal size for its type.
- * It should be noted that some inventory types do not support titles and
- * may not render with said titles on the Minecraft client.
+ * otherwise the new inventory has the normal size for its type.
*
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
* created with this method. Use
@@ -1260,12 +1230,12 @@ public final class Bukkit {
/**
* Create a ChunkData for use in a generator.
- *
+ *
* See {@link ChunkGenerator#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}
- *
+ *
* @param world the world to create the ChunkData for
* @return a new ChunkData for the world
- *
+ *
*/
@NotNull
public static ChunkGenerator.ChunkData createChunkData(@NotNull World world) {
@@ -1533,9 +1503,7 @@ public final class Bukkit {
* no further guarantees are made.
* @throws IllegalArgumentException if the selector is malformed in any way
* or a parameter is null
- * @deprecated draft API
*/
- @Deprecated
@NotNull
public static List selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException {
return server.selectEntities(sender, selector);
@@ -1631,6 +1599,10 @@ public final class Bukkit {
public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
return server.createProfile(uuid, name);
}
+
+ public static int getCurrentTick() {
+ return server.getCurrentTick();
+ }
// Paper end
@NotNull
diff --git a/api/src/main/java/org/bukkit/ChatColor.java b/api/src/main/java/org/bukkit/ChatColor.java
index 3ab8e9414..b2c82940c 100644
--- a/api/src/main/java/org/bukkit/ChatColor.java
+++ b/api/src/main/java/org/bukkit/ChatColor.java
@@ -1,11 +1,9 @@
package org.bukkit;
+import com.google.common.collect.Maps;
import java.util.Map;
import java.util.regex.Pattern;
-
import org.apache.commons.lang.Validate;
-
-import com.google.common.collect.Maps;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -13,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
/**
* All supported color values for chat
*/
-public enum ChatColor{
+public enum ChatColor {
/**
* Represents black
*/
@@ -27,7 +25,7 @@ public enum ChatColor{
/**
* Represents dark blue
*/
- DARK_BLUE('1', 0x1){
+ DARK_BLUE('1', 0x1) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -37,7 +35,7 @@ public enum ChatColor{
/**
* Represents dark green
*/
- DARK_GREEN('2', 0x2){
+ DARK_GREEN('2', 0x2) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -47,7 +45,7 @@ public enum ChatColor{
/**
* Represents dark blue (aqua)
*/
- DARK_AQUA('3', 0x3){
+ DARK_AQUA('3', 0x3) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -57,7 +55,7 @@ public enum ChatColor{
/**
* Represents dark red
*/
- DARK_RED('4', 0x4){
+ DARK_RED('4', 0x4) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -67,7 +65,7 @@ public enum ChatColor{
/**
* Represents dark purple
*/
- DARK_PURPLE('5', 0x5){
+ DARK_PURPLE('5', 0x5) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -77,7 +75,7 @@ public enum ChatColor{
/**
* Represents gold
*/
- GOLD('6', 0x6){
+ GOLD('6', 0x6) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -87,7 +85,7 @@ public enum ChatColor{
/**
* Represents gray
*/
- GRAY('7', 0x7){
+ GRAY('7', 0x7) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -97,7 +95,7 @@ public enum ChatColor{
/**
* Represents dark gray
*/
- DARK_GRAY('8', 0x8){
+ DARK_GRAY('8', 0x8) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -107,7 +105,7 @@ public enum ChatColor{
/**
* Represents blue
*/
- BLUE('9', 0x9){
+ BLUE('9', 0x9) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -117,7 +115,7 @@ public enum ChatColor{
/**
* Represents green
*/
- GREEN('a', 0xA){
+ GREEN('a', 0xA) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -127,7 +125,7 @@ public enum ChatColor{
/**
* Represents aqua
*/
- AQUA('b', 0xB){
+ AQUA('b', 0xB) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -137,7 +135,7 @@ public enum ChatColor{
/**
* Represents red
*/
- RED('c', 0xC){
+ RED('c', 0xC) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -147,7 +145,7 @@ public enum ChatColor{
/**
* Represents light purple
*/
- LIGHT_PURPLE('d', 0xD){
+ LIGHT_PURPLE('d', 0xD) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -157,7 +155,7 @@ public enum ChatColor{
/**
* Represents yellow
*/
- YELLOW('e', 0xE){
+ YELLOW('e', 0xE) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -167,7 +165,7 @@ public enum ChatColor{
/**
* Represents white
*/
- WHITE('f', 0xF){
+ WHITE('f', 0xF) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -177,7 +175,7 @@ public enum ChatColor{
/**
* Represents magical characters that change around randomly
*/
- MAGIC('k', 0x10, true){
+ MAGIC('k', 0x10, true) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -187,7 +185,7 @@ public enum ChatColor{
/**
* Makes the text bold.
*/
- BOLD('l', 0x11, true){
+ BOLD('l', 0x11, true) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -197,7 +195,7 @@ public enum ChatColor{
/**
* Makes a line appear through the text.
*/
- STRIKETHROUGH('m', 0x12, true){
+ STRIKETHROUGH('m', 0x12, true) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -207,7 +205,7 @@ public enum ChatColor{
/**
* Makes the text appear underlined.
*/
- UNDERLINE('n', 0x13, true){
+ UNDERLINE('n', 0x13, true) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -217,7 +215,7 @@ public enum ChatColor{
/**
* Makes the text italic.
*/
- ITALIC('o', 0x14, true){
+ ITALIC('o', 0x14, true) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -227,7 +225,7 @@ public enum ChatColor{
/**
* Resets all previous chat colors or formats.
*/
- RESET('r', 0x15){
+ RESET('r', 0x15) {
@NotNull
@Override
public net.md_5.bungee.api.ChatColor asBungee() {
@@ -246,8 +244,8 @@ public enum ChatColor{
private final char code;
private final boolean isFormat;
private final String toString;
- private final static Map BY_ID = Maps.newHashMap();
- private final static Map BY_CHAR = Maps.newHashMap();
+ private static final Map BY_ID = Maps.newHashMap();
+ private static final Map BY_CHAR = Maps.newHashMap();
private ChatColor(char code, int intCode) {
this(code, intCode, false);
@@ -282,7 +280,7 @@ public enum ChatColor{
/**
* Checks if this code is a format code as opposed to a color code.
- *
+ *
* @return whether this ChatColor is a format code
*/
public boolean isFormat() {
@@ -291,7 +289,7 @@ public enum ChatColor{
/**
* Checks if this code is a color code as opposed to a format code.
- *
+ *
* @return whether this ChatColor is a color code
*/
public boolean isColor() {
@@ -353,6 +351,8 @@ public enum ChatColor{
*/
@NotNull
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
+ Validate.notNull(textToTranslate, "Cannot translate null text");
+
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
@@ -371,6 +371,8 @@ public enum ChatColor{
*/
@NotNull
public static String getLastColors(@NotNull String input) {
+ Validate.notNull(input, "Cannot get last colors from null text");
+
String result = "";
int length = input.length();
diff --git a/api/src/main/java/org/bukkit/Chunk.java b/api/src/main/java/org/bukkit/Chunk.java
index 22ff63e52..7909caef7 100644
--- a/api/src/main/java/org/bukkit/Chunk.java
+++ b/api/src/main/java/org/bukkit/Chunk.java
@@ -1,8 +1,11 @@
package org.bukkit;
+import java.util.Collection;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
+import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
+import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
/**
@@ -143,18 +146,6 @@ public interface Chunk {
*/
boolean load();
- /**
- * Unloads and optionally saves 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
- boolean unload(boolean save, boolean safe);
-
/**
* Unloads and optionally saves the Chunk
*
@@ -194,8 +185,81 @@ public interface Chunk {
*
* A force loaded chunk will not be unloaded due to lack of player activity.
*
- * @param forced
+ * @param forced force load status
* @see World#setChunkForceLoaded(int, int, boolean)
*/
void setForceLoaded(boolean forced);
+
+ /**
+ * Adds a plugin ticket for this chunk, loading this chunk if it is not
+ * already loaded.
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param plugin Plugin which owns the ticket
+ * @return {@code true} if a plugin ticket was added, {@code false} if the
+ * ticket already exists for the plugin
+ * @throws IllegalStateException If the specified plugin is not enabled
+ * @see World#addPluginChunkTicket(int, int, Plugin)
+ */
+ boolean addPluginChunkTicket(@NotNull Plugin plugin);
+
+ /**
+ * Removes the specified plugin's ticket for this chunk
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param plugin Plugin which owns the ticket
+ * @return {@code true} if the plugin ticket was removed, {@code false} if
+ * there is no plugin ticket for the chunk
+ * @see World#removePluginChunkTicket(int, int, Plugin)
+ */
+ boolean removePluginChunkTicket(@NotNull Plugin plugin);
+
+ /**
+ * Retrieves a collection specifying which plugins have tickets for this
+ * chunk. This collection is not updated when plugin tickets are added or
+ * removed to this chunk.
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @return unmodifiable collection containing which plugins have tickets for
+ * this chunk
+ * @see World#getPluginChunkTickets(int, int)
+ */
+ @NotNull
+ Collection getPluginChunkTickets();
+
+ /**
+ * Gets the amount of time in ticks that this chunk has been inhabited.
+ *
+ * Note that the time is incremented once per tick per player in the chunk.
+ *
+ * @return inhabited time
+ */
+ long getInhabitedTime();
+
+ /**
+ * Sets the amount of time in ticks that this chunk has been inhabited.
+ *
+ * @param ticks new inhabited time
+ */
+ void setInhabitedTime(long ticks);
+
+ /**
+ * Tests if this chunk contains the specified block.
+ *
+ * @param block block to test
+ * @return if the block is contained within
+ */
+ boolean contains(@NotNull BlockData block);
}
diff --git a/api/src/main/java/org/bukkit/ChunkSnapshot.java b/api/src/main/java/org/bukkit/ChunkSnapshot.java
index 153d72b0e..dc5e6918d 100644
--- a/api/src/main/java/org/bukkit/ChunkSnapshot.java
+++ b/api/src/main/java/org/bukkit/ChunkSnapshot.java
@@ -131,4 +131,12 @@ public interface ChunkSnapshot {
* @return true if empty, false if not
*/
boolean isSectionEmpty(int sy);
+
+ /**
+ * Tests if this snapshot contains the specified block.
+ *
+ * @param block block to test
+ * @return if the block is contained within
+ */
+ boolean contains(@NotNull BlockData block);
}
diff --git a/api/src/main/java/org/bukkit/CoalType.java b/api/src/main/java/org/bukkit/CoalType.java
index 9e59a7ba1..c07499dbd 100644
--- a/api/src/main/java/org/bukkit/CoalType.java
+++ b/api/src/main/java/org/bukkit/CoalType.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -13,7 +12,7 @@ public enum CoalType {
CHARCOAL(0x1);
private final byte data;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private CoalType(final int data) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/Color.java b/api/src/main/java/org/bukkit/Color.java
index fbad45905..78be0f3b9 100644
--- a/api/src/main/java/org/bukkit/Color.java
+++ b/api/src/main/java/org/bukkit/Color.java
@@ -1,12 +1,10 @@
package org.bukkit;
+import com.google.common.collect.ImmutableMap;
import java.util.Map;
-
import org.apache.commons.lang.Validate;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
-
-import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
/**
@@ -319,6 +317,7 @@ public final class Color implements ConfigurationSerializable {
return asRGB() ^ Color.class.hashCode();
}
+ @Override
@NotNull
public Map serialize() {
return ImmutableMap.of(
diff --git a/api/src/main/java/org/bukkit/CropState.java b/api/src/main/java/org/bukkit/CropState.java
index 9a3990dff..fb4832fb7 100644
--- a/api/src/main/java/org/bukkit/CropState.java
+++ b/api/src/main/java/org/bukkit/CropState.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -44,7 +43,7 @@ public enum CropState {
RIPE(0x7);
private final byte data;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private CropState(final int data) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/Difficulty.java b/api/src/main/java/org/bukkit/Difficulty.java
index 19367a700..3f6cbefc2 100644
--- a/api/src/main/java/org/bukkit/Difficulty.java
+++ b/api/src/main/java/org/bukkit/Difficulty.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -35,7 +34,7 @@ public enum Difficulty {
HARD(3);
private final int value;
- private final static Map BY_ID = Maps.newHashMap();
+ private static final Map BY_ID = Maps.newHashMap();
private Difficulty(final int value) {
this.value = value;
diff --git a/api/src/main/java/org/bukkit/DyeColor.java b/api/src/main/java/org/bukkit/DyeColor.java
index ac75be657..bd213cabd 100644
--- a/api/src/main/java/org/bukkit/DyeColor.java
+++ b/api/src/main/java/org/bukkit/DyeColor.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.ImmutableMap;
+import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -80,10 +79,10 @@ public enum DyeColor {
private final byte dyeData;
private final Color color;
private final Color firework;
- private final static DyeColor[] BY_WOOL_DATA;
- private final static DyeColor[] BY_DYE_DATA;
- private final static Map BY_COLOR;
- private final static Map BY_FIREWORK;
+ private static final DyeColor[] BY_WOOL_DATA;
+ private static final DyeColor[] BY_DYE_DATA;
+ private static final Map BY_COLOR;
+ private static final Map BY_FIREWORK;
private DyeColor(final int woolData, final int dyeData, /*@NotNull*/ Color color, /*@NotNull*/ Color firework) {
this.woolData = (byte) woolData;
diff --git a/api/src/main/java/org/bukkit/Effect.java b/api/src/main/java/org/bukkit/Effect.java
index e476de658..87911e08b 100644
--- a/api/src/main/java/org/bukkit/Effect.java
+++ b/api/src/main/java/org/bukkit/Effect.java
@@ -1,9 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
-
+import java.util.Map;
import org.bukkit.block.BlockFace;
import org.bukkit.potion.Potion;
import org.jetbrains.annotations.NotNull;
diff --git a/api/src/main/java/org/bukkit/EntityEffect.java b/api/src/main/java/org/bukkit/EntityEffect.java
index b7576f681..4cec72688 100644
--- a/api/src/main/java/org/bukkit/EntityEffect.java
+++ b/api/src/main/java/org/bukkit/EntityEffect.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
@@ -153,7 +152,7 @@ public enum EntityEffect {
private final byte data;
private final Class extends Entity> applicable;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
EntityEffect(final int data, /*@NotNull*/ Class extends Entity> clazz) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/FireworkEffect.java b/api/src/main/java/org/bukkit/FireworkEffect.java
index 524dc9989..31e14b0ce 100644
--- a/api/src/main/java/org/bukkit/FireworkEffect.java
+++ b/api/src/main/java/org/bukkit/FireworkEffect.java
@@ -1,14 +1,12 @@
package org.bukkit;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang.Validate;
-import org.bukkit.configuration.serialization.ConfigurationSerializable;
-import org.bukkit.configuration.serialization.SerializableAs;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang.Validate;
+import org.bukkit.configuration.serialization.ConfigurationSerializable;
+import org.bukkit.configuration.serialization.SerializableAs;
import org.jetbrains.annotations.NotNull;
/**
diff --git a/api/src/main/java/org/bukkit/GameMode.java b/api/src/main/java/org/bukkit/GameMode.java
index 4cfc7762e..938c3217f 100644
--- a/api/src/main/java/org/bukkit/GameMode.java
+++ b/api/src/main/java/org/bukkit/GameMode.java
@@ -1,10 +1,8 @@
package org.bukkit;
-import java.util.Map;
-
-import org.bukkit.entity.HumanEntity;
-
import com.google.common.collect.Maps;
+import java.util.Map;
+import org.bukkit.entity.HumanEntity;
import org.jetbrains.annotations.Nullable;
/**
@@ -29,14 +27,14 @@ public enum GameMode {
ADVENTURE(2),
/**
- * Spectator mode cannot interact with the world in anyway and is
- * invisible to normal players. This grants the player the
+ * Spectator mode cannot interact with the world in anyway and is
+ * invisible to normal players. This grants the player the
* ability to no-clip through the world.
*/
SPECTATOR(3);
private final int value;
- private final static Map BY_ID = Maps.newHashMap();
+ private static final Map BY_ID = Maps.newHashMap();
private GameMode(final int value) {
this.value = value;
diff --git a/api/src/main/java/org/bukkit/GameRule.java b/api/src/main/java/org/bukkit/GameRule.java
index da49c26c5..ee7ae56f9 100644
--- a/api/src/main/java/org/bukkit/GameRule.java
+++ b/api/src/main/java/org/bukkit/GameRule.java
@@ -1,11 +1,10 @@
package org.bukkit;
import com.google.common.base.Preconditions;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import java.util.HashMap;
import java.util.Map;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* GameRules dictate certain behavior within Minecraft itself
@@ -117,6 +116,11 @@ public final class GameRule {
*/
public static final GameRule SPECTATORS_GENERATE_CHUNKS = new GameRule<>("spectatorsGenerateChunks", Boolean.class);
+ /**
+ * Whether pillager raids are enabled or not.
+ */
+ public static final GameRule DISABLE_RAIDS = new GameRule<>("disableRaids", Boolean.class);
+
// Numerical rules
/**
* How often a random block tick occurs (such as plant growth, leaf decay,
diff --git a/api/src/main/java/org/bukkit/GrassSpecies.java b/api/src/main/java/org/bukkit/GrassSpecies.java
index 5943eddd3..f9c9ae463 100644
--- a/api/src/main/java/org/bukkit/GrassSpecies.java
+++ b/api/src/main/java/org/bukkit/GrassSpecies.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -24,7 +23,7 @@ public enum GrassSpecies {
FERN_LIKE(0x2);
private final byte data;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private GrassSpecies(final int data) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/Instrument.java b/api/src/main/java/org/bukkit/Instrument.java
index f21497fff..92194803b 100644
--- a/api/src/main/java/org/bukkit/Instrument.java
+++ b/api/src/main/java/org/bukkit/Instrument.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
public enum Instrument {
@@ -51,10 +50,34 @@ public enum Instrument {
/**
* Xylophone is normally played when a note block is on top of a bone block.
*/
- XYLOPHONE(0x9);
+ XYLOPHONE(0x9),
+ /**
+ * Iron Xylophone is normally played when a note block is on top of a iron block.
+ */
+ IRON_XYLOPHONE(0xA),
+ /**
+ * Cow Bell is normally played when a note block is on top of a soul sand block.
+ */
+ COW_BELL(0xB),
+ /**
+ * Didgeridoo is normally played when a note block is on top of a pumpkin block.
+ */
+ DIDGERIDOO(0xC),
+ /**
+ * Bit is normally played when a note block is on top of a emerald block.
+ */
+ BIT(0xD),
+ /**
+ * Banjo is normally played when a note block is on top of a hay block.
+ */
+ BANJO(0xE),
+ /**
+ * Pling is normally played when a note block is on top of a glowstone block.
+ */
+ PLING(0xF);
private final byte type;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private Instrument(final int type) {
this.type = (byte) type;
diff --git a/api/src/main/java/org/bukkit/Location.java b/api/src/main/java/org/bukkit/Location.java
index 8352b77c5..3e1ca4c9f 100644
--- a/api/src/main/java/org/bukkit/Location.java
+++ b/api/src/main/java/org/bukkit/Location.java
@@ -1,9 +1,11 @@
package org.bukkit;
+import com.google.common.base.Preconditions;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
import com.google.common.base.Preconditions; // Paper
import java.util.HashMap;
import java.util.Map;
-
import org.bukkit.block.Block;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.Entity; // Paper
@@ -29,7 +31,7 @@ import org.bukkit.entity.Player;
* representation by the implementation.
*/
public class Location implements Cloneable, ConfigurationSerializable {
- private World world;
+ private Reference world;
private double x;
private double y;
private double z;
@@ -58,8 +60,11 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @param yaw The absolute rotation on the x-plane, in degrees
* @param pitch The absolute rotation on the y-plane, in degrees
*/
- public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper
- this.world = world;
+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) {
+ if (world != null) {
+ this.world = new WeakReference<>(world);
+ }
+
this.x = x;
this.y = y;
this.z = z;
@@ -73,16 +78,38 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @param world New world that this location resides in
*/
public void setWorld(@Nullable World world) {
- this.world = world;
+ this.world = (world == null) ? null : new WeakReference<>(world);
+ }
+
+ /**
+ * Checks if world in this location is present and loaded.
+ *
+ * @return true if is loaded, otherwise false
+ */
+ public boolean isWorldLoaded() {
+ if (this.world == null) {
+ return false;
+ }
+
+ World world = this.world.get();
+ return world != null && Bukkit.getWorld(world.getUID()) != null;
}
/**
* Gets the world that this location resides in
*
- * @return World that contains this location
+ * @return World that contains this location, or {@code null} if it is not set
+ * @throws IllegalArgumentException when world is unloaded
+ * @see #isWorldLoaded()
*/
@UndefinedNullability
public World getWorld() {
+ if (this.world == null) {
+ return null;
+ }
+
+ World world = this.world.get();
+ Preconditions.checkArgument(world != null, "World unloaded");
return world;
}
@@ -93,7 +120,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
*/
@NotNull
public Chunk getChunk() {
- return world.getChunkAt(this);
+ return getWorld().getChunkAt(this);
}
/**
@@ -103,7 +130,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
*/
@NotNull
public Block getBlock() {
- return world.getBlockAt(this);
+ return getWorld().getBlockAt(this);
}
/**
@@ -285,7 +312,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
/**
* Sets the {@link #getYaw() yaw} and {@link #getPitch() pitch} to point
* in the direction of the vector.
- *
+ *
* @param vector the direction vector
* @return the same location
*/
@@ -516,7 +543,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
return this;
}
- public boolean isChunkLoaded() { return world.isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
+ public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
// Paper start
/**
@@ -525,6 +552,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return true if a chunk has been generated at this location
*/
public boolean isGenerated() {
+ World world = this.getWorld();
Preconditions.checkNotNull(world, "Location has no world!");
return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
}
@@ -610,6 +638,33 @@ public class Location implements Cloneable, ConfigurationSerializable {
return centerLoc;
}
+ // Paper start - Add heightmap api
+
+ /**
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
+ */
+ @NotNull
+ public Location toHighestLocation() {
+ return this.toHighestLocation(com.destroystokyo.paper.HeightmapType.LIGHT_BLOCKING);
+ }
+
+ /**
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
+ * @param heightmap The heightmap to use for finding the highest y location.
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
+ * @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap
+ */
+ @NotNull
+ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) {
+ final Location ret = this.clone();
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap));
+ return ret;
+ }
+ // Paper end
+
/**
* Creates explosion at this location with given power
*
@@ -619,7 +674,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(float power) {
- return world.createExplosion(this, power);
+ return this.getWorld().createExplosion(this, power);
}
/**
@@ -633,7 +688,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(float power, boolean setFire) {
- return world.createExplosion(this, power, setFire);
+ return this.getWorld().createExplosion(this, power, setFire);
}
/**
@@ -646,7 +701,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
- return world.createExplosion(this, power, setFire, breakBlocks);
+ return this.getWorld().createExplosion(this, power, setFire, breakBlocks);
}
/**
@@ -659,7 +714,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(@Nullable Entity source, float power) {
- return world.createExplosion(source, this, power, true, true);
+ return this.getWorld().createExplosion(source, this, power, true, true);
}
/**
@@ -674,7 +729,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
- return world.createExplosion(source, this, power, setFire, true);
+ return this.getWorld().createExplosion(source, this, power, setFire, true);
}
/**
@@ -688,7 +743,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
* @return false if explosion was canceled, otherwise true
*/
public boolean createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks) {
- return world.createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
+ return this.getWorld().createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
}
/**
@@ -703,6 +758,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
*/
@NotNull
public Collection getNearbyEntities(double x, double y, double z) {
+ World world = this.getWorld();
if (world == null) {
throw new IllegalArgumentException("Location has no world");
}
@@ -925,6 +981,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
*/
@NotNull
public Collection getNearbyEntitiesByType(@Nullable Class extends Entity> clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) {
+ World world = this.getWorld();
if (world == null) {
throw new IllegalArgumentException("Location has no world");
}
@@ -941,7 +998,9 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
final Location other = (Location) obj;
- if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) {
+ World world = (this.world == null) ? null : this.world.get();
+ World otherWorld = (other.world == null) ? null : other.world.get();
+ if (world != otherWorld && (world == null || !world.equals(otherWorld))) {
return false;
}
if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) {
@@ -966,7 +1025,8 @@ public class Location implements Cloneable, ConfigurationSerializable {
public int hashCode() {
int hash = 3;
- hash = 19 * hash + (this.world != null ? this.world.hashCode() : 0);
+ World world = (this.world == null) ? null : this.world.get();
+ hash = 19 * hash + (world != null ? 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));
hash = 19 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32));
@@ -977,6 +1037,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
@Override
public String toString() {
+ World world = (this.world == null) ? null : this.world.get();
return "Location{" + "world=" + world + ",x=" + x + ",y=" + y + ",z=" + z + ",pitch=" + pitch + ",yaw=" + yaw + '}';
}
@@ -1025,11 +1086,15 @@ public class Location implements Cloneable, ConfigurationSerializable {
return NumberConversions.floor(loc);
}
+ @Override
@Utility
@NotNull
public Map serialize() {
Map data = new HashMap();
- data.put("world", this.world.getName());
+
+ if (this.world != null) {
+ data.put("world", getWorld().getName());
+ }
data.put("x", this.x);
data.put("y", this.y);
@@ -1051,9 +1116,12 @@ public class Location implements Cloneable, ConfigurationSerializable {
*/
@NotNull
public static Location deserialize(@NotNull Map args) {
- World world = Bukkit.getWorld((String) args.get("world"));
- if (world == null) {
- throw new IllegalArgumentException("unknown world");
+ World world = null;
+ if (args.containsKey("world")) {
+ world = Bukkit.getWorld((String) args.get("world"));
+ if (world == null) {
+ throw new IllegalArgumentException("unknown world");
+ }
}
return new Location(world, NumberConversions.toDouble(args.get("x")), NumberConversions.toDouble(args.get("y")), NumberConversions.toDouble(args.get("z")), NumberConversions.toFloat(args.get("yaw")), NumberConversions.toFloat(args.get("pitch")));
diff --git a/api/src/main/java/org/bukkit/Material.java b/api/src/main/java/org/bukkit/Material.java
index c628a9349..bb0833f62 100644
--- a/api/src/main/java/org/bukkit/Material.java
+++ b/api/src/main/java/org/bukkit/Material.java
@@ -16,14 +16,17 @@ import org.bukkit.block.data.Lightable;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.block.data.Orientable;
import org.bukkit.block.data.Powerable;
+import org.bukkit.block.data.Rail;
import org.bukkit.block.data.Rotatable;
import org.bukkit.block.data.Snowable;
-import org.bukkit.block.data.Rail;
import org.bukkit.block.data.Waterlogged;
+import org.bukkit.block.data.type.Bamboo;
import org.bukkit.block.data.type.Bed;
+import org.bukkit.block.data.type.Bell;
import org.bukkit.block.data.type.BrewingStand;
import org.bukkit.block.data.type.BubbleColumn;
import org.bukkit.block.data.type.Cake;
+import org.bukkit.block.data.type.Campfire;
import org.bukkit.block.data.type.Chest;
import org.bukkit.block.data.type.Cocoa;
import org.bukkit.block.data.type.CommandBlock;
@@ -43,7 +46,9 @@ import org.bukkit.block.data.type.GlassPane;
import org.bukkit.block.data.type.Hopper;
import org.bukkit.block.data.type.Jukebox;
import org.bukkit.block.data.type.Ladder;
+import org.bukkit.block.data.type.Lantern;
import org.bukkit.block.data.type.Leaves;
+import org.bukkit.block.data.type.Lectern;
import org.bukkit.block.data.type.NoteBlock;
import org.bukkit.block.data.type.Observer;
import org.bukkit.block.data.type.Piston;
@@ -53,6 +58,7 @@ import org.bukkit.block.data.type.RedstoneWallTorch;
import org.bukkit.block.data.type.RedstoneWire;
import org.bukkit.block.data.type.Repeater;
import org.bukkit.block.data.type.Sapling;
+import org.bukkit.block.data.type.Scaffolding;
import org.bukkit.block.data.type.SeaPickle;
import org.bukkit.block.data.type.Sign;
import org.bukkit.block.data.type.Slab;
@@ -111,6 +117,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
ACACIA_SAPLING(20806, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ ACACIA_SIGN(29808, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -123,6 +133,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
ACACIA_TRAPDOOR(18343, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ ACACIA_WALL_SIGN(20316, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -134,6 +148,18 @@ public enum Material implements Keyed {
AIR(9648, 0),
ALLIUM(6871),
ANDESITE(25975),
+ /**
+ * BlockData: {@link Slab}
+ */
+ ANDESITE_SLAB(32124, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ ANDESITE_STAIRS(17747, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ ANDESITE_WALL(14938, Fence.class),
/**
* BlockData: {@link Directional}
*/
@@ -151,6 +177,15 @@ public enum Material implements Keyed {
ATTACHED_PUMPKIN_STEM(12724, Directional.class),
AZURE_BLUET(17608),
BAKED_POTATO(14624),
+ /**
+ * BlockData: {@link Bamboo}
+ */
+ BAMBOO(18728, Bamboo.class),
+ BAMBOO_SAPLING(8478),
+ /**
+ * BlockData: {@link Directional}
+ */
+ BARREL(22396, Directional.class),
BARRIER(26453),
BAT_SPAWN_EGG(14607),
BEACON(6608),
@@ -163,6 +198,10 @@ public enum Material implements Keyed {
BEETROOTS(22075, Ageable.class),
BEETROOT_SEEDS(21282),
BEETROOT_SOUP(16036, 1),
+ /**
+ * BlockData: {@link Bell}
+ */
+ BELL(20000, Bell.class),
BIRCH_BOAT(28104, 1),
/**
* BlockData: {@link Switch}
@@ -197,6 +236,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
BIRCH_SAPLING(31533, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ BIRCH_SIGN(11351, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -209,6 +252,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
BIRCH_TRAPDOOR(32585, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ BIRCH_WALL_SIGN(9887, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -224,6 +271,7 @@ public enum Material implements Keyed {
BLACK_CARPET(6056),
BLACK_CONCRETE(13338),
BLACK_CONCRETE_POWDER(16150),
+ BLACK_DYE(6202),
/**
* BlockData: {@link Directional}
*/
@@ -243,6 +291,10 @@ public enum Material implements Keyed {
*/
BLACK_WALL_BANNER(4919, Directional.class),
BLACK_WOOL(16693),
+ /**
+ * BlockData: {@link Furnace}
+ */
+ BLAST_FURNACE(31157, Furnace.class),
BLAZE_POWDER(18941),
BLAZE_ROD(8289),
BLAZE_SPAWN_EGG(4759),
@@ -257,6 +309,7 @@ public enum Material implements Keyed {
BLUE_CARPET(13292),
BLUE_CONCRETE(18756),
BLUE_CONCRETE_POWDER(17773),
+ BLUE_DYE(11588),
/**
* BlockData: {@link Directional}
*/
@@ -316,6 +369,10 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
BRICK_STAIRS(21534, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ BRICK_WALL(18995, Fence.class),
/**
* BlockData: {@link Rotatable}
*/
@@ -327,6 +384,7 @@ public enum Material implements Keyed {
BROWN_CARPET(23352),
BROWN_CONCRETE(19006),
BROWN_CONCRETE_POWDER(21485),
+ BROWN_DYE(7648),
/**
* BlockData: {@link Directional}
*/
@@ -373,21 +431,26 @@ public enum Material implements Keyed {
* BlockData: {@link Ageable}
*/
CACTUS(12191, Ageable.class),
- CACTUS_GREEN(17296),
/**
* BlockData: {@link Cake}
*/
CAKE(27048, 1, Cake.class),
+ /**
+ * BlockData: {@link Campfire}
+ */
+ CAMPFIRE(8488, Campfire.class),
CARROT(22824),
/**
* BlockData: {@link Ageable}
*/
CARROTS(17258, Ageable.class),
CARROT_ON_A_STICK(27809, 1, 25),
+ CARTOGRAPHY_TABLE(28529),
/**
* BlockData: {@link Directional}
*/
CARVED_PUMPKIN(25833, Directional.class),
+ CAT_SPAWN_EGG(29583),
/**
* BlockData: {@link Levelled}
*/
@@ -466,6 +529,10 @@ public enum Material implements Keyed {
*/
COMPARATOR(18911, Comparator.class),
COMPASS(24139),
+ /**
+ * BlockData: {@link Levelled}
+ */
+ COMPOSTER(31247, Levelled.class),
/**
* BlockData: {@link Waterlogged}
*/
@@ -478,9 +545,11 @@ public enum Material implements Keyed {
COOKED_RABBIT(4454),
COOKED_SALMON(5615),
COOKIE(27431),
+ CORNFLOWER(15405),
COW_SPAWN_EGG(14761),
CRACKED_STONE_BRICKS(27869),
CRAFTING_TABLE(20706),
+ CREEPER_BANNER_PATTERN(15774, 1),
/**
* BlockData: {@link Rotatable}
*/
@@ -490,8 +559,17 @@ public enum Material implements Keyed {
* BlockData: {@link Directional}
*/
CREEPER_WALL_HEAD(30123, Directional.class),
+ CROSSBOW(4340, 1, 326),
CUT_RED_SANDSTONE(26842),
+ /**
+ * BlockData: {@link Slab}
+ */
+ CUT_RED_SANDSTONE_SLAB(7220, Slab.class),
CUT_SANDSTONE(6118),
+ /**
+ * BlockData: {@link Slab}
+ */
+ CUT_SANDSTONE_SLAB(30944, Slab.class),
/**
* BlockData: {@link Rotatable}
*/
@@ -528,7 +606,6 @@ public enum Material implements Keyed {
*/
DAMAGED_ANVIL(10274, Directional.class),
DANDELION(30558),
- DANDELION_YELLOW(21789),
DARK_OAK_BOAT(28618, 1),
/**
* BlockData: {@link Switch}
@@ -563,6 +640,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
DARK_OAK_SAPLING(14933, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ DARK_OAK_SIGN(15127, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -575,6 +656,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
DARK_OAK_TRAPDOOR(10355, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ DARK_OAK_WALL_SIGN(9508, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -677,6 +762,18 @@ public enum Material implements Keyed {
DIAMOND_SHOVEL(25415, 1, 1561),
DIAMOND_SWORD(27707, 1, 1561),
DIORITE(24688),
+ /**
+ * BlockData: {@link Slab}
+ */
+ DIORITE_SLAB(10715, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ DIORITE_STAIRS(13134, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ DIORITE_WALL(17412, Fence.class),
DIRT(10580),
/**
* BlockData: {@link Dispenser}
@@ -731,6 +828,18 @@ public enum Material implements Keyed {
END_ROD(24832, Directional.class),
END_STONE(29686),
END_STONE_BRICKS(20314),
+ /**
+ * BlockData: {@link Slab}
+ */
+ END_STONE_BRICK_SLAB(23239, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ END_STONE_BRICK_STAIRS(28831, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ END_STONE_BRICK_WALL(27225, Fence.class),
EVOKER_SPAWN_EGG(21271),
EXPERIENCE_BOTTLE(12858),
/**
@@ -762,9 +871,12 @@ public enum Material implements Keyed {
*/
FIRE_CORAL_WALL_FAN(20100, CoralWallFan.class),
FISHING_ROD(4167, 1, 64),
+ FLETCHING_TABLE(30838),
FLINT(23596),
FLINT_AND_STEEL(28620, 1, 64),
+ FLOWER_BANNER_PATTERN(5762, 1),
FLOWER_POT(30567),
+ FOX_SPAWN_EGG(22376),
/**
* BlockData: {@link Ageable}
*/
@@ -779,10 +891,11 @@ public enum Material implements Keyed {
GLASS(6195),
GLASS_BOTTLE(6116),
/**
- * BlockData: {@link GlassPane}
+ * BlockData: {@link Fence}
*/
- GLASS_PANE(5709, GlassPane.class),
+ GLASS_PANE(5709, Fence.class),
GLISTERING_MELON_SLICE(20158),
+ GLOBE_BANNER_PATTERN(27753, 1),
GLOWSTONE(32713),
GLOWSTONE_DUST(6665),
GOLDEN_APPLE(27732),
@@ -802,6 +915,18 @@ public enum Material implements Keyed {
GOLD_NUGGET(28814),
GOLD_ORE(32625),
GRANITE(21091),
+ /**
+ * BlockData: {@link Slab}
+ */
+ GRANITE_SLAB(25898, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ GRANITE_STAIRS(21840, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ GRANITE_WALL(23279, Fence.class),
GRASS(6155),
/**
* BlockData: {@link Snowable}
@@ -851,6 +976,7 @@ public enum Material implements Keyed {
GREEN_CARPET(7780),
GREEN_CONCRETE(17949),
GREEN_CONCRETE_POWDER(6904),
+ GREEN_DYE(23215),
/**
* BlockData: {@link Directional}
*/
@@ -870,6 +996,10 @@ public enum Material implements Keyed {
*/
GREEN_WALL_BANNER(15046, Directional.class),
GREEN_WOOL(25085),
+ /**
+ * BlockData: {@link Directional}
+ */
+ GRINDSTONE(26260, Directional.class),
GUARDIAN_SPAWN_EGG(20113),
GUNPOWDER(29974),
/**
@@ -940,6 +1070,10 @@ public enum Material implements Keyed {
* BlockData: {@link Directional}
*/
JACK_O_LANTERN(31612, Directional.class),
+ /**
+ * BlockData: {@link Directional}
+ */
+ JIGSAW(17398, Directional.class),
/**
* BlockData: {@link Jukebox}
*/
@@ -978,6 +1112,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
JUNGLE_SAPLING(17951, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ JUNGLE_SIGN(24717, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -990,6 +1128,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
JUNGLE_TRAPDOOR(8626, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ JUNGLE_WALL_SIGN(29629, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -1004,6 +1146,10 @@ public enum Material implements Keyed {
* BlockData: {@link Ladder}
*/
LADDER(23599, Ladder.class),
+ /**
+ * BlockData: {@link Lantern}
+ */
+ LANTERN(5992, Lantern.class),
LAPIS_BLOCK(14485),
LAPIS_LAZULI(11075),
LAPIS_ORE(22934),
@@ -1021,7 +1167,12 @@ public enum Material implements Keyed {
LEATHER_BOOTS(15282, 1, 65),
LEATHER_CHESTPLATE(29275, 1, 80),
LEATHER_HELMET(11624, 1, 55),
+ LEATHER_HORSE_ARMOR(30667, 1),
LEATHER_LEGGINGS(28210, 1, 75),
+ /**
+ * BlockData: {@link Lectern}
+ */
+ LECTERN(23490, Lectern.class),
/**
* BlockData: {@link Switch}
*/
@@ -1096,6 +1247,7 @@ public enum Material implements Keyed {
* BlockData: {@link Bisected}
*/
LILAC(22837, Bisected.class),
+ LILY_OF_THE_VALLEY(7185),
LILY_PAD(19271),
/**
* BlockData: {@link Rotatable}
@@ -1130,6 +1282,10 @@ public enum Material implements Keyed {
LIME_WOOL(10443),
LINGERING_POTION(25857, 1),
LLAMA_SPAWN_EGG(23640),
+ /**
+ * BlockData: {@link Directional}
+ */
+ LOOM(14276, Directional.class),
/**
* BlockData: {@link Rotatable}
*/
@@ -1174,16 +1330,37 @@ public enum Material implements Keyed {
MELON_STEM(8247, Ageable.class),
MILK_BUCKET(9680, 1),
MINECART(14352, 1),
+ MOJANG_BANNER_PATTERN(11903, 1),
MOOSHROOM_SPAWN_EGG(22125),
/**
* BlockData: {@link MultipleFacing}
*/
MOSSY_COBBLESTONE(21900, MultipleFacing.class),
+ /**
+ * BlockData: {@link Slab}
+ */
+ MOSSY_COBBLESTONE_SLAB(12139, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ MOSSY_COBBLESTONE_STAIRS(29210, Stairs.class),
/**
* BlockData: {@link Fence}
*/
MOSSY_COBBLESTONE_WALL(11536, Fence.class),
MOSSY_STONE_BRICKS(16415),
+ /**
+ * BlockData: {@link Slab}
+ */
+ MOSSY_STONE_BRICK_SLAB(14002, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ MOSSY_STONE_BRICK_STAIRS(27578, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ MOSSY_STONE_BRICK_WALL(18259, Fence.class),
/**
* BlockData: {@link TechnicalPiston}
*/
@@ -1228,6 +1405,10 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
NETHER_BRICK_STAIRS(12085, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ NETHER_BRICK_WALL(10398, Fence.class),
/**
* BlockData: {@link Orientable}
*/
@@ -1277,6 +1458,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
OAK_SAPLING(9636, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ OAK_SIGN(8192, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -1289,6 +1474,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
OAK_TRAPDOOR(16927, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ OAK_WALL_SIGN(12984, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -1334,6 +1523,7 @@ public enum Material implements Keyed {
OXEYE_DAISY(11709),
PACKED_ICE(28993),
PAINTING(23945),
+ PANDA_SPAWN_EGG(23759),
PAPER(9923),
PARROT_SPAWN_EGG(23614),
/**
@@ -1347,6 +1537,7 @@ public enum Material implements Keyed {
PHANTOM_MEMBRANE(18398),
PHANTOM_SPAWN_EGG(24648),
PIG_SPAWN_EGG(22584),
+ PILLAGER_SPAWN_EGG(28659),
/**
* BlockData: {@link Rotatable}
*/
@@ -1402,8 +1593,32 @@ public enum Material implements Keyed {
POISONOUS_POTATO(32640),
POLAR_BEAR_SPAWN_EGG(17015),
POLISHED_ANDESITE(8335),
+ /**
+ * BlockData: {@link Slab}
+ */
+ POLISHED_ANDESITE_SLAB(24573, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ POLISHED_ANDESITE_STAIRS(7573, Stairs.class),
POLISHED_DIORITE(31615),
+ /**
+ * BlockData: {@link Slab}
+ */
+ POLISHED_DIORITE_SLAB(18303, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ POLISHED_DIORITE_STAIRS(4625, Stairs.class),
POLISHED_GRANITE(5477),
+ /**
+ * BlockData: {@link Slab}
+ */
+ POLISHED_GRANITE_SLAB(4521, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ POLISHED_GRANITE_STAIRS(29588, Stairs.class),
POPPED_CHORUS_FRUIT(27844),
POPPY(12851),
PORKCHOP(30896),
@@ -1416,15 +1631,18 @@ public enum Material implements Keyed {
POTTED_ACACIA_SAPLING(14096),
POTTED_ALLIUM(13184),
POTTED_AZURE_BLUET(8754),
+ POTTED_BAMBOO(22542),
POTTED_BIRCH_SAPLING(32484),
POTTED_BLUE_ORCHID(6599),
POTTED_BROWN_MUSHROOM(14481),
POTTED_CACTUS(8777),
+ POTTED_CORNFLOWER(28917),
POTTED_DANDELION(9727),
POTTED_DARK_OAK_SAPLING(6486),
POTTED_DEAD_BUSH(13020),
POTTED_FERN(23315),
POTTED_JUNGLE_SAPLING(7525),
+ POTTED_LILY_OF_THE_VALLEY(9364),
POTTED_OAK_SAPLING(11905),
POTTED_ORANGE_TULIP(28807),
POTTED_OXEYE_DAISY(19707),
@@ -1434,6 +1652,7 @@ public enum Material implements Keyed {
POTTED_RED_TULIP(28594),
POTTED_SPRUCE_SAPLING(29498),
POTTED_WHITE_TULIP(24330),
+ POTTED_WITHER_ROSE(26876),
/**
* BlockData: {@link RedstoneRail}
*/
@@ -1458,9 +1677,13 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
PRISMARINE_STAIRS(19217, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ PRISMARINE_WALL(18184, Fence.class),
PUFFERFISH(8115),
PUFFERFISH_BUCKET(8861, 1),
- PUFFERFISH_SPAWN_EGG(24573),
+ PUFFERFISH_SPAWN_EGG(24570),
PUMPKIN(19170),
PUMPKIN_PIE(28725),
PUMPKIN_SEEDS(28985),
@@ -1535,6 +1758,7 @@ public enum Material implements Keyed {
* BlockData: {@link Rail}
*/
RAIL(13285, Rail.class),
+ RAVAGER_SPAWN_EGG(8726),
REDSTONE(11233),
REDSTONE_BLOCK(19496),
/**
@@ -1568,6 +1792,7 @@ public enum Material implements Keyed {
RED_CARPET(5424),
RED_CONCRETE(8032),
RED_CONCRETE_POWDER(13286),
+ RED_DYE(5728),
/**
* BlockData: {@link Directional}
*/
@@ -1578,6 +1803,18 @@ public enum Material implements Keyed {
*/
RED_MUSHROOM_BLOCK(20766, MultipleFacing.class),
RED_NETHER_BRICKS(18056),
+ /**
+ * BlockData: {@link Slab}
+ */
+ RED_NETHER_BRICK_SLAB(12462, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ RED_NETHER_BRICK_STAIRS(26374, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ RED_NETHER_BRICK_WALL(4580, Fence.class),
RED_SAND(16279),
RED_SANDSTONE(9092),
/**
@@ -1588,6 +1825,10 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
RED_SANDSTONE_STAIRS(25466, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ RED_SANDSTONE_WALL(4753, Fence.class),
/**
* BlockData: {@link Directional}
*/
@@ -1616,7 +1857,6 @@ public enum Material implements Keyed {
* BlockData: {@link Bisected}
*/
ROSE_BUSH(6080, Bisected.class),
- ROSE_RED(15694),
ROTTEN_FLESH(21591),
SADDLE(30206, 1),
SALMON(18516),
@@ -1632,6 +1872,14 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
SANDSTONE_STAIRS(18474, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ SANDSTONE_WALL(18470, Fence.class),
+ /**
+ * BlockData: {@link Scaffolding}
+ */
+ SCAFFOLDING(15757, Scaffolding.class),
SCUTE(11914),
SEAGRASS(23942),
SEA_LANTERN(16984),
@@ -1648,10 +1896,6 @@ public enum Material implements Keyed {
SHULKER_BOX(7776, 1, Directional.class),
SHULKER_SHELL(27848),
SHULKER_SPAWN_EGG(31848),
- /**
- * BlockData: {@link Sign}
- */
- SIGN(16918, 16, Sign.class),
SILVERFISH_SPAWN_EGG(14537),
SKELETON_HORSE_SPAWN_EGG(21356),
/**
@@ -1663,13 +1907,47 @@ public enum Material implements Keyed {
* BlockData: {@link Directional}
*/
SKELETON_WALL_SKULL(31650, Directional.class),
+ SKULL_BANNER_PATTERN(7680, 1),
SLIME_BALL(5242),
SLIME_BLOCK(31892),
SLIME_SPAWN_EGG(6550),
+ SMITHING_TABLE(9082),
+ /**
+ * BlockData: {@link Furnace}
+ */
+ SMOKER(24781, Furnace.class),
SMOOTH_QUARTZ(14415),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SMOOTH_QUARTZ_SLAB(26543, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ SMOOTH_QUARTZ_STAIRS(19560, Stairs.class),
SMOOTH_RED_SANDSTONE(25180),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SMOOTH_RED_SANDSTONE_SLAB(16304, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ SMOOTH_RED_SANDSTONE_STAIRS(17561, Stairs.class),
SMOOTH_SANDSTONE(30039),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SMOOTH_SANDSTONE_SLAB(9030, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ SMOOTH_SANDSTONE_STAIRS(21183, Stairs.class),
SMOOTH_STONE(21910),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SMOOTH_STONE_SLAB(24129, Slab.class),
/**
* BlockData: {@link Snow}
*/
@@ -1717,6 +1995,10 @@ public enum Material implements Keyed {
* BlockData: {@link Sapling}
*/
SPRUCE_SAPLING(19874, Sapling.class),
+ /**
+ * BlockData: {@link Sign}
+ */
+ SPRUCE_SIGN(21502, 16, Sign.class),
/**
* BlockData: {@link Slab}
*/
@@ -1729,6 +2011,10 @@ public enum Material implements Keyed {
* BlockData: {@link TrapDoor}
*/
SPRUCE_TRAPDOOR(10289, TrapDoor.class),
+ /**
+ * BlockData: {@link WallSign}
+ */
+ SPRUCE_WALL_SIGN(7352, 16, WallSign.class),
/**
* BlockData: {@link Orientable}
*/
@@ -1740,6 +2026,10 @@ public enum Material implements Keyed {
*/
STICKY_PISTON(18127, Piston.class),
STONE(22948),
+ /**
+ * BlockData: {@link Directional}
+ */
+ STONECUTTER(25170, Directional.class),
STONE_AXE(6338, 1, 131),
STONE_BRICKS(6962),
/**
@@ -1750,6 +2040,10 @@ public enum Material implements Keyed {
* BlockData: {@link Stairs}
*/
STONE_BRICK_STAIRS(27032, Stairs.class),
+ /**
+ * BlockData: {@link Fence}
+ */
+ STONE_BRICK_WALL(29073, Fence.class),
/**
* BlockData: {@link Switch}
*/
@@ -1765,6 +2059,10 @@ public enum Material implements Keyed {
* BlockData: {@link Slab}
*/
STONE_SLAB(19838, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ STONE_STAIRS(23784, Stairs.class),
STONE_SWORD(25084, 1, 131),
STRAY_SPAWN_EGG(30153),
STRING(12806),
@@ -1830,6 +2128,12 @@ public enum Material implements Keyed {
* BlockData: {@link Bisected}
*/
SUNFLOWER(7408, Bisected.class),
+ SUSPICIOUS_STEW(8173, 1),
+ SWEET_BERRIES(19747),
+ /**
+ * BlockData: {@link Ageable}
+ */
+ SWEET_BERRY_BUSH(11958, Ageable.class),
/**
* BlockData: {@link Bisected}
*/
@@ -1847,6 +2151,7 @@ public enum Material implements Keyed {
TNT_MINECART(4277, 1),
TORCH(6063),
TOTEM_OF_UNDYING(10139, 1),
+ TRADER_LLAMA_SPAWN_EGG(8439),
/**
* BlockData: {@link Chest}
*/
@@ -1890,14 +2195,11 @@ public enum Material implements Keyed {
*/
VINE(14564, MultipleFacing.class),
VOID_AIR(13668),
- /**
- * BlockData: {@link WallSign}
- */
- WALL_SIGN(10644, WallSign.class),
/**
* BlockData: {@link Directional}
*/
WALL_TORCH(25890, Directional.class),
+ WANDERING_TRADER_SPAWN_EGG(17904),
/**
* BlockData: {@link Levelled}
*/
@@ -1920,6 +2222,7 @@ public enum Material implements Keyed {
WHITE_CARPET(15117),
WHITE_CONCRETE(6281),
WHITE_CONCRETE_POWDER(10363),
+ WHITE_DYE(10758),
/**
* BlockData: {@link Directional}
*/
@@ -1941,6 +2244,7 @@ public enum Material implements Keyed {
WHITE_WALL_BANNER(15967, Directional.class),
WHITE_WOOL(8624),
WITCH_SPAWN_EGG(11837),
+ WITHER_ROSE(8619),
/**
* BlockData: {@link Rotatable}
*/
@@ -1969,6 +2273,7 @@ public enum Material implements Keyed {
YELLOW_CARPET(18149),
YELLOW_CONCRETE(15722),
YELLOW_CONCRETE_POWDER(10655),
+ YELLOW_DYE(5952),
/**
* BlockData: {@link Directional}
*/
@@ -2939,7 +3244,7 @@ public enum Material implements Keyed {
private final int id;
private final Constructor extends MaterialData> ctor;
- private final static Map BY_NAME = Maps.newHashMap();
+ private static final Map BY_NAME = Maps.newHashMap();
private final int maxStack;
private final short durability;
public final Class> data;
@@ -3011,6 +3316,7 @@ public enum Material implements Keyed {
*/
@Deprecated
public int getId() {
+ Validate.isTrue(legacy, "Cannot get ID of Modern Material");
return id;
}
@@ -3142,22 +3448,31 @@ public enum Material implements Keyed {
case ACACIA_PLANKS:
case ACACIA_PRESSURE_PLATE:
case ACACIA_SAPLING:
+ case ACACIA_SIGN:
case ACACIA_SLAB:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
+ case ACACIA_WALL_SIGN:
case ACACIA_WOOD:
case ACTIVATOR_RAIL:
case AIR:
case ALLIUM:
case ANDESITE:
+ case ANDESITE_SLAB:
+ case ANDESITE_STAIRS:
+ case ANDESITE_WALL:
case ANVIL:
case ATTACHED_MELON_STEM:
case ATTACHED_PUMPKIN_STEM:
case AZURE_BLUET:
+ case BAMBOO:
+ case BAMBOO_SAPLING:
+ case BARREL:
case BARRIER:
case BEACON:
case BEDROCK:
case BEETROOTS:
+ case BELL:
case BIRCH_BUTTON:
case BIRCH_DOOR:
case BIRCH_FENCE:
@@ -3167,9 +3482,11 @@ public enum Material implements Keyed {
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
case BIRCH_SAPLING:
+ case BIRCH_SIGN:
case BIRCH_SLAB:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
+ case BIRCH_WALL_SIGN:
case BIRCH_WOOD:
case BLACK_BANNER:
case BLACK_BED:
@@ -3183,6 +3500,7 @@ public enum Material implements Keyed {
case BLACK_TERRACOTTA:
case BLACK_WALL_BANNER:
case BLACK_WOOL:
+ case BLAST_FURNACE:
case BLUE_BANNER:
case BLUE_BED:
case BLUE_CARPET:
@@ -3207,6 +3525,7 @@ public enum Material implements Keyed {
case BRICKS:
case BRICK_SLAB:
case BRICK_STAIRS:
+ case BRICK_WALL:
case BROWN_BANNER:
case BROWN_BED:
case BROWN_CARPET:
@@ -3228,7 +3547,9 @@ public enum Material implements Keyed {
case BUBBLE_CORAL_WALL_FAN:
case CACTUS:
case CAKE:
+ case CAMPFIRE:
case CARROTS:
+ case CARTOGRAPHY_TABLE:
case CARVED_PUMPKIN:
case CAULDRON:
case CAVE_AIR:
@@ -3253,13 +3574,17 @@ public enum Material implements Keyed {
case COCOA:
case COMMAND_BLOCK:
case COMPARATOR:
+ case COMPOSTER:
case CONDUIT:
+ case CORNFLOWER:
case CRACKED_STONE_BRICKS:
case CRAFTING_TABLE:
case CREEPER_HEAD:
case CREEPER_WALL_HEAD:
case CUT_RED_SANDSTONE:
+ case CUT_RED_SANDSTONE_SLAB:
case CUT_SANDSTONE:
+ case CUT_SANDSTONE_SLAB:
case CYAN_BANNER:
case CYAN_BED:
case CYAN_CARPET:
@@ -3283,9 +3608,11 @@ public enum Material implements Keyed {
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
case DARK_OAK_SAPLING:
+ case DARK_OAK_SIGN:
case DARK_OAK_SLAB:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
+ case DARK_OAK_WALL_SIGN:
case DARK_OAK_WOOD:
case DARK_PRISMARINE:
case DARK_PRISMARINE_SLAB:
@@ -3316,6 +3643,9 @@ public enum Material implements Keyed {
case DIAMOND_BLOCK:
case DIAMOND_ORE:
case DIORITE:
+ case DIORITE_SLAB:
+ case DIORITE_STAIRS:
+ case DIORITE_WALL:
case DIRT:
case DISPENSER:
case DRAGON_EGG:
@@ -3333,6 +3663,9 @@ public enum Material implements Keyed {
case END_ROD:
case END_STONE:
case END_STONE_BRICKS:
+ case END_STONE_BRICK_SLAB:
+ case END_STONE_BRICK_STAIRS:
+ case END_STONE_BRICK_WALL:
case FARMLAND:
case FERN:
case FIRE:
@@ -3340,6 +3673,7 @@ public enum Material implements Keyed {
case FIRE_CORAL_BLOCK:
case FIRE_CORAL_FAN:
case FIRE_CORAL_WALL_FAN:
+ case FLETCHING_TABLE:
case FLOWER_POT:
case FROSTED_ICE:
case FURNACE:
@@ -3349,6 +3683,9 @@ public enum Material implements Keyed {
case GOLD_BLOCK:
case GOLD_ORE:
case GRANITE:
+ case GRANITE_SLAB:
+ case GRANITE_STAIRS:
+ case GRANITE_WALL:
case GRASS:
case GRASS_BLOCK:
case GRASS_PATH:
@@ -3377,6 +3714,7 @@ public enum Material implements Keyed {
case GREEN_TERRACOTTA:
case GREEN_WALL_BANNER:
case GREEN_WOOL:
+ case GRINDSTONE:
case HAY_BLOCK:
case HEAVY_WEIGHTED_PRESSURE_PLATE:
case HOPPER:
@@ -3397,6 +3735,7 @@ public enum Material implements Keyed {
case IRON_ORE:
case IRON_TRAPDOOR:
case JACK_O_LANTERN:
+ case JIGSAW:
case JUKEBOX:
case JUNGLE_BUTTON:
case JUNGLE_DOOR:
@@ -3407,17 +3746,21 @@ public enum Material implements Keyed {
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
case JUNGLE_SAPLING:
+ case JUNGLE_SIGN:
case JUNGLE_SLAB:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
+ case JUNGLE_WALL_SIGN:
case JUNGLE_WOOD:
case KELP:
case KELP_PLANT:
case LADDER:
+ case LANTERN:
case LAPIS_BLOCK:
case LAPIS_ORE:
case LARGE_FERN:
case LAVA:
+ case LECTERN:
case LEVER:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_BED:
@@ -3445,6 +3788,7 @@ public enum Material implements Keyed {
case LIGHT_GRAY_WOOL:
case LIGHT_WEIGHTED_PRESSURE_PLATE:
case LILAC:
+ case LILY_OF_THE_VALLEY:
case LILY_PAD:
case LIME_BANNER:
case LIME_BED:
@@ -3458,6 +3802,7 @@ public enum Material implements Keyed {
case LIME_TERRACOTTA:
case LIME_WALL_BANNER:
case LIME_WOOL:
+ case LOOM:
case MAGENTA_BANNER:
case MAGENTA_BED:
case MAGENTA_CARPET:
@@ -3474,8 +3819,13 @@ public enum Material implements Keyed {
case MELON:
case MELON_STEM:
case MOSSY_COBBLESTONE:
+ case MOSSY_COBBLESTONE_SLAB:
+ case MOSSY_COBBLESTONE_STAIRS:
case MOSSY_COBBLESTONE_WALL:
case MOSSY_STONE_BRICKS:
+ case MOSSY_STONE_BRICK_SLAB:
+ case MOSSY_STONE_BRICK_STAIRS:
+ case MOSSY_STONE_BRICK_WALL:
case MOVING_PISTON:
case MUSHROOM_STEM:
case MYCELIUM:
@@ -3484,6 +3834,7 @@ public enum Material implements Keyed {
case NETHER_BRICK_FENCE:
case NETHER_BRICK_SLAB:
case NETHER_BRICK_STAIRS:
+ case NETHER_BRICK_WALL:
case NETHER_PORTAL:
case NETHER_QUARTZ_ORE:
case NETHER_WART:
@@ -3498,9 +3849,11 @@ public enum Material implements Keyed {
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
case OAK_SAPLING:
+ case OAK_SIGN:
case OAK_SLAB:
case OAK_STAIRS:
case OAK_TRAPDOOR:
+ case OAK_WALL_SIGN:
case OAK_WOOD:
case OBSERVER:
case OBSIDIAN:
@@ -3540,22 +3893,31 @@ public enum Material implements Keyed {
case PLAYER_WALL_HEAD:
case PODZOL:
case POLISHED_ANDESITE:
+ case POLISHED_ANDESITE_SLAB:
+ case POLISHED_ANDESITE_STAIRS:
case POLISHED_DIORITE:
+ case POLISHED_DIORITE_SLAB:
+ case POLISHED_DIORITE_STAIRS:
case POLISHED_GRANITE:
+ case POLISHED_GRANITE_SLAB:
+ case POLISHED_GRANITE_STAIRS:
case POPPY:
case POTATOES:
case POTTED_ACACIA_SAPLING:
case POTTED_ALLIUM:
case POTTED_AZURE_BLUET:
+ case POTTED_BAMBOO:
case POTTED_BIRCH_SAPLING:
case POTTED_BLUE_ORCHID:
case POTTED_BROWN_MUSHROOM:
case POTTED_CACTUS:
+ case POTTED_CORNFLOWER:
case POTTED_DANDELION:
case POTTED_DARK_OAK_SAPLING:
case POTTED_DEAD_BUSH:
case POTTED_FERN:
case POTTED_JUNGLE_SAPLING:
+ case POTTED_LILY_OF_THE_VALLEY:
case POTTED_OAK_SAPLING:
case POTTED_ORANGE_TULIP:
case POTTED_OXEYE_DAISY:
@@ -3565,6 +3927,7 @@ public enum Material implements Keyed {
case POTTED_RED_TULIP:
case POTTED_SPRUCE_SAPLING:
case POTTED_WHITE_TULIP:
+ case POTTED_WITHER_ROSE:
case POWERED_RAIL:
case PRISMARINE:
case PRISMARINE_BRICKS:
@@ -3572,6 +3935,7 @@ public enum Material implements Keyed {
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_SLAB:
case PRISMARINE_STAIRS:
+ case PRISMARINE_WALL:
case PUMPKIN:
case PUMPKIN_STEM:
case PURPLE_BANNER:
@@ -3610,10 +3974,14 @@ public enum Material implements Keyed {
case RED_MUSHROOM:
case RED_MUSHROOM_BLOCK:
case RED_NETHER_BRICKS:
+ case RED_NETHER_BRICK_SLAB:
+ case RED_NETHER_BRICK_STAIRS:
+ case RED_NETHER_BRICK_WALL:
case RED_SAND:
case RED_SANDSTONE:
case RED_SANDSTONE_SLAB:
case RED_SANDSTONE_STAIRS:
+ case RED_SANDSTONE_WALL:
case RED_SHULKER_BOX:
case RED_STAINED_GLASS:
case RED_STAINED_GLASS_PANE:
@@ -3628,18 +3996,28 @@ public enum Material implements Keyed {
case SANDSTONE:
case SANDSTONE_SLAB:
case SANDSTONE_STAIRS:
+ case SANDSTONE_WALL:
+ case SCAFFOLDING:
case SEAGRASS:
case SEA_LANTERN:
case SEA_PICKLE:
case SHULKER_BOX:
- case SIGN:
case SKELETON_SKULL:
case SKELETON_WALL_SKULL:
case SLIME_BLOCK:
+ case SMITHING_TABLE:
+ case SMOKER:
case SMOOTH_QUARTZ:
+ case SMOOTH_QUARTZ_SLAB:
+ case SMOOTH_QUARTZ_STAIRS:
case SMOOTH_RED_SANDSTONE:
+ case SMOOTH_RED_SANDSTONE_SLAB:
+ case SMOOTH_RED_SANDSTONE_STAIRS:
case SMOOTH_SANDSTONE:
+ case SMOOTH_SANDSTONE_SLAB:
+ case SMOOTH_SANDSTONE_STAIRS:
case SMOOTH_STONE:
+ case SMOOTH_STONE_SLAB:
case SNOW:
case SNOW_BLOCK:
case SOUL_SAND:
@@ -3654,18 +4032,23 @@ public enum Material implements Keyed {
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
case SPRUCE_SAPLING:
+ case SPRUCE_SIGN:
case SPRUCE_SLAB:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
+ case SPRUCE_WALL_SIGN:
case SPRUCE_WOOD:
case STICKY_PISTON:
case STONE:
+ case STONECUTTER:
case STONE_BRICKS:
case STONE_BRICK_SLAB:
case STONE_BRICK_STAIRS:
+ case STONE_BRICK_WALL:
case STONE_BUTTON:
case STONE_PRESSURE_PLATE:
case STONE_SLAB:
+ case STONE_STAIRS:
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
case STRIPPED_BIRCH_LOG:
@@ -3682,6 +4065,7 @@ public enum Material implements Keyed {
case STRUCTURE_VOID:
case SUGAR_CANE:
case SUNFLOWER:
+ case SWEET_BERRY_BUSH:
case TALL_GRASS:
case TALL_SEAGRASS:
case TERRACOTTA:
@@ -3697,7 +4081,6 @@ public enum Material implements Keyed {
case TURTLE_EGG:
case VINE:
case VOID_AIR:
- case WALL_SIGN:
case WALL_TORCH:
case WATER:
case WET_SPONGE:
@@ -3715,6 +4098,7 @@ public enum Material implements Keyed {
case WHITE_TULIP:
case WHITE_WALL_BANNER:
case WHITE_WOOL:
+ case WITHER_ROSE:
case WITHER_SKELETON_SKULL:
case WITHER_SKELETON_WALL_SKULL:
case YELLOW_BANNER:
@@ -3781,6 +4165,8 @@ public enum Material implements Keyed {
case ROTTEN_FLESH:
case SALMON:
case SPIDER_EYE:
+ case SUSPICIOUS_STEW:
+ case SWEET_BERRIES:
case TROPICAL_FISH:
// ----- Legacy Separator -----
case LEGACY_BREAD:
@@ -3948,15 +4334,23 @@ public enum Material implements Keyed {
case ACACIA_LOG:
case ACACIA_PLANKS:
case ACACIA_PRESSURE_PLATE:
+ case ACACIA_SIGN:
case ACACIA_SLAB:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
+ case ACACIA_WALL_SIGN:
case ACACIA_WOOD:
case ANDESITE:
+ case ANDESITE_SLAB:
+ case ANDESITE_STAIRS:
+ case ANDESITE_WALL:
case ANVIL:
+ case BAMBOO:
+ case BARREL:
case BARRIER:
case BEACON:
case BEDROCK:
+ case BELL:
case BIRCH_DOOR:
case BIRCH_FENCE:
case BIRCH_FENCE_GATE:
@@ -3964,9 +4358,11 @@ public enum Material implements Keyed {
case BIRCH_LOG:
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
+ case BIRCH_SIGN:
case BIRCH_SLAB:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
+ case BIRCH_WALL_SIGN:
case BIRCH_WOOD:
case BLACK_BANNER:
case BLACK_BED:
@@ -3979,6 +4375,7 @@ public enum Material implements Keyed {
case BLACK_TERRACOTTA:
case BLACK_WALL_BANNER:
case BLACK_WOOL:
+ case BLAST_FURNACE:
case BLUE_BANNER:
case BLUE_BED:
case BLUE_CONCRETE:
@@ -3998,6 +4395,7 @@ public enum Material implements Keyed {
case BRICKS:
case BRICK_SLAB:
case BRICK_STAIRS:
+ case BRICK_WALL:
case BROWN_BANNER:
case BROWN_BED:
case BROWN_CONCRETE:
@@ -4013,6 +4411,8 @@ public enum Material implements Keyed {
case BUBBLE_CORAL_BLOCK:
case CACTUS:
case CAKE:
+ case CAMPFIRE:
+ case CARTOGRAPHY_TABLE:
case CARVED_PUMPKIN:
case CAULDRON:
case CHAIN_COMMAND_BLOCK:
@@ -4031,11 +4431,14 @@ public enum Material implements Keyed {
case COBBLESTONE_STAIRS:
case COBBLESTONE_WALL:
case COMMAND_BLOCK:
+ case COMPOSTER:
case CONDUIT:
case CRACKED_STONE_BRICKS:
case CRAFTING_TABLE:
case CUT_RED_SANDSTONE:
+ case CUT_RED_SANDSTONE_SLAB:
case CUT_SANDSTONE:
+ case CUT_SANDSTONE_SLAB:
case CYAN_BANNER:
case CYAN_BED:
case CYAN_CONCRETE:
@@ -4055,9 +4458,11 @@ public enum Material implements Keyed {
case DARK_OAK_LOG:
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
+ case DARK_OAK_SIGN:
case DARK_OAK_SLAB:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
+ case DARK_OAK_WALL_SIGN:
case DARK_OAK_WOOD:
case DARK_PRISMARINE:
case DARK_PRISMARINE_SLAB:
@@ -4086,6 +4491,9 @@ public enum Material implements Keyed {
case DIAMOND_BLOCK:
case DIAMOND_ORE:
case DIORITE:
+ case DIORITE_SLAB:
+ case DIORITE_STAIRS:
+ case DIORITE_WALL:
case DIRT:
case DISPENSER:
case DRAGON_EGG:
@@ -4098,8 +4506,12 @@ public enum Material implements Keyed {
case END_PORTAL_FRAME:
case END_STONE:
case END_STONE_BRICKS:
+ case END_STONE_BRICK_SLAB:
+ case END_STONE_BRICK_STAIRS:
+ case END_STONE_BRICK_WALL:
case FARMLAND:
case FIRE_CORAL_BLOCK:
+ case FLETCHING_TABLE:
case FROSTED_ICE:
case FURNACE:
case GLASS:
@@ -4108,6 +4520,9 @@ public enum Material implements Keyed {
case GOLD_BLOCK:
case GOLD_ORE:
case GRANITE:
+ case GRANITE_SLAB:
+ case GRANITE_STAIRS:
+ case GRANITE_WALL:
case GRASS_BLOCK:
case GRASS_PATH:
case GRAVEL:
@@ -4133,6 +4548,7 @@ public enum Material implements Keyed {
case GREEN_TERRACOTTA:
case GREEN_WALL_BANNER:
case GREEN_WOOL:
+ case GRINDSTONE:
case HAY_BLOCK:
case HEAVY_WEIGHTED_PRESSURE_PLATE:
case HOPPER:
@@ -4150,6 +4566,7 @@ public enum Material implements Keyed {
case IRON_ORE:
case IRON_TRAPDOOR:
case JACK_O_LANTERN:
+ case JIGSAW:
case JUKEBOX:
case JUNGLE_DOOR:
case JUNGLE_FENCE:
@@ -4158,12 +4575,16 @@ public enum Material implements Keyed {
case JUNGLE_LOG:
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
+ case JUNGLE_SIGN:
case JUNGLE_SLAB:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
+ case JUNGLE_WALL_SIGN:
case JUNGLE_WOOD:
+ case LANTERN:
case LAPIS_BLOCK:
case LAPIS_ORE:
+ case LECTERN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_BED:
case LIGHT_BLUE_CONCRETE:
@@ -4198,6 +4619,7 @@ public enum Material implements Keyed {
case LIME_TERRACOTTA:
case LIME_WALL_BANNER:
case LIME_WOOL:
+ case LOOM:
case MAGENTA_BANNER:
case MAGENTA_BED:
case MAGENTA_CONCRETE:
@@ -4212,8 +4634,13 @@ public enum Material implements Keyed {
case MAGMA_BLOCK:
case MELON:
case MOSSY_COBBLESTONE:
+ case MOSSY_COBBLESTONE_SLAB:
+ case MOSSY_COBBLESTONE_STAIRS:
case MOSSY_COBBLESTONE_WALL:
case MOSSY_STONE_BRICKS:
+ case MOSSY_STONE_BRICK_SLAB:
+ case MOSSY_STONE_BRICK_STAIRS:
+ case MOSSY_STONE_BRICK_WALL:
case MOVING_PISTON:
case MUSHROOM_STEM:
case MYCELIUM:
@@ -4222,6 +4649,7 @@ public enum Material implements Keyed {
case NETHER_BRICK_FENCE:
case NETHER_BRICK_SLAB:
case NETHER_BRICK_STAIRS:
+ case NETHER_BRICK_WALL:
case NETHER_QUARTZ_ORE:
case NETHER_WART_BLOCK:
case NOTE_BLOCK:
@@ -4232,9 +4660,11 @@ public enum Material implements Keyed {
case OAK_LOG:
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
+ case OAK_SIGN:
case OAK_SLAB:
case OAK_STAIRS:
case OAK_TRAPDOOR:
+ case OAK_WALL_SIGN:
case OAK_WOOD:
case OBSERVER:
case OBSIDIAN:
@@ -4266,14 +4696,21 @@ public enum Material implements Keyed {
case PISTON_HEAD:
case PODZOL:
case POLISHED_ANDESITE:
+ case POLISHED_ANDESITE_SLAB:
+ case POLISHED_ANDESITE_STAIRS:
case POLISHED_DIORITE:
+ case POLISHED_DIORITE_SLAB:
+ case POLISHED_DIORITE_STAIRS:
case POLISHED_GRANITE:
+ case POLISHED_GRANITE_SLAB:
+ case POLISHED_GRANITE_STAIRS:
case PRISMARINE:
case PRISMARINE_BRICKS:
case PRISMARINE_BRICK_SLAB:
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_SLAB:
case PRISMARINE_STAIRS:
+ case PRISMARINE_WALL:
case PUMPKIN:
case PURPLE_BANNER:
case PURPLE_BED:
@@ -4304,10 +4741,14 @@ public enum Material implements Keyed {
case RED_GLAZED_TERRACOTTA:
case RED_MUSHROOM_BLOCK:
case RED_NETHER_BRICKS:
+ case RED_NETHER_BRICK_SLAB:
+ case RED_NETHER_BRICK_STAIRS:
+ case RED_NETHER_BRICK_WALL:
case RED_SAND:
case RED_SANDSTONE:
case RED_SANDSTONE_SLAB:
case RED_SANDSTONE_STAIRS:
+ case RED_SANDSTONE_WALL:
case RED_SHULKER_BOX:
case RED_STAINED_GLASS:
case RED_STAINED_GLASS_PANE:
@@ -4319,14 +4760,23 @@ public enum Material implements Keyed {
case SANDSTONE:
case SANDSTONE_SLAB:
case SANDSTONE_STAIRS:
+ case SANDSTONE_WALL:
case SEA_LANTERN:
case SHULKER_BOX:
- case SIGN:
case SLIME_BLOCK:
+ case SMITHING_TABLE:
+ case SMOKER:
case SMOOTH_QUARTZ:
+ case SMOOTH_QUARTZ_SLAB:
+ case SMOOTH_QUARTZ_STAIRS:
case SMOOTH_RED_SANDSTONE:
+ case SMOOTH_RED_SANDSTONE_SLAB:
+ case SMOOTH_RED_SANDSTONE_STAIRS:
case SMOOTH_SANDSTONE:
+ case SMOOTH_SANDSTONE_SLAB:
+ case SMOOTH_SANDSTONE_STAIRS:
case SMOOTH_STONE:
+ case SMOOTH_STONE_SLAB:
case SNOW_BLOCK:
case SOUL_SAND:
case SPAWNER:
@@ -4338,17 +4788,22 @@ public enum Material implements Keyed {
case SPRUCE_LOG:
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
+ case SPRUCE_SIGN:
case SPRUCE_SLAB:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
+ case SPRUCE_WALL_SIGN:
case SPRUCE_WOOD:
case STICKY_PISTON:
case STONE:
+ case STONECUTTER:
case STONE_BRICKS:
case STONE_BRICK_SLAB:
case STONE_BRICK_STAIRS:
+ case STONE_BRICK_WALL:
case STONE_PRESSURE_PLATE:
case STONE_SLAB:
+ case STONE_STAIRS:
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
case STRIPPED_BIRCH_LOG:
@@ -4367,7 +4822,6 @@ public enum Material implements Keyed {
case TRAPPED_CHEST:
case TUBE_CORAL_BLOCK:
case TURTLE_EGG:
- case WALL_SIGN:
case WET_SPONGE:
case WHITE_BANNER:
case WHITE_BED:
@@ -4598,6 +5052,26 @@ public enum Material implements Keyed {
}
}
+ /**
+ * Check if the material is an air block.
+ *
+ * @return True if this material is an air block.
+ */
+ public boolean isAir() {
+ switch (this) {
+ //
+ case AIR:
+ case CAVE_AIR:
+ case VOID_AIR:
+ // ----- Legacy Separator -----
+ case LEGACY_AIR:
+ //
+ return true;
+ default:
+ return false;
+ }
+ }
+
/**
* Check if the material is a block and does not block any light
*
@@ -4813,10 +5287,15 @@ public enum Material implements Keyed {
case ACACIA_LOG:
case ACACIA_PLANKS:
case ACACIA_PRESSURE_PLATE:
+ case ACACIA_SIGN:
case ACACIA_SLAB:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
+ case ACACIA_WALL_SIGN:
case ACACIA_WOOD:
+ case BAMBOO:
+ case BAMBOO_SAPLING:
+ case BARREL:
case BIRCH_DOOR:
case BIRCH_FENCE:
case BIRCH_FENCE_GATE:
@@ -4824,9 +5303,11 @@ public enum Material implements Keyed {
case BIRCH_LOG:
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
+ case BIRCH_SIGN:
case BIRCH_SLAB:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
+ case BIRCH_WALL_SIGN:
case BIRCH_WOOD:
case BLACK_BANNER:
case BLACK_BED:
@@ -4845,7 +5326,10 @@ public enum Material implements Keyed {
case BROWN_MUSHROOM_BLOCK:
case BROWN_WALL_BANNER:
case BROWN_WOOL:
+ case CAMPFIRE:
+ case CARTOGRAPHY_TABLE:
case CHEST:
+ case COMPOSTER:
case CRAFTING_TABLE:
case CYAN_BANNER:
case CYAN_BED:
@@ -4859,13 +5343,16 @@ public enum Material implements Keyed {
case DARK_OAK_LOG:
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
+ case DARK_OAK_SIGN:
case DARK_OAK_SLAB:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
+ case DARK_OAK_WALL_SIGN:
case DARK_OAK_WOOD:
case DAYLIGHT_DETECTOR:
case DEAD_BUSH:
case FERN:
+ case FLETCHING_TABLE:
case GRASS:
case GRAY_BANNER:
case GRAY_BED:
@@ -4885,11 +5372,14 @@ public enum Material implements Keyed {
case JUNGLE_LOG:
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
+ case JUNGLE_SIGN:
case JUNGLE_SLAB:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
+ case JUNGLE_WALL_SIGN:
case JUNGLE_WOOD:
case LARGE_FERN:
+ case LECTERN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_BED:
case LIGHT_BLUE_CARPET:
@@ -4906,6 +5396,7 @@ public enum Material implements Keyed {
case LIME_CARPET:
case LIME_WALL_BANNER:
case LIME_WOOL:
+ case LOOM:
case MAGENTA_BANNER:
case MAGENTA_BED:
case MAGENTA_CARPET:
@@ -4920,9 +5411,11 @@ public enum Material implements Keyed {
case OAK_LOG:
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
+ case OAK_SIGN:
case OAK_SLAB:
case OAK_STAIRS:
case OAK_TRAPDOOR:
+ case OAK_WALL_SIGN:
case OAK_WOOD:
case ORANGE_BANNER:
case ORANGE_BED:
@@ -4947,7 +5440,7 @@ public enum Material implements Keyed {
case RED_WALL_BANNER:
case RED_WOOL:
case ROSE_BUSH:
- case SIGN:
+ case SMITHING_TABLE:
case SPRUCE_DOOR:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
@@ -4955,9 +5448,11 @@ public enum Material implements Keyed {
case SPRUCE_LOG:
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
+ case SPRUCE_SIGN:
case SPRUCE_SLAB:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
+ case SPRUCE_WALL_SIGN:
case SPRUCE_WOOD:
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
@@ -4976,7 +5471,6 @@ public enum Material implements Keyed {
case TNT:
case TRAPPED_CHEST:
case VINE:
- case WALL_SIGN:
case WHITE_BANNER:
case WHITE_BED:
case WHITE_CARPET:
@@ -5071,6 +5565,7 @@ public enum Material implements Keyed {
case ACACIA_WOOD:
case ALLIUM:
case AZURE_BLUET:
+ case BAMBOO:
case BIRCH_FENCE:
case BIRCH_FENCE_GATE:
case BIRCH_LEAVES:
@@ -5088,6 +5583,8 @@ public enum Material implements Keyed {
case BROWN_CARPET:
case BROWN_WOOL:
case COAL_BLOCK:
+ case COMPOSTER:
+ case CORNFLOWER:
case CYAN_CARPET:
case CYAN_WOOL:
case DANDELION:
@@ -5117,11 +5614,13 @@ public enum Material implements Keyed {
case JUNGLE_STAIRS:
case JUNGLE_WOOD:
case LARGE_FERN:
+ case LECTERN:
case LIGHT_BLUE_CARPET:
case LIGHT_BLUE_WOOL:
case LIGHT_GRAY_CARPET:
case LIGHT_GRAY_WOOL:
case LILAC:
+ case LILY_OF_THE_VALLEY:
case LIME_CARPET:
case LIME_WOOL:
case MAGENTA_CARPET:
@@ -5149,6 +5648,7 @@ public enum Material implements Keyed {
case RED_TULIP:
case RED_WOOL:
case ROSE_BUSH:
+ case SCAFFOLDING:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
case SPRUCE_LEAVES:
@@ -5170,12 +5670,14 @@ public enum Material implements Keyed {
case STRIPPED_SPRUCE_LOG:
case STRIPPED_SPRUCE_WOOD:
case SUNFLOWER:
+ case SWEET_BERRY_BUSH:
case TALL_GRASS:
case TNT:
case VINE:
case WHITE_CARPET:
case WHITE_TULIP:
case WHITE_WOOL:
+ case WITHER_ROSE:
case YELLOW_CARPET:
case YELLOW_WOOL:
// ----- Legacy Separator -----
@@ -5240,10 +5742,13 @@ public enum Material implements Keyed {
case ACACIA_PLANKS:
case ACACIA_PRESSURE_PLATE:
case ACACIA_SAPLING:
+ case ACACIA_SIGN:
case ACACIA_SLAB:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
case ACACIA_WOOD:
+ case BAMBOO:
+ case BARREL:
case BIRCH_BOAT:
case BIRCH_BUTTON:
case BIRCH_DOOR:
@@ -5253,6 +5758,7 @@ public enum Material implements Keyed {
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
case BIRCH_SAPLING:
+ case BIRCH_SIGN:
case BIRCH_SLAB:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
@@ -5270,11 +5776,14 @@ public enum Material implements Keyed {
case BROWN_BANNER:
case BROWN_CARPET:
case BROWN_WOOL:
+ case CARTOGRAPHY_TABLE:
case CHARCOAL:
case CHEST:
case COAL:
case COAL_BLOCK:
+ case COMPOSTER:
case CRAFTING_TABLE:
+ case CROSSBOW:
case CYAN_BANNER:
case CYAN_CARPET:
case CYAN_WOOL:
@@ -5287,13 +5796,16 @@ public enum Material implements Keyed {
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
case DARK_OAK_SAPLING:
+ case DARK_OAK_SIGN:
case DARK_OAK_SLAB:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
case DARK_OAK_WOOD:
case DAYLIGHT_DETECTOR:
+ case DEAD_BUSH:
case DRIED_KELP_BLOCK:
case FISHING_ROD:
+ case FLETCHING_TABLE:
case GRAY_BANNER:
case GRAY_CARPET:
case GRAY_WOOL:
@@ -5310,12 +5822,14 @@ public enum Material implements Keyed {
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
case JUNGLE_SAPLING:
+ case JUNGLE_SIGN:
case JUNGLE_SLAB:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
case JUNGLE_WOOD:
case LADDER:
case LAVA_BUCKET:
+ case LECTERN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_CARPET:
case LIGHT_BLUE_WOOL:
@@ -5325,6 +5839,7 @@ public enum Material implements Keyed {
case LIME_BANNER:
case LIME_CARPET:
case LIME_WOOL:
+ case LOOM:
case MAGENTA_BANNER:
case MAGENTA_CARPET:
case MAGENTA_WOOL:
@@ -5338,6 +5853,7 @@ public enum Material implements Keyed {
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
case OAK_SAPLING:
+ case OAK_SIGN:
case OAK_SLAB:
case OAK_STAIRS:
case OAK_TRAPDOOR:
@@ -5354,7 +5870,8 @@ public enum Material implements Keyed {
case RED_BANNER:
case RED_CARPET:
case RED_WOOL:
- case SIGN:
+ case SCAFFOLDING:
+ case SMITHING_TABLE:
case SPRUCE_BOAT:
case SPRUCE_BUTTON:
case SPRUCE_DOOR:
@@ -5364,6 +5881,7 @@ public enum Material implements Keyed {
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
case SPRUCE_SAPLING:
+ case SPRUCE_SIGN:
case SPRUCE_SLAB:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
@@ -5479,6 +5997,7 @@ public enum Material implements Keyed {
case ACACIA_PLANKS:
case ACACIA_WOOD:
case ANDESITE:
+ case BARREL:
case BARRIER:
case BEDROCK:
case BIRCH_LOG:
@@ -5487,12 +6006,15 @@ public enum Material implements Keyed {
case BLACK_CONCRETE:
case BLACK_CONCRETE_POWDER:
case BLACK_GLAZED_TERRACOTTA:
+ case BLACK_SHULKER_BOX:
case BLACK_TERRACOTTA:
case BLACK_WOOL:
+ case BLAST_FURNACE:
case BLUE_CONCRETE:
case BLUE_CONCRETE_POWDER:
case BLUE_GLAZED_TERRACOTTA:
case BLUE_ICE:
+ case BLUE_SHULKER_BOX:
case BLUE_TERRACOTTA:
case BLUE_WOOL:
case BONE_BLOCK:
@@ -5503,9 +6025,11 @@ public enum Material implements Keyed {
case BROWN_CONCRETE_POWDER:
case BROWN_GLAZED_TERRACOTTA:
case BROWN_MUSHROOM_BLOCK:
+ case BROWN_SHULKER_BOX:
case BROWN_TERRACOTTA:
case BROWN_WOOL:
case BUBBLE_CORAL_BLOCK:
+ case CARTOGRAPHY_TABLE:
case CARVED_PUMPKIN:
case CHAIN_COMMAND_BLOCK:
case CHISELED_QUARTZ_BLOCK:
@@ -5525,6 +6049,7 @@ public enum Material implements Keyed {
case CYAN_CONCRETE:
case CYAN_CONCRETE_POWDER:
case CYAN_GLAZED_TERRACOTTA:
+ case CYAN_SHULKER_BOX:
case CYAN_TERRACOTTA:
case CYAN_WOOL:
case DARK_OAK_LOG:
@@ -5548,6 +6073,7 @@ public enum Material implements Keyed {
case END_STONE:
case END_STONE_BRICKS:
case FIRE_CORAL_BLOCK:
+ case FLETCHING_TABLE:
case FURNACE:
case GOLD_BLOCK:
case GOLD_ORE:
@@ -5557,11 +6083,13 @@ public enum Material implements Keyed {
case GRAY_CONCRETE:
case GRAY_CONCRETE_POWDER:
case GRAY_GLAZED_TERRACOTTA:
+ case GRAY_SHULKER_BOX:
case GRAY_TERRACOTTA:
case GRAY_WOOL:
case GREEN_CONCRETE:
case GREEN_CONCRETE_POWDER:
case GREEN_GLAZED_TERRACOTTA:
+ case GREEN_SHULKER_BOX:
case GREEN_TERRACOTTA:
case GREEN_WOOL:
case HAY_BLOCK:
@@ -5575,6 +6103,7 @@ public enum Material implements Keyed {
case IRON_BLOCK:
case IRON_ORE:
case JACK_O_LANTERN:
+ case JIGSAW:
case JUKEBOX:
case JUNGLE_LOG:
case JUNGLE_PLANKS:
@@ -5584,21 +6113,26 @@ public enum Material implements Keyed {
case LIGHT_BLUE_CONCRETE:
case LIGHT_BLUE_CONCRETE_POWDER:
case LIGHT_BLUE_GLAZED_TERRACOTTA:
+ case LIGHT_BLUE_SHULKER_BOX:
case LIGHT_BLUE_TERRACOTTA:
case LIGHT_BLUE_WOOL:
case LIGHT_GRAY_CONCRETE:
case LIGHT_GRAY_CONCRETE_POWDER:
case LIGHT_GRAY_GLAZED_TERRACOTTA:
+ case LIGHT_GRAY_SHULKER_BOX:
case LIGHT_GRAY_TERRACOTTA:
case LIGHT_GRAY_WOOL:
case LIME_CONCRETE:
case LIME_CONCRETE_POWDER:
case LIME_GLAZED_TERRACOTTA:
+ case LIME_SHULKER_BOX:
case LIME_TERRACOTTA:
case LIME_WOOL:
+ case LOOM:
case MAGENTA_CONCRETE:
case MAGENTA_CONCRETE_POWDER:
case MAGENTA_GLAZED_TERRACOTTA:
+ case MAGENTA_SHULKER_BOX:
case MAGENTA_TERRACOTTA:
case MAGENTA_WOOL:
case MAGMA_BLOCK:
@@ -5619,12 +6153,14 @@ public enum Material implements Keyed {
case ORANGE_CONCRETE:
case ORANGE_CONCRETE_POWDER:
case ORANGE_GLAZED_TERRACOTTA:
+ case ORANGE_SHULKER_BOX:
case ORANGE_TERRACOTTA:
case ORANGE_WOOL:
case PACKED_ICE:
case PINK_CONCRETE:
case PINK_CONCRETE_POWDER:
case PINK_GLAZED_TERRACOTTA:
+ case PINK_SHULKER_BOX:
case PINK_TERRACOTTA:
case PINK_WOOL:
case PODZOL:
@@ -5637,6 +6173,7 @@ public enum Material implements Keyed {
case PURPLE_CONCRETE:
case PURPLE_CONCRETE_POWDER:
case PURPLE_GLAZED_TERRACOTTA:
+ case PURPLE_SHULKER_BOX:
case PURPLE_TERRACOTTA:
case PURPLE_WOOL:
case PURPUR_BLOCK:
@@ -5652,12 +6189,16 @@ public enum Material implements Keyed {
case RED_NETHER_BRICKS:
case RED_SAND:
case RED_SANDSTONE:
+ case RED_SHULKER_BOX:
case RED_TERRACOTTA:
case RED_WOOL:
case REPEATING_COMMAND_BLOCK:
case SAND:
case SANDSTONE:
+ case SHULKER_BOX:
case SLIME_BLOCK:
+ case SMITHING_TABLE:
+ case SMOKER:
case SMOOTH_QUARTZ:
case SMOOTH_RED_SANDSTONE:
case SMOOTH_SANDSTONE:
@@ -5690,11 +6231,13 @@ public enum Material implements Keyed {
case WHITE_CONCRETE:
case WHITE_CONCRETE_POWDER:
case WHITE_GLAZED_TERRACOTTA:
+ case WHITE_SHULKER_BOX:
case WHITE_TERRACOTTA:
case WHITE_WOOL:
case YELLOW_CONCRETE:
case YELLOW_CONCRETE_POWDER:
case YELLOW_GLAZED_TERRACOTTA:
+ case YELLOW_SHULKER_BOX:
case YELLOW_TERRACOTTA:
case YELLOW_WOOL:
// ----- Legacy Separator -----
@@ -5855,9 +6398,12 @@ public enum Material implements Keyed {
public boolean isItem() {
switch (this) {
//
+ case ACACIA_WALL_SIGN:
case ATTACHED_MELON_STEM:
case ATTACHED_PUMPKIN_STEM:
+ case BAMBOO_SAPLING:
case BEETROOTS:
+ case BIRCH_WALL_SIGN:
case BLACK_WALL_BANNER:
case BLUE_WALL_BANNER:
case BRAIN_CORAL_WALL_FAN:
@@ -5869,6 +6415,7 @@ public enum Material implements Keyed {
case COCOA:
case CREEPER_WALL_HEAD:
case CYAN_WALL_BANNER:
+ case DARK_OAK_WALL_SIGN:
case DEAD_BRAIN_CORAL_WALL_FAN:
case DEAD_BUBBLE_CORAL_WALL_FAN:
case DEAD_FIRE_CORAL_WALL_FAN:
@@ -5883,6 +6430,7 @@ public enum Material implements Keyed {
case GRAY_WALL_BANNER:
case GREEN_WALL_BANNER:
case HORN_CORAL_WALL_FAN:
+ case JUNGLE_WALL_SIGN:
case KELP_PLANT:
case LAVA:
case LIGHT_BLUE_WALL_BANNER:
@@ -5892,6 +6440,7 @@ public enum Material implements Keyed {
case MELON_STEM:
case MOVING_PISTON:
case NETHER_PORTAL:
+ case OAK_WALL_SIGN:
case ORANGE_WALL_BANNER:
case PINK_WALL_BANNER:
case PISTON_HEAD:
@@ -5900,15 +6449,18 @@ public enum Material implements Keyed {
case POTTED_ACACIA_SAPLING:
case POTTED_ALLIUM:
case POTTED_AZURE_BLUET:
+ case POTTED_BAMBOO:
case POTTED_BIRCH_SAPLING:
case POTTED_BLUE_ORCHID:
case POTTED_BROWN_MUSHROOM:
case POTTED_CACTUS:
+ case POTTED_CORNFLOWER:
case POTTED_DANDELION:
case POTTED_DARK_OAK_SAPLING:
case POTTED_DEAD_BUSH:
case POTTED_FERN:
case POTTED_JUNGLE_SAPLING:
+ case POTTED_LILY_OF_THE_VALLEY:
case POTTED_OAK_SAPLING:
case POTTED_ORANGE_TULIP:
case POTTED_OXEYE_DAISY:
@@ -5918,17 +6470,19 @@ public enum Material implements Keyed {
case POTTED_RED_TULIP:
case POTTED_SPRUCE_SAPLING:
case POTTED_WHITE_TULIP:
+ case POTTED_WITHER_ROSE:
case PUMPKIN_STEM:
case PURPLE_WALL_BANNER:
case REDSTONE_WALL_TORCH:
case REDSTONE_WIRE:
case RED_WALL_BANNER:
case SKELETON_WALL_SKULL:
+ case SPRUCE_WALL_SIGN:
+ case SWEET_BERRY_BUSH:
case TALL_SEAGRASS:
case TRIPWIRE:
case TUBE_CORAL_WALL_FAN:
case VOID_AIR:
- case WALL_SIGN:
case WALL_TORCH:
case WATER:
case WHITE_WALL_BANNER:
@@ -6018,18 +6572,26 @@ public enum Material implements Keyed {
case ACACIA_DOOR:
case ACACIA_FENCE:
case ACACIA_FENCE_GATE:
+ case ACACIA_SIGN:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
+ case ACACIA_WALL_SIGN:
+ case ANDESITE_STAIRS:
case ANVIL:
+ case BARREL:
case BEACON:
+ case BELL:
case BIRCH_BUTTON:
case BIRCH_DOOR:
case BIRCH_FENCE:
case BIRCH_FENCE_GATE:
+ case BIRCH_SIGN:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
+ case BIRCH_WALL_SIGN:
case BLACK_BED:
case BLACK_SHULKER_BOX:
+ case BLAST_FURNACE:
case BLUE_BED:
case BLUE_SHULKER_BOX:
case BREWING_STAND:
@@ -6037,6 +6599,8 @@ public enum Material implements Keyed {
case BROWN_BED:
case BROWN_SHULKER_BOX:
case CAKE:
+ case CAMPFIRE:
+ case CARTOGRAPHY_TABLE:
case CAULDRON:
case CHAIN_COMMAND_BLOCK:
case CHEST:
@@ -6044,6 +6608,7 @@ public enum Material implements Keyed {
case COBBLESTONE_STAIRS:
case COMMAND_BLOCK:
case COMPARATOR:
+ case COMPOSTER:
case CRAFTING_TABLE:
case CYAN_BED:
case CYAN_SHULKER_BOX:
@@ -6052,31 +6617,42 @@ public enum Material implements Keyed {
case DARK_OAK_DOOR:
case DARK_OAK_FENCE:
case DARK_OAK_FENCE_GATE:
+ case DARK_OAK_SIGN:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
+ case DARK_OAK_WALL_SIGN:
case DARK_PRISMARINE_STAIRS:
case DAYLIGHT_DETECTOR:
+ case DIORITE_STAIRS:
case DISPENSER:
case DRAGON_EGG:
case DROPPER:
case ENCHANTING_TABLE:
case ENDER_CHEST:
+ case END_STONE_BRICK_STAIRS:
+ case FLETCHING_TABLE:
case FLOWER_POT:
case FURNACE:
+ case GRANITE_STAIRS:
case GRAY_BED:
case GRAY_SHULKER_BOX:
case GREEN_BED:
case GREEN_SHULKER_BOX:
+ case GRINDSTONE:
case HOPPER:
case IRON_DOOR:
case IRON_TRAPDOOR:
+ case JIGSAW:
case JUKEBOX:
case JUNGLE_BUTTON:
case JUNGLE_DOOR:
case JUNGLE_FENCE:
case JUNGLE_FENCE_GATE:
+ case JUNGLE_SIGN:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
+ case JUNGLE_WALL_SIGN:
+ case LECTERN:
case LEVER:
case LIGHT_BLUE_BED:
case LIGHT_BLUE_SHULKER_BOX:
@@ -6084,8 +6660,11 @@ public enum Material implements Keyed {
case LIGHT_GRAY_SHULKER_BOX:
case LIME_BED:
case LIME_SHULKER_BOX:
+ case LOOM:
case MAGENTA_BED:
case MAGENTA_SHULKER_BOX:
+ case MOSSY_COBBLESTONE_STAIRS:
+ case MOSSY_STONE_BRICK_STAIRS:
case MOVING_PISTON:
case NETHER_BRICK_FENCE:
case NETHER_BRICK_STAIRS:
@@ -6094,24 +6673,32 @@ public enum Material implements Keyed {
case OAK_DOOR:
case OAK_FENCE:
case OAK_FENCE_GATE:
+ case OAK_SIGN:
case OAK_STAIRS:
case OAK_TRAPDOOR:
+ case OAK_WALL_SIGN:
case ORANGE_BED:
case ORANGE_SHULKER_BOX:
case PINK_BED:
case PINK_SHULKER_BOX:
+ case POLISHED_ANDESITE_STAIRS:
+ case POLISHED_DIORITE_STAIRS:
+ case POLISHED_GRANITE_STAIRS:
case POTTED_ACACIA_SAPLING:
case POTTED_ALLIUM:
case POTTED_AZURE_BLUET:
+ case POTTED_BAMBOO:
case POTTED_BIRCH_SAPLING:
case POTTED_BLUE_ORCHID:
case POTTED_BROWN_MUSHROOM:
case POTTED_CACTUS:
+ case POTTED_CORNFLOWER:
case POTTED_DANDELION:
case POTTED_DARK_OAK_SAPLING:
case POTTED_DEAD_BUSH:
case POTTED_FERN:
case POTTED_JUNGLE_SAPLING:
+ case POTTED_LILY_OF_THE_VALLEY:
case POTTED_OAK_SAPLING:
case POTTED_ORANGE_TULIP:
case POTTED_OXEYE_DAISY:
@@ -6121,6 +6708,7 @@ public enum Material implements Keyed {
case POTTED_RED_TULIP:
case POTTED_SPRUCE_SAPLING:
case POTTED_WHITE_TULIP:
+ case POTTED_WITHER_ROSE:
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_STAIRS:
case PUMPKIN:
@@ -6130,25 +6718,34 @@ public enum Material implements Keyed {
case QUARTZ_STAIRS:
case REDSTONE_ORE:
case RED_BED:
+ case RED_NETHER_BRICK_STAIRS:
case RED_SANDSTONE_STAIRS:
case RED_SHULKER_BOX:
case REPEATER:
case REPEATING_COMMAND_BLOCK:
case SANDSTONE_STAIRS:
case SHULKER_BOX:
- case SIGN:
+ case SMITHING_TABLE:
+ case SMOKER:
+ case SMOOTH_QUARTZ_STAIRS:
+ case SMOOTH_RED_SANDSTONE_STAIRS:
+ case SMOOTH_SANDSTONE_STAIRS:
case SPRUCE_BUTTON:
case SPRUCE_DOOR:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
+ case SPRUCE_SIGN:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
+ case SPRUCE_WALL_SIGN:
+ case STONECUTTER:
case STONE_BRICK_STAIRS:
case STONE_BUTTON:
+ case STONE_STAIRS:
case STRUCTURE_BLOCK:
+ case SWEET_BERRY_BUSH:
case TNT:
case TRAPPED_CHEST:
- case WALL_SIGN:
case WHITE_BED:
case WHITE_SHULKER_BOX:
case YELLOW_BED:
@@ -6180,6 +6777,7 @@ public enum Material implements Keyed {
case END_GATEWAY:
case END_PORTAL:
case END_PORTAL_FRAME:
+ case JIGSAW:
case MOVING_PISTON:
case NETHER_PORTAL:
case REPEATING_COMMAND_BLOCK:
@@ -6330,6 +6928,7 @@ public enum Material implements Keyed {
case YELLOW_CONCRETE_POWDER:
return 0.5F;
case CLAY:
+ case COMPOSTER:
case FARMLAND:
case GRASS_BLOCK:
case GRAVEL:
@@ -6354,6 +6953,9 @@ public enum Material implements Keyed {
case CUT_SANDSTONE:
case CYAN_WOOL:
case END_STONE_BRICKS:
+ case END_STONE_BRICK_SLAB:
+ case END_STONE_BRICK_STAIRS:
+ case END_STONE_BRICK_WALL:
case GRAY_WOOL:
case GREEN_WOOL:
case LIGHT_BLUE_WOOL:
@@ -6369,12 +6971,20 @@ public enum Material implements Keyed {
case QUARTZ_STAIRS:
case RED_SANDSTONE:
case RED_SANDSTONE_STAIRS:
+ case RED_SANDSTONE_WALL:
case RED_WOOL:
case SANDSTONE:
case SANDSTONE_STAIRS:
+ case SANDSTONE_WALL:
case WHITE_WOOL:
case YELLOW_WOOL:
return 0.8F;
+ case ACACIA_SIGN:
+ case ACACIA_WALL_SIGN:
+ case BAMBOO:
+ case BAMBOO_SAPLING:
+ case BIRCH_SIGN:
+ case BIRCH_WALL_SIGN:
case BLACK_BANNER:
case BLACK_WALL_BANNER:
case BLUE_BANNER:
@@ -6386,6 +6996,8 @@ public enum Material implements Keyed {
case CREEPER_WALL_HEAD:
case CYAN_BANNER:
case CYAN_WALL_BANNER:
+ case DARK_OAK_SIGN:
+ case DARK_OAK_WALL_SIGN:
case DRAGON_HEAD:
case DRAGON_WALL_HEAD:
case GRAY_BANNER:
@@ -6393,6 +7005,8 @@ public enum Material implements Keyed {
case GREEN_BANNER:
case GREEN_WALL_BANNER:
case JACK_O_LANTERN:
+ case JUNGLE_SIGN:
+ case JUNGLE_WALL_SIGN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_WALL_BANNER:
case LIGHT_GRAY_BANNER:
@@ -6403,6 +7017,8 @@ public enum Material implements Keyed {
case MAGENTA_WALL_BANNER:
case MELON:
case NETHER_WART_BLOCK:
+ case OAK_SIGN:
+ case OAK_WALL_SIGN:
case ORANGE_BANNER:
case ORANGE_WALL_BANNER:
case PINK_BANNER:
@@ -6414,10 +7030,10 @@ public enum Material implements Keyed {
case PURPLE_WALL_BANNER:
case RED_BANNER:
case RED_WALL_BANNER:
- case SIGN:
case SKELETON_SKULL:
case SKELETON_WALL_SKULL:
- case WALL_SIGN:
+ case SPRUCE_SIGN:
+ case SPRUCE_WALL_SIGN:
case WHITE_BANNER:
case WHITE_WALL_BANNER:
case WITHER_SKELETON_SKULL:
@@ -6463,6 +7079,9 @@ public enum Material implements Keyed {
case YELLOW_GLAZED_TERRACOTTA:
return 1.4F;
case ANDESITE:
+ case ANDESITE_SLAB:
+ case ANDESITE_STAIRS:
+ case ANDESITE_WALL:
case BOOKSHELF:
case BRAIN_CORAL_BLOCK:
case BUBBLE_CORAL_BLOCK:
@@ -6477,25 +7096,43 @@ public enum Material implements Keyed {
case DEAD_HORN_CORAL_BLOCK:
case DEAD_TUBE_CORAL_BLOCK:
case DIORITE:
+ case DIORITE_SLAB:
+ case DIORITE_STAIRS:
+ case DIORITE_WALL:
case FIRE_CORAL_BLOCK:
case GRANITE:
+ case GRANITE_SLAB:
+ case GRANITE_STAIRS:
+ case GRANITE_WALL:
case HORN_CORAL_BLOCK:
case MOSSY_STONE_BRICKS:
+ case MOSSY_STONE_BRICK_SLAB:
+ case MOSSY_STONE_BRICK_STAIRS:
+ case MOSSY_STONE_BRICK_WALL:
case POLISHED_ANDESITE:
+ case POLISHED_ANDESITE_SLAB:
+ case POLISHED_ANDESITE_STAIRS:
case POLISHED_DIORITE:
+ case POLISHED_DIORITE_SLAB:
+ case POLISHED_DIORITE_STAIRS:
case POLISHED_GRANITE:
+ case POLISHED_GRANITE_SLAB:
+ case POLISHED_GRANITE_STAIRS:
case PRISMARINE:
case PRISMARINE_BRICKS:
case PRISMARINE_BRICK_SLAB:
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_SLAB:
case PRISMARINE_STAIRS:
+ case PRISMARINE_WALL:
case PURPUR_BLOCK:
case PURPUR_PILLAR:
case PURPUR_STAIRS:
case STONE:
case STONE_BRICKS:
case STONE_BRICK_STAIRS:
+ case STONE_BRICK_WALL:
+ case STONE_STAIRS:
case TUBE_CORAL_BLOCK:
return 1.5F;
case BLACK_CONCRETE:
@@ -6535,12 +7172,16 @@ public enum Material implements Keyed {
case BRICKS:
case BRICK_SLAB:
case BRICK_STAIRS:
+ case BRICK_WALL:
case BROWN_SHULKER_BOX:
+ case CAMPFIRE:
case CAULDRON:
case COBBLESTONE:
case COBBLESTONE_SLAB:
case COBBLESTONE_STAIRS:
case COBBLESTONE_WALL:
+ case CUT_RED_SANDSTONE_SLAB:
+ case CUT_SANDSTONE_SLAB:
case CYAN_SHULKER_BOX:
case DARK_OAK_FENCE:
case DARK_OAK_FENCE_GATE:
@@ -6551,6 +7192,7 @@ public enum Material implements Keyed {
case DARK_OAK_WOOD:
case GRAY_SHULKER_BOX:
case GREEN_SHULKER_BOX:
+ case GRINDSTONE:
case JUKEBOX:
case JUNGLE_FENCE:
case JUNGLE_FENCE_GATE:
@@ -6564,11 +7206,14 @@ public enum Material implements Keyed {
case LIME_SHULKER_BOX:
case MAGENTA_SHULKER_BOX:
case MOSSY_COBBLESTONE:
+ case MOSSY_COBBLESTONE_SLAB:
+ case MOSSY_COBBLESTONE_STAIRS:
case MOSSY_COBBLESTONE_WALL:
case NETHER_BRICKS:
case NETHER_BRICK_FENCE:
case NETHER_BRICK_SLAB:
case NETHER_BRICK_STAIRS:
+ case NETHER_BRICK_WALL:
case OAK_FENCE:
case OAK_FENCE_GATE:
case OAK_LOG:
@@ -6583,14 +7228,24 @@ public enum Material implements Keyed {
case PURPUR_SLAB:
case QUARTZ_SLAB:
case RED_NETHER_BRICKS:
+ case RED_NETHER_BRICK_SLAB:
+ case RED_NETHER_BRICK_STAIRS:
+ case RED_NETHER_BRICK_WALL:
case RED_SANDSTONE_SLAB:
case RED_SHULKER_BOX:
case SANDSTONE_SLAB:
case SHULKER_BOX:
case SMOOTH_QUARTZ:
+ case SMOOTH_QUARTZ_SLAB:
+ case SMOOTH_QUARTZ_STAIRS:
case SMOOTH_RED_SANDSTONE:
+ case SMOOTH_RED_SANDSTONE_SLAB:
+ case SMOOTH_RED_SANDSTONE_STAIRS:
case SMOOTH_SANDSTONE:
+ case SMOOTH_SANDSTONE_SLAB:
+ case SMOOTH_SANDSTONE_STAIRS:
case SMOOTH_STONE:
+ case SMOOTH_STONE_SLAB:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
case SPRUCE_LOG:
@@ -6615,8 +7270,14 @@ public enum Material implements Keyed {
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
return 2.0F;
+ case BARREL:
+ case CARTOGRAPHY_TABLE:
case CHEST:
case CRAFTING_TABLE:
+ case FLETCHING_TABLE:
+ case LECTERN:
+ case LOOM:
+ case SMITHING_TABLE:
case TRAPPED_CHEST:
return 2.5F;
case BLUE_ICE:
@@ -6650,13 +7311,18 @@ public enum Material implements Keyed {
case SPRUCE_DOOR:
case SPRUCE_TRAPDOOR:
return 3.0F;
+ case BLAST_FURNACE:
case DISPENSER:
case DROPPER:
case FURNACE:
+ case LANTERN:
+ case SMOKER:
+ case STONECUTTER:
return 3.5F;
case COBWEB:
return 4.0F;
case ANVIL:
+ case BELL:
case CHIPPED_ANVIL:
case COAL_BLOCK:
case DAMAGED_ANVIL:
@@ -6840,6 +7506,7 @@ public enum Material implements Keyed {
case YELLOW_CONCRETE_POWDER:
return 0.5F;
case CLAY:
+ case COMPOSTER:
case FARMLAND:
case GRASS_BLOCK:
case GRAVEL:
@@ -6871,6 +7538,9 @@ public enum Material implements Keyed {
case CUT_SANDSTONE:
case CYAN_WOOL:
case END_STONE_BRICKS:
+ case END_STONE_BRICK_SLAB:
+ case END_STONE_BRICK_STAIRS:
+ case END_STONE_BRICK_WALL:
case GRAY_WOOL:
case GREEN_WOOL:
case LIGHT_BLUE_WOOL:
@@ -6886,12 +7556,20 @@ public enum Material implements Keyed {
case QUARTZ_STAIRS:
case RED_SANDSTONE:
case RED_SANDSTONE_STAIRS:
+ case RED_SANDSTONE_WALL:
case RED_WOOL:
case SANDSTONE:
case SANDSTONE_STAIRS:
+ case SANDSTONE_WALL:
case WHITE_WOOL:
case YELLOW_WOOL:
return 0.8F;
+ case ACACIA_SIGN:
+ case ACACIA_WALL_SIGN:
+ case BAMBOO:
+ case BAMBOO_SAPLING:
+ case BIRCH_SIGN:
+ case BIRCH_WALL_SIGN:
case BLACK_BANNER:
case BLACK_WALL_BANNER:
case BLUE_BANNER:
@@ -6903,6 +7581,8 @@ public enum Material implements Keyed {
case CREEPER_WALL_HEAD:
case CYAN_BANNER:
case CYAN_WALL_BANNER:
+ case DARK_OAK_SIGN:
+ case DARK_OAK_WALL_SIGN:
case DRAGON_HEAD:
case DRAGON_WALL_HEAD:
case GRAY_BANNER:
@@ -6910,6 +7590,8 @@ public enum Material implements Keyed {
case GREEN_BANNER:
case GREEN_WALL_BANNER:
case JACK_O_LANTERN:
+ case JUNGLE_SIGN:
+ case JUNGLE_WALL_SIGN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_WALL_BANNER:
case LIGHT_GRAY_BANNER:
@@ -6920,6 +7602,8 @@ public enum Material implements Keyed {
case MAGENTA_WALL_BANNER:
case MELON:
case NETHER_WART_BLOCK:
+ case OAK_SIGN:
+ case OAK_WALL_SIGN:
case ORANGE_BANNER:
case ORANGE_WALL_BANNER:
case PINK_BANNER:
@@ -6931,10 +7615,10 @@ public enum Material implements Keyed {
case PURPLE_WALL_BANNER:
case RED_BANNER:
case RED_WALL_BANNER:
- case SIGN:
case SKELETON_SKULL:
case SKELETON_WALL_SKULL:
- case WALL_SIGN:
+ case SPRUCE_SIGN:
+ case SPRUCE_WALL_SIGN:
case WHITE_BANNER:
case WHITE_WALL_BANNER:
case WITHER_SKELETON_SKULL:
@@ -6988,6 +7672,7 @@ public enum Material implements Keyed {
case BLUE_SHULKER_BOX:
case BONE_BLOCK:
case BROWN_SHULKER_BOX:
+ case CAMPFIRE:
case CAULDRON:
case CYAN_SHULKER_BOX:
case DARK_OAK_LOG:
@@ -7024,9 +7709,15 @@ public enum Material implements Keyed {
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
return 2.0F;
+ case BARREL:
+ case CARTOGRAPHY_TABLE:
case CHEST:
case CRAFTING_TABLE:
case DRIED_KELP_BLOCK:
+ case FLETCHING_TABLE:
+ case LECTERN:
+ case LOOM:
+ case SMITHING_TABLE:
case TRAPPED_CHEST:
return 2.5F;
case BLUE_ICE:
@@ -7087,9 +7778,13 @@ public enum Material implements Keyed {
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
return 3.0F;
+ case BLAST_FURNACE:
case DISPENSER:
case DROPPER:
case FURNACE:
+ case LANTERN:
+ case SMOKER:
+ case STONECUTTER:
return 3.5F;
case COBWEB:
return 4.0F;
@@ -7113,15 +7808,20 @@ public enum Material implements Keyed {
return 4.2F;
case HOPPER:
return 4.8F;
+ case BELL:
case IRON_DOOR:
case IRON_TRAPDOOR:
case SPAWNER:
return 5.0F;
case ANDESITE:
+ case ANDESITE_SLAB:
+ case ANDESITE_STAIRS:
+ case ANDESITE_WALL:
case BRAIN_CORAL_BLOCK:
case BRICKS:
case BRICK_SLAB:
case BRICK_STAIRS:
+ case BRICK_WALL:
case BUBBLE_CORAL_BLOCK:
case CHISELED_STONE_BRICKS:
case COAL_BLOCK:
@@ -7130,6 +7830,8 @@ public enum Material implements Keyed {
case COBBLESTONE_STAIRS:
case COBBLESTONE_WALL:
case CRACKED_STONE_BRICKS:
+ case CUT_RED_SANDSTONE_SLAB:
+ case CUT_SANDSTONE_SLAB:
case DARK_PRISMARINE:
case DARK_PRISMARINE_SLAB:
case DARK_PRISMARINE_STAIRS:
@@ -7140,31 +7842,51 @@ public enum Material implements Keyed {
case DEAD_TUBE_CORAL_BLOCK:
case DIAMOND_BLOCK:
case DIORITE:
+ case DIORITE_SLAB:
+ case DIORITE_STAIRS:
+ case DIORITE_WALL:
case EMERALD_BLOCK:
case FIRE_CORAL_BLOCK:
case GOLD_BLOCK:
case GRANITE:
+ case GRANITE_SLAB:
+ case GRANITE_STAIRS:
+ case GRANITE_WALL:
+ case GRINDSTONE:
case HORN_CORAL_BLOCK:
case IRON_BARS:
case IRON_BLOCK:
case JUKEBOX:
case MOSSY_COBBLESTONE:
+ case MOSSY_COBBLESTONE_SLAB:
+ case MOSSY_COBBLESTONE_STAIRS:
case MOSSY_COBBLESTONE_WALL:
case MOSSY_STONE_BRICKS:
+ case MOSSY_STONE_BRICK_SLAB:
+ case MOSSY_STONE_BRICK_STAIRS:
+ case MOSSY_STONE_BRICK_WALL:
case NETHER_BRICKS:
case NETHER_BRICK_FENCE:
case NETHER_BRICK_SLAB:
case NETHER_BRICK_STAIRS:
+ case NETHER_BRICK_WALL:
case PETRIFIED_OAK_SLAB:
case POLISHED_ANDESITE:
+ case POLISHED_ANDESITE_SLAB:
+ case POLISHED_ANDESITE_STAIRS:
case POLISHED_DIORITE:
+ case POLISHED_DIORITE_SLAB:
+ case POLISHED_DIORITE_STAIRS:
case POLISHED_GRANITE:
+ case POLISHED_GRANITE_SLAB:
+ case POLISHED_GRANITE_STAIRS:
case PRISMARINE:
case PRISMARINE_BRICKS:
case PRISMARINE_BRICK_SLAB:
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_SLAB:
case PRISMARINE_STAIRS:
+ case PRISMARINE_WALL:
case PURPUR_BLOCK:
case PURPUR_PILLAR:
case PURPUR_SLAB:
@@ -7172,17 +7894,29 @@ public enum Material implements Keyed {
case QUARTZ_SLAB:
case REDSTONE_BLOCK:
case RED_NETHER_BRICKS:
+ case RED_NETHER_BRICK_SLAB:
+ case RED_NETHER_BRICK_STAIRS:
+ case RED_NETHER_BRICK_WALL:
case RED_SANDSTONE_SLAB:
case SANDSTONE_SLAB:
case SMOOTH_QUARTZ:
+ case SMOOTH_QUARTZ_SLAB:
+ case SMOOTH_QUARTZ_STAIRS:
case SMOOTH_RED_SANDSTONE:
+ case SMOOTH_RED_SANDSTONE_SLAB:
+ case SMOOTH_RED_SANDSTONE_STAIRS:
case SMOOTH_SANDSTONE:
+ case SMOOTH_SANDSTONE_SLAB:
+ case SMOOTH_SANDSTONE_STAIRS:
case SMOOTH_STONE:
+ case SMOOTH_STONE_SLAB:
case STONE:
case STONE_BRICKS:
case STONE_BRICK_SLAB:
case STONE_BRICK_STAIRS:
+ case STONE_BRICK_WALL:
case STONE_SLAB:
+ case STONE_STAIRS:
case TUBE_CORAL_BLOCK:
return 6.0F;
case DRAGON_EGG:
@@ -7205,6 +7939,7 @@ public enum Material implements Keyed {
case END_GATEWAY:
case END_PORTAL:
case END_PORTAL_FRAME:
+ case JIGSAW:
case REPEATING_COMMAND_BLOCK:
case STRUCTURE_BLOCK:
return 3600000.0F;
diff --git a/api/src/main/java/org/bukkit/NamespacedKey.java b/api/src/main/java/org/bukkit/NamespacedKey.java
index 8648e8fb6..620a962df 100644
--- a/api/src/main/java/org/bukkit/NamespacedKey.java
+++ b/api/src/main/java/org/bukkit/NamespacedKey.java
@@ -39,8 +39,8 @@ public final class NamespacedKey implements com.destroystokyo.paper.Namespaced {
/**
* Create a key in a specific namespace.
*
- * @param namespace String representing a grouping of keys
- * @param key Name for this specific key
+ * @param namespace namespace
+ * @param key key
* @deprecated should never be used by plugins, for internal use only!!
*/
@Deprecated
@@ -72,7 +72,7 @@ public final class NamespacedKey implements com.destroystokyo.paper.Namespaced {
Preconditions.checkArgument(key != null, "Key cannot be null");
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
- this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
+ this.key = key.toLowerCase(Locale.ROOT);
// Check validity after normalization
Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
diff --git a/api/src/main/java/org/bukkit/Note.java b/api/src/main/java/org/bukkit/Note.java
index 6aa02542b..b1c86aefb 100644
--- a/api/src/main/java/org/bukkit/Note.java
+++ b/api/src/main/java/org/bukkit/Note.java
@@ -1,10 +1,8 @@
package org.bukkit;
-import java.util.Map;
-
-import org.apache.commons.lang.Validate;
-
import com.google.common.collect.Maps;
+import java.util.Map;
+import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/api/src/main/java/org/bukkit/OfflinePlayer.java b/api/src/main/java/org/bukkit/OfflinePlayer.java
index 30195c045..3ab914fb2 100644
--- a/api/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/api/src/main/java/org/bukkit/OfflinePlayer.java
@@ -1,7 +1,6 @@
package org.bukkit;
import java.util.UUID;
-
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Player;
@@ -26,6 +25,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
*
* @return Player name or null if we have not seen a name for this player yet
*/
+ @Override
@Nullable
public String getName();
@@ -34,6 +34,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
*
* @return Player UUID
*/
+ @Override
@NotNull
public UUID getUniqueId();
diff --git a/api/src/main/java/org/bukkit/Particle.java b/api/src/main/java/org/bukkit/Particle.java
index a919c6d5b..69aae30a3 100644
--- a/api/src/main/java/org/bukkit/Particle.java
+++ b/api/src/main/java/org/bukkit/Particle.java
@@ -60,6 +60,14 @@ public enum Particle {
BUBBLE_COLUMN_UP,
NAUTILUS,
DOLPHIN,
+ SNEEZE,
+ CAMPFIRE_COSY_SMOKE,
+ CAMPFIRE_SIGNAL_SMOKE,
+ COMPOSTER,
+ FLASH,
+ FALLING_LAVA,
+ LANDING_LAVA,
+ FALLING_WATER,
// ----- Legacy Separator -----
LEGACY_BLOCK_CRACK(MaterialData.class),
LEGACY_BLOCK_DUST(MaterialData.class),
diff --git a/api/src/main/java/org/bukkit/Raid.java b/api/src/main/java/org/bukkit/Raid.java
new file mode 100644
index 000000000..983a8c20a
--- /dev/null
+++ b/api/src/main/java/org/bukkit/Raid.java
@@ -0,0 +1,134 @@
+package org.bukkit;
+
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import org.bukkit.entity.Raider;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a raid event.
+ */
+public interface Raid {
+
+ /**
+ * Get whether this raid started.
+ *
+ * @return whether raid is started
+ */
+ boolean isStarted();
+
+ /**
+ * Gets the amount of ticks this raid has existed.
+ *
+ * @return active ticks
+ */
+ long getActiveTicks();
+
+ /**
+ * Gets the Bad Omen level of this raid.
+ *
+ * @return Bad Omen level (between 0 and 5)
+ */
+ int getBadOmenLevel();
+
+ /**
+ * Sets the Bad Omen level.
+ *
+ * If the level is higher than 1, there will be an additional wave that as
+ * strong as the final wave.
+ *
+ * @param badOmenLevel new Bad Omen level (from 0-5)
+ * @throws IllegalArgumentException if invalid Bad Omen level
+ */
+ void setBadOmenLevel(int badOmenLevel);
+
+ /**
+ * Gets the center location where the raid occurs.
+ *
+ * @return location
+ */
+ @NotNull
+ Location getLocation();
+
+ /**
+ * Gets the current status of the raid.
+ *
+ * Do not use this method to check if the raid has been started, call
+ * {@link #isStarted()} instead.
+ *
+ * @return Raids status
+ */
+ @NotNull
+ RaidStatus getStatus();
+
+ /**
+ * Gets the number of raider groups which have spawned.
+ *
+ * @return total spawned groups
+ */
+ int getSpawnedGroups();
+
+ /**
+ * Gets the number of raider groups which would spawn.
+ *
+ * This also includes the group which spawns in the additional wave (if
+ * present).
+ *
+ * @return total groups
+ */
+ int getTotalGroups();
+
+ /**
+ * Gets the number of waves in this raid (exclude the additional wave).
+ *
+ * @return number of waves
+ */
+ int getTotalWaves();
+
+ /**
+ * Gets the sum of all raider's health.
+ *
+ * @return total raiders health
+ */
+ float getTotalHealth();
+
+ /**
+ * Get the UUID of all heroes in this raid.
+ *
+ * @return a set of unique ids
+ */
+ @NotNull
+ Set getHeroes();
+
+ /**
+ * Gets all remaining {@link Raider} in the present wave.
+ *
+ * @return a list of current raiders
+ */
+ @NotNull
+ List getRaiders();
+
+ /**
+ * Represents the status of a {@link Raid}.
+ */
+ public enum RaidStatus {
+
+ /**
+ * The raid is in progress.
+ */
+ ONGOING,
+ /**
+ * The raid was beaten by heroes.
+ */
+ VICTORY,
+ /**
+ * The village has fallen (i.e. all villagers died).
+ */
+ LOSS,
+ /**
+ * The raid was terminated.
+ */
+ STOPPED;
+ }
+}
diff --git a/api/src/main/java/org/bukkit/Registry.java b/api/src/main/java/org/bukkit/Registry.java
new file mode 100644
index 000000000..9d0d0d745
--- /dev/null
+++ b/api/src/main/java/org/bukkit/Registry.java
@@ -0,0 +1,196 @@
+package org.bukkit;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableMap;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Predicate;
+import org.bukkit.advancement.Advancement;
+import org.bukkit.block.Biome;
+import org.bukkit.boss.KeyedBossBar;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Villager;
+import org.bukkit.entity.memory.MemoryKey;
+import org.bukkit.loot.LootTables;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a registry of Bukkit objects that may be retrieved by
+ * {@link NamespacedKey}.
+ *
+ * @param type of item in the registry
+ */
+public interface Registry extends Iterable {
+
+ /**
+ * Server advancements.
+ *
+ * @see Bukkit#getAdvancement(org.bukkit.NamespacedKey)
+ * @see Bukkit#advancementIterator()
+ */
+ Registry ADVANCEMENT = new Registry() {
+
+ @Nullable
+ @Override
+ public Advancement get(@NotNull NamespacedKey key) {
+ return Bukkit.getAdvancement(key);
+ }
+
+ @NotNull
+ @Override
+ public Iterator iterator() {
+ return Bukkit.advancementIterator();
+ }
+ };
+ /**
+ * Server art.
+ *
+ * @see Art
+ */
+ Registry ART = new SimpleRegistry<>(Art.class);
+ /**
+ * Server biomes.
+ *
+ * @see Biome
+ */
+ Registry BIOME = new SimpleRegistry<>(Biome.class);
+ /**
+ * Custom boss bars.
+ *
+ * @see Bukkit#getBossBar(org.bukkit.NamespacedKey)
+ * @see Bukkit#getBossBars()
+ */
+ Registry BOSS_BARS = new Registry() {
+
+ @Nullable
+ @Override
+ public KeyedBossBar get(@NotNull NamespacedKey key) {
+ return Bukkit.getBossBar(key);
+ }
+
+ @NotNull
+ @Override
+ public Iterator iterator() {
+ return Bukkit.getBossBars();
+ }
+ };
+ /**
+ * Server enchantments.
+ *
+ * @see Enchantment#getByKey(org.bukkit.NamespacedKey)
+ */
+ Registry ENCHANTMENT = new Registry() {
+
+ @Nullable
+ @Override
+ public Enchantment get(@NotNull NamespacedKey key) {
+ return Enchantment.getByKey(key);
+ }
+
+ @NotNull
+ @Override
+ public Iterator iterator() {
+ return Arrays.asList(Enchantment.values()).iterator();
+ }
+ };
+ /**
+ * Server entity types.
+ *
+ * @see EntityType
+ */
+ Registry ENTITY_TYPE = new SimpleRegistry<>(EntityType.class, (entity) -> entity != EntityType.UNKNOWN);
+ /**
+ * Default server loot tables.
+ *
+ * @see LootTables
+ */
+ Registry LOOT_TABLES = new SimpleRegistry<>(LootTables.class);
+ /**
+ * Server materials.
+ *
+ * @see Material
+ */
+ Registry MATERIAL = new SimpleRegistry<>(Material.class, (mat) -> !mat.isLegacy());
+ /**
+ * Server statistics.
+ *
+ * @see Statistic
+ */
+ Registry STATISTIC = new SimpleRegistry<>(Statistic.class);
+ /**
+ * Villager profession.
+ *
+ * @see Villager.Profession
+ */
+ Registry VILLAGER_PROFESSION = new SimpleRegistry<>(Villager.Profession.class);
+ /**
+ * Villager type.
+ *
+ * @see Villager.Type
+ */
+ Registry VILLAGER_TYPE = new SimpleRegistry<>(Villager.Type.class);
+ /**
+ * Memory Keys.
+ *
+ * @see MemoryKey
+ */
+ Registry MEMORY_MODULE_TYPE = new Registry() {
+
+ @NotNull
+ @Override
+ public Iterator iterator() {
+ return MemoryKey.values().iterator();
+ }
+
+ @Nullable
+ @Override
+ public MemoryKey get(@NotNull NamespacedKey key) {
+ return MemoryKey.getByKey(key);
+ }
+ };
+
+ /**
+ * Get the object by its key.
+ *
+ * @param key non-null key
+ * @return item or null if does not exist
+ */
+ @Nullable
+ T get(@NotNull NamespacedKey key);
+
+ static final class SimpleRegistry & Keyed> implements Registry {
+
+ private final Map map;
+
+ protected SimpleRegistry(@NotNull Class type) {
+ this(type, Predicates.alwaysTrue());
+ }
+
+ protected SimpleRegistry(@NotNull Class type, @NotNull Predicate predicate) {
+ ImmutableMap.Builder builder = ImmutableMap.builder();
+
+ for (T entry : type.getEnumConstants()) {
+ if (predicate.test(entry)) {
+ builder.put(entry.getKey(), entry);
+ }
+ }
+
+ map = builder.build();
+ }
+
+ @Nullable
+ @Override
+ public T get(@NotNull NamespacedKey key) {
+ return map.get(key);
+ }
+
+ @NotNull
+ @Override
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+}
diff --git a/api/src/main/java/org/bukkit/SandstoneType.java b/api/src/main/java/org/bukkit/SandstoneType.java
index 3b3a4a7cc..6277451c3 100644
--- a/api/src/main/java/org/bukkit/SandstoneType.java
+++ b/api/src/main/java/org/bukkit/SandstoneType.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -14,7 +13,7 @@ public enum SandstoneType {
SMOOTH(0x2);
private final byte data;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private SandstoneType(final int data) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/Server.java b/api/src/main/java/org/bukkit/Server.java
index eb23417b7..314704790 100644
--- a/api/src/main/java/org/bukkit/Server.java
+++ b/api/src/main/java/org/bukkit/Server.java
@@ -1,5 +1,6 @@
package org.bukkit;
+import com.google.common.collect.ImmutableList;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.Serializable;
@@ -12,8 +13,8 @@ import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.logging.Logger;
-
import org.bukkit.Warning.WarningState;
+import org.bukkit.advancement.Advancement;
import org.bukkit.block.data.BlockData;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
@@ -28,12 +29,15 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.server.ServerListPingEvent;
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.Recipe;
+import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.loot.LootTable;
import org.bukkit.map.MapView;
import org.bukkit.permissions.Permissible;
@@ -44,13 +48,6 @@ import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.util.CachedServerIcon;
-
-import com.google.common.collect.ImmutableList;
-import org.bukkit.advancement.Advancement;
-import org.bukkit.generator.ChunkGenerator;
-
-import org.bukkit.inventory.ItemFactory;
-import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -161,27 +158,6 @@ public interface Server extends PluginMessageRecipient {
@NotNull
public String getIp();
- /**
- * Get the name of this server.
- *
- * @return the name of this server
- * @deprecated not a standard server property
- */
- @Deprecated
- @NotNull
- public String getServerName();
-
- /**
- * Get an ID of this server. The ID is a simple generally alphanumeric ID
- * that can be used for uniquely identifying this server.
- *
- * @return the ID of this server
- * @deprecated not a standard server property
- */
- @Deprecated
- @NotNull
- public String getServerId();
-
/**
* Get world type (level-type setting) for default world.
*
@@ -814,11 +790,9 @@ public interface Server extends PluginMessageRecipient {
public HelpMap getHelpMap();
/**
- * Creates an empty inventory with the specified type and title. If the type
+ * Creates an empty inventory with the specified type. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
- * otherwise the new inventory has the normal size for its type.
- * It should be noted that some inventory types do not support titles and
- * may not render with said titles on the Minecraft client.
+ * otherwise the new inventory has the normal size for its type.
*
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
* created with this method. Use
@@ -1053,12 +1027,12 @@ public interface Server extends PluginMessageRecipient {
/**
* Create a ChunkData for use in a generator.
- *
+ *
* See {@link ChunkGenerator#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}
- *
+ *
* @param world the world to create the ChunkData for
* @return a new ChunkData for the world
- *
+ *
*/
@NotNull
public ChunkGenerator.ChunkData createChunkData(@NotNull World world);
@@ -1305,9 +1279,7 @@ public interface Server extends PluginMessageRecipient {
* no further guarantees are made.
* @throws IllegalArgumentException if the selector is malformed in any way
* or a parameter is null
- * @deprecated draft API
*/
- @Deprecated
@NotNull
List selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException;
@@ -1426,5 +1398,12 @@ public interface Server extends PluginMessageRecipient {
*/
@NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
+
+ /**
+ * Get the current internal server tick
+ *
+ * @return Current tick
+ */
+ int getCurrentTick();
// Paper end
}
diff --git a/api/src/main/java/org/bukkit/Sound.java b/api/src/main/java/org/bukkit/Sound.java
index d84ad5b90..91e5f0f09 100644
--- a/api/src/main/java/org/bukkit/Sound.java
+++ b/api/src/main/java/org/bukkit/Sound.java
@@ -24,22 +24,40 @@ public enum Sound {
BLOCK_ANVIL_PLACE,
BLOCK_ANVIL_STEP,
BLOCK_ANVIL_USE,
+ BLOCK_BAMBOO_BREAK,
+ BLOCK_BAMBOO_FALL,
+ BLOCK_BAMBOO_HIT,
+ BLOCK_BAMBOO_PLACE,
+ BLOCK_BAMBOO_SAPLING_BREAK,
+ BLOCK_BAMBOO_SAPLING_HIT,
+ BLOCK_BAMBOO_SAPLING_PLACE,
+ BLOCK_BAMBOO_STEP,
+ BLOCK_BARREL_CLOSE,
+ BLOCK_BARREL_OPEN,
BLOCK_BEACON_ACTIVATE,
BLOCK_BEACON_AMBIENT,
BLOCK_BEACON_DEACTIVATE,
BLOCK_BEACON_POWER_SELECT,
+ BLOCK_BELL_RESONATE,
+ BLOCK_BELL_USE,
+ BLOCK_BLASTFURNACE_FIRE_CRACKLE,
BLOCK_BREWING_STAND_BREW,
BLOCK_BUBBLE_COLUMN_BUBBLE_POP,
BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT,
BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE,
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT,
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE,
+ BLOCK_CAMPFIRE_CRACKLE,
BLOCK_CHEST_CLOSE,
BLOCK_CHEST_LOCKED,
BLOCK_CHEST_OPEN,
BLOCK_CHORUS_FLOWER_DEATH,
BLOCK_CHORUS_FLOWER_GROW,
BLOCK_COMPARATOR_CLICK,
+ BLOCK_COMPOSTER_EMPTY,
+ BLOCK_COMPOSTER_FILL,
+ BLOCK_COMPOSTER_FILL_SUCCESS,
+ BLOCK_COMPOSTER_READY,
BLOCK_CONDUIT_ACTIVATE,
BLOCK_CONDUIT_AMBIENT,
BLOCK_CONDUIT_AMBIENT_SHORT,
@@ -50,6 +68,7 @@ public enum Sound {
BLOCK_CORAL_BLOCK_HIT,
BLOCK_CORAL_BLOCK_PLACE,
BLOCK_CORAL_BLOCK_STEP,
+ BLOCK_CROP_BREAK,
BLOCK_DISPENSER_DISPENSE,
BLOCK_DISPENSER_FAIL,
BLOCK_DISPENSER_LAUNCH,
@@ -79,6 +98,7 @@ public enum Sound {
BLOCK_GRAVEL_HIT,
BLOCK_GRAVEL_PLACE,
BLOCK_GRAVEL_STEP,
+ BLOCK_GRINDSTONE_USE,
BLOCK_IRON_DOOR_CLOSE,
BLOCK_IRON_DOOR_OPEN,
BLOCK_IRON_TRAPDOOR_CLOSE,
@@ -88,6 +108,11 @@ public enum Sound {
BLOCK_LADDER_HIT,
BLOCK_LADDER_PLACE,
BLOCK_LADDER_STEP,
+ BLOCK_LANTERN_BREAK,
+ BLOCK_LANTERN_FALL,
+ BLOCK_LANTERN_HIT,
+ BLOCK_LANTERN_PLACE,
+ BLOCK_LANTERN_STEP,
BLOCK_LAVA_AMBIENT,
BLOCK_LAVA_EXTINGUISH,
BLOCK_LAVA_POP,
@@ -100,14 +125,20 @@ public enum Sound {
BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF,
BLOCK_METAL_PRESSURE_PLATE_CLICK_ON,
BLOCK_METAL_STEP,
+ BLOCK_NETHER_WART_BREAK,
+ BLOCK_NOTE_BLOCK_BANJO,
BLOCK_NOTE_BLOCK_BASEDRUM,
BLOCK_NOTE_BLOCK_BASS,
BLOCK_NOTE_BLOCK_BELL,
+ BLOCK_NOTE_BLOCK_BIT,
BLOCK_NOTE_BLOCK_CHIME,
+ BLOCK_NOTE_BLOCK_COW_BELL,
+ BLOCK_NOTE_BLOCK_DIDGERIDOO,
BLOCK_NOTE_BLOCK_FLUTE,
BLOCK_NOTE_BLOCK_GUITAR,
BLOCK_NOTE_BLOCK_HARP,
BLOCK_NOTE_BLOCK_HAT,
+ BLOCK_NOTE_BLOCK_IRON_XYLOPHONE,
BLOCK_NOTE_BLOCK_PLING,
BLOCK_NOTE_BLOCK_SNARE,
BLOCK_NOTE_BLOCK_XYLOPHONE,
@@ -123,6 +154,11 @@ public enum Sound {
BLOCK_SAND_HIT,
BLOCK_SAND_PLACE,
BLOCK_SAND_STEP,
+ BLOCK_SCAFFOLDING_BREAK,
+ BLOCK_SCAFFOLDING_FALL,
+ BLOCK_SCAFFOLDING_HIT,
+ BLOCK_SCAFFOLDING_PLACE,
+ BLOCK_SCAFFOLDING_STEP,
BLOCK_SHULKER_BOX_CLOSE,
BLOCK_SHULKER_BOX_OPEN,
BLOCK_SLIME_BLOCK_BREAK,
@@ -130,6 +166,7 @@ public enum Sound {
BLOCK_SLIME_BLOCK_HIT,
BLOCK_SLIME_BLOCK_PLACE,
BLOCK_SLIME_BLOCK_STEP,
+ BLOCK_SMOKER_SMOKE,
BLOCK_SNOW_BREAK,
BLOCK_SNOW_FALL,
BLOCK_SNOW_HIT,
@@ -144,6 +181,8 @@ public enum Sound {
BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF,
BLOCK_STONE_PRESSURE_PLATE_CLICK_ON,
BLOCK_STONE_STEP,
+ BLOCK_SWEET_BERRY_BUSH_BREAK,
+ BLOCK_SWEET_BERRY_BUSH_PLACE,
BLOCK_TRIPWIRE_ATTACH,
BLOCK_TRIPWIRE_CLICK_OFF,
BLOCK_TRIPWIRE_CLICK_ON,
@@ -193,11 +232,14 @@ public enum Sound {
ENTITY_BOAT_PADDLE_LAND,
ENTITY_BOAT_PADDLE_WATER,
ENTITY_CAT_AMBIENT,
+ ENTITY_CAT_BEG_FOR_FOOD,
ENTITY_CAT_DEATH,
+ ENTITY_CAT_EAT,
ENTITY_CAT_HISS,
ENTITY_CAT_HURT,
ENTITY_CAT_PURR,
ENTITY_CAT_PURREOW,
+ ENTITY_CAT_STRAY_AMBIENT,
ENTITY_CHICKEN_AMBIENT,
ENTITY_CHICKEN_DEATH,
ENTITY_CHICKEN_EGG,
@@ -270,6 +312,7 @@ public enum Sound {
ENTITY_ENDER_PEARL_THROW,
ENTITY_EVOKER_AMBIENT,
ENTITY_EVOKER_CAST_SPELL,
+ ENTITY_EVOKER_CELEBRATE,
ENTITY_EVOKER_DEATH,
ENTITY_EVOKER_FANGS_ATTACK,
ENTITY_EVOKER_HURT,
@@ -290,6 +333,16 @@ public enum Sound {
ENTITY_FISHING_BOBBER_SPLASH,
ENTITY_FISHING_BOBBER_THROW,
ENTITY_FISH_SWIM,
+ ENTITY_FOX_AGGRO,
+ ENTITY_FOX_AMBIENT,
+ ENTITY_FOX_BITE,
+ ENTITY_FOX_DEATH,
+ ENTITY_FOX_EAT,
+ ENTITY_FOX_HURT,
+ ENTITY_FOX_SCREECH,
+ ENTITY_FOX_SLEEP,
+ ENTITY_FOX_SNIFF,
+ ENTITY_FOX_SPIT,
ENTITY_GENERIC_BIG_FALL,
ENTITY_GENERIC_BURN,
ENTITY_GENERIC_DEATH,
@@ -380,13 +433,31 @@ public enum Sound {
ENTITY_MAGMA_CUBE_SQUISH_SMALL,
ENTITY_MINECART_INSIDE,
ENTITY_MINECART_RIDING,
+ ENTITY_MOOSHROOM_CONVERT,
+ ENTITY_MOOSHROOM_EAT,
+ ENTITY_MOOSHROOM_MILK,
ENTITY_MOOSHROOM_SHEAR,
+ ENTITY_MOOSHROOM_SUSPICIOUS_MILK,
ENTITY_MULE_AMBIENT,
ENTITY_MULE_CHEST,
ENTITY_MULE_DEATH,
ENTITY_MULE_HURT,
+ ENTITY_OCELOT_AMBIENT,
+ ENTITY_OCELOT_DEATH,
+ ENTITY_OCELOT_HURT,
ENTITY_PAINTING_BREAK,
ENTITY_PAINTING_PLACE,
+ ENTITY_PANDA_AGGRESSIVE_AMBIENT,
+ ENTITY_PANDA_AMBIENT,
+ ENTITY_PANDA_BITE,
+ ENTITY_PANDA_CANT_BREED,
+ ENTITY_PANDA_DEATH,
+ ENTITY_PANDA_EAT,
+ ENTITY_PANDA_HURT,
+ ENTITY_PANDA_PRE_SNEEZE,
+ ENTITY_PANDA_SNEEZE,
+ ENTITY_PANDA_STEP,
+ ENTITY_PANDA_WORRIED_AMBIENT,
ENTITY_PARROT_AMBIENT,
ENTITY_PARROT_DEATH,
ENTITY_PARROT_EAT,
@@ -401,11 +472,15 @@ public enum Sound {
ENTITY_PARROT_IMITATE_ENDER_DRAGON,
ENTITY_PARROT_IMITATE_EVOKER,
ENTITY_PARROT_IMITATE_GHAST,
+ ENTITY_PARROT_IMITATE_GUARDIAN,
ENTITY_PARROT_IMITATE_HUSK,
ENTITY_PARROT_IMITATE_ILLUSIONER,
ENTITY_PARROT_IMITATE_MAGMA_CUBE,
+ ENTITY_PARROT_IMITATE_PANDA,
ENTITY_PARROT_IMITATE_PHANTOM,
+ ENTITY_PARROT_IMITATE_PILLAGER,
ENTITY_PARROT_IMITATE_POLAR_BEAR,
+ ENTITY_PARROT_IMITATE_RAVAGER,
ENTITY_PARROT_IMITATE_SHULKER,
ENTITY_PARROT_IMITATE_SILVERFISH,
ENTITY_PARROT_IMITATE_SKELETON,
@@ -433,6 +508,10 @@ public enum Sound {
ENTITY_PIG_HURT,
ENTITY_PIG_SADDLE,
ENTITY_PIG_STEP,
+ ENTITY_PILLAGER_AMBIENT,
+ ENTITY_PILLAGER_CELEBRATE,
+ ENTITY_PILLAGER_DEATH,
+ ENTITY_PILLAGER_HURT,
ENTITY_PLAYER_ATTACK_CRIT,
ENTITY_PLAYER_ATTACK_KNOCKBACK,
ENTITY_PLAYER_ATTACK_NODAMAGE,
@@ -446,6 +525,7 @@ public enum Sound {
ENTITY_PLAYER_HURT,
ENTITY_PLAYER_HURT_DROWN,
ENTITY_PLAYER_HURT_ON_FIRE,
+ ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH,
ENTITY_PLAYER_LEVELUP,
ENTITY_PLAYER_SMALL_FALL,
ENTITY_PLAYER_SPLASH,
@@ -469,6 +549,14 @@ public enum Sound {
ENTITY_RABBIT_DEATH,
ENTITY_RABBIT_HURT,
ENTITY_RABBIT_JUMP,
+ ENTITY_RAVAGER_AMBIENT,
+ ENTITY_RAVAGER_ATTACK,
+ ENTITY_RAVAGER_CELEBRATE,
+ ENTITY_RAVAGER_DEATH,
+ ENTITY_RAVAGER_HURT,
+ ENTITY_RAVAGER_ROAR,
+ ENTITY_RAVAGER_STEP,
+ ENTITY_RAVAGER_STUNNED,
ENTITY_SALMON_AMBIENT,
ENTITY_SALMON_DEATH,
ENTITY_SALMON_FLOP,
@@ -555,15 +643,41 @@ public enum Sound {
ENTITY_VEX_DEATH,
ENTITY_VEX_HURT,
ENTITY_VILLAGER_AMBIENT,
+ ENTITY_VILLAGER_CELEBRATE,
ENTITY_VILLAGER_DEATH,
ENTITY_VILLAGER_HURT,
ENTITY_VILLAGER_NO,
ENTITY_VILLAGER_TRADE,
+ ENTITY_VILLAGER_WORK_ARMORER,
+ ENTITY_VILLAGER_WORK_BUTCHER,
+ ENTITY_VILLAGER_WORK_CARTOGRAPHER,
+ ENTITY_VILLAGER_WORK_CLERIC,
+ ENTITY_VILLAGER_WORK_FARMER,
+ ENTITY_VILLAGER_WORK_FISHERMAN,
+ ENTITY_VILLAGER_WORK_FLETCHER,
+ ENTITY_VILLAGER_WORK_LEATHERWORKER,
+ ENTITY_VILLAGER_WORK_LIBRARIAN,
+ ENTITY_VILLAGER_WORK_MASON,
+ ENTITY_VILLAGER_WORK_SHEPHERD,
+ ENTITY_VILLAGER_WORK_TOOLSMITH,
+ ENTITY_VILLAGER_WORK_WEAPONSMITH,
ENTITY_VILLAGER_YES,
ENTITY_VINDICATOR_AMBIENT,
+ ENTITY_VINDICATOR_CELEBRATE,
ENTITY_VINDICATOR_DEATH,
ENTITY_VINDICATOR_HURT,
+ ENTITY_WANDERING_TRADER_AMBIENT,
+ ENTITY_WANDERING_TRADER_DEATH,
+ ENTITY_WANDERING_TRADER_DISAPPEARED,
+ ENTITY_WANDERING_TRADER_DRINK_MILK,
+ ENTITY_WANDERING_TRADER_DRINK_POTION,
+ ENTITY_WANDERING_TRADER_HURT,
+ ENTITY_WANDERING_TRADER_NO,
+ ENTITY_WANDERING_TRADER_REAPPEARED,
+ ENTITY_WANDERING_TRADER_TRADE,
+ ENTITY_WANDERING_TRADER_YES,
ENTITY_WITCH_AMBIENT,
+ ENTITY_WITCH_CELEBRATE,
ENTITY_WITCH_DEATH,
ENTITY_WITCH_DRINK,
ENTITY_WITCH_HURT,
@@ -610,6 +724,7 @@ public enum Sound {
ENTITY_ZOMBIE_VILLAGER_DEATH,
ENTITY_ZOMBIE_VILLAGER_HURT,
ENTITY_ZOMBIE_VILLAGER_STEP,
+ EVENT_RAID_HORN,
ITEM_ARMOR_EQUIP_CHAIN,
ITEM_ARMOR_EQUIP_DIAMOND,
ITEM_ARMOR_EQUIP_ELYTRA,
@@ -619,6 +734,8 @@ public enum Sound {
ITEM_ARMOR_EQUIP_LEATHER,
ITEM_ARMOR_EQUIP_TURTLE,
ITEM_AXE_STRIP,
+ ITEM_BOOK_PAGE_TURN,
+ ITEM_BOOK_PUT,
ITEM_BOTTLE_EMPTY,
ITEM_BOTTLE_FILL,
ITEM_BOTTLE_FILL_DRAGONBREATH,
@@ -629,13 +746,24 @@ public enum Sound {
ITEM_BUCKET_FILL_FISH,
ITEM_BUCKET_FILL_LAVA,
ITEM_CHORUS_FRUIT_TELEPORT,
+ ITEM_CROP_PLANT,
+ ITEM_CROSSBOW_HIT,
+ ITEM_CROSSBOW_LOADING_END,
+ ITEM_CROSSBOW_LOADING_MIDDLE,
+ ITEM_CROSSBOW_LOADING_START,
+ ITEM_CROSSBOW_QUICK_CHARGE_1,
+ ITEM_CROSSBOW_QUICK_CHARGE_2,
+ ITEM_CROSSBOW_QUICK_CHARGE_3,
+ ITEM_CROSSBOW_SHOOT,
ITEM_ELYTRA_FLYING,
ITEM_FIRECHARGE_USE,
ITEM_FLINTANDSTEEL_USE,
ITEM_HOE_TILL,
+ ITEM_NETHER_WART_PLANT,
ITEM_SHIELD_BLOCK,
ITEM_SHIELD_BREAK,
ITEM_SHOVEL_FLATTEN,
+ ITEM_SWEET_BERRIES_PICK_FROM_BUSH,
ITEM_TOTEM_USE,
ITEM_TRIDENT_HIT,
ITEM_TRIDENT_HIT_GROUND,
@@ -666,6 +794,11 @@ public enum Sound {
MUSIC_NETHER,
MUSIC_UNDER_WATER,
UI_BUTTON_CLICK,
+ UI_CARTOGRAPHY_TABLE_TAKE_RESULT,
+ UI_LOOM_SELECT_PATTERN,
+ UI_LOOM_TAKE_RESULT,
+ UI_STONECUTTER_SELECT_RECIPE,
+ UI_STONECUTTER_TAKE_RESULT,
UI_TOAST_CHALLENGE_COMPLETE,
UI_TOAST_IN,
UI_TOAST_OUT,
diff --git a/api/src/main/java/org/bukkit/Statistic.java b/api/src/main/java/org/bukkit/Statistic.java
index f5a834fea..c54c00128 100644
--- a/api/src/main/java/org/bukkit/Statistic.java
+++ b/api/src/main/java/org/bukkit/Statistic.java
@@ -1,11 +1,12 @@
package org.bukkit;
+import java.util.Locale;
import org.jetbrains.annotations.NotNull;
/**
* Represents a countable statistic, which is tracked by the server.
*/
-public enum Statistic {
+public enum Statistic implements Keyed {
DAMAGE_DEALT,
DAMAGE_TAKEN,
DEATHS,
@@ -74,9 +75,21 @@ public enum Statistic {
DAMAGE_BLOCKED_BY_SHIELD,
DAMAGE_ABSORBED,
DAMAGE_RESISTED,
- CLEAN_SHULKER_BOX;
+ CLEAN_SHULKER_BOX,
+ OPEN_BARREL,
+ INTERACT_WITH_BLAST_FURNACE,
+ INTERACT_WITH_SMOKER,
+ INTERACT_WITH_LECTERN,
+ INTERACT_WITH_CAMPFIRE,
+ INTERACT_WITH_CARTOGRAPHY_TABLE,
+ INTERACT_WITH_LOOM,
+ INTERACT_WITH_STONECUTTER,
+ BELL_RING,
+ RAID_TRIGGER,
+ RAID_WIN;
private final Type type;
+ private final NamespacedKey key;
private Statistic() {
this(Type.UNTYPED);
@@ -84,6 +97,7 @@ public enum Statistic {
private Statistic(/*@NotNull*/ Type type) {
this.type = type;
+ this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
}
/**
@@ -123,6 +137,12 @@ public enum Statistic {
return type == Type.BLOCK;
}
+ @NotNull
+ @Override
+ public NamespacedKey getKey() {
+ return key;
+ }
+
/**
* The type of statistic.
*
diff --git a/api/src/main/java/org/bukkit/StructureType.java b/api/src/main/java/org/bukkit/StructureType.java
index 02d795451..e062c90ea 100644
--- a/api/src/main/java/org/bukkit/StructureType.java
+++ b/api/src/main/java/org/bukkit/StructureType.java
@@ -2,15 +2,14 @@ package org.bukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
import org.apache.commons.lang.Validate;
import org.bukkit.map.MapCursor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
/**
* This class handles the creation and storage of all structure types for
* Bukkit. Structure Types are the different kinds of structures that can be
@@ -20,7 +19,7 @@ import java.util.Objects;
* The registration of new {@link StructureType}s is case-sensitive.
*/
// Order is retrieved from WorldGenFactory
-public class StructureType {
+public final class StructureType {
private static final Map structureTypeMap = new HashMap<>();
@@ -31,7 +30,7 @@ public class StructureType {
* They are the only place where cave spider spawners and minecarts with
* chests can be found naturally.
*/
- public static final StructureType MINESHAFT = register(new StructureType("Mineshaft", MapCursor.Type.RED_X));
+ public static final StructureType MINESHAFT = register(new StructureType("mineshaft", MapCursor.Type.RED_X));
/**
* Villages are naturally generating structures that form above ground.
@@ -39,7 +38,7 @@ public class StructureType {
* They are usually generated in desert, plains, taiga, and savanna biomes
* and are a site for villager spawns, with whom the player can trade.
*/
- public static final StructureType VILLAGE = register(new StructureType("Village", MapCursor.Type.MANSION));
+ public static final StructureType VILLAGE = register(new StructureType("village", MapCursor.Type.MANSION));
/**
* Nether fortresses are very large complexes that mainly consist of
@@ -48,7 +47,7 @@ public class StructureType {
* They contain blaze spawners, nether wart farms, and loot chests. They are
* only generated in the nether dimension.
*/
- public static final StructureType NETHER_FORTRESS = register(new StructureType("Fortress", MapCursor.Type.RED_X));
+ public static final StructureType NETHER_FORTRESS = register(new StructureType("fortress", MapCursor.Type.RED_X));
/**
* Strongholds are underground structures that consist of many rooms,
@@ -56,7 +55,7 @@ public class StructureType {
*
* They can be found using an {@link Material#ENDER_EYE}.
*/
- public static final StructureType STRONGHOLD = register(new StructureType("Stronghold", MapCursor.Type.MANSION));
+ public static final StructureType STRONGHOLD = register(new StructureType("stronghold", MapCursor.Type.MANSION));
/**
* Jungle pyramids (also known as jungle temples) are found in jungles.
@@ -65,7 +64,7 @@ public class StructureType {
* consist of three floors, with the bottom floor containing treasure
* chests.
*/
- public static final StructureType JUNGLE_PYRAMID = register(new StructureType("Jungle_Pyramid", MapCursor.Type.RED_X));
+ public static final StructureType JUNGLE_PYRAMID = register(new StructureType("jungle_pyramid", MapCursor.Type.RED_X));
/**
* Ocean ruins are clusters of many different blocks that generate
@@ -74,27 +73,27 @@ public class StructureType {
* They come in my different variations. The cold variants consist primarily
* of stone brick, and the warm variants consist of sandstone.
*/
- public static final StructureType OCEAN_RUIN = register(new StructureType("Ocean_Ruin", MapCursor.Type.TEMPLE));
+ public static final StructureType OCEAN_RUIN = register(new StructureType("ocean_ruin", MapCursor.Type.TEMPLE));
/**
* Desert pyramids (also known as desert temples) are found in deserts.
*
* They are usually composed of sandstone and stained terracotta.
*/
- public static final StructureType DESERT_PYRAMID = register(new StructureType("Desert_Pyramid", MapCursor.Type.RED_X));
+ public static final StructureType DESERT_PYRAMID = register(new StructureType("desert_pyramid", MapCursor.Type.RED_X));
/**
* Igloos are structures that generate in snowy biomes.
*
* They consist of the house, as well as a basement.
*/
- public static final StructureType IGLOO = register(new StructureType("Igloo", MapCursor.Type.RED_X));
+ public static final StructureType IGLOO = register(new StructureType("igloo", MapCursor.Type.RED_X));
/**
* Swamp huts (also known as witch huts) generate in swamp biomes and have
* the ability to spawn witches.
*/
- public static final StructureType SWAMP_HUT = register(new StructureType("Swamp_Hut", MapCursor.Type.RED_X));
+ public static final StructureType SWAMP_HUT = register(new StructureType("swamp_hut", MapCursor.Type.RED_X));
/**
* Ocean monuments are underwater structures.
@@ -103,7 +102,7 @@ public class StructureType {
* lanterns. They are the only place guardians and elder guardians spawn
* naturally.
*/
- public static final StructureType OCEAN_MONUMENT = register(new StructureType("Monument", MapCursor.Type.TEMPLE));
+ public static final StructureType OCEAN_MONUMENT = register(new StructureType("monument", MapCursor.Type.TEMPLE));
/**
* End Cities are tall castle-like structures that generate in the outer
@@ -112,7 +111,7 @@ public class StructureType {
* They consist primarily of end stone bricks, purpur blocks, and end rods.
* They are the only place where shulkers can be found.
*/
- public static final StructureType END_CITY = register(new StructureType("EndCity", MapCursor.Type.RED_X));
+ public static final StructureType END_CITY = register(new StructureType("endcity", MapCursor.Type.RED_X));
/**
* Mansions (also known as woodland mansions) are massive house structures
@@ -121,13 +120,13 @@ public class StructureType {
* They are the only place where evokers, vindicators, and vexes spawn
* naturally (but only once)
*/
- public static final StructureType WOODLAND_MANSION = register(new StructureType("Mansion", MapCursor.Type.MANSION));
+ public static final StructureType WOODLAND_MANSION = register(new StructureType("mansion", MapCursor.Type.MANSION));
/**
* Buried treasure consists of a single chest buried in the beach sand or
* gravel, with random loot in it.
*/
- public static final StructureType BURIED_TREASURE = register(new StructureType("Buried_Treasure", MapCursor.Type.RED_X));
+ public static final StructureType BURIED_TREASURE = register(new StructureType("buried_treasure", MapCursor.Type.RED_X));
/**
* Shipwrecks are structures that generate on the floor of oceans or
@@ -136,7 +135,12 @@ public class StructureType {
* They are made up of wood materials, and contain 1-3 loot chests. They can
* generate sideways, upside-down, or upright.
*/
- public static final StructureType SHIPWRECK = register(new StructureType("Shipwreck", MapCursor.Type.RED_X));
+ public static final StructureType SHIPWRECK = register(new StructureType("shipwreck", MapCursor.Type.RED_X));
+
+ /**
+ * Pillager outposts may contain crossbows.
+ */
+ public static final StructureType PILLAGER_OUTPOST = register(new StructureType("pillager_outpost", MapCursor.Type.RED_X));
/* ****************
* STRUCTURE TYPES REGISTERED ABOVE THIS
diff --git a/api/src/main/java/org/bukkit/Tag.java b/api/src/main/java/org/bukkit/Tag.java
index 03d1f2583..1d9021b0b 100644
--- a/api/src/main/java/org/bukkit/Tag.java
+++ b/api/src/main/java/org/bukkit/Tag.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import org.jetbrains.annotations.NotNull;
-
import java.util.Set;
+import org.jetbrains.annotations.NotNull;
/**
* Represents a tag that may be defined by the server or a resource pack to
@@ -57,6 +56,10 @@ public interface Tag extends Keyed {
* Vanilla block tag representing all wooden slabs.
*/
Tag WOODEN_SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_slabs"), Material.class);
+ /**
+ * Vanilla block tag representing all wooden fences.
+ */
+ Tag WOODEN_FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_fences"), Material.class);
/**
* Vanilla block tag representing all wooden pressure plates.
*/
@@ -118,6 +121,10 @@ public interface Tag extends Keyed {
* Vanilla block tag representing all slabs.
*/
Tag SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("slabs"), Material.class);
+ /**
+ * Vanilla block tag representing all walls.
+ */
+ Tag WALLS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("walls"), Material.class);
/**
* Vanilla block tag representing all damaged and undamaged anvils.
*/
@@ -139,6 +146,18 @@ public interface Tag extends Keyed {
* Vanilla block tag representing all empty and filled flower pots.
*/
Tag FLOWER_POTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flower_pots"), Material.class);
+ /**
+ * Vanilla block tag representing all small flowers.
+ */
+ Tag SMALL_FLOWERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("small_flowers"), Material.class);
+ /**
+ * Vanilla block tag representing all beds.
+ */
+ Tag BEDS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beds"), Material.class);
+ /**
+ * Vanilla block tag representing all fences.
+ */
+ Tag FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fences"), Material.class);
/**
* Vanilla block tag denoting blocks that enderman may pick up and hold.
*/
@@ -175,6 +194,26 @@ public interface Tag extends Keyed {
* Vanilla block tag representing all coral.
*/
Tag CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("corals"), Material.class);
+ /**
+ * Vanilla block tag denoting all blocks bamboo may be planted on.
+ */
+ Tag BAMBOO_PLANTABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bamboo_plantable_on"), Material.class);
+ /**
+ * Vanilla block tag denoting dirt like blocks.
+ */
+ Tag DIRT_LIKE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dirt_like"), Material.class);
+ /**
+ * Vanilla block tag representing all standing signs.
+ */
+ Tag STANDING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("standing_signs"), Material.class);
+ /**
+ * Vanilla block tag representing all wall signs.
+ */
+ Tag WALL_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_signs"), Material.class);
+ /**
+ * Vanilla block tag representing all signs.
+ */
+ Tag SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("signs"), Material.class);
/**
* Key for the built in item registry.
*/
@@ -191,6 +230,18 @@ public interface Tag extends Keyed {
* Vanilla item tag representing all fish items.
*/
Tag ITEMS_FISHES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fishes"), Material.class);
+ /**
+ * Vanilla item tag representing all music disc items.
+ */
+ Tag ITEMS_MUSIC_DISCS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("music_discs"), Material.class);
+ /**
+ * Vanilla item tag representing all coal items.
+ */
+ Tag ITEMS_COALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("coals"), Material.class);
+ /**
+ * Vanilla item tag representing all arrow items.
+ */
+ Tag ITEMS_ARROWS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("arrows"), Material.class);
/**
* Returns whether or not this tag has an entry for the specified item.
diff --git a/api/src/main/java/org/bukkit/TravelAgent.java b/api/src/main/java/org/bukkit/TravelAgent.java
deleted file mode 100644
index f1a89e7c8..000000000
--- a/api/src/main/java/org/bukkit/TravelAgent.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.bukkit;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * The Travel Agent handles the creation and the research of Nether and End
- * portals when Entities try to use one.
- *
- * 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/api/src/main/java/org/bukkit/TreeSpecies.java b/api/src/main/java/org/bukkit/TreeSpecies.java
index a18e23a4d..2b177f98a 100644
--- a/api/src/main/java/org/bukkit/TreeSpecies.java
+++ b/api/src/main/java/org/bukkit/TreeSpecies.java
@@ -1,8 +1,7 @@
package org.bukkit;
-import java.util.Map;
-
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
@@ -37,7 +36,7 @@ public enum TreeSpecies {
;
private final byte data;
- private final static Map BY_DATA = Maps.newHashMap();
+ private static final Map BY_DATA = Maps.newHashMap();
private TreeSpecies(final int data) {
this.data = (byte) data;
diff --git a/api/src/main/java/org/bukkit/UnsafeValues.java b/api/src/main/java/org/bukkit/UnsafeValues.java
index f462b631b..b173e2ece 100644
--- a/api/src/main/java/org/bukkit/UnsafeValues.java
+++ b/api/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);
@@ -68,9 +70,22 @@ public interface UnsafeValues {
*/
boolean removeAdvancement(NamespacedKey key);
- // Paper start - Add legacy check util
+ // Paper start
+ /**
+ * Server name to report to timings v2
+ * @return name
+ */
+ String getTimingsServerName();
+
+ /**
+ * Called once by the version command on first use, then cached.
+ */
+ default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
+ return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
+ }
+
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
- return !("1.13".equals(plugin.getDescription().getAPIVersion()));
+ return !"1.13".equals(plugin.getDescription().getAPIVersion()) && !"1.14".equals(plugin.getDescription().getAPIVersion());
}
// Paper end
}
diff --git a/api/src/main/java/org/bukkit/Warning.java b/api/src/main/java/org/bukkit/Warning.java
index f86f25a0d..91c9cb8fa 100644
--- a/api/src/main/java/org/bukkit/Warning.java
+++ b/api/src/main/java/org/bukkit/Warning.java
@@ -1,12 +1,11 @@
package org.bukkit;
+import com.google.common.collect.ImmutableMap;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Map;
-
-import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/api/src/main/java/org/bukkit/World.java b/api/src/main/java/org/bukkit/World.java
index b22895c22..2d22ab30a 100644
--- a/api/src/main/java/org/bukkit/World.java
+++ b/api/src/main/java/org/bukkit/World.java
@@ -10,15 +10,24 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Predicate;
-
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
-import org.bukkit.entity.*;
+import org.bukkit.entity.AbstractArrow;
+import org.bukkit.entity.Arrow;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.LightningStrike;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator;
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.metadata.Metadatable;
+import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.Consumer;
@@ -33,22 +42,6 @@ import org.jetbrains.annotations.Nullable;
*/
public interface World extends PluginMessageRecipient, Metadatable {
- // Akarin start
- /**
- * Get the nearest village of the location in range.
- *
- * @return The nearest village, null if there is no village in range.
- */
- public io.akarin.server.api.structure.Village getNearestVillage(@NotNull Location location, double xRadius, double yRadius, double zRadius);
-
- /**
- * Get villages which are near by the location in range.
- *
- * @return All the villages in range, an empty list if there is no village in range.
- */
- public List getVillagesInRange(@NotNull Location location, double xRadius, double yRadius, double zRadius);
- // Akarin end
-
// Paper start
/**
* @return The amount of Entities in this world
@@ -169,6 +162,79 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public Block getHighestBlockAt(@NotNull Location location);
+ // Paper start - Add heightmap API
+ /**
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
+ *
+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
+ * throwing an {@code UnsupportedOperationException}.
+ *
+ *
+ * @param x The block's x-coordinate.
+ * @param z The block's z-coordinate.
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
+ * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions.
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
+ *
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException;
+
+ /**
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
+ * Note that the y-coordinate of the specified location is ignored.
+ *
+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
+ * throwing an {@code UnsupportedOperationException}.
+ *
+ *
+ * @param location The specified block coordinates.
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
+ * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions.
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap);
+ }
+
+ /**
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
+ *
+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
+ * throwing an {@code UnsupportedOperationException}.
+ *
+ * @param x The block's x-coordinate.
+ * @param z The block's z-coordinate.
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
+ * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions.
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @NotNull
+ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z);
+ }
+
+ /**
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
+ * Note that the y-coordinate of the specified location is ignored.
+ *
+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
+ * throwing an {@code UnsupportedOperationException}.
+ *
+ * @param location The specified block coordinates.
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
+ * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions.
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @NotNull
+ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap);
+ }
+ // Paper end
+
/**
* Gets the {@link Chunk} at the given coordinates
*
@@ -593,7 +659,11 @@ public interface World extends PluginMessageRecipient, Metadatable {
public Chunk[] getLoadedChunks();
/**
- * Loads the specified {@link Chunk}
+ * Loads the specified {@link Chunk}.
+ *
+ * This method will keep the specified chunk loaded until one of the
+ * unload methods is manually called. Callers are advised to instead use
+ * getChunkAt which will only temporarily load the requested chunk.
*
* @param chunk The chunk to load
*/
@@ -625,11 +695,19 @@ 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);
/**
- * Loads the {@link Chunk} at the specified coordinates
+ * Loads the {@link Chunk} at the specified coordinates.
+ *
+ * This method will keep the specified chunk loaded until one of the
+ * unload methods is manually called. Callers are advised to instead use
+ * getChunkAt which will only temporarily load the requested chunk.
*
* If the chunk does not exist, it will be generated.
*
@@ -642,7 +720,11 @@ public interface World extends PluginMessageRecipient, Metadatable {
public void loadChunk(int x, int z);
/**
- * Loads the {@link Chunk} at the specified coordinates
+ * Loads the {@link Chunk} at the specified coordinates.
+ *
+ * This method will keep the specified chunk loaded until one of the
+ * unload methods is manually called. Callers are advised to instead use
+ * getChunkAt which will only temporarily load the requested chunk.
*
* @param x X-coordinate of the chunk
* @param z Z-coordinate of the chunk
@@ -655,8 +737,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
@@ -666,8 +748,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
@@ -677,10 +759,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
@@ -689,27 +768,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
@@ -717,18 +778,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
*
@@ -749,7 +798,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param x X-coordinate of the chunk
* @param z Z-coordinate of the chunk
* @return Whether the chunk was actually refreshed
- *
+ *
* @deprecated This method is not guaranteed to work suitably across all client implementations.
*/
@Deprecated
@@ -775,7 +824,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
*
* @param x X-coordinate of the chunk
* @param z Z-coordinate of the chunk
- * @param forced
+ * @param forced force load status
*/
public void setChunkForceLoaded(int x, int z, boolean forced);
@@ -789,6 +838,94 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public Collection getForceLoadedChunks();
+ /**
+ * Adds a plugin ticket for the specified chunk, loading the chunk if it is
+ * not already loaded.
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param x X-coordinate of the chunk
+ * @param z Z-coordinate of the chunk
+ * @param plugin Plugin which owns the ticket
+ * @return {@code true} if a plugin ticket was added, {@code false} if the
+ * ticket already exists for the plugin
+ * @throws IllegalStateException If the specified plugin is not enabled
+ * @see #removePluginChunkTicket(int, int, Plugin)
+ */
+ public boolean addPluginChunkTicket(int x, int z, @NotNull Plugin plugin);
+
+ /**
+ * Removes the specified plugin's ticket for the specified chunk
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param x X-coordinate of the chunk
+ * @param z Z-coordinate of the chunk
+ * @param plugin Plugin which owns the ticket
+ * @return {@code true} if the plugin ticket was removed, {@code false} if
+ * there is no plugin ticket for the chunk
+ * @see #addPluginChunkTicket(int, int, Plugin)
+ */
+ public boolean removePluginChunkTicket(int x, int z, @NotNull Plugin plugin);
+
+ /**
+ * Removes all plugin tickets for the specified plugin
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param plugin Specified plugin
+ * @see #addPluginChunkTicket(int, int, Plugin)
+ * @see #removePluginChunkTicket(int, int, Plugin)
+ */
+ public void removePluginChunkTickets(@NotNull Plugin plugin);
+
+ /**
+ * Retrieves a collection specifying which plugins have tickets for the
+ * specified chunk. This collection is not updated when plugin tickets are
+ * added or removed to the chunk.
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @param x X-coordinate of the chunk
+ * @param z Z-coordinate of the chunk
+ * @return unmodifiable collection containing which plugins have tickets for
+ * the chunk
+ * @see #addPluginChunkTicket(int, int, Plugin)
+ * @see #removePluginChunkTicket(int, int, Plugin)
+ */
+ @NotNull
+ public Collection getPluginChunkTickets(int x, int z);
+
+ /**
+ * Returns a map of which plugins have tickets for what chunks. The returned
+ * map is not updated when plugin tickets are added or removed to chunks. If
+ * a plugin has no tickets, it will be absent from the map.
+ *
+ * A plugin ticket will prevent a chunk from unloading until it is
+ * explicitly removed. A plugin instance may only have one ticket per chunk,
+ * but each chunk can have multiple plugin tickets.
+ *
+ *
+ * @return unmodifiable map containing which plugins have tickets for what
+ * chunks
+ * @see #addPluginChunkTicket(int, int, Plugin)
+ * @see #removePluginChunkTicket(int, int, Plugin)
+ */
+ @NotNull
+ public Map> getPluginChunkTickets();
+
/**
* Drops an item at the specified {@link Location}
*
@@ -834,7 +971,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @return Arrow entity spawned as a result of this method
*/
@NotNull
- public T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class clazz);
+ public T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class clazz);
/**
* Creates a tree at the given {@link Location}
@@ -916,7 +1053,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
/**
* Get a collection of all entities in this World matching the given
* class/interface
- *
+ *
* @param an entity subclass
* @param cls The class representing the type of entity to match
* @return A List of all Entities currently residing in this world that
@@ -1638,6 +1775,21 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks);
+ /**
+ * Creates explosion at given coordinates with given power and optionally
+ * setting blocks on fire or breaking blocks.
+ *
+ * @param x X coordinate
+ * @param y Y coordinate
+ * @param z Z coordinate
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @param source the source entity, used for tracking damage
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source);
+
/**
* Creates explosion at given coordinates with given power
*
@@ -1738,9 +1890,10 @@ public interface World extends PluginMessageRecipient, Metadatable {
public default boolean createExplosion(@NotNull Entity source, float power) {
return createExplosion(source, source.getLocation(), power, true, true);
}
+ // Paper end
/**
- * Creates explosion at given location with given power and optionally
+ * Creates explosion at given coordinates with given power and optionally
* setting blocks on fire or breaking blocks.
*
* @param loc Location to blow up
@@ -1749,10 +1902,20 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param breakBlocks Whether or not to have blocks be destroyed
* @return false if explosion was canceled, otherwise true
*/
- public default boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
- return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks);
- }
- // Paper end
+ public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks);
+
+ /**
+ * Creates explosion at given coordinates with given power and optionally
+ * setting blocks on fire or breaking blocks.
+ *
+ * @param loc Location to blow up
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @param source the source entity, used for tracking damage
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source);
/**
* Gets the {@link Environment} type of this world
@@ -2230,7 +2393,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
*
* Note: If set to a negative number the world will use the
* server-wide spawn limit instead.
- *
+ *
* @param limit the new mob limit
*/
void setMonsterSpawnLimit(int limit);
@@ -2249,7 +2412,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
*
* Note: If set to a negative number the world will use the
* server-wide spawn limit instead.
- *
+ *
* @param limit the new mob limit
*/
void setAnimalSpawnLimit(int limit);
@@ -2268,7 +2431,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
*
* Note: If set to a negative number the world will use the
* server-wide spawn limit instead.
- *
+ *
* @param limit the new mob limit
*/
void setWaterAnimalSpawnLimit(int limit);
@@ -2287,7 +2450,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
*
* Note: If set to a negative number the world will use the
* server-wide spawn limit instead.
- *
+ *
* @param limit the new mob limit
*/
void setAmbientSpawnLimit(int limit);
@@ -2457,6 +2620,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* Spawns the particle (the number of times specified by count)
* at the target location.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param location the location to spawn at
* @param count the number of particles
@@ -2471,6 +2635,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* Spawns the particle (the number of times specified by count)
* at the target location.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param x the position on the x axis to spawn at
* @param y the position on the y axis to spawn at
@@ -2520,6 +2685,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param location the location to spawn at
* @param count the number of particles
@@ -2538,6 +2704,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param x the position on the x axis to spawn at
* @param y the position on the y axis to spawn at
@@ -2594,6 +2761,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param location the location to spawn at
* @param count the number of particles
@@ -2614,6 +2782,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param x the position on the x axis to spawn at
* @param y the position on the y axis to spawn at
@@ -2686,6 +2855,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param location the location to spawn at
* @param count the number of particles
@@ -2709,6 +2879,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* randomized positively and negatively by the offset parameters
* on each axis.
*
+ * @param type of particle data (see {@link Particle#getDataType()}
* @param particle the particle to spawn
* @param x the position on the x axis to spawn at
* @param y the position on the y axis to spawn at
@@ -2755,6 +2926,15 @@ public interface World extends PluginMessageRecipient, Metadatable {
@Nullable
public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored);
+ // Spigot start
+ /**
+ * Returns the view distance used for this world.
+ *
+ * @return the view distance used for this world
+ */
+ int getViewDistance();
+ // Spigot end
+
// Spigot start
public class Spigot
{
@@ -2790,6 +2970,24 @@ public interface World extends PluginMessageRecipient, Metadatable {
Spigot spigot();
// Spigot end
+ /**
+ * Finds the nearest raid close to the given location.
+ *
+ * @param location the origin location
+ * @param radius the radius
+ * @return the closest {@link Raid}, or null if no raids were found
+ */
+ @Nullable
+ public Raid locateNearestRaid(@NotNull Location location, int radius);
+
+ /**
+ * Gets all raids that are going on over this world.
+ *
+ * @return the list of all active raids
+ */
+ @NotNull
+ public List getRaids();
+
/**
* Represents various map environment types that a world may be
*/
diff --git a/api/src/main/java/org/bukkit/WorldCreator.java b/api/src/main/java/org/bukkit/WorldCreator.java
index a9b29b6e2..435fce5b0 100644
--- a/api/src/main/java/org/bukkit/WorldCreator.java
+++ b/api/src/main/java/org/bukkit/WorldCreator.java
@@ -48,6 +48,8 @@ public class WorldCreator {
seed = world.getSeed();
environment = world.getEnvironment();
generator = world.getGenerator();
+ type = world.getWorldType();
+ generateStructures = world.canGenerateStructures();
return this;
}
@@ -67,6 +69,9 @@ public class WorldCreator {
seed = creator.seed();
environment = creator.environment();
generator = creator.generator();
+ type = creator.type();
+ generateStructures = creator.generateStructures();
+ generatorSettings = creator.generatorSettings();
return this;
}
diff --git a/api/src/main/java/org/bukkit/WorldType.java b/api/src/main/java/org/bukkit/WorldType.java
index e82fe0767..f98b13e71 100644
--- a/api/src/main/java/org/bukkit/WorldType.java
+++ b/api/src/main/java/org/bukkit/WorldType.java
@@ -1,11 +1,10 @@
package org.bukkit;
import com.google.common.collect.Maps;
+import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.Map;
-
/**
* Represents various types of worlds that may exist
*/
@@ -18,7 +17,7 @@ public enum WorldType {
CUSTOMIZED("CUSTOMIZED"),
BUFFET("BUFFET");
- private final static Map BY_NAME = Maps.newHashMap();
+ private static final Map BY_NAME = Maps.newHashMap();
private final String name;
private WorldType(/*@NotNull*/ String name) {
diff --git a/api/src/main/java/org/bukkit/advancement/AdvancementProgress.java b/api/src/main/java/org/bukkit/advancement/AdvancementProgress.java
index 00823dc9b..f9bc179da 100644
--- a/api/src/main/java/org/bukkit/advancement/AdvancementProgress.java
+++ b/api/src/main/java/org/bukkit/advancement/AdvancementProgress.java
@@ -1,10 +1,9 @@
package org.bukkit.advancement;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import java.util.Collection;
import java.util.Date;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* The individual status of an advancement for a player. This class is not
diff --git a/api/src/main/java/org/bukkit/attribute/AttributeInstance.java b/api/src/main/java/org/bukkit/attribute/AttributeInstance.java
index 18bafb04e..f08ee26cc 100644
--- a/api/src/main/java/org/bukkit/attribute/AttributeInstance.java
+++ b/api/src/main/java/org/bukkit/attribute/AttributeInstance.java
@@ -1,8 +1,7 @@
package org.bukkit.attribute;
-import org.jetbrains.annotations.NotNull;
-
import java.util.Collection;
+import org.jetbrains.annotations.NotNull;
/**
* Represents a mutable instance of an attribute and its associated modifiers
diff --git a/api/src/main/java/org/bukkit/block/Banner.java b/api/src/main/java/org/bukkit/block/Banner.java
index befa9da6f..e6eb3c04b 100644
--- a/api/src/main/java/org/bukkit/block/Banner.java
+++ b/api/src/main/java/org/bukkit/block/Banner.java
@@ -1,15 +1,14 @@
package org.bukkit.block;
+import java.util.List;
import org.bukkit.DyeColor;
import org.bukkit.block.banner.Pattern;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
-
/**
* Represents a captured state of a banner.
*/
-public interface Banner extends BlockState {
+public interface Banner extends TileState {
/**
* Returns the base color for this banner
diff --git a/api/src/main/java/org/bukkit/block/Barrel.java b/api/src/main/java/org/bukkit/block/Barrel.java
new file mode 100644
index 000000000..5eacc44ac
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/Beacon.java b/api/src/main/java/org/bukkit/block/Beacon.java
index e5332c0a7..6349fa9da 100644
--- a/api/src/main/java/org/bukkit/block/Beacon.java
+++ b/api/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 TileState, Lockable, Nameable {
/**
* Returns the list of players within the beacon's range of effect.
diff --git a/api/src/main/java/org/bukkit/block/Bed.java b/api/src/main/java/org/bukkit/block/Bed.java
index a2393852e..f9bd74f9c 100644
--- a/api/src/main/java/org/bukkit/block/Bed.java
+++ b/api/src/main/java/org/bukkit/block/Bed.java
@@ -7,4 +7,4 @@ import org.bukkit.material.Colorable;
* @deprecated does not provide useful information beyond the material itself
*/
@Deprecated
-public interface Bed extends BlockState, Colorable { }
+public interface Bed extends TileState, Colorable { }
diff --git a/api/src/main/java/org/bukkit/block/Bell.java b/api/src/main/java/org/bukkit/block/Bell.java
new file mode 100644
index 000000000..6fee356a3
--- /dev/null
+++ b/api/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 TileState { }
diff --git a/api/src/main/java/org/bukkit/block/Biome.java b/api/src/main/java/org/bukkit/block/Biome.java
index a3b310b73..55386ffe0 100644
--- a/api/src/main/java/org/bukkit/block/Biome.java
+++ b/api/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/api/src/main/java/org/bukkit/block/BlastFurnace.java b/api/src/main/java/org/bukkit/block/BlastFurnace.java
new file mode 100644
index 000000000..3c4d8571b
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/Block.java b/api/src/main/java/org/bukkit/block/Block.java
index c20f903a9..038de5a64 100644
--- a/api/src/main/java/org/bukkit/block/Block.java
+++ b/api/src/main/java/org/bukkit/block/Block.java
@@ -170,20 +170,16 @@ public interface Block extends Metadatable {
* The return value can be computed as follows:
*
* {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);}
- *
*
*
*
* And may be unpacked as follows:
*
* {@code int x = (int) ((packed << 37) >> 37);}
- *
*
* {@code int y = (int) (packed >>> 54);}
- *
*
* {@code int z = (int) ((packed << 10) >> 37);}
- *
*
*
* @return This block's x, y, and z coordinates packed into a long value
@@ -311,7 +307,7 @@ public interface Block extends Metadatable {
/**
* Gets the face relation of this block compared to the given block.
*
- * For example:
+ * For example:
*
{@code
* Block current = world.getBlockAt(100, 100, 100);
* Block target = world.getBlockAt(100, 101, 100);
@@ -532,4 +528,16 @@ public interface Block extends Metadatable {
*/
@NotNull
BoundingBox getBoundingBox();
+
+ // Paper start
+ /**
+ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block.
+ *
+ * This object contains the block, step, place, hit, and fall sounds.
+ *
+ * @return the sound group for this block
+ */
+ @NotNull
+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
+ // Paper end
}
diff --git a/api/src/main/java/org/bukkit/block/BrewingStand.java b/api/src/main/java/org/bukkit/block/BrewingStand.java
index 7611a126c..fe155f14d 100644
--- a/api/src/main/java/org/bukkit/block/BrewingStand.java
+++ b/api/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/api/src/main/java/org/bukkit/block/Campfire.java b/api/src/main/java/org/bukkit/block/Campfire.java
new file mode 100644
index 000000000..09522d5e8
--- /dev/null
+++ b/api/src/main/java/org/bukkit/block/Campfire.java
@@ -0,0 +1,75 @@
+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 TileState {
+
+ /**
+ * @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 item slot 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 item slot 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 item slot 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 item slot index
+ * @param cookTimeTotal Cook time total
+ */
+ void setCookTimeTotal(int index, int cookTimeTotal);
+}
diff --git a/api/src/main/java/org/bukkit/block/Chest.java b/api/src/main/java/org/bukkit/block/Chest.java
index eb475ec84..a569c7b63 100644
--- a/api/src/main/java/org/bukkit/block/Chest.java
+++ b/api/src/main/java/org/bukkit/block/Chest.java
@@ -1,7 +1,7 @@
package org.bukkit.block;
-import com.destroystokyo.paper.loottable.LootableBlockInventory;
-import org.bukkit.Nameable;
+import com.destroystokyo.paper.loottable.LootableBlockInventory; // Paper
+import org.bukkit.Nameable; // Paper
import org.bukkit.inventory.Inventory;
import org.bukkit.loot.Lootable;
import org.jetbrains.annotations.NotNull;
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a chest.
*/
-public interface Chest extends Container, Nameable, LootableBlockInventory { // Paper
+public interface Chest extends Container, LootableBlockInventory { // Paper
/**
* Gets the inventory of the chest block represented by this block state.
diff --git a/api/src/main/java/org/bukkit/block/CommandBlock.java b/api/src/main/java/org/bukkit/block/CommandBlock.java
index b7ee5bc94..372c0bd5a 100644
--- a/api/src/main/java/org/bukkit/block/CommandBlock.java
+++ b/api/src/main/java/org/bukkit/block/CommandBlock.java
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a captured state of a command block.
*/
-public interface CommandBlock extends BlockState {
+public interface CommandBlock extends TileState {
/**
* Gets the command that this CommandBlock will run when powered.
diff --git a/api/src/main/java/org/bukkit/block/Comparator.java b/api/src/main/java/org/bukkit/block/Comparator.java
index c9acc916d..6fb4c1a94 100644
--- a/api/src/main/java/org/bukkit/block/Comparator.java
+++ b/api/src/main/java/org/bukkit/block/Comparator.java
@@ -3,4 +3,4 @@ package org.bukkit.block;
/**
* Represents a captured state of an on / off comparator.
*/
-public interface Comparator extends BlockState { }
+public interface Comparator extends TileState { }
diff --git a/api/src/main/java/org/bukkit/block/Conduit.java b/api/src/main/java/org/bukkit/block/Conduit.java
index d889f41b7..554316553 100644
--- a/api/src/main/java/org/bukkit/block/Conduit.java
+++ b/api/src/main/java/org/bukkit/block/Conduit.java
@@ -3,4 +3,4 @@ package org.bukkit.block;
/**
* Represents a captured state of a conduit.
*/
-public interface Conduit extends BlockState { }
+public interface Conduit extends TileState { }
diff --git a/api/src/main/java/org/bukkit/block/Container.java b/api/src/main/java/org/bukkit/block/Container.java
index 96888ba89..bc06199f0 100644
--- a/api/src/main/java/org/bukkit/block/Container.java
+++ b/api/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 TileState, BlockInventoryHolder, Lockable, Nameable {
/**
* Gets the inventory of the block represented by this block state.
diff --git a/api/src/main/java/org/bukkit/block/CreatureSpawner.java b/api/src/main/java/org/bukkit/block/CreatureSpawner.java
index 5773e99ee..2ff0f24d5 100644
--- a/api/src/main/java/org/bukkit/block/CreatureSpawner.java
+++ b/api/src/main/java/org/bukkit/block/CreatureSpawner.java
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a creature spawner.
*/
-public interface CreatureSpawner extends BlockState {
+public interface CreatureSpawner extends TileState {
/**
* Get the spawner's creature type.
@@ -199,4 +199,18 @@ public interface CreatureSpawner extends BlockState {
* @param spawnRange the new spawn range
*/
public void setSpawnRange(int spawnRange);
+
+ // Paper start
+ /**
+ * Check if spawner is activated (a player is close enough)
+ *
+ * @return True if a player is close enough to activate it
+ */
+ public boolean isActivated();
+
+ /**
+ * Resets the spawn delay timer within the min/max range
+ */
+ public void resetTimer();
+ // Paper end
}
diff --git a/api/src/main/java/org/bukkit/block/DaylightDetector.java b/api/src/main/java/org/bukkit/block/DaylightDetector.java
index ea4117ea8..702ee7fbe 100644
--- a/api/src/main/java/org/bukkit/block/DaylightDetector.java
+++ b/api/src/main/java/org/bukkit/block/DaylightDetector.java
@@ -3,4 +3,4 @@ package org.bukkit.block;
/**
* Represents a captured state of a (possibly inverted) daylight detector.
*/
-public interface DaylightDetector extends BlockState { }
+public interface DaylightDetector extends TileState { }
diff --git a/api/src/main/java/org/bukkit/block/DoubleChest.java b/api/src/main/java/org/bukkit/block/DoubleChest.java
index 97153adfa..83a464211 100644
--- a/api/src/main/java/org/bukkit/block/DoubleChest.java
+++ b/api/src/main/java/org/bukkit/block/DoubleChest.java
@@ -18,6 +18,7 @@ public class DoubleChest implements InventoryHolder {
inventory = chest;
}
+ @Override
@NotNull
public Inventory getInventory() {
return inventory;
diff --git a/api/src/main/java/org/bukkit/block/Dropper.java b/api/src/main/java/org/bukkit/block/Dropper.java
index 47737b590..c76202321 100644
--- a/api/src/main/java/org/bukkit/block/Dropper.java
+++ b/api/src/main/java/org/bukkit/block/Dropper.java
@@ -1,13 +1,12 @@
package org.bukkit.block;
import com.destroystokyo.paper.loottable.LootableBlockInventory;
-import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
/**
* Represents a captured state of a dropper.
*/
-public interface Dropper extends Container, Nameable, LootableBlockInventory { // Paper
+public interface Dropper extends Container, LootableBlockInventory { // Paper
/**
* Tries to drop a randomly selected item from the dropper's inventory,
@@ -16,7 +15,7 @@ public interface Dropper extends Container, Nameable, LootableBlockInventory { /
* Normal behavior of a dropper is as follows:
*
* If the block that the dropper is facing is an InventoryHolder,
- * the randomly selected ItemStack is placed within that
+ * the randomly selected ItemStack is placed within that
* Inventory in the first slot that's available, starting with 0 and
* counting up. If the inventory is full, nothing happens.
*
@@ -26,7 +25,7 @@ public interface Dropper extends Container, Nameable, LootableBlockInventory { /
*
* If the block represented by this state is no longer a dropper, this will
* do nothing.
- *
+ *
* @throws IllegalStateException if this block state is not placed
*/
public void drop();
diff --git a/api/src/main/java/org/bukkit/block/EnchantingTable.java b/api/src/main/java/org/bukkit/block/EnchantingTable.java
index 9f5aa6c6c..68b9e034a 100644
--- a/api/src/main/java/org/bukkit/block/EnchantingTable.java
+++ b/api/src/main/java/org/bukkit/block/EnchantingTable.java
@@ -5,4 +5,4 @@ import org.bukkit.Nameable;
/**
* Represents a captured state of an enchanting table.
*/
-public interface EnchantingTable extends BlockState, Nameable { }
+public interface EnchantingTable extends TileState, Nameable { }
diff --git a/api/src/main/java/org/bukkit/block/EndGateway.java b/api/src/main/java/org/bukkit/block/EndGateway.java
index e737f2db2..5e76a1cf4 100644
--- a/api/src/main/java/org/bukkit/block/EndGateway.java
+++ b/api/src/main/java/org/bukkit/block/EndGateway.java
@@ -6,14 +6,14 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a captured state of an end gateway.
*/
-public interface EndGateway extends BlockState {
+public interface EndGateway extends TileState {
/**
- * Gets the location that entities are teleported to when
+ * Gets the location that entities are teleported to when
* entering the gateway portal.
*
* If this block state is not placed the location's world will be null.
- *
+ *
* @return the gateway exit location
*/
@Nullable
@@ -24,7 +24,7 @@ public interface EndGateway extends BlockState {
* they enter the gateway portal.
*
* If this block state is not placed the location's world has to be null.
- *
+ *
* @param location the new exit location
* @throws IllegalArgumentException for differing worlds
*/
@@ -33,7 +33,7 @@ public interface EndGateway extends BlockState {
/**
* Gets whether this gateway will teleport entities directly to
* the exit location instead of finding a nearby location.
- *
+ *
* @return true if the gateway is teleporting to the exact location
*/
boolean isExactTeleport();
@@ -41,7 +41,7 @@ public interface EndGateway extends BlockState {
/**
* Sets whether this gateway will teleport entities directly to
* the exit location instead of finding a nearby location.
- *
+ *
* @param exact whether to teleport to the exact location
*/
void setExactTeleport(boolean exact);
diff --git a/api/src/main/java/org/bukkit/block/EnderChest.java b/api/src/main/java/org/bukkit/block/EnderChest.java
index e0eb2560f..17843e338 100644
--- a/api/src/main/java/org/bukkit/block/EnderChest.java
+++ b/api/src/main/java/org/bukkit/block/EnderChest.java
@@ -3,4 +3,4 @@ package org.bukkit.block;
/**
* Represents a captured state of an ender chest.
*/
-public interface EnderChest extends BlockState { }
+public interface EnderChest extends TileState { }
diff --git a/api/src/main/java/org/bukkit/block/Furnace.java b/api/src/main/java/org/bukkit/block/Furnace.java
index 97b25dbd9..9063cf370 100644
--- a/api/src/main/java/org/bukkit/block/Furnace.java
+++ b/api/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/api/src/main/java/org/bukkit/block/Hopper.java b/api/src/main/java/org/bukkit/block/Hopper.java
index 221123e8c..7ade312f1 100644
--- a/api/src/main/java/org/bukkit/block/Hopper.java
+++ b/api/src/main/java/org/bukkit/block/Hopper.java
@@ -1,10 +1,9 @@
package org.bukkit.block;
import com.destroystokyo.paper.loottable.LootableBlockInventory;
-import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
/**
* Represents a captured state of a hopper.
*/
-public interface Hopper extends Container, Nameable, LootableBlockInventory { } // Paper
+public interface Hopper extends Container, LootableBlockInventory { } // Paper
diff --git a/api/src/main/java/org/bukkit/block/Jigsaw.java b/api/src/main/java/org/bukkit/block/Jigsaw.java
new file mode 100644
index 000000000..02c7fa58e
--- /dev/null
+++ b/api/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 TileState { }
diff --git a/api/src/main/java/org/bukkit/block/Jukebox.java b/api/src/main/java/org/bukkit/block/Jukebox.java
index 1203182f3..363294cff 100644
--- a/api/src/main/java/org/bukkit/block/Jukebox.java
+++ b/api/src/main/java/org/bukkit/block/Jukebox.java
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a captured state of a jukebox.
*/
-public interface Jukebox extends BlockState {
+public interface Jukebox extends TileState {
/**
* Gets the record inserted into the jukebox.
diff --git a/api/src/main/java/org/bukkit/block/Lectern.java b/api/src/main/java/org/bukkit/block/Lectern.java
new file mode 100644
index 000000000..78107207b
--- /dev/null
+++ b/api/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 TileState, 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/api/src/main/java/org/bukkit/block/PistonMoveReaction.java b/api/src/main/java/org/bukkit/block/PistonMoveReaction.java
index 02df88682..b90f5dc34 100644
--- a/api/src/main/java/org/bukkit/block/PistonMoveReaction.java
+++ b/api/src/main/java/org/bukkit/block/PistonMoveReaction.java
@@ -1,9 +1,8 @@
package org.bukkit.block;
-import org.jetbrains.annotations.Nullable;
-
import java.util.HashMap;
import java.util.Map;
+import org.jetbrains.annotations.Nullable;
/**
* Represents how a block or entity will react when interacting with a piston
diff --git a/api/src/main/java/org/bukkit/block/ShulkerBox.java b/api/src/main/java/org/bukkit/block/ShulkerBox.java
index 8c8811d4d..42f5b4ea3 100644
--- a/api/src/main/java/org/bukkit/block/ShulkerBox.java
+++ b/api/src/main/java/org/bukkit/block/ShulkerBox.java
@@ -2,14 +2,13 @@ package org.bukkit.block;
import com.destroystokyo.paper.loottable.LootableBlockInventory;
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, LootableBlockInventory { // Paper
+public interface ShulkerBox extends Container, LootableBlockInventory { // Paper
/**
* Get the {@link DyeColor} corresponding to this ShulkerBox
diff --git a/api/src/main/java/org/bukkit/block/Sign.java b/api/src/main/java/org/bukkit/block/Sign.java
index 74db5efcb..7e3cf00e4 100644
--- a/api/src/main/java/org/bukkit/block/Sign.java
+++ b/api/src/main/java/org/bukkit/block/Sign.java
@@ -1,11 +1,12 @@
package org.bukkit.block;
+import org.bukkit.material.Colorable;
import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of either a SignPost or a WallSign.
*/
-public interface Sign extends BlockState {
+public interface Sign extends TileState, Colorable {
/**
* Gets all the lines of text currently on this sign.
diff --git a/api/src/main/java/org/bukkit/block/Skull.java b/api/src/main/java/org/bukkit/block/Skull.java
index 27675ecd1..a6914f01e 100644
--- a/api/src/main/java/org/bukkit/block/Skull.java
+++ b/api/src/main/java/org/bukkit/block/Skull.java
@@ -12,7 +12,7 @@ import com.destroystokyo.paper.profile.PlayerProfile; // Paper
/**
* Represents a captured state of a skull block.
*/
-public interface Skull extends BlockState {
+public interface Skull extends TileState {
/**
* Checks to see if the skull has an owner
diff --git a/api/src/main/java/org/bukkit/block/Smoker.java b/api/src/main/java/org/bukkit/block/Smoker.java
new file mode 100644
index 000000000..7601c30d7
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/Structure.java b/api/src/main/java/org/bukkit/block/Structure.java
index d0f1d507e..dc4006955 100644
--- a/api/src/main/java/org/bukkit/block/Structure.java
+++ b/api/src/main/java/org/bukkit/block/Structure.java
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
* Represents a structure block that can save and load blocks from a file. They
* can only be used by OPs, and are not obtainable in survival.
*/
-public interface Structure extends BlockState {
+public interface Structure extends TileState {
/**
* The name of this structure.
diff --git a/api/src/main/java/org/bukkit/block/TileState.java b/api/src/main/java/org/bukkit/block/TileState.java
new file mode 100644
index 000000000..3b10fcc13
--- /dev/null
+++ b/api/src/main/java/org/bukkit/block/TileState.java
@@ -0,0 +1,39 @@
+package org.bukkit.block;
+
+import org.bukkit.persistence.PersistentDataContainer;
+import org.bukkit.persistence.PersistentDataHolder;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a block state that also hosts a tile entity at the given location.
+ *
+ * This interface alone is merely a marker that does not provide any data.
+ *
+ * Data about the tile entities is provided by the respective interface for each
+ * tile entity type.
+ *
+ * After modifying the data provided by a TileState, {@link #update()} needs to
+ * be called to store the data.
+ */
+public interface TileState extends BlockState, PersistentDataHolder {
+
+ /**
+ * Returns a custom tag container capable of storing tags on the object.
+ *
+ * Note that the tags stored on this container are all stored under their
+ * own custom namespace therefore modifying default tags using this
+ * {@link PersistentDataHolder} is impossible.
+ *
+ * This {@link PersistentDataHolder} is only linked to the snapshot instance
+ * stored by the {@link BlockState}.
+ *
+ * When storing changes on the {@link PersistentDataHolder}, the updated
+ * content will only be applied to the actual tile entity after one of the
+ * {@link #update()} methods is called.
+ *
+ * @return the custom tag container
+ */
+ @NotNull
+ @Override
+ PersistentDataContainer getPersistentDataContainer();
+}
diff --git a/api/src/main/java/org/bukkit/block/banner/PatternType.java b/api/src/main/java/org/bukkit/block/banner/PatternType.java
index 95f55a446..754582aa0 100644
--- a/api/src/main/java/org/bukkit/block/banner/PatternType.java
+++ b/api/src/main/java/org/bukkit/block/banner/PatternType.java
@@ -1,11 +1,10 @@
package org.bukkit.block.banner;
-import org.jetbrains.annotations.Contract;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import java.util.HashMap;
import java.util.Map;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
public enum PatternType {
BASE("b"),
@@ -46,7 +45,8 @@ public enum PatternType {
BRICKS("bri"),
SKULL("sku"),
FLOWER("flo"),
- MOJANG("moj");
+ MOJANG("moj"),
+ GLOBE("glb");
private final String identifier;
private static final Map byString = new HashMap();
diff --git a/api/src/main/java/org/bukkit/block/data/Rail.java b/api/src/main/java/org/bukkit/block/data/Rail.java
index e8300a741..b89938800 100644
--- a/api/src/main/java/org/bukkit/block/data/Rail.java
+++ b/api/src/main/java/org/bukkit/block/data/Rail.java
@@ -1,8 +1,7 @@
package org.bukkit.block.data;
-import org.jetbrains.annotations.NotNull;
-
import java.util.Set;
+import org.jetbrains.annotations.NotNull;
/**
* 'shape' represents the current layout of a minecart rail.
diff --git a/api/src/main/java/org/bukkit/block/data/type/Bamboo.java b/api/src/main/java/org/bukkit/block/data/type/Bamboo.java
new file mode 100644
index 000000000..96b5add29
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/data/type/Bell.java b/api/src/main/java/org/bukkit/block/data/type/Bell.java
new file mode 100644
index 000000000..e83f41b23
--- /dev/null
+++ b/api/src/main/java/org/bukkit/block/data/type/Bell.java
@@ -0,0 +1,48 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.Directional;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * 'attachment' denotes how the bell is attached to its block.
+ */
+public interface Bell extends Directional {
+
+ /**
+ * Gets the value of the 'attachment' property.
+ *
+ * @return the 'attachment' value
+ */
+ @NotNull
+ Attachment getAttachment();
+
+ /**
+ * Sets the value of the 'attachment' property.
+ *
+ * @param attachment the new 'attachment' value
+ */
+ void setAttachment(@NotNull Attachment attachment);
+
+ /**
+ * 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/api/src/main/java/org/bukkit/block/data/type/Campfire.java b/api/src/main/java/org/bukkit/block/data/type/Campfire.java
new file mode 100644
index 000000000..bc5159b40
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/data/type/Lantern.java b/api/src/main/java/org/bukkit/block/data/type/Lantern.java
new file mode 100644
index 000000000..a6c35655a
--- /dev/null
+++ b/api/src/main/java/org/bukkit/block/data/type/Lantern.java
@@ -0,0 +1,23 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.block.data.BlockData;
+
+/**
+ * 'hanging' denotes whether the lantern is hanging from a block.
+ */
+public interface Lantern extends BlockData {
+
+ /**
+ * 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/api/src/main/java/org/bukkit/block/data/type/Lectern.java b/api/src/main/java/org/bukkit/block/data/type/Lectern.java
new file mode 100644
index 000000000..11b4a173f
--- /dev/null
+++ b/api/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/api/src/main/java/org/bukkit/block/data/type/Scaffolding.java b/api/src/main/java/org/bukkit/block/data/type/Scaffolding.java
new file mode 100644
index 000000000..1f6859eee
--- /dev/null
+++ b/api/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.
+ *
+ * '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/api/src/main/java/org/bukkit/boss/BossBar.java b/api/src/main/java/org/bukkit/boss/BossBar.java
index acaf8ff0b..70274f2e2 100644
--- a/api/src/main/java/org/bukkit/boss/BossBar.java
+++ b/api/src/main/java/org/bukkit/boss/BossBar.java
@@ -1,12 +1,10 @@
package org.bukkit.boss;
+import java.util.List;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.List;
-
public interface BossBar {
/**
diff --git a/api/src/main/java/org/bukkit/command/Command.java b/api/src/main/java/org/bukkit/command/Command.java
index f0222fc27..0b0d1bd7c 100644
--- a/api/src/main/java/org/bukkit/command/Command.java
+++ b/api/src/main/java/org/bukkit/command/Command.java
@@ -1,10 +1,10 @@
package org.bukkit.command;
+import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
-
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -16,8 +16,6 @@ import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.util.StringUtil;
-
-import com.google.common.collect.ImmutableList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/api/src/main/java/org/bukkit/command/PluginCommand.java b/api/src/main/java/org/bukkit/command/PluginCommand.java
index e420b7902..1e126487d 100644
--- a/api/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/api/src/main/java/org/bukkit/command/PluginCommand.java
@@ -1,7 +1,6 @@
package org.bukkit.command;
import java.util.List;
-
import org.apache.commons.lang.Validate;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@@ -103,6 +102,7 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
*
* @return Plugin that owns this command
*/
+ @Override
@NotNull
public Plugin getPlugin() {
return owningPlugin;
diff --git a/api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
index 92b3f7997..a542c4bb3 100644
--- a/api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
+++ b/api/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
diff --git a/api/src/main/java/org/bukkit/command/SimpleCommandMap.java b/api/src/main/java/org/bukkit/command/SimpleCommandMap.java
index b78f3d69d..460fda05a 100644
--- a/api/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/api/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -15,7 +15,11 @@ import com.destroystokyo.paper.exception.ServerTabCompleteException;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
-import org.bukkit.command.defaults.*;
+import org.bukkit.command.defaults.BukkitCommand;
+import org.bukkit.command.defaults.HelpCommand;
+import org.bukkit.command.defaults.PluginsCommand;
+import org.bukkit.command.defaults.ReloadCommand;
+import org.bukkit.command.defaults.VersionCommand;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
@@ -44,6 +48,7 @@ public class SimpleCommandMap implements CommandMap {
/**
* {@inheritDoc}
*/
+ @Override
public void registerAll(@NotNull String fallbackPrefix, @NotNull List commands) {
if (commands != null) {
for (Command c : commands) {
@@ -55,6 +60,7 @@ public class SimpleCommandMap implements CommandMap {
/**
* {@inheritDoc}
*/
+ @Override
public boolean register(@NotNull String fallbackPrefix, @NotNull Command command) {
return register(command.getName(), fallbackPrefix, command);
}
@@ -62,6 +68,7 @@ public class SimpleCommandMap implements CommandMap {
/**
* {@inheritDoc}
*/
+ @Override
public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) {
command.timings = co.aikar.timings.TimingsManager.getCommandTiming(fallbackPrefix, command); // Paper
label = label.toLowerCase(java.util.Locale.ENGLISH).trim();
@@ -125,6 +132,7 @@ public class SimpleCommandMap implements CommandMap {
/**
* {@inheritDoc}
*/
+ @Override
public boolean dispatch(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException {
String[] args = commandLine.split(" ");
@@ -165,6 +173,7 @@ public class SimpleCommandMap implements CommandMap {
return true;
}
+ @Override
public synchronized void clearCommands() {
for (Map.Entry entry : knownCommands.entrySet()) {
entry.getValue().unregister(this);
@@ -173,17 +182,20 @@ public class SimpleCommandMap implements CommandMap {
setDefaultCommands();
}
+ @Override
@Nullable
public Command getCommand(@NotNull String name) {
Command target = knownCommands.get(name.toLowerCase(java.util.Locale.ENGLISH));
return target;
}
+ @Override
@Nullable
public List tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine) {
return tabComplete(sender, cmdLine, null);
}
+ @Override
@Nullable
public List tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) {
Validate.notNull(sender, "Sender cannot be null");
diff --git a/api/src/main/java/org/bukkit/command/TabCompleter.java b/api/src/main/java/org/bukkit/command/TabCompleter.java
index 04c0e8749..e9cf71f5c 100644
--- a/api/src/main/java/org/bukkit/command/TabCompleter.java
+++ b/api/src/main/java/org/bukkit/command/TabCompleter.java
@@ -1,10 +1,9 @@
package org.bukkit.command;
+import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.List;
-
/**
* Represents a class which can suggest tab completions for commands.
*/
@@ -15,7 +14,7 @@ public interface TabCompleter {
*
* @param sender Source of the command. For players tab-completing a
* command inside of a command block, this will be the player, not
- * the command block.
+ * the command block.
* @param command Command which was executed
* @param alias The alias used
* @param args The arguments passed to the command, including final
diff --git a/api/src/main/java/org/bukkit/command/defaults/BukkitCommand.java b/api/src/main/java/org/bukkit/command/defaults/BukkitCommand.java
index 1d8249da2..cb032d038 100644
--- a/api/src/main/java/org/bukkit/command/defaults/BukkitCommand.java
+++ b/api/src/main/java/org/bukkit/command/defaults/BukkitCommand.java
@@ -1,7 +1,6 @@
package org.bukkit.command.defaults;
import java.util.List;
-
import org.bukkit.command.Command;
import org.jetbrains.annotations.NotNull;
diff --git a/api/src/main/java/org/bukkit/command/defaults/HelpCommand.java b/api/src/main/java/org/bukkit/command/defaults/HelpCommand.java
index 391283bd4..3ec11eb29 100644
--- a/api/src/main/java/org/bukkit/command/defaults/HelpCommand.java
+++ b/api/src/main/java/org/bukkit/command/defaults/HelpCommand.java
@@ -1,5 +1,6 @@
package org.bukkit.command.defaults;
+import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -7,7 +8,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
@@ -21,8 +21,6 @@ import org.bukkit.help.HelpTopic;
import org.bukkit.help.HelpTopicComparator;
import org.bukkit.help.IndexHelpTopic;
import org.bukkit.util.ChatPaginator;
-
-import com.google.common.collect.ImmutableList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/api/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/api/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
index 607323a83..af8ab73fe 100644
--- a/api/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
+++ b/api/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
@@ -3,7 +3,6 @@ package org.bukkit.command.defaults;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
diff --git a/api/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/api/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 7dce1eae2..0486abd19 100644
--- a/api/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/api/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -1,10 +1,22 @@
package org.bukkit.command.defaults;
+import com.destroystokyo.paper.util.VersionFetcher; // Paper - version supplier
import com.google.common.base.Charsets;
+import com.google.common.collect.ImmutableList;
+import com.google.common.io.Resources;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSyntaxException;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
-
+import java.util.Set;
+import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -12,28 +24,19 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.util.StringUtil;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.io.Resources;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.locks.ReentrantLock;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-
-// Paper start
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import com.destroystokyo.paper.VersionHistoryManager;
-// Paper end
+import org.jetbrains.annotations.NotNull;
public class VersionCommand extends BukkitCommand {
- public VersionCommand(String name) {
+ private VersionFetcher versionFetcher;
+ private VersionFetcher getVersionFetcher() { // lazy load because unsafe isn't available at command registration
+ if (versionFetcher == null) {
+ versionFetcher = Bukkit.getUnsafe().getVersionFetcher();
+ }
+
+ return versionFetcher;
+ }
+
+ public VersionCommand(@NotNull String name) {
super(name);
this.description = "Gets the version of this server including any plugins in use";
@@ -43,12 +46,11 @@ public class VersionCommand extends BukkitCommand {
}
@Override
- public boolean execute(CommandSender sender, String currentAlias, String[] args) {
+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
if (!testPermission(sender)) return true;
if (args.length == 0) {
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
- tellHistory(sender); // Paper
sendVersion(sender);
} else {
StringBuilder name = new StringBuilder();
@@ -85,23 +87,7 @@ public class VersionCommand extends BukkitCommand {
return true;
}
- // Paper start - show version history
- private void tellHistory(final CommandSender sender) {
- final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData();
- if (data == null) {
- return;
- }
-
- final String oldVersion = data.getOldVersion();
- if (oldVersion == null) {
- return;
- }
-
- sender.sendMessage("Previous version: " + oldVersion);
- }
- // Paper end
-
- private void describeToSender(Plugin plugin, CommandSender sender) {
+ private void describeToSender(@NotNull Plugin plugin, @NotNull CommandSender sender) {
PluginDescriptionFile desc = plugin.getDescription();
sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());
@@ -122,7 +108,8 @@ public class VersionCommand extends BukkitCommand {
}
}
- private String getAuthors(final PluginDescriptionFile desc) {
+ @NotNull
+ private String getAuthors(@NotNull final PluginDescriptionFile desc) {
StringBuilder result = new StringBuilder();
List authors = desc.getAuthors();
@@ -144,8 +131,9 @@ public class VersionCommand extends BukkitCommand {
return result.toString();
}
+ @NotNull
@Override
- public List tabComplete(CommandSender sender, String alias, String[] args) {
+ public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
@@ -170,20 +158,20 @@ public class VersionCommand extends BukkitCommand {
private boolean versionTaskStarted = false;
private long lastCheck = 0;
- private void sendVersion(CommandSender sender) {
+ private void sendVersion(@NotNull CommandSender sender) {
if (hasVersion) {
- if (System.currentTimeMillis() - lastCheck > 7200000) { // Paper - Lower to 2 hours
+ if (System.currentTimeMillis() - lastCheck > getVersionFetcher().getCacheTime()) { // Paper - use version supplier
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
- sender.sendMessage(versionMessage);
+ sendMessages(versionMessage, sender); // Paper - allow \n for multiple messages
return;
}
}
versionLock.lock();
try {
if (hasVersion) {
- sender.sendMessage(versionMessage);
+ sendMessages(versionMessage, sender); // Paper - allow \n for multiple messages
return;
}
versionWaiters.add(sender);
@@ -203,28 +191,29 @@ public class VersionCommand extends BukkitCommand {
}
}
- // Paper start
private void obtainVersion() {
String version = Bukkit.getVersion();
- if (version == null) version = "Custom";
- if (version.startsWith("git-Akarin-")) { // Akarin
- String[] parts = version.substring("git-Akarin-".length()).split("[-\\s]"); // Akarin
- int distance = getDistance(null, parts[0]);
- switch (distance) {
- case -1:
- setVersionMessage("Error obtaining version information");
- break;
- case 0:
+ // Paper start
+ if (version.startsWith("null")) { // running from ide?
+ setVersionMessage("Unknown version, custom build?");
+ return;
+ }
+ /*
+ if (version.startsWith("git-Spigot-")) {
+ String[] parts = version.substring("git-Spigot-".length()).split("-");
+ int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
+ int spigotVersions = getDistance("spigot", parts[0]);
+ if (cbVersions == -1 || spigotVersions == -1) {
+ setVersionMessage("Error obtaining version information");
+ } else {
+ if (cbVersions == 0 && spigotVersions == 0) {
setVersionMessage("You are running the latest version");
- break;
- case -2:
- setVersionMessage("Unknown version");
- break;
- default:
- setVersionMessage("You are " + distance + " version(s) behind");
+ } else {
+ setVersionMessage("You are " + (cbVersions + spigotVersions) + " version(s) behind");
+ }
}
+
} else if (version.startsWith("git-Bukkit-")) {
- // Paper end
version = version.substring("git-Bukkit-".length());
int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' ')));
if (cbVersions == -1) {
@@ -239,17 +228,25 @@ public class VersionCommand extends BukkitCommand {
} else {
setVersionMessage("Unknown version, custom build?");
}
+ */
+ setVersionMessage(getVersionFetcher().getVersionMessage(version));
+ // Paper end
}
- private void setVersionMessage(String msg) {
+ private void setVersionMessage(@NotNull String msg) {
lastCheck = System.currentTimeMillis();
versionMessage = msg;
versionLock.lock();
try {
hasVersion = true;
versionTaskStarted = false;
+ // Paper - allow \n for multiple messages
+ String[] messages = versionMessage.split("\n");
for (CommandSender sender : versionWaiters) {
- sender.sendMessage(versionMessage);
+ for (String message : messages) {
+ sender.sendMessage(message);
+ }
+ // Paper end
}
versionWaiters.clear();
} finally {
@@ -258,81 +255,32 @@ public class VersionCommand extends BukkitCommand {
}
// Paper start
- private static int getDistance(String repo, String verInfo) {
- // Akarin start
- //try {
- // int currentVer = Integer.decode(verInfo);
- // return getFromJenkins(currentVer);
- //} catch (NumberFormatException ex) {
- // Akarin end
- verInfo = verInfo.replace("\"", "");
- return getFromRepo("Akarin-project/Akarin", "master", verInfo); // Akarin
- //} // Akarin
- /*
+ private void sendMessages(String toSplit, CommandSender target) {
+ String[] messages = toSplit.split("\n");
+ for (String message : messages) {
+ target.sendMessage(message);
+ }
+ }
+ // Paper end
+
+ private static int getDistance(@NotNull String repo, @NotNull String hash) {
+ try {
BufferedReader reader = Resources.asCharSource(
new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
Charsets.UTF_8
).openBufferedStream();
try {
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
- return ((Number) obj.get("totalCount")).intValue();
- } catch (ParseException ex) {
+ JsonObject obj = new Gson().fromJson(reader, JsonObject.class);
+ return obj.get("totalCount").getAsInt();
+ } catch (JsonSyntaxException ex) {
ex.printStackTrace();
return -1;
} finally {
reader.close();
}
- */
- }
-
- private static int getFromJenkins(int currentVer) {
- try {
- BufferedReader reader = Resources.asCharSource(
- new URL("https://ci.destroystokyo.com/job/Paper-1.13/lastSuccessfulBuild/buildNumber"), // Paper
- Charsets.UTF_8
- ).openBufferedStream();
- try {
- int newVer = Integer.decode(reader.readLine());
- return newVer - currentVer;
- } catch (NumberFormatException ex) {
- ex.printStackTrace();
- return -2;
- } finally {
- reader.close();
- }
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
-
- // Contributed by Techcable in GH PR #65
- private static int getFromRepo(String repo, String branch, String hash) {
- try {
- HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
- connection.connect();
- if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return -2; // Unknown commit
- try (
- BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8))
- ) {
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
- String status = (String) obj.get("status");
- switch (status) {
- case "identical":
- return 0;
- case "behind":
- return ((Number) obj.get("behind_by")).intValue();
- default:
- return -1;
- }
- } catch (ParseException | NumberFormatException e) {
- e.printStackTrace();
- return -1;
- }
- } catch (IOException e) {
- e.printStackTrace();
- return -1;
- }
- }
- // Paper end
}
diff --git a/api/src/main/java/org/bukkit/configuration/Configuration.java b/api/src/main/java/org/bukkit/configuration/Configuration.java
index 7f7e3ff71..f12a98b1b 100644
--- a/api/src/main/java/org/bukkit/configuration/Configuration.java
+++ b/api/src/main/java/org/bukkit/configuration/Configuration.java
@@ -1,10 +1,9 @@
package org.bukkit.configuration;
+import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.Map;
-
/**
* Represents a source of configurable options and settings
*/
@@ -23,6 +22,7 @@ public interface Configuration extends ConfigurationSection {
* @param value Value to set the default to.
* @throws IllegalArgumentException Thrown if path is null.
*/
+ @Override
public void addDefault(@NotNull String path, @Nullable Object value);
/**
diff --git a/api/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
index e83de68ac..5a6e621d5 100644
--- a/api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
+++ b/api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
@@ -1,14 +1,14 @@
package org.bukkit.configuration;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.List;
-
import org.bukkit.Color;
+import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
-import org.bukkit.util.Vector;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -883,6 +883,48 @@ public interface ConfigurationSection {
*/
public boolean isColor(@NotNull String path);
+ /**
+ * Gets the requested Location by path.
+ *
+ * If the Location does not exist but a default value has been specified,
+ * this will return the default value. If the Location does not exist and no
+ * default value was specified, this will return null.
+ *
+ * @param path Path of the Location to get.
+ * @return Requested Location.
+ */
+ @Nullable
+ public Location getLocation(@NotNull String path);
+
+ /**
+ * Gets the requested {@link Location} by path, returning a default value if
+ * not found.
+ *
+ * If the Location does not exist then the specified default value will
+ * returned regardless of if a default has been identified in the root
+ * {@link Configuration}.
+ *
+ * @param path Path of the Location to get.
+ * @param def The default value to return if the path is not found or is not
+ * a Location.
+ * @return Requested Location.
+ */
+ @Nullable
+ public Location getLocation(@NotNull String path, @Nullable Location def);
+
+ /**
+ * Checks if the specified path is a Location.
+ *
+ * If the path exists but is not a Location, this will return false. If the
+ * path does not exist, this will return false. If the path does not exist
+ * but a default value has been specified, this will check if that default
+ * value is a Location and return appropriately.
+ *
+ * @param path Path of the Location to check.
+ * @return Whether or not the specified path is a Location.
+ */
+ public boolean isLocation(@NotNull String path);
+
/**
* Gets the requested ConfigurationSection by path.
*
diff --git a/api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java b/api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java
index e03108b12..010a97fee 100644
--- a/api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java
+++ b/api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java
@@ -1,7 +1,6 @@
package org.bukkit.configuration;
import java.util.Map;
-
import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,6 +41,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
defaults.set(path, value);
}
+ @Override
public void addDefaults(@NotNull Map defaults) {
Validate.notNull(defaults, "Defaults may not be null");
@@ -50,18 +50,21 @@ public class MemoryConfiguration extends MemorySection implements Configuration
}
}
+ @Override
public void addDefaults(@NotNull Configuration defaults) {
Validate.notNull(defaults, "Defaults may not be null");
addDefaults(defaults.getValues(true));
}
+ @Override
public void setDefaults(@NotNull Configuration defaults) {
Validate.notNull(defaults, "Defaults may not be null");
this.defaults = defaults;
}
+ @Override
@Nullable
public Configuration getDefaults() {
return defaults;
@@ -73,6 +76,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
return null;
}
+ @Override
@NotNull
public MemoryConfigurationOptions options() {
if (options == null) {
diff --git a/api/src/main/java/org/bukkit/configuration/MemorySection.java b/api/src/main/java/org/bukkit/configuration/MemorySection.java
index 37bb1c67a..e9b6a12a8 100644
--- a/api/src/main/java/org/bukkit/configuration/MemorySection.java
+++ b/api/src/main/java/org/bukkit/configuration/MemorySection.java
@@ -1,16 +1,15 @@
package org.bukkit.configuration;
import static org.bukkit.util.NumberConversions.*;
-
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.apache.commons.lang.Validate;
import org.bukkit.Color;
+import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.inventory.ItemStack;
@@ -71,6 +70,7 @@ public class MemorySection implements ConfigurationSection {
this.fullPath = createPath(parent, path);
}
+ @Override
@NotNull
public Set getKeys(boolean deep) {
Set result = new LinkedHashSet();
@@ -89,6 +89,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public Map getValues(boolean deep) {
Map result = new LinkedHashMap();
@@ -107,14 +108,17 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
public boolean contains(@NotNull String path) {
return contains(path, false);
}
+ @Override
public boolean contains(@NotNull String path, boolean ignoreDefault) {
return ((ignoreDefault) ? get(path, null) : get(path)) != null;
}
+ @Override
public boolean isSet(@NotNull String path) {
Configuration root = getRoot();
if (root == null) {
@@ -126,26 +130,31 @@ public class MemorySection implements ConfigurationSection {
return get(path, null) != null;
}
+ @Override
@NotNull
public String getCurrentPath() {
return fullPath;
}
+ @Override
@NotNull
public String getName() {
return path;
}
+ @Override
@Nullable
public Configuration getRoot() {
return root;
}
+ @Override
@Nullable
public ConfigurationSection getParent() {
return parent;
}
+ @Override
public void addDefault(@NotNull String path, @Nullable Object value) {
Validate.notNull(path, "Path cannot be null");
@@ -159,6 +168,7 @@ public class MemorySection implements ConfigurationSection {
root.addDefault(createPath(this, path), value);
}
+ @Override
@Nullable
public ConfigurationSection getDefaultSection() {
Configuration root = getRoot();
@@ -173,6 +183,7 @@ public class MemorySection implements ConfigurationSection {
return null;
}
+ @Override
public void set(@NotNull String path, @Nullable Object value) {
Validate.notEmpty(path, "Cannot set to an empty path");
@@ -212,11 +223,13 @@ public class MemorySection implements ConfigurationSection {
}
}
+ @Override
@Nullable
public Object get(@NotNull String path) {
return get(path, getDefault(path));
}
+ @Override
@Nullable
public Object get(@NotNull String path, @Nullable Object def) {
Validate.notNull(path, "Path cannot be null");
@@ -250,6 +263,7 @@ public class MemorySection implements ConfigurationSection {
return section.get(key, def);
}
+ @Override
@NotNull
public ConfigurationSection createSection(@NotNull String path) {
Validate.notEmpty(path, "Cannot create section at empty path");
@@ -282,6 +296,7 @@ public class MemorySection implements ConfigurationSection {
return section.createSection(key);
}
+ @Override
@NotNull
public ConfigurationSection createSection(@NotNull String path, @NotNull Map, ?> map) {
ConfigurationSection section = createSection(path);
@@ -298,101 +313,120 @@ public class MemorySection implements ConfigurationSection {
}
// Primitives
+ @Override
@Nullable
public String getString(@NotNull String path) {
Object def = getDefault(path);
return getString(path, def != null ? def.toString() : null);
}
+ @Override
@Nullable
public String getString(@NotNull String path, @Nullable String def) {
Object val = get(path, def);
return (val != null) ? val.toString() : def;
}
+ @Override
public boolean isString(@NotNull String path) {
Object val = get(path);
return val instanceof String;
}
+ @Override
public int getInt(@NotNull String path) {
Object def = getDefault(path);
return getInt(path, (def instanceof Number) ? toInt(def) : 0);
}
+ @Override
public int getInt(@NotNull String path, int def) {
Object val = get(path, def);
return (val instanceof Number) ? toInt(val) : def;
}
+ @Override
public boolean isInt(@NotNull String path) {
Object val = get(path);
return val instanceof Integer;
}
+ @Override
public boolean getBoolean(@NotNull String path) {
Object def = getDefault(path);
return getBoolean(path, (def instanceof Boolean) ? (Boolean) def : false);
}
+ @Override
public boolean getBoolean(@NotNull String path, boolean def) {
Object val = get(path, def);
return (val instanceof Boolean) ? (Boolean) val : def;
}
+ @Override
public boolean isBoolean(@NotNull String path) {
Object val = get(path);
return val instanceof Boolean;
}
+ @Override
public double getDouble(@NotNull String path) {
Object def = getDefault(path);
return getDouble(path, (def instanceof Number) ? toDouble(def) : 0);
}
+ @Override
public double getDouble(@NotNull String path, double def) {
Object val = get(path, def);
return (val instanceof Number) ? toDouble(val) : def;
}
+ @Override
public boolean isDouble(@NotNull String path) {
Object val = get(path);
return val instanceof Double;
}
+ @Override
public long getLong(@NotNull String path) {
Object def = getDefault(path);
return getLong(path, (def instanceof Number) ? toLong(def) : 0);
}
+ @Override
public long getLong(@NotNull String path, long def) {
Object val = get(path, def);
return (val instanceof Number) ? toLong(val) : def;
}
+ @Override
public boolean isLong(@NotNull String path) {
Object val = get(path);
return val instanceof Long;
}
// Java
+ @Override
@Nullable
public List> getList(@NotNull String path) {
Object def = getDefault(path);
return getList(path, (def instanceof List) ? (List>) def : null);
}
+ @Override
@Nullable
public List> getList(@NotNull String path, @Nullable List> def) {
Object val = get(path, def);
return (List>) ((val instanceof List) ? val : def);
}
+ @Override
public boolean isList(@NotNull String path) {
Object val = get(path);
return val instanceof List;
}
+ @Override
@NotNull
public List getStringList(@NotNull String path) {
List> list = getList(path);
@@ -412,6 +446,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getIntegerList(@NotNull String path) {
List> list = getList(path);
@@ -440,6 +475,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getBooleanList(@NotNull String path) {
List> list = getList(path);
@@ -465,6 +501,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getDoubleList(@NotNull String path) {
List> list = getList(path);
@@ -493,6 +530,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getFloatList(@NotNull String path) {
List> list = getList(path);
@@ -521,6 +559,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getLongList(@NotNull String path) {
List> list = getList(path);
@@ -549,6 +588,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getByteList(@NotNull String path) {
List> list = getList(path);
@@ -577,6 +617,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getCharacterList(@NotNull String path) {
List> list = getList(path);
@@ -604,6 +645,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List getShortList(@NotNull String path) {
List> list = getList(path);
@@ -632,6 +674,7 @@ public class MemorySection implements ConfigurationSection {
return result;
}
+ @Override
@NotNull
public List