) Material::isLegacy).negate()).count();
- if (size != actual) {
- throw new IllegalStateException(label + " - Expected " + size + " materials, got " + actual);
- }
- return this;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/MaterialTags.java b/api/src/main/java/com/destroystokyo/paper/MaterialTags.java
deleted file mode 100644
index ef1e2c191..000000000
--- a/api/src/main/java/com/destroystokyo/paper/MaterialTags.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper;
-
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.Tag;
-
-/**
- * Represents a collection tags to identify materials that share common properties.
- * Will map to minecraft for missing tags, as well as custom ones that may be useful.
- */
-@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"})
-public class MaterialTags {
-
- private static NamespacedKey keyFor(String key) {
- //noinspection deprecation
- return new NamespacedKey("paper", key + "_settag");
- }
- public static final MaterialSetTag ARROWS = new MaterialSetTag(keyFor("arrows"))
- .endsWith("ARROW")
- .ensureSize("ARROWS", 3);
-
- /**
- * Cover all 16 colors of beds.
- */
- public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds"))
- .endsWith("_BED")
- .ensureSize("BEDS", 16);
-
- /**
- * Covers all bucket items.
- */
- public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets"))
- .endsWith("BUCKET")
- .ensureSize("BUCKETS", 8);
-
- /**
- * Covers coal and charcoal.
- */
- public static final MaterialSetTag COALS = new MaterialSetTag(keyFor("coals"))
- .add(Material.COAL, Material.CHARCOAL);
-
- /**
- * Covers both cobblestone wall variants.
- */
- public static final MaterialSetTag COBBLESTONE_WALLS = new MaterialSetTag(keyFor("cobblestone_walls"))
- .endsWith("COBBLESTONE_WALL")
- .ensureSize("COBBLESTONE_WALLS", 2);
-
- /**
- * Covers both cobblestone and mossy Cobblestone.
- */
- public static final MaterialSetTag COBBLESTONES = new MaterialSetTag(keyFor("cobblestones"))
- .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE);
-
- /**
- * Covers all 16 colors of concrete.
- */
- public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes"))
- .endsWith("_CONCRETE")
- .ensureSize("CONCRETES", 16);
-
- /**
- * Covers all 16 colors of concrete powder.
- */
- public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder"))
- .endsWith("_CONCRETE_POWDER")
- .ensureSize("CONCRETE_POWDER", 16);
-
- /**
- * Covers the two types of cooked fish.
- */
- public static final MaterialSetTag COOKED_FISH = new MaterialSetTag(keyFor("cooked_fish"))
- .add(Material.COOKED_COD, Material.COOKED_SALMON);
-
- /**
- * Covers all 16 dyes.
- */
- public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes"))
- .endsWith("_DYE")
- .ensureSize("DYES", 16);
-
- /**
- * Covers all 6 wood variants of gates.
- */
- public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
- .endsWith("_GATE")
- .ensureSize("FENCE_GATES", 6);
-
- /**
- * Covers all 6 wood variants and nether brick fence.
- */
- public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
- .endsWith("_FENCE")
- .ensureSize("FENCES", 7);
-
- /**
- * Covers all 4 variants of fish buckets.
- */
- public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets"))
- .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET);
-
- /**
- * Covers the non-colored glass and 16 stained glass (not panes).
- */
- public static final MaterialSetTag GLASS = new MaterialSetTag(keyFor("glass"))
- .endsWith("_GLASS")
- .add(Material.GLASS)
- .ensureSize("GLASS", 17);
-
- /**
- * Covers the non-colored glass panes and 16 stained glass panes (panes only).
- */
- public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes"))
- .endsWith("GLASS_PANE")
- .ensureSize("GLASS_PANES", 17);
-
- /**
- * Covers all 16 glazed terracotta blocks.
- */
- public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta"))
- .endsWith("GLAZED_TERRACOTTA")
- .ensureSize("GLAZED_TERRACOTTA", 16);
-
- /**
- * Covers the 16 colors of stained terracotta.
- */
- public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta"))
- .endsWith("TERRACOTTA")
- .not(Material.TERRACOTTA)
- .notEndsWith("GLAZED_TERRACOTTA")
- .ensureSize("STAINED_TERRACOTTA", 16);
-
- /**
- * Covers terracotta along with the 16 stained variants.
- */
- public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta"))
- .endsWith("TERRACOTTA")
- .ensureSize("TERRACOTTA", 33);
-
-
- /**
- * Covers both golden apples.
- */
- public static final MaterialSetTag GOLDEN_APPLES = new MaterialSetTag(keyFor("golden_apples"))
- .endsWith("GOLDEN_APPLE")
- .ensureSize("GOLDEN_APPLES", 2);
-
- /**
- * Covers the 3 variants of horse armor.
- */
- public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors"))
- .endsWith("_HORSE_ARMOR")
- .ensureSize("HORSE_ARMORS", 4);
-
- /**
- * Covers the 6 variants of infested blocks.
- */
- public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks"))
- .startsWith("INFESTED_")
- .ensureSize("INFESTED_BLOCKS", 6);
-
- /**
- * Covers the 3 variants of mushroom blocks.
- */
- public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks"))
- .endsWith("MUSHROOM_BLOCK")
- .add(Material.MUSHROOM_STEM)
- .ensureSize("MUSHROOM_BLOCKS", 3);
-
- /**
- * Covers both mushrooms.
- */
- public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms"))
- .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM);
-
- /**
- * Covers all 12 music disc items.
- */
- public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs"))
- .startsWith("MUSIC_DISC_")
- .ensureSize("MUSIC_DISCS", 12);
-
- /**
- * Covers all 8 ores.
- */
- public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores"))
- .endsWith("_ORE")
- .ensureSize("ORES", 8);
-
- /**
- * Covers all piston typed items and blocks including the piston head and moving piston.
- */
- public static final MaterialSetTag PISTONS = new MaterialSetTag(keyFor("pistons"))
- .contains("PISTON")
- .ensureSize("PISTONS", 4);
-
- /**
- * Covers all potato items.
- */
- public static final MaterialSetTag POTATOES = new MaterialSetTag(keyFor("potatoes"))
- .endsWith("POTATO")
- .ensureSize("POTATOES", 3);
-
- /**
- * Covers all 6 wooden pressure plates and the 2 weighted pressure plates and 1 stone pressure plate.
- */
- public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
- .endsWith("_PRESSURE_PLATE")
- .ensureSize("PRESSURE_PLATES", 9);
-
- /**
- * Covers the 3 variants of prismarine blocks.
- */
- public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine"))
- .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE);
-
- /**
- * Covers the 3 variants of prismarine slabs.
- */
- public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs"))
- .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB);
-
- /**
- * Covers the 3 variants of prismarine stairs.
- */
- public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs"))
- .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS);
-
- /**
- * Covers the 3 variants of pumpkins.
- */
- public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins"))
- .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN);
-
- /**
- * Covers the 4 variants of quartz blocks.
- */
- public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks"))
- .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ);
-
- /**
- * Covers all uncooked fish items.
- */
- public static final MaterialSetTag RAW_FISH = new MaterialSetTag(keyFor("raw_fish"))
- .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH);
-
- /**
- * Covers the 4 variants of red sandstone blocks.
- */
- public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones"))
- .endsWith("RED_SANDSTONE")
- .ensureSize("RED_SANDSTONES", 4);
-
- /**
- * Covers the 4 variants of sandstone blocks.
- */
- public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones"))
- .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE);
-
- /**
- * Covers sponge and wet sponge.
- */
- public static final MaterialSetTag SPONGES = new MaterialSetTag(keyFor("sponges"))
- .endsWith("SPONGE")
- .ensureSize("SPONGES", 2);
-
- /**
- * Covers the non-colored and 16 colored shulker boxes.
- */
- public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes"))
- .endsWith("SHULKER_BOX")
- .ensureSize("SHULKER_BOXES", 17);
-
- /**
- * Covers zombie, creeper, skeleton, dragon, and player heads.
- */
- public static final MaterialSetTag SKULLS = new MaterialSetTag(keyFor("skulls"))
- .endsWith("_HEAD")
- .endsWith("_SKULL")
- .not(Material.PISTON_HEAD)
- .ensureSize("SKULLS", 12);
-
- /**
- * Covers all spawn egg items.
- */
- public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
- .endsWith("_SPAWN_EGG")
- .ensureSize("SPAWN_EGGS", 58);
-
- /**
- * Covers all 16 colors of stained glass.
- */
- public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass"))
- .endsWith("_STAINED_GLASS")
- .ensureSize("STAINED_GLASS", 16);
-
- /**
- * Covers all 16 colors of stained glass panes.
- */
- public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes"))
- .endsWith("STAINED_GLASS_PANE")
- .ensureSize("STAINED_GLASS_PANES", 16);
-
- /**
- * Covers all 7 variants of trapdoors.
- */
- public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
- .endsWith("_TRAPDOOR")
- .ensureSize("TRAPDOORS", 7);
-
- /**
- * Covers all 6 wood variants of fences.
- */
- public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
- .endsWith("_FENCE")
- .not(Material.NETHER_BRICK_FENCE)
- .ensureSize("WOODEN_FENCES", 6);
-
- /**
- * Covers all 6 wood variants of trapdoors.
- */
- public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
- .endsWith("_TRAPDOOR")
- .not(Material.IRON_TRAPDOOR)
- .ensureSize("WOODEN_TRAPDOORS", 6);
-
- public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
- .endsWith("_GATE")
- .ensureSize("WOODEN_GATES", 6);
-
- public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur"))
- .startsWith("PURPUR_")
- .ensureSize("PURPUR", 4);
-
- public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
- .endsWith("_SIGN")
- .ensureSize("SIGNS", 12);
-
- public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch"))
- .add(Material.TORCH, Material.WALL_TORCH)
- .ensureSize("TORCH", 2);
-
- public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("restone_torch"))
- .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH)
- .ensureSize("REDSTONE_TORCH", 2);
-
- @SuppressWarnings("unchecked")
- public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable"))
- .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS);
- //.ensureSize("COLORABLE", 81); unit test don't have the vanilla item tags, so counts don't line up for real
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/Namespaced.java b/api/src/main/java/com/destroystokyo/paper/Namespaced.java
deleted file mode 100644
index cd1a34b82..000000000
--- a/api/src/main/java/com/destroystokyo/paper/Namespaced.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.destroystokyo.paper;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a namespaced resource, see {@link org.bukkit.NamespacedKey} for single elements
- * or {@link com.destroystokyo.paper.NamespacedTag} for a collection of elements
- *
- * Namespaces may only contain lowercase alphanumeric characters, periods,
- * underscores, and hyphens.
- *
- * Keys may only contain lowercase alphanumeric characters, periods,
- * underscores, hyphens, and forward slashes.
- *
- * You should not be implementing this interface yourself, use {@link org.bukkit.NamespacedKey}
- * or {@link com.destroystokyo.paper.NamespacedTag} as needed instead.
- */
-public interface Namespaced {
- /**
- * Gets the namespace this resource is a part of
- *
- * This is contractually obligated to only contain lowercase alphanumeric characters,
- * periods, underscores, and hyphens.
- *
- * @return resource namespace
- */
- @NotNull
- String getNamespace();
-
- /**
- * Gets the key corresponding to this resource
- *
- * This is contractually obligated to only contain lowercase alphanumeric characters,
- * periods, underscores, hyphens, and forward slashes.
- *
- * @return resource key
- */
- @NotNull
- String getKey();
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/NamespacedTag.java b/api/src/main/java/com/destroystokyo/paper/NamespacedTag.java
deleted file mode 100644
index 28f3fda95..000000000
--- a/api/src/main/java/com/destroystokyo/paper/NamespacedTag.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.destroystokyo.paper;
-
-import com.google.common.base.Preconditions;
-import java.util.Locale;
-import java.util.UUID;
-import java.util.regex.Pattern;
-import org.bukkit.plugin.Plugin;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a String based key pertaining to a tagged entry. Consists of two components - a namespace
- * and a key.
- *
- * Namespaces may only contain lowercase alphanumeric characters, periods,
- * underscores, and hyphens.
- *
- * Keys may only contain lowercase alphanumeric characters, periods,
- * underscores, hyphens, and forward slashes.
- *
- */
-// Paper - entire class, based on org.bukkit.NamespacedKey
-public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
-
- /**
- * The namespace representing all inbuilt keys.
- */
- public static final String MINECRAFT = "minecraft";
- /**
- * The namespace representing all keys generated by Bukkit for backwards
- * compatibility measures.
- */
- public static final String BUKKIT = "bukkit";
- //
- private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+");
- private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+");
- //
- private final String namespace;
- private final String key;
-
- /**
- * Create a key in a specific namespace.
- *
- * @param namespace String representing a grouping of keys
- * @param key Name for this specific key
- * @deprecated should never be used by plugins, for internal use only!!
- */
- @Deprecated
- public NamespacedTag(@NotNull String namespace, @NotNull String key) {
- Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
- Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key);
-
- this.namespace = namespace;
- this.key = key;
-
- String string = toString();
- Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters", string);
- }
-
- /**
- * Create a key in the plugin's namespace.
- *
- * Namespaces may only contain lowercase alphanumeric characters, periods,
- * underscores, and hyphens.
- *
- * Keys may only contain lowercase alphanumeric characters, periods,
- * underscores, hyphens, and forward slashes.
- *
- * @param plugin the plugin to use for the namespace
- * @param key the key to create
- */
- public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) {
- Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
- Preconditions.checkArgument(key != null, "Key cannot be null");
-
- this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
- this.key = key.toLowerCase().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);
- Preconditions.checkArgument(VALID_KEY.matcher(this.key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", this.key);
-
- String string = toString();
- Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters (%s)", string);
- }
-
- @NotNull
- public String getNamespace() {
- return namespace;
- }
-
- @NotNull
- public String getKey() {
- return key;
- }
-
- @Override
- public int hashCode() {
- int hash = 7;
- hash = 47 * hash + this.namespace.hashCode();
- hash = 47 * hash + this.key.hashCode();
- return hash;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final NamespacedTag other = (NamespacedTag) obj;
- return this.namespace.equals(other.namespace) && this.key.equals(other.key);
- }
-
- @Override
- public String toString() {
- return "#" + this.namespace + ":" + this.key;
- }
-
- /**
- * Return a new random key in the {@link #BUKKIT} namespace.
- *
- * @return new key
- * @deprecated should never be used by plugins, for internal use only!!
- */
- @Deprecated
- public static NamespacedTag randomKey() {
- return new NamespacedTag(BUKKIT, UUID.randomUUID().toString());
- }
-
- /**
- * Get a key in the Minecraft namespace.
- *
- * @param key the key to use
- * @return new key in the Minecraft namespace
- */
- @NotNull
- public static NamespacedTag minecraft(@NotNull String key) {
- return new NamespacedTag(MINECRAFT, key);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/api/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
deleted file mode 100644
index 06f1602f5..000000000
--- a/api/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
+++ /dev/null
@@ -1,478 +0,0 @@
-package com.destroystokyo.paper;
-
-import com.google.common.collect.Lists;
-import org.bukkit.Color;
-import org.bukkit.Location;
-import org.bukkit.Particle;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-import org.bukkit.util.NumberConversions;
-
-import java.util.Collection;
-import java.util.List;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Helps prepare a particle to be sent to players.
- *
- * Usage of the builder is preferred over the super long {@link World#spawnParticle(Particle, Location, int, double, double, double, double, Object)} API
- */
-public class ParticleBuilder {
-
- private Particle particle;
- private List receivers;
- private Player source;
- private Location location;
- private int count = 1;
- private double offsetX = 0, offsetY = 0, offsetZ = 0;
- private double extra = 1;
- private Object data;
- private boolean force = true;
-
- public ParticleBuilder(@NotNull Particle particle) {
- this.particle = particle;
- }
-
- /**
- * Sends the particle to all receiving players (or all). This method is safe to use
- * Asynchronously
- *
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder spawn() {
- if (this.location == null) {
- throw new IllegalStateException("Please specify location for this particle");
- }
- location.getWorld().spawnParticle(particle, receivers, source,
- location.getX(), location.getY(), location.getZ(),
- count, offsetX, offsetY, offsetZ, extra, data, force
- );
- return this;
- }
-
- /**
- * @return The particle going to be sent
- */
- @NotNull
- public Particle particle() {
- return particle;
- }
-
- /**
- * Changes what particle will be sent
- *
- * @param particle The particle
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder particle(@NotNull Particle particle) {
- this.particle = particle;
- return this;
- }
-
- /**
- * @return List of players who will receive the particle, or null for all in world
- */
- @Nullable
- public List receivers() {
- return receivers;
- }
-
- /**
- * Example use:
- *
- * builder.receivers(16); if (builder.hasReceivers()) { sendParticleAsync(builder); }
- *
- * @return If this particle is going to be sent to someone
- */
- public boolean hasReceivers() {
- return (receivers == null && !location.getWorld().getPlayers().isEmpty()) || (
- receivers != null && !receivers.isEmpty());
- }
-
- /**
- * Sends this particle to all players in the world. This is rather silly and you should likely not
- * be doing this.
- *
- * Just be a logical person and use receivers by radius or collection.
- *
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder allPlayers() {
- this.receivers = null;
- return this;
- }
-
- /**
- * @param receivers List of players to receive this particle, or null for all players in the
- * world
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(@Nullable List receivers) {
- // Had to keep this as we first made API List<> and not Collection, but removing this may break plugins compiled on older jars
- // TODO: deprecate?
- this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
- return this;
- }
-
- /**
- * @param receivers List of players to receive this particle, or null for all players in the
- * world
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(@Nullable Collection receivers) {
- this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
- return this;
- }
-
- /**
- * @param receivers List of players to be receive this particle, or null for all players in the
- * world
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(@Nullable Player... receivers) {
- this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
- return this;
- }
-
- /**
- * Selects all players within a cuboid selection around the particle location, within the
- * specified bounding box. If you want a more spherical check, see {@link #receivers(int,
- * boolean)}
- *
- * @param radius amount to add on all axis
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(int radius) {
- return receivers(radius, radius);
- }
-
- /**
- * Selects all players within the specified radius around the particle location. If byDistance is
- * false, behavior uses cuboid selection the same as {@link #receivers(int, int)} If byDistance is
- * true, radius is tested by distance in a spherical shape
- *
- * @param radius amount to add on each axis
- * @param byDistance true to use a spherical radius, false to use a cuboid
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(int radius, boolean byDistance) {
- if (!byDistance) {
- return receivers(radius, radius, radius);
- } else {
- this.receivers = Lists.newArrayList();
- for (Player nearbyPlayer : location.getWorld()
- .getNearbyPlayers(location, radius, radius, radius)) {
- Location loc = nearbyPlayer.getLocation();
- double x = NumberConversions.square(location.getX() - loc.getX());
- double y = NumberConversions.square(location.getY() - loc.getY());
- double z = NumberConversions.square(location.getZ() - loc.getZ());
- if (Math.sqrt(x + y + z) > radius) {
- continue;
- }
- this.receivers.add(nearbyPlayer);
- }
- return this;
- }
- }
-
- /**
- * Selects all players within a cuboid selection around the particle location, within the
- * specified bounding box. Allows specifying a different Y size than X and Z If you want a more
- * cylinder check, see {@link #receivers(int, int, boolean)} If you want a more spherical check,
- * see {@link #receivers(int, boolean)}
- *
- * @param xzRadius amount to add on the x/z axis
- * @param yRadius amount to add on the y axis
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(int xzRadius, int yRadius) {
- return receivers(xzRadius, yRadius, xzRadius);
- }
-
- /**
- * Selects all players within the specified radius around the particle location. If byDistance is
- * false, behavior uses cuboid selection the same as {@link #receivers(int, int)} If byDistance is
- * true, radius is tested by distance on the y plane and on the x/z plane, in a cylinder shape.
- *
- * @param xzRadius amount to add on the x/z axis
- * @param yRadius amount to add on the y axis
- * @param byDistance true to use a cylinder shape, false to use cuboid
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(int xzRadius, int yRadius, boolean byDistance) {
- if (!byDistance) {
- return receivers(xzRadius, yRadius, xzRadius);
- } else {
- this.receivers = Lists.newArrayList();
- for (Player nearbyPlayer : location.getWorld()
- .getNearbyPlayers(location, xzRadius, yRadius, xzRadius)) {
- Location loc = nearbyPlayer.getLocation();
- if (Math.abs(loc.getY() - this.location.getY()) > yRadius) {
- continue;
- }
- double x = NumberConversions.square(location.getX() - loc.getX());
- double z = NumberConversions.square(location.getZ() - loc.getZ());
- if (x + z > NumberConversions.square(xzRadius)) {
- continue;
- }
- this.receivers.add(nearbyPlayer);
- }
- return this;
- }
- }
-
- /**
- * Selects all players within a cuboid selection around the particle location, within the
- * specified bounding box. If you want a more cylinder check, see {@link #receivers(int, int,
- * boolean)} If you want a more spherical check, see {@link #receivers(int, boolean)}
- *
- * @param xRadius amount to add on the x axis
- * @param yRadius amount to add on the y axis
- * @param zRadius amount to add on the z axis
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder receivers(int xRadius, int yRadius, int zRadius) {
- if (location == null) {
- throw new IllegalStateException("Please set location first");
- }
- return receivers(location.getWorld().getNearbyPlayers(location, xRadius, yRadius, zRadius));
- }
-
- /**
- * @return The player considered the source of this particle (for Visibility concerns), or null
- */
- @Nullable
- public Player source() {
- return source;
- }
-
- /**
- * Sets the source of this particle for visibility concerns (Vanish API)
- *
- * @param source The player who is considered the source
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder source(@Nullable Player source) {
- this.source = source;
- return this;
- }
-
- /**
- * @return Location of where the particle will spawn
- */
- @Nullable
- public Location location() {
- return location;
- }
-
- /**
- * Sets the location of where to spawn the particle
- *
- * @param location The location of the particle
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder location(@NotNull Location location) {
- this.location = location.clone();
- return this;
- }
-
- /**
- * Sets the location of where to spawn the particle
- *
- * @param world World to spawn particle in
- * @param x X location
- * @param y Y location
- * @param z Z location
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder location(@NotNull World world, double x, double y, double z) {
- this.location = new Location(world, x, y, z);
- return this;
- }
-
- /**
- * @return Number of particles to spawn
- */
- public int count() {
- return count;
- }
-
- /**
- * Sets the number of particles to spawn
- *
- * @param count Number of particles
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder count(int count) {
- this.count = count;
- return this;
- }
-
- /**
- * Particle offset X. Varies by particle on how this is used
- *
- * @return Particle offset X.
- */
- public double offsetX() {
- return offsetX;
- }
-
- /**
- * Particle offset Y. Varies by particle on how this is used
- *
- * @return Particle offset Y.
- */
- public double offsetY() {
- return offsetY;
- }
-
- /**
- * Particle offset Z. Varies by particle on how this is used
- *
- * @return Particle offset Z.
- */
- public double offsetZ() {
- return offsetZ;
- }
-
- /**
- * Sets the particle offset. Varies by particle on how this is used
- *
- * @param offsetX Particle offset X
- * @param offsetY Particle offset Y
- * @param offsetZ Particle offset Z
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder offset(double offsetX, double offsetY, double offsetZ) {
- this.offsetX = offsetX;
- this.offsetY = offsetY;
- this.offsetZ = offsetZ;
- return this;
- }
-
- /**
- * Gets the Particle extra data. Varies by particle on how this is used
- *
- * @return the extra particle data
- */
- public double extra() {
- return extra;
- }
-
- /**
- * Sets the particle extra data. Varies by particle on how this is used
- *
- * @param extra the extra particle data
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder extra(double extra) {
- this.extra = extra;
- return this;
- }
-
- /**
- * Gets the particle custom data. Varies by particle on how this is used
- *
- * @param The Particle data type
- * @return the ParticleData for this particle
- */
- @Nullable
- public T data() {
- //noinspection unchecked
- return (T) data;
- }
-
- /**
- * Sets the particle custom data. Varies by particle on how this is used
- *
- * @param data The new particle data
- * @param The Particle data type
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder data(@Nullable T data) {
- this.data = data;
- return this;
- }
-
- /**
- * Sets whether the particle is forcefully shown to the player. If forced, the particle will show
- * faraway, as far as the player's view distance allows. If false, the particle will show
- * according to the client's particle settings.
- *
- * @param force true to force, false for normal
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder force(boolean force) {
- this.force = force;
- return this;
- }
-
- /**
- * Sets the particle Color. Only valid for REDSTONE.
- *
- * @param color the new particle color
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder color(@Nullable Color color) {
- return color(color, 1);
- }
-
- /**
- * Sets the particle Color and size. Only valid for REDSTONE.
- *
- * @param color the new particle color
- * @param size the size of the particle
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder color(@Nullable Color color, float size) {
- if (particle != Particle.REDSTONE && color != null) {
- throw new IllegalStateException("Color may only be set on REDSTONE");
- }
-
- // We don't officially support reusing these objects, but here we go
- if (color == null) {
- if (data instanceof Particle.DustOptions) {
- return data(null);
- } else {
- return this;
- }
- }
-
- return data(new Particle.DustOptions(color, size));
- }
-
- /**
- * Sets the particle Color.
- * Only valid for REDSTONE.
- * @param r red color component
- * @param g green color component
- * @param b blue color component
- * @return a reference to this object.
- */
- @NotNull
- public ParticleBuilder color(int r, int g, int b) {
- return color(Color.fromRGB(r, g, b));
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/Title.java b/api/src/main/java/com/destroystokyo/paper/Title.java
deleted file mode 100644
index 4fe18540f..000000000
--- a/api/src/main/java/com/destroystokyo/paper/Title.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package com.destroystokyo.paper;
-
-import net.md_5.bungee.api.chat.BaseComponent;
-import net.md_5.bungee.api.chat.TextComponent;
-
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-/**
- * Represents a title to may be sent to a {@link Player}.
- *
- * A title can be sent without subtitle text.
- */
-public final class Title {
-
- /**
- * The default number of ticks for the title to fade in.
- */
- public static final int DEFAULT_FADE_IN = 20;
- /**
- * The default number of ticks for the title to stay.
- */
- public static final int DEFAULT_STAY = 200;
- /**
- * The default number of ticks for the title to fade out.
- */
- public static final int DEFAULT_FADE_OUT = 20;
-
- private final BaseComponent[] title;
- private final BaseComponent[] subtitle;
- private final int fadeIn;
- private final int stay;
- private final int fadeOut;
-
- /**
- * Create a title with the default time values and no subtitle.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @throws NullPointerException if the title is null
- */
- public Title(@NotNull BaseComponent title) {
- this(title, null);
- }
-
- /**
- * Create a title with the default time values and no subtitle.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @throws NullPointerException if the title is null
- */
- public Title(@NotNull BaseComponent[] title) {
- this(title, null);
- }
-
- /**
- * Create a title with the default time values and no subtitle.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @throws NullPointerException if the title is null
- */
- public Title(@NotNull String title) {
- this(title, null);
- }
-
- /**
- * Create a title with the default time values.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- */
- public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle) {
- this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
- }
-
- /**
- * Create a title with the default time values.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- */
- public Title(@NotNull BaseComponent[] title, @Nullable BaseComponent[] subtitle) {
- this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
- }
-
- /**
- * Create a title with the default time values.
- *
- * Times use default values.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- */
- public Title(@NotNull String title, @Nullable String subtitle) {
- this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
- }
-
- /**
- * Creates a new title.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- * @param fadeIn the number of ticks for the title to fade in
- * @param stay the number of ticks for the title to stay on screen
- * @param fadeOut the number of ticks for the title to fade out
- * @throws IllegalArgumentException if any of the times are negative
- */
- public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle, int fadeIn, int stay, int fadeOut) {
- this(
- new BaseComponent[]{checkNotNull(title, "title")},
- subtitle == null ? null : new BaseComponent[]{subtitle},
- fadeIn,
- stay,
- fadeOut
- );
- }
-
- /**
- * Creates a new title.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- * @param fadeIn the number of ticks for the title to fade in
- * @param stay the number of ticks for the title to stay on screen
- * @param fadeOut the number of ticks for the title to fade out
- * @throws IllegalArgumentException if any of the times are negative
- */
- public Title(@Nullable BaseComponent[] title, @NotNull BaseComponent[] subtitle, int fadeIn, int stay, int fadeOut) {
- checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
- checkArgument(stay >= 0, "Negative stay: %s", stay);
- checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
- this.title = checkNotNull(title, "title");
- this.subtitle = subtitle;
- this.fadeIn = fadeIn;
- this.stay = stay;
- this.fadeOut = fadeOut;
- }
-
- /**
- * Creates a new title.
- *
- * It is recommended to the {@link BaseComponent} constrctors.
- *
- * @param title the main text of the title
- * @param subtitle the secondary text of the title
- * @param fadeIn the number of ticks for the title to fade in
- * @param stay the number of ticks for the title to stay on screen
- * @param fadeOut the number of ticks for the title to fade out
- */
- public Title(@NotNull String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) {
- this(
- TextComponent.fromLegacyText(checkNotNull(title, "title")),
- subtitle == null ? null : TextComponent.fromLegacyText(subtitle),
- fadeIn,
- stay,
- fadeOut
- );
- }
-
- /**
- * Gets the text of this title
- *
- * @return the text
- */
- @NotNull
- public BaseComponent[] getTitle() {
- return this.title;
- }
-
- /**
- * Gets the text of this title's subtitle
- *
- * @return the text
- */
- @Nullable
- public BaseComponent[] getSubtitle() {
- return this.subtitle;
- }
-
- /**
- * Gets the number of ticks to fade in.
- *
- * The returned value is never negative.
- *
- * @return the number of ticks to fade in
- */
- public int getFadeIn() {
- return this.fadeIn;
- }
-
- /**
- * Gets the number of ticks to stay.
- *
- * The returned value is never negative.
- *
- * @return the number of ticks to stay
- */
- public int getStay() {
- return this.stay;
- }
-
- /**
- * Gets the number of ticks to fade out.
- *
- * The returned value is never negative.
- *
- * @return the number of ticks to fade out
- */
- public int getFadeOut() {
- return this.fadeOut;
- }
-
- @NotNull
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * A builder for creating titles
- */
- public static final class Builder {
-
- private BaseComponent[] title;
- private BaseComponent[] subtitle;
- private int fadeIn = DEFAULT_FADE_IN;
- private int stay = DEFAULT_STAY;
- private int fadeOut = DEFAULT_FADE_OUT;
-
- /**
- * Sets the title to the given text.
- *
- * @param title the title text
- * @return this builder instance
- * @throws NullPointerException if the title is null
- */
- @NotNull
- public Builder title(@NotNull BaseComponent title) {
- return this.title(new BaseComponent[]{checkNotNull(title, "title")});
- }
-
- /**
- * Sets the title to the given text.
- *
- * @param title the title text
- * @return this builder instance
- * @throws NullPointerException if the title is null
- */
- @NotNull
- public Builder title(@NotNull BaseComponent[] title) {
- this.title = checkNotNull(title, "title");
- return this;
- }
-
- /**
- * Sets the title to the given text.
- *
- * It is recommended to the {@link BaseComponent} methods.
- *
- * @param title the title text
- * @return this builder instance
- * @throws NullPointerException if the title is null
- */
- @NotNull
- public Builder title(@NotNull String title) {
- return this.title(TextComponent.fromLegacyText(checkNotNull(title, "title")));
- }
-
- /**
- * Sets the subtitle to the given text.
- *
- * @param subtitle the title text
- * @return this builder instance
- */
- @NotNull
- public Builder subtitle(@Nullable BaseComponent subtitle) {
- return this.subtitle(subtitle == null ? null : new BaseComponent[]{subtitle});
- }
-
- /**
- * Sets the subtitle to the given text.
- *
- * @param subtitle the title text
- * @return this builder instance
- */
- @NotNull
- public Builder subtitle(@Nullable BaseComponent[] subtitle) {
- this.subtitle = subtitle;
- return this;
- }
-
- /**
- * Sets the subtitle to the given text.
- *
- * It is recommended to the {@link BaseComponent} methods.
- *
- * @param subtitle the title text
- * @return this builder instance
- */
- @NotNull
- public Builder subtitle(@Nullable String subtitle) {
- return this.subtitle(subtitle == null ? null : TextComponent.fromLegacyText(subtitle));
- }
-
- /**
- * Sets the number of ticks for the title to fade in
- *
- * @param fadeIn the number of ticks to fade in
- * @return this builder instance
- * @throws IllegalArgumentException if it is negative
- */
- @NotNull
- public Builder fadeIn(int fadeIn) {
- checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
- this.fadeIn = fadeIn;
- return this;
- }
-
-
- /**
- * Sets the number of ticks for the title to stay.
- *
- * @param stay the number of ticks to stay
- * @return this builder instance
- * @throws IllegalArgumentException if it is negative
- */
- @NotNull
- public Builder stay(int stay) {
- checkArgument(stay >= 0, "Negative stay: %s", stay);
- this.stay = stay;
- return this;
- }
-
- /**
- * Sets the number of ticks for the title to fade out.
- *
- * @param fadeOut the number of ticks to fade out
- * @return this builder instance
- * @throws IllegalArgumentException if it is negative
- */
- @NotNull
- public Builder fadeOut(int fadeOut) {
- checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
- this.fadeOut = fadeOut;
- return this;
- }
-
- /**
- * Create a title based on the values in the builder.
- *
- * @return a title from the values in this builder
- * @throws IllegalStateException if title isn't specified
- */
- @NotNull
- public Title build() {
- checkState(title != null, "Title not specified");
- return new Title(this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut);
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
deleted file mode 100644
index 8cf87d228..000000000
--- a/api/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
+++ /dev/null
@@ -1,52 +0,0 @@
-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/block/TargetBlockInfo.java b/api/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java
deleted file mode 100644
index 18a96dbb0..000000000
--- a/api/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.destroystokyo.paper.block;
-
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents information about a targeted block
- */
-public class TargetBlockInfo {
- private final Block block;
- private final BlockFace blockFace;
-
- public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) {
- this.block = block;
- this.blockFace = blockFace;
- }
-
- /**
- * Get the block that is targeted
- *
- * @return Targeted block
- */
- @NotNull
- public Block getBlock() {
- return block;
- }
-
- /**
- * Get the targeted BlockFace
- *
- * @return Targeted blockface
- */
- @NotNull
- public BlockFace getBlockFace() {
- return blockFace;
- }
-
- /**
- * Get the relative Block to the targeted block on the side it is targeted at
- *
- * @return Block relative to targeted block
- */
- @NotNull
- public Block getRelativeBlock() {
- return block.getRelative(blockFace);
- }
-
- public enum FluidMode {
- NEVER,
- SOURCE_ONLY,
- ALWAYS
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/api/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
deleted file mode 100644
index 8b90a9053..000000000
--- a/api/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package com.destroystokyo.paper.entity;
-
-import org.bukkit.Location;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Mob;
-
-import java.util.List;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Handles pathfinding operations for an Entity
- */
-public interface Pathfinder {
-
- /**
- *
- * @return The entity that is controlled by this pathfinder
- */
- @NotNull
- Mob getEntity();
-
- /**
- * Instructs the Entity to stop trying to navigate to its current desired location
- */
- void stopPathfinding();
-
- /**
- * If the entity is currently trying to navigate to a destination, this will return true
- * @return true if the entity is navigating to a destination
- */
- boolean hasPath();
-
- /**
- * @return The location the entity is trying to navigate to, or null if there is no destination
- */
- @Nullable
- PathResult getCurrentPath();
-
- /**
- * Calculates a destination for the Entity to navigate to, but does not set it
- * as the current target. Useful for calculating what would happen before setting it.
- * @param loc Location to navigate to
- * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
- */
- @Nullable PathResult findPath(@NotNull Location loc);
-
- /**
- * Calculates a destination for the Entity to navigate to to reach the target entity,
- * but does not set it as the current target.
- * Useful for calculating what would happen before setting it.
- *
- * The behavior of this PathResult is subject to the games pathfinding rules, and may
- * result in the pathfinding automatically updating to follow the target Entity.
- *
- * However, this behavior is not guaranteed, and is subject to the games behavior.
- *
- * @param target the Entity to navigate to
- * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
- */
- @Nullable PathResult findPath(@NotNull LivingEntity target);
-
- /**
- * Calculates a destination for the Entity to navigate to, and sets it with default speed
- * as the current target.
- * @param loc Location to navigate to
- * @return If the pathfinding was successfully started
- */
- default boolean moveTo(@NotNull Location loc) {
- return moveTo(loc, 1);
- }
-
- /**
- * Calculates a destination for the Entity to navigate to, with desired speed
- * as the current target.
- * @param loc Location to navigate to
- * @param speed Speed multiplier to navigate at, where 1 is 'normal'
- * @return If the pathfinding was successfully started
- */
- default boolean moveTo(@NotNull Location loc, double speed) {
- PathResult path = findPath(loc);
- return path != null && moveTo(path, speed);
- }
-
- /**
- * Calculates a destination for the Entity to navigate to to reach the target entity,
- * and sets it with default speed.
- *
- * The behavior of this PathResult is subject to the games pathfinding rules, and may
- * result in the pathfinding automatically updating to follow the target Entity.
- *
- * However, this behavior is not guaranteed, and is subject to the games behavior.
- *
- * @param target the Entity to navigate to
- * @return If the pathfinding was successfully started
- */
- default boolean moveTo(@NotNull LivingEntity target) {
- return moveTo(target, 1);
- }
-
- /**
- * Calculates a destination for the Entity to navigate to to reach the target entity,
- * and sets it with specified speed.
- *
- * The behavior of this PathResult is subject to the games pathfinding rules, and may
- * result in the pathfinding automatically updating to follow the target Entity.
- *
- * However, this behavior is not guaranteed, and is subject to the games behavior.
- *
- * @param target the Entity to navigate to
- * @param speed Speed multiplier to navigate at, where 1 is 'normal'
- * @return If the pathfinding was successfully started
- */
- default boolean moveTo(@NotNull LivingEntity target, double speed) {
- PathResult path = findPath(target);
- return path != null && moveTo(path, speed);
- }
-
- /**
- * Takes the result of a previous pathfinding calculation and sets it
- * as the active pathfinding with default speed.
- *
- * @param path The Path to start following
- * @return If the pathfinding was successfully started
- */
- default boolean moveTo(@NotNull PathResult path) {
- return moveTo(path, 1);
- }
-
- /**
- * Takes the result of a previous pathfinding calculation and sets it
- * as the active pathfinding,
- *
- * @param path The Path to start following
- * @param speed Speed multiplier to navigate at, where 1 is 'normal'
- * @return If the pathfinding was successfully started
- */
- boolean moveTo(@NotNull PathResult path, double speed);
-
- /**
- * Represents the result of a pathfinding calculation
- */
- interface PathResult {
-
- /**
- * All currently calculated points to follow along the path to reach the destination location
- *
- * Will return points the entity has already moved past, see {@link #getNextPointIndex()}
- * @return List of points
- */
- @NotNull
- List getPoints();
-
- /**
- * @return Returns the index of the current point along the points returned in {@link #getPoints()} the entity
- * is trying to reach, or null if we are done with this pathfinding.
- */
- int getNextPointIndex();
-
- /**
- * @return The next location in the path points the entity is trying to reach, or null if there is no next point
- */
- @Nullable Location getNextPoint();
-
- /**
- * @return The closest point the path can get to the target location
- */
- @Nullable Location getFinalPoint();
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java b/api/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
deleted file mode 100644
index f2e3233a3..000000000
--- a/api/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.destroystokyo.paper.entity;
-
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Mob;
-import org.jetbrains.annotations.NotNull;
-
-public interface RangedEntity extends Mob {
- /**
- * Attack the specified entity using a ranged attack.
- *
- * @param target the entity to target
- * @param charge How "charged" the attack is (how far back the bow was pulled for Bow attacks).
- * This should be a value between 0 and 1, represented as targetDistance/maxDistance.
- */
- void rangedAttack(@NotNull LivingEntity target, float charge);
-
- /**
- * Sets that the Entity is "charging" up an attack, by raising its hands
- *
- * @param raiseHands Whether the entities hands are raised to charge attack
- */
- void setChargingAttack(boolean raiseHands);
-
- /**
- * Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack
- * @return If entities hands are raised
- */
- default boolean isChargingAttack() {
- return isHandRaised();
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/api/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
deleted file mode 100644
index f52644fab..000000000
--- a/api/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.destroystokyo.paper.entity;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents information about a targeted entity
- */
-public class TargetEntityInfo {
- private final Entity entity;
- private final Vector hitVec;
-
- public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) {
- this.entity = entity;
- this.hitVec = hitVec;
- }
-
- /**
- * Get the entity that is targeted
- *
- * @return Targeted entity
- */
- @NotNull
- public Entity getEntity() {
- return entity;
- }
-
- /**
- * Get the position the entity is targeted at
- *
- * @return Targeted position
- */
- @NotNull
- public Vector getHitVector() {
- return hitVec;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/api/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
deleted file mode 100644
index a83c286c1..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.destroystokyo.paper.event.block;
-
-import org.bukkit.Material;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.inventory.InventoryEvent;
-import org.bukkit.inventory.AnvilInventory;
-import org.bukkit.inventory.InventoryView;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Called when an anvil is damaged from being used
- */
-public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancel;
- private DamageState damageState;
-
- public AnvilDamagedEvent(@NotNull InventoryView inventory, @NotNull BlockData blockData) {
- super(inventory);
- this.damageState = DamageState.getState(blockData);
- }
-
- @NotNull
- @Override
- public AnvilInventory getInventory() {
- return (AnvilInventory) super.getInventory();
- }
-
- /**
- * Gets the new state of damage on the anvil
- *
- * @return Damage state
- */
- @NotNull
- public DamageState getDamageState() {
- return damageState;
- }
-
- /**
- * Sets the new state of damage on the anvil
- *
- * @param damageState Damage state
- */
- public void setDamageState(@NotNull DamageState damageState) {
- this.damageState = damageState;
- }
-
- /**
- * Gets if anvil is breaking on this use
- *
- * @return True if breaking
- */
- public boolean isBreaking() {
- return damageState == DamageState.BROKEN;
- }
-
- /**
- * Sets if anvil is breaking on this use
- *
- * @param breaking True if breaking
- */
- public void setBreaking(boolean breaking) {
- if (breaking) {
- damageState = DamageState.BROKEN;
- } else if (damageState == DamageState.BROKEN) {
- damageState = DamageState.DAMAGED;
- }
- }
-
- public boolean isCancelled() {
- return cancel;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancel = cancel;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * Represents the amount of damage on an anvil block
- */
- public enum DamageState {
- FULL(Material.ANVIL),
- CHIPPED(Material.CHIPPED_ANVIL),
- DAMAGED(Material.DAMAGED_ANVIL),
- BROKEN(Material.AIR);
-
- private Material material;
-
- DamageState(@NotNull Material material) {
- this.material = material;
- }
-
- /**
- * Get block material of this state
- *
- * @return Material
- */
- @NotNull
- public Material getMaterial() {
- return material;
- }
-
- /**
- * Get damaged state by block data
- *
- * @param blockData Block data
- * @return DamageState
- * @throws IllegalArgumentException If non anvil block data is given
- */
- @NotNull
- public static DamageState getState(@Nullable BlockData blockData) {
- return blockData == null ? BROKEN : getState(blockData.getMaterial());
- }
-
- /**
- * Get damaged state by block material
- *
- * @param material Block material
- * @return DamageState
- * @throws IllegalArgumentException If non anvil material is given
- */
- @NotNull
- public static DamageState getState(@Nullable Material material) {
- if (material == null) {
- return BROKEN;
- }
- for (DamageState state : values()) {
- if (state.material == material) {
- return state;
- }
- }
- throw new IllegalArgumentException("Material not an anvil");
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/api/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
deleted file mode 100644
index 978813b94..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.destroystokyo.paper.event.block;
-
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.block.BlockEvent;
-import org.bukkit.potion.PotionEffect;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when a beacon effect is being applied to a player.
- */
-public class BeaconEffectEvent extends BlockEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- private PotionEffect effect;
- private Player player;
- private boolean primary;
-
- public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
- super(block);
- this.effect = effect;
- this.player = player;
- this.primary = primary;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancelled) {
- this.cancelled = cancelled;
- }
-
- /**
- * Gets the potion effect being applied.
- *
- * @return Potion effect
- */
- @NotNull
- public PotionEffect getEffect() {
- return effect;
- }
-
- /**
- * Sets the potion effect that will be applied.
- *
- * @param effect Potion effect
- */
- public void setEffect(@NotNull PotionEffect effect) {
- this.effect = effect;
- }
-
- /**
- * Gets the player who the potion effect is being applied to.
- *
- * @return Affected player
- */
- @NotNull
- public Player getPlayer() {
- return player;
- }
-
- /**
- * Gets whether the effect is a primary beacon effect.
- *
- * @return true if this event represents a primary effect
- */
- public boolean isPrimary() {
- return primary;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
deleted file mode 100644
index 3aee12f1c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.destroystokyo.paper.event.block;
-
-import org.bukkit.block.Block;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.block.BlockEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired anytime the server intends to 'destroy' a block through some triggering reason.
- * This does not fire anytime a block is set to air, but only with more direct triggers such
- * as physics updates, pistons, Entities changing blocks, commands set to "Destroy".
- *
- * This event is associated with the game playing a sound effect at the block in question, when
- * something can be described as "intend to destroy what is there",
- *
- * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
- *
- */
-public class BlockDestroyEvent extends BlockEvent implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull private final BlockData newState;
- private final boolean willDrop;
- private boolean playEffect;
-
- private boolean cancelled = false;
-
- public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, boolean willDrop) {
- super(block);
- this.newState = newState;
- this.willDrop = willDrop;
- }
-
- /**
- * @return The new state of this block (Air, or a Fluid type)
- */
- @NotNull
- public BlockData getNewState() {
- return newState;
- }
-
- /**
- * @return If the server is going to drop the block in question with this destroy event
- */
- public boolean willDrop() {
- return this.willDrop;
- }
-
- /**
- * @return If the server is going to play the sound effect for this destruction
- */
- public boolean playEffect() {
- return this.playEffect;
- }
-
- /**
- * @param playEffect If the server should play the sound effect for this destruction
- */
- public void setPlayEffect(boolean playEffect) {
- this.playEffect = playEffect;
- }
-
- /**
- * @return If the event is cancelled, meaning the block will not be destroyed
- */
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * If the event is cancelled, the block will remain in its previous state.
- * @param cancel true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
deleted file mode 100644
index 73dabb82c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.destroystokyo.paper.event.block;
-
-import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.block.BlockEvent;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Called when TNT block is about to turn into {@link org.bukkit.entity.TNTPrimed}
- *
- * Cancelling it won't turn TNT into {@link org.bukkit.entity.TNTPrimed} and leaves
- * the TNT block as-is
- *
- * @author Mark Vainomaa
- */
-public class TNTPrimeEvent extends BlockEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- @NotNull private PrimeReason reason;
- @Nullable private Entity primerEntity;
-
- public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
- super(theBlock);
- this.reason = reason;
- this.primerEntity = primerEntity;
- }
-
- /**
- * Gets the TNT prime reason
- *
- * @return Prime reason
- */
- @NotNull
- public PrimeReason getReason() {
- return this.reason;
- }
-
- /**
- * Gets the TNT primer {@link Entity}.
- *
- * It's null if {@link #getReason()} is {@link PrimeReason#REDSTONE} or {@link PrimeReason#FIRE}.
- * It's not null if {@link #getReason()} is {@link PrimeReason#ITEM} or {@link PrimeReason#PROJECTILE}
- * It might be null if {@link #getReason()} is {@link PrimeReason#EXPLOSION}
- *
- * @return The {@link Entity} who primed the TNT
- */
- @Nullable
- public Entity getPrimerEntity() {
- return this.primerEntity;
- }
-
- /**
- * Gets whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
- *
- * @return Whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
- */
- @Override
- public boolean isCancelled() {
- return this.cancelled;
- }
-
- /**
- * Sets whether to cancel spawning {@link org.bukkit.entity.TNTPrimed} or not
- *
- * @param cancel whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
- */
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- @Nullable
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @Nullable
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- public enum PrimeReason {
- /**
- * When TNT prime was caused by other explosion (chain reaction)
- */
- EXPLOSION,
-
- /**
- * When TNT prime was caused by fire
- */
- FIRE,
-
- /**
- * When {@link org.bukkit.entity.Player} used {@link org.bukkit.Material#FLINT_AND_STEEL} or
- * {@link org.bukkit.Material#FIRE_CHARGE} on given TNT block
- */
- ITEM,
-
- /**
- * When TNT prime was caused by an {@link Entity} shooting TNT
- * using a bow with {@link org.bukkit.enchantments.Enchantment#ARROW_FIRE} enchantment
- */
- PROJECTILE,
-
- /**
- * When redstone power triggered the TNT prime
- */
- REDSTONE
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
deleted file mode 100644
index ff10251b6..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Creeper;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
- */
-public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean canceled;
- private boolean ignited;
-
- public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
- super(creeper);
- this.ignited = ignited;
- }
-
- @NotNull
- @Override
- public Creeper getEntity() {
- return (Creeper) entity;
- }
-
- public boolean isIgnited() {
- return ignited;
- }
-
- public void setIgnited(boolean ignited) {
- this.ignited = ignited;
- }
-
- public boolean isCancelled() {
- return canceled;
- }
-
- public void setCancelled(boolean cancel) {
- canceled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
deleted file mode 100644
index 118c7b677..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.AreaEffectCloud;
-import org.bukkit.entity.DragonFireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-
-import java.util.Collection;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
- */
-public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
- @Nullable private final Collection targets;
- @NotNull private final AreaEffectCloud areaEffectCloud;
-
- public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @Nullable Collection targets, @NotNull AreaEffectCloud areaEffectCloud) {
- super(fireball);
- this.targets = targets;
- this.areaEffectCloud = areaEffectCloud;
- }
-
- /**
- * The fireball involved in this event
- */
- @NotNull
- @Override
- public DragonFireball getEntity() {
- return (DragonFireball) super.getEntity();
- }
-
- /**
- * The living entities hit by fireball
- *
- * May be null if no entities were hit
- *
- * @return the targets
- */
- @Nullable
- public Collection getTargets() {
- return targets;
- }
-
- /**
- * @return The area effect cloud spawned in this collision
- */
- @NotNull
- public AreaEffectCloud getAreaEffectCloud() {
- return areaEffectCloud;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
deleted file mode 100644
index 1915177f4..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.AreaEffectCloud;
-import org.bukkit.entity.EnderDragon;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
- */
-public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
- @NotNull private final AreaEffectCloud areaEffectCloud;
-
- public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
- super(enderDragon);
- this.areaEffectCloud = areaEffectCloud;
- }
-
- /**
- * The enderdragon involved in this event
- */
- @NotNull
- @Override
- public EnderDragon getEntity() {
- return (EnderDragon) super.getEntity();
- }
-
- /**
- * @return The area effect cloud spawned in this collision
- */
- @NotNull
- public AreaEffectCloud getAreaEffectCloud() {
- return areaEffectCloud;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
deleted file mode 100644
index 8414bd805..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.DragonFireball;
-import org.bukkit.entity.EnderDragon;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when an EnderDragon shoots a fireball
- */
-public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
- @NotNull private final DragonFireball fireball;
-
- public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
- super(entity);
- this.fireball = fireball;
- }
-
- /**
- * The enderdragon shooting the fireball
- */
- @NotNull
- @Override
- public EnderDragon getEntity() {
- return (EnderDragon) super.getEntity();
- }
-
- /**
- * @return The fireball being shot
- */
- @NotNull
- public DragonFireball getFireball() {
- return fireball;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
deleted file mode 100644
index f530a3d93..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Enderman;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when an Enderman determines if it should attack a player or not.
- * Starts off cancelled if the player is wearing a pumpkin head or is not looking
- * at the Enderman, according to Vanilla rules.
- *
- */
-public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable {
- @NotNull private final Player player;
-
- public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) {
- super(entity);
- this.player = player;
- }
-
- /**
- * The enderman considering attacking
- *
- * @return The enderman considering attacking
- */
- @NotNull
- @Override
- public Enderman getEntity() {
- return (Enderman) super.getEntity();
- }
-
- /**
- * The player the Enderman is considering attacking
- *
- * @return The player the Enderman is considering attacking
- */
- @NotNull
- public Player getPlayer() {
- return player;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- *
- * @return If cancelled, the enderman will not attack
- */
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * Cancels if the Enderman will attack this player
- * @param cancel true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
deleted file mode 100644
index 806112a8b..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Enderman;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
- @NotNull private final Reason reason;
-
- public EndermanEscapeEvent(@NotNull Enderman entity, @NotNull Reason reason) {
- super(entity);
- this.reason = reason;
- }
-
- @NotNull
- @Override
- public Enderman getEntity() {
- return (Enderman) super.getEntity();
- }
-
- /**
- * @return The reason the enderman is trying to escape
- */
- @NotNull
- public Reason getReason() {
- return reason;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * Cancels the escape.
- *
- * If this escape normally would of resulted in damage avoidance such as indirect,
- * the enderman will now take damage.
- *
- * @param cancel true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- public enum Reason {
- /**
- * The enderman has stopped attacking and ran away
- */
- RUNAWAY,
- /**
- * The enderman has teleported away due to indirect damage (ranged)
- */
- INDIRECT,
- /**
- * The enderman has teleported away due to a critical hit
- */
- CRITICAL_HIT,
- /**
- * The enderman has teleported away due to the player staring at it during combat
- */
- STARE,
- /**
- * Specific case for CRITICAL_HIT where the enderman is taking rain damage
- */
- DROWN
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
deleted file mode 100644
index 07660202e..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired any time an entity is being added to the world for any reason.
- *
- * Not to be confused with {@link org.bukkit.event.entity.CreatureSpawnEvent}
- * This will fire anytime a chunk is reloaded too.
- */
-public class EntityAddToWorldEvent extends EntityEvent {
-
- public EntityAddToWorldEvent(@NotNull Entity entity) {
- super(entity);
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
deleted file mode 100644
index 9efecabab..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
- * vector can be modified. If this event is cancelled, the entity is not knocked back.
- *
- */
-public class EntityKnockbackByEntityEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull private final Entity hitBy;
- private final float knockbackStrength;
- @NotNull private final Vector acceleration;
- private boolean cancelled = false;
-
- public EntityKnockbackByEntityEvent(@NotNull LivingEntity entity, @NotNull Entity hitBy, float knockbackStrength, @NotNull Vector acceleration) {
- super(entity);
- this.hitBy = hitBy;
- this.knockbackStrength = knockbackStrength;
- this.acceleration = acceleration;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- /**
- * @return the entity which was knocked back
- */
- @NotNull
- @Override
- public LivingEntity getEntity() {
- return (LivingEntity) super.getEntity();
- }
-
- /**
- * @return the original knockback strength.
- */
- public float getKnockbackStrength() {
- return knockbackStrength;
- }
-
- /**
- * @return the Entity which hit
- */
- @NotNull
- public Entity getHitBy() {
- return hitBy;
- }
-
- /**
- * @return the acceleration that will be applied
- */
- @NotNull
- public Vector getAcceleration() {
- return acceleration;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
deleted file mode 100644
index 63e46b2fb..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Fired when an Entity decides to start moving towards a location.
- *
- * This event does not fire for the entities actual movement. Only when it
- * is choosing to start moving to a location.
- */
-public class EntityPathfindEvent extends EntityEvent implements Cancellable {
- @Nullable private final Entity targetEntity;
- @NotNull private final Location loc;
-
- public EntityPathfindEvent(@NotNull Entity entity, @NotNull Location loc, @Nullable Entity targetEntity) {
- super(entity);
- this.targetEntity = targetEntity;
- this.loc = loc;
- }
-
- /**
- * The Entity that is pathfinding.
- * @return The Entity that is pathfinding.
- */
- @NotNull
- public Entity getEntity() {
- return entity;
- }
-
- /**
- * If the Entity is trying to pathfind to an entity, this is the entity in relation.
- *
- * Otherwise this will return null.
- *
- * @return The entity target or null
- */
- @Nullable
- public Entity getTargetEntity() {
- return targetEntity;
- }
-
- /**
- * The Location of where the entity is about to move to.
- *
- * Note that if the target happened to of been an entity
- * @return Location of where the entity is trying to pathfind to.
- */
- @NotNull
- public Location getLoc() {
- return loc;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
deleted file mode 100644
index e5dbbd660..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired any time an entity is being removed from a world for any reason
- */
-public class EntityRemoveFromWorldEvent extends EntityEvent {
-
- public EntityRemoveFromWorldEvent(@NotNull Entity entity) {
- super(entity);
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
deleted file mode 100644
index bfc69a43c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Location;
-import org.bukkit.block.EndGateway;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.entity.EntityTeleportEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired any time an entity attempts to teleport in an end gateway
- */
-public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
-
- @NotNull private final EndGateway gateway;
-
- public EntityTeleportEndGatewayEvent(@NotNull Entity what, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
- super(what, from, to);
- this.gateway = gateway;
- }
-
- /**
- * The gateway triggering the teleport
- *
- * @return EndGateway used
- */
- @NotNull
- public EndGateway getGateway() {
- return gateway;
- }
-
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
deleted file mode 100644
index 12194f1fc..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.event.entity.EntityTransformEvent;
-
-/**
- * Fired when an entity transforms into another entity
- *
- * If the event is cancelled, the entity will not transform
- * @deprecated Bukkit has added {@link EntityTransformEvent}, you should start using that
- */
-@Deprecated
-public class EntityTransformedEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- private final Entity transformed;
- private final TransformedReason reason;
-
- public EntityTransformedEvent(Entity entity, Entity transformed, TransformedReason reason) {
- super(entity);
- this.transformed = transformed;
- this.reason = reason;
- }
-
- /**
- * The entity after it has transformed
- *
- * @return Transformed entity
- * @deprecated see {@link EntityTransformEvent#getTransformedEntity()}
- */
- @Deprecated
- public Entity getTransformed() {
- return transformed;
- }
-
- /**
- * @return The reason for the transformation
- * @deprecated see {@link EntityTransformEvent#getTransformReason()}
- */
- @Deprecated
- public TransformedReason getReason() {
- return reason;
- }
-
-
- @Override
- public HandlerList getHandlers(){
- return handlers;
- }
-
- public static HandlerList getHandlerList(){
- return handlers;
- }
-
- @Override
- public boolean isCancelled(){
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel){
- cancelled = cancel;
- }
-
- public enum TransformedReason {
- /**
- * When a zombie drowns
- */
- DROWNED,
- /**
- * When a zombie villager is cured
- */
- CURED,
- /**
- * When a villager turns to a zombie villager
- */
- INFECTED,
- /**
- * When a mooshroom turns to a cow
- */
- SHEARED,
- /**
- * When a pig turns to a zombiepigman
- */
- LIGHTNING
-
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
deleted file mode 100644
index 3b725a489..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.apache.commons.lang.Validate;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LightningStrike;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.event.entity.EntityTransformEvent;
-
-import java.util.Collections;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when lightning strikes an entity
- */
-public class EntityZapEvent extends EntityTransformEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- @NotNull private final LightningStrike bolt;
-
- public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) {
- super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
- Validate.notNull(bolt);
- Validate.notNull(replacementEntity);
- this.bolt = bolt;
- }
-
- public boolean isCancelled() {
- return cancelled;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- /**
- * Gets the lightning bolt that is striking the entity.
- * @return The lightning bolt responsible for this event
- */
- @NotNull
- public LightningStrike getBolt() {
- return bolt;
- }
-
- /**
- * Gets the entity that will replace the struck entity.
- * @return The entity that will replace the struck entity
- */
- @NotNull
- public Entity getReplacementEntity() {
- return getTransformedEntity();
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
deleted file mode 100644
index 0ce3e3977..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.ExperienceOrb;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired anytime the server is about to merge 2 experience orbs into one
- */
-public class ExperienceOrbMergeEvent extends EntityEvent implements Cancellable {
- @NotNull private final ExperienceOrb mergeTarget;
- @NotNull private final ExperienceOrb mergeSource;
-
- public ExperienceOrbMergeEvent(@NotNull ExperienceOrb mergeTarget, @NotNull ExperienceOrb mergeSource) {
- super(mergeTarget);
- this.mergeTarget = mergeTarget;
- this.mergeSource = mergeSource;
- }
-
- /**
- * @return The orb that will absorb the other experience orb
- */
- @NotNull
- public ExperienceOrb getMergeTarget() {
- return mergeTarget;
- }
-
- /**
- * @return The orb that is subject to being removed and merged into the target orb
- */
- @NotNull
- public ExperienceOrb getMergeSource() {
- return mergeSource;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * @param cancel true if you wish to cancel this event, and prevent the orbs from merging
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
deleted file mode 100644
index 9022f697a..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-
-/**
- * Called when a phantom is spawned for an exhausted player
- */
-public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
- @NotNull private final Entity entity;
-
- public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
- super(location, EntityType.PHANTOM, reason);
- this.entity = entity;
- }
-
- /**
- * Get the entity this phantom is spawning for
- *
- * @return Entity
- */
- @Nullable
- public Entity getSpawningEntity() {
- return entity;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
deleted file mode 100644
index 112a0dbf5..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when the server is calculating what chunks to try to spawn monsters in every Monster Spawn Tick event
- */
-public class PlayerNaturallySpawnCreaturesEvent extends PlayerEvent implements Cancellable {
- private byte radius;
-
- public PlayerNaturallySpawnCreaturesEvent(@NotNull Player player, byte radius) {
- super(player);
- this.radius = radius;
- }
-
- /**
- * @return The radius of chunks around this player to be included in natural spawn selection
- */
- public byte getSpawnRadius() {
- return radius;
- }
-
- /**
- * @param radius The radius of chunks around this player to be included in natural spawn selection
- */
- public void setSpawnRadius(byte radius) {
- this.radius = radius;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- * @return If this players chunks will be excluded from natural spawns
- */
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * @param cancel true if you wish to cancel this event, and not include this players chunks for natural spawning
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
deleted file mode 100644
index d5edde9cd..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import com.google.common.base.Preconditions;
-import org.bukkit.Location;
-import org.bukkit.entity.EntityType;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * WARNING: This event only fires for a limited number of cases, and not for every case that CreatureSpawnEvent does.
- *
- * You should still listen to CreatureSpawnEvent as a backup, and only use this event as an "enhancement".
- * The intent of this event is to improve server performance, so limited use cases.
- *
- * Currently: NATURAL and SPAWNER based reasons. Please submit a Pull Request for future additions.
- * Also, Plugins that replace Entity Registrations with their own custom entities might not fire this event.
- */
-public class PreCreatureSpawnEvent extends Event implements Cancellable {
- @NotNull private final Location location;
- @NotNull private final EntityType type;
- @NotNull private final CreatureSpawnEvent.SpawnReason reason;
- private boolean shouldAbortSpawn;
-
- public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
- this.location = Preconditions.checkNotNull(location, "Location may not be null").clone();
- this.type = Preconditions.checkNotNull(type, "Type may not be null");
- this.reason = Preconditions.checkNotNull(reason, "Reason may not be null");
- }
-
- /**
- * @return The location this creature is being spawned at
- */
- @NotNull
- public Location getSpawnLocation() {
- return location;
- }
-
- /**
- * @return The type of creature being spawned
- */
- @NotNull
- public EntityType getType() {
- return type;
- }
-
- /**
- * @return Reason this creature is spawning (ie, NATURAL vs SPAWNER)
- */
- @NotNull
- public CreatureSpawnEvent.SpawnReason getReason() {
- return reason;
- }
-
- /**
- * @return If the spawn process should be aborted vs trying more attempts
- */
- public boolean shouldAbortSpawn() {
- return shouldAbortSpawn;
- }
-
- /**
- * Set this if you are more blanket blocking all types of these spawns, and wish to abort the spawn process from
- * trying more attempts after this cancellation.
- *
- * @param shouldAbortSpawn Set if the spawn process should be aborted vs trying more attempts
- */
- public void setShouldAbortSpawn(boolean shouldAbortSpawn) {
- this.shouldAbortSpawn = shouldAbortSpawn;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- * @return If the spawn of this creature is cancelled or not
- */
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * Cancelling this event is more effecient than cancelling CreatureSpawnEvent
- * @param cancel true if you wish to cancel this event, and abort the spawn of this creature
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
deleted file mode 100644
index 48cff0635..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-
-import com.google.common.base.Preconditions;
-import org.bukkit.Location;
-import org.bukkit.entity.EntityType;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called before an entity is spawned into a world by a spawner.
- *
- * This only includes the spawner's location and not the full BlockState snapshot for performance reasons.
- * If you really need it you have to get the spawner yourself.
- */
-
-public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
- @NotNull private final Location spawnerLocation;
-
- public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) {
- super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
- this.spawnerLocation = Preconditions.checkNotNull(spawnerLocation, "Spawner location may not be null");
- }
-
- @NotNull
- public Location getSpawnerLocation() {
- return spawnerLocation;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
deleted file mode 100644
index 453663893..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when an projectile collides with an entity
- *
- * This event is called before {@link org.bukkit.event.entity.EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying
- */
-public class ProjectileCollideEvent extends EntityEvent implements Cancellable {
- @NotNull private final Entity collidedWith;
-
- /**
- * Get the entity the projectile collided with
- *
- * @return the entity collided with
- */
- @NotNull
- public Entity getCollidedWith() {
- return collidedWith;
- }
-
- public ProjectileCollideEvent(@NotNull Projectile what, @NotNull Entity collidedWith) {
- super(what);
- this.collidedWith = collidedWith;
- }
-
- /**
- * Get the projectile that collided
- *
- * @return the projectile that collided
- */
- @NotNull
- public Projectile getEntity() {
- return (Projectile) super.getEntity();
- }
-
- private static final HandlerList handlerList = new HandlerList();
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlerList;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlerList;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
deleted file mode 100644
index d79dbcd68..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.SkeletonHorse;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Event called when a player gets close to a skeleton horse and triggers the lightning trap
- */
-public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
- public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
- super(horse);
- }
-
- @NotNull
- @Override
- public SkeletonHorse getEntity() {
- return (SkeletonHorse) super.getEntity();
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
-
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
deleted file mode 100644
index 2638bbd3e..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Cancellable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Slime decides to change it's facing direction.
- *
- * This event does not fire for the entity's actual movement. Only when it
- * is choosing to change direction.
- */
-public class SlimeChangeDirectionEvent extends SlimePathfindEvent implements Cancellable {
- private float yaw;
-
- public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) {
- super(slime);
- this.yaw = yaw;
- }
-
- /**
- * Get the new chosen yaw
- *
- * @return Chosen yaw
- */
- public float getNewYaw() {
- return yaw;
- }
-
- /**
- * Set the new chosen yaw
- *
- * @param yaw Chosen yaw
- */
- public void setNewYaw(float yaw) {
- this.yaw = yaw;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
deleted file mode 100644
index 14b67da10..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Slime decides to start pathfinding.
- *
- * This event does not fire for the entity's actual movement. Only when it
- * is choosing to start moving.
- */
-public class SlimePathfindEvent extends EntityEvent implements Cancellable {
- public SlimePathfindEvent(@NotNull Slime slime) {
- super(slime);
- }
-
- /**
- * The Slime that is pathfinding.
- *
- * @return The Slime that is pathfinding.
- */
- @NotNull
- public Slime getEntity() {
- return (Slime) entity;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
deleted file mode 100644
index c8dd49d11..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Cancellable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Slime decides to start jumping while swimming in water/lava.
- *
- * This event does not fire for the entity's actual movement. Only when it
- * is choosing to start jumping.
- */
-public class SlimeSwimEvent extends SlimeWanderEvent implements Cancellable {
- public SlimeSwimEvent(@NotNull Slime slime) {
- super(slime);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
deleted file mode 100644
index e9ba32799..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Cancellable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Slime decides to change direction to target a LivingEntity.
- *
- * This event does not fire for the entity's actual movement. Only when it
- * is choosing to start moving.
- */
-public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent implements Cancellable {
- @NotNull private final LivingEntity target;
-
- public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) {
- super(slime);
- this.target = target;
- }
-
- /**
- * Get the targeted entity
- *
- * @return Targeted entity
- */
- @NotNull
- public LivingEntity getTarget() {
- return target;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
deleted file mode 100644
index 4683a7237..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Cancellable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Slime decides to start wandering.
- *
- * This event does not fire for the entity's actual movement. Only when it
- * is choosing to start moving.
- */
-public class SlimeWanderEvent extends SlimePathfindEvent implements Cancellable {
- public SlimeWanderEvent(@NotNull Slime slime) {
- super(slime);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
deleted file mode 100644
index 021356d15..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Turtle;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Turtle decides to go home
- */
-public class TurtleGoHomeEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
-
- public TurtleGoHomeEvent(@NotNull Turtle turtle) {
- super(turtle);
- }
-
- /**
- * The turtle going home
- *
- * @return The turtle
- */
- @NotNull
- public Turtle getEntity() {
- return (Turtle) entity;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
deleted file mode 100644
index a315c5185..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Turtle;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Turtle lays eggs
- */
-public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
- @NotNull
- private final Location location;
- private int eggCount;
-
- public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
- super(turtle);
- this.location = location;
- this.eggCount = eggCount;
- }
-
- /**
- * The turtle laying the eggs
- *
- * @return The turtle
- */
- @NotNull
- public Turtle getEntity() {
- return (Turtle) entity;
- }
-
- /**
- * Get the location where the eggs are being laid
- *
- * @return Location of eggs
- */
- @NotNull
- public Location getLocation() {
- return location;
- }
-
- /**
- * Get the number of eggs being laid
- *
- * @return Number of eggs
- */
- public int getEggCount() {
- return eggCount;
- }
-
- /**
- * Set the number of eggs being laid
- *
- * @param eggCount Number of eggs
- */
- public void setEggCount(int eggCount) {
- if (eggCount < 1) {
- cancelled = true;
- return;
- }
- eggCount = Math.min(eggCount, 4);
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
deleted file mode 100644
index abeb24fcc..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Turtle;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a Turtle starts digging to lay eggs
- */
-public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
- @NotNull private final Location location;
-
- public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
- super(turtle);
- this.location = location;
- }
-
- /**
- * The turtle digging
- *
- * @return The turtle
- */
- @NotNull
- public Turtle getEntity() {
- return (Turtle) entity;
- }
-
- /**
- * Get the location where the turtle is digging
- *
- * @return Location where digging
- */
- @NotNull
- public Location getLocation() {
- return location;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
deleted file mode 100644
index fbbace36d..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.Witch;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Fired when a witch consumes the potion in their hand to buff themselves.
- */
-public class WitchConsumePotionEvent extends EntityEvent implements Cancellable {
- @Nullable private ItemStack potion;
-
- public WitchConsumePotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
- super(witch);
- this.potion = potion;
- }
-
- @NotNull
- @Override
- public Witch getEntity() {
- return (Witch) super.getEntity();
- }
-
- /**
- * @return the potion the witch will consume and have the effects applied.
- */
- @Nullable
- public ItemStack getPotion() {
- return potion;
- }
-
- /**
- * Sets the potion to be consumed and applied to the witch.
- * @param potion The potion
- */
- public void setPotion(@Nullable ItemStack potion) {
- this.potion = potion != null ? potion.clone() : null;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- * @return Event was cancelled or potion was null
- */
- @Override
- public boolean isCancelled() {
- return cancelled || potion == null;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
deleted file mode 100644
index 5351b523d..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.Material;
-import org.bukkit.entity.Witch;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class WitchReadyPotionEvent extends EntityEvent implements Cancellable {
- private ItemStack potion;
-
- public WitchReadyPotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
- super(witch);
- this.potion = potion;
- }
-
- /**
- * Fires thee event, returning the desired potion, or air of cancelled
- * @param witch the witch whom is readying to use a potion
- * @param potion the potion to be used
- * @return The ItemStack to be used
- */
- @Nullable
- public static ItemStack process(@NotNull Witch witch, @Nullable ItemStack potion) {
- WitchReadyPotionEvent event = new WitchReadyPotionEvent(witch, potion);
- if (!event.callEvent() || event.getPotion() == null) {
- return new ItemStack(Material.AIR);
- }
- return event.getPotion();
- }
-
- @NotNull
- @Override
- public Witch getEntity() {
- return (Witch) super.getEntity();
- }
-
- /**
- * @return the potion the witch is readying to use
- */
- @Nullable
- public ItemStack getPotion() {
- return potion;
- }
-
- /**
- * Sets the potion the which is going to hold and use
- * @param potion The potion
- */
- public void setPotion(@Nullable ItemStack potion) {
- this.potion = potion != null ? potion.clone() : null;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/api/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
deleted file mode 100644
index 688a596aa..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.destroystokyo.paper.event.entity;
-
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Witch;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.entity.EntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Fired when a witch throws a potion at a player
- */
-public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
- @NotNull private final LivingEntity target;
- @Nullable private ItemStack potion;
-
- public WitchThrowPotionEvent(@NotNull Witch witch, @NotNull LivingEntity target, @Nullable ItemStack potion) {
- super(witch);
- this.target = target;
- this.potion = potion;
- }
-
- @NotNull
- @Override
- public Witch getEntity() {
- return (Witch) super.getEntity();
- }
-
- /**
- * @return The target of the potion
- */
- @NotNull
- public LivingEntity getTarget() {
- return target;
- }
-
- /**
- * @return The potion the witch will throw at a player
- */
- @Nullable
- public ItemStack getPotion() {
- return potion;
- }
-
- /**
- * Sets the potion to be thrown at a player
- * @param potion The potion
- */
- public void setPotion(@Nullable ItemStack potion) {
- this.potion = potion != null ? potion.clone() : null;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- * @return Event was cancelled or potion was null
- */
- @Override
- public boolean isCancelled() {
- return cancelled || potion == null;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/api/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
deleted file mode 100644
index 5b28e9b1d..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.destroystokyo.paper.event.executor;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Method;
-
-import com.destroystokyo.paper.util.SneakyThrow;
-import org.bukkit.event.Event;
-import org.bukkit.event.EventException;
-import org.bukkit.event.Listener;
-import org.bukkit.plugin.EventExecutor;
-import org.jetbrains.annotations.NotNull;
-
-public class MethodHandleEventExecutor implements EventExecutor {
- private final Class extends Event> eventClass;
- private final MethodHandle handle;
-
- public MethodHandleEventExecutor(@NotNull Class extends Event> eventClass, @NotNull MethodHandle handle) {
- this.eventClass = eventClass;
- this.handle = handle;
- }
-
- public MethodHandleEventExecutor(@NotNull Class extends Event> eventClass, @NotNull Method m) {
- this.eventClass = eventClass;
- try {
- m.setAccessible(true);
- this.handle = MethodHandles.lookup().unreflect(m);
- } catch (IllegalAccessException e) {
- throw new AssertionError("Unable to set accessible", e);
- }
- }
-
- @Override
- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
- if (!eventClass.isInstance(event)) return;
- try {
- handle.invoke(listener, event);
- } catch (Throwable t) {
- SneakyThrow.sneaky(t);
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/api/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
deleted file mode 100644
index c83672427..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.destroystokyo.paper.event.executor;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import com.destroystokyo.paper.util.SneakyThrow;
-import com.google.common.base.Preconditions;
-
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-import org.bukkit.event.EventException;
-import org.bukkit.event.Listener;
-import org.bukkit.plugin.EventExecutor;
-import org.jetbrains.annotations.NotNull;
-
-public class StaticMethodHandleEventExecutor implements EventExecutor {
- private final Class extends Event> eventClass;
- private final MethodHandle handle;
-
- public StaticMethodHandleEventExecutor(@NotNull Class extends Event> eventClass, @NotNull Method m) {
- Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
- Preconditions.checkArgument(eventClass != null, "eventClass is null");
- this.eventClass = eventClass;
- try {
- m.setAccessible(true);
- this.handle = MethodHandles.lookup().unreflect(m);
- } catch (IllegalAccessException e) {
- throw new AssertionError("Unable to set accessible", e);
- }
- }
-
- @Override
- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
- if (!eventClass.isInstance(event)) return;
- try {
- handle.invoke(event);
- } catch (Throwable throwable) {
- SneakyThrow.sneaky(throwable);
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
deleted file mode 100644
index b6e7d8ee8..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.destroystokyo.paper.event.executor.asm;
-
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.bukkit.plugin.EventExecutor;
-import org.jetbrains.annotations.NotNull;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.GeneratorAdapter;
-
-import static org.objectweb.asm.Opcodes.*;
-
-public class ASMEventExecutorGenerator {
- @NotNull
- public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
- ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
- writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
- // Generate constructor
- GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "", "()V", null, null), ACC_PUBLIC, "", "()V");
- methodGenerator.loadThis();
- methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "", "()V", false); // Invoke the super class (Object) constructor
- methodGenerator.returnValue();
- methodGenerator.endMethod();
- // Generate the execute method
- methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V", null, null), ACC_PUBLIC, "execute", "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Listener;)V");;
- methodGenerator.loadArg(0);
- methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
- methodGenerator.loadArg(1);
- methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
- methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
- if (m.getReturnType() != void.class) {
- methodGenerator.pop();
- }
- methodGenerator.returnValue();
- methodGenerator.endMethod();
- writer.visitEnd();
- return writer.toByteArray();
- }
-
- public static AtomicInteger NEXT_ID = new AtomicInteger(1);
- @NotNull
- public static String generateName() {
- int id = NEXT_ID.getAndIncrement();
- return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
deleted file mode 100644
index beed9e6e0..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.destroystokyo.paper.event.executor.asm;
-
-import com.destroystokyo.paper.utils.UnsafeUtils;
-import org.jetbrains.annotations.NotNull;
-
-public interface ClassDefiner {
-
- /**
- * Returns if the defined classes can bypass access checks
- *
- * @return if classes bypass access checks
- */
- public default boolean isBypassAccessChecks() {
- return false;
- }
-
- /**
- * Define a class
- *
- * @param parentLoader the parent classloader
- * @param name the name of the class
- * @param data the class data to load
- * @return the defined class
- * @throws ClassFormatError if the class data is invalid
- * @throws NullPointerException if any of the arguments are null
- */
- @NotNull
- public Class> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
-
- @NotNull
- public static ClassDefiner getInstance() {
- return SafeClassDefiner.INSTANCE;
- }
-
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/api/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
deleted file mode 100644
index ac99477e9..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.destroystokyo.paper.event.executor.asm;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import com.google.common.base.Preconditions;
-
-import com.google.common.collect.MapMaker;
-import org.jetbrains.annotations.NotNull;
-import org.objectweb.asm.Type;
-
-public class SafeClassDefiner implements ClassDefiner {
- /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
-
- private SafeClassDefiner() {}
-
- private final ConcurrentMap loaders = new MapMaker().weakKeys().makeMap();
-
- @NotNull
- @Override
- public Class> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
- GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
- synchronized (loader.getClassLoadingLock(name)) {
- Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
- Class> c = loader.define(name, data);
- assert c.getName().equals(name);
- return c;
- }
- }
-
- private static class GeneratedClassLoader extends ClassLoader {
- static {
- ClassLoader.registerAsParallelCapable();
- }
-
- protected GeneratedClassLoader(@NotNull ClassLoader parent) {
- super(parent);
- }
-
- private Class> define(@NotNull String name, byte[] data) {
- synchronized (getClassLoadingLock(name)) {
- assert !hasClass(name);
- Class> c = defineClass(name, data, 0, data.length);
- resolveClass(c);
- return c;
- }
- }
-
- @Override
- @NotNull
- public Object getClassLoadingLock(@NotNull String name) {
- return super.getClassLoadingLock(name);
- }
-
- public boolean hasClass(@NotNull String name) {
- synchronized (getClassLoadingLock(name)) {
- try {
- Class.forName(name);
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
deleted file mode 100644
index 37a17f0bb..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class IllegalPacketEvent extends PlayerEvent {
- @Nullable private final String type;
- @Nullable private final String ex;
- @Nullable private String kickMessage;
- private boolean shouldKick = true;
-
- public IllegalPacketEvent(@NotNull Player player, @Nullable String type, @Nullable String kickMessage, @NotNull Exception e) {
- super(player);
- this.type = type;
- this.kickMessage = kickMessage;
- this.ex = e.getMessage();
- }
-
- public boolean isShouldKick() {
- return shouldKick;
- }
-
- public void setShouldKick(boolean shouldKick) {
- this.shouldKick = shouldKick;
- }
-
- @Nullable
- public String getKickMessage() {
- return kickMessage;
- }
-
- public void setKickMessage(@Nullable String kickMessage) {
- this.kickMessage = kickMessage;
- }
-
- @Nullable
- public String getType() {
- return type;
- }
-
- @Nullable
- public String getExceptionMessage() {
- return ex;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- public static void process(@NotNull Player player, @Nullable String type, @Nullable String kickMessage, @NotNull Exception exception) {
- IllegalPacketEvent event = new IllegalPacketEvent(player, type, kickMessage, exception);
- event.callEvent();
- if (event.shouldKick) {
- player.kickPlayer(kickMessage);
- }
- Bukkit.getLogger().severe(player.getName() + "/" + type + ": " + exception.getMessage());
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
deleted file mode 100644
index bb8d7c959..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.advancement.Advancement;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when a player is granted a criteria in an advancement.
- */
-public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- @NotNull private final Advancement advancement;
- @NotNull private final String criterion;
- private boolean cancel = false;
-
- public PlayerAdvancementCriterionGrantEvent(@NotNull Player who, @NotNull Advancement advancement, @NotNull String criterion) {
- super(who);
- this.advancement = advancement;
- this.criterion = criterion;
- }
-
- /**
- * Get the advancement which has been affected.
- *
- * @return affected advancement
- */
- @NotNull
- public Advancement getAdvancement() {
- return advancement;
- }
-
- /**
- * Get the criterion which has been granted.
- *
- * @return granted criterion
- */
- @NotNull
- public String getCriterion() {
- return criterion;
- }
-
- public boolean isCancelled() {
- return cancel;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancel = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
deleted file mode 100644
index 2827a1002..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.bukkit.Material.*;
-
-/**
- * Called when the player themselves change their armor items
- *
- * Not currently called for environmental factors though it MAY BE IN THE FUTURE
- */
-public class PlayerArmorChangeEvent extends PlayerEvent {
- private static final HandlerList HANDLERS = new HandlerList();
-
- @NotNull private final SlotType slotType;
- @Nullable private final ItemStack oldItem;
- @Nullable private final ItemStack newItem;
-
- public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @Nullable ItemStack oldItem, @Nullable ItemStack newItem) {
- super(player);
- this.slotType = slotType;
- this.oldItem = oldItem;
- this.newItem = newItem;
- }
-
- /**
- * Gets the type of slot being altered.
- *
- * @return type of slot being altered
- */
- @NotNull
- public SlotType getSlotType() {
- return this.slotType;
- }
-
- /**
- * Gets the existing item that's being replaced
- *
- * @return old item
- */
- @Nullable
- public ItemStack getOldItem() {
- return this.oldItem;
- }
-
- /**
- * Gets the new item that's replacing the old
- *
- * @return new item
- */
- @Nullable
- public ItemStack getNewItem() {
- return this.newItem;
- }
-
- @Override
- public String toString() {
- return "ArmorChangeEvent{" + "player=" + player + ", slotType=" + slotType + ", oldItem=" + oldItem + ", newItem=" + newItem + '}';
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return HANDLERS;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return HANDLERS;
- }
-
- public enum SlotType {
- HEAD(DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, PUMPKIN, JACK_O_LANTERN),
- CHEST(DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA),
- LEGS(DIAMOND_LEGGINGS, GOLDEN_LEGGINGS, IRON_LEGGINGS, CHAINMAIL_LEGGINGS, LEATHER_LEGGINGS),
- FEET(DIAMOND_BOOTS, GOLDEN_BOOTS, IRON_BOOTS, CHAINMAIL_BOOTS, LEATHER_BOOTS);
-
- private final Set mutableTypes = new HashSet<>();
- private Set immutableTypes;
-
- SlotType(Material... types) {
- this.mutableTypes.addAll(Arrays.asList(types));
- }
-
- /**
- * Gets an immutable set of all allowed material types that can be placed in an
- * armor slot.
- *
- * @return immutable set of material types
- */
- @NotNull
- public Set getTypes() {
- if (immutableTypes == null) {
- immutableTypes = Collections.unmodifiableSet(mutableTypes);
- }
-
- return immutableTypes;
- }
-
- /**
- * Gets the type of slot via the specified material
- *
- * @param material material to get slot by
- * @return slot type the material will go in, or null if it won't
- */
- @Nullable
- public static SlotType getByMaterial(@NotNull Material material) {
- for (SlotType slotType : values()) {
- if (slotType.getTypes().contains(material)) {
- return slotType;
- }
- }
- return null;
- }
-
- /**
- * Gets whether or not this material can be equipped to a slot
- *
- * @param material material to check
- * @return whether or not this material can be equipped
- */
- public static boolean isEquipable(@NotNull Material material) {
- return getByMaterial(material) != null;
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
deleted file mode 100644
index 12c1c6fe9..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.net.InetAddress;
-import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
-
-/**
- *
- * This event is invoked when a player has disconnected. It is guaranteed that,
- * if the server is in online-mode, that the provided uuid and username have been
- * validated.
- *
- *
- *
- * The event is invoked for players who have not yet logged into the world, whereas
- * {@link org.bukkit.event.player.PlayerQuitEvent} is only invoked on players who have logged into the world.
- *
- *
- *
- * The event is invoked for players who have already logged into the world,
- * although whether or not the player exists in the world at the time of
- * firing is undefined. (That is, whether the plugin can retrieve a Player object
- * using the event parameters is undefined). However, it is guaranteed that this
- * event is invoked AFTER {@link org.bukkit.event.player.PlayerQuitEvent}, if the player has already logged into the world.
- *
- *
- *
- * This event is guaranteed to never fire unless {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} has
- * been fired beforehand, and this event may not be called in parallel with
- * {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} for the same connection.
- *
- *
- *
- * Cancelling the {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} guarantees the corresponding
- * {@code PlayerConnectionCloseEvent} is never called.
- *
- *
- *
- * The event may be invoked asynchronously or synchronously. Plugins should check
- * {@link Event#isAsynchronous()} and handle accordingly.
- *
- */
-public class PlayerConnectionCloseEvent extends Event {
-
- private static final HandlerList HANDLERS = new HandlerList();
-
- @NotNull private final UUID playerUniqueId;
- @NotNull private final String playerName;
- @NotNull private final InetAddress ipAddress;
-
- public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
- super(async);
- this.playerUniqueId = playerUniqueId;
- this.playerName = playerName;
- this.ipAddress = ipAddress;
- }
-
- /**
- * Returns the {@code UUID} of the player disconnecting.
- */
- @NotNull
- public UUID getPlayerUniqueId() {
- return this.playerUniqueId;
- }
-
- /**
- * Returns the name of the player disconnecting.
- */
- @NotNull
- public String getPlayerName() {
- return this.playerName;
- }
-
- /**
- * Returns the player's IP address.
- */
- @NotNull
- public InetAddress getIpAddress() {
- return this.ipAddress;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return HANDLERS;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return HANDLERS;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java
deleted file mode 100644
index e9a76a25f..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a player boosts elytra flight with a firework
- */
-public class PlayerElytraBoostEvent extends PlayerEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
- @NotNull private final ItemStack itemStack;
- @NotNull private Firework firework;
- private boolean consume = true;
-
- public PlayerElytraBoostEvent(@NotNull Player player, @NotNull ItemStack itemStack, @NotNull Firework firework) {
- super(player);
- this.itemStack = itemStack;
- this.firework = firework;
- }
-
- /**
- * Get the firework itemstack used
- *
- * @return ItemStack of firework
- */
- @NotNull
- public ItemStack getItemStack() {
- return itemStack;
- }
-
- /**
- * Get the firework entity that was spawned
- *
- * @return Firework entity
- */
- @NotNull
- public Firework getFirework() {
- return firework;
- }
-
- /**
- * Get whether to consume the firework or not
- *
- * @return True to consume
- */
- public boolean shouldConsume() {
- return consume;
- }
-
- /**
- * Set whether to consume the firework or not
- *
- * @param consume True to consume
- */
- public void setShouldConsume(boolean consume) {
- this.consume = consume;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
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
deleted file mode 100644
index f0bb4e31c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.apache.commons.lang.Validate;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * This event is fired during a player handshake.
- *
- * If there are no listeners listening to this event, the logic default
- * to your server platform will be ran.
- *
- * WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS
- */
-public class PlayerHandshakeEvent extends Event implements Cancellable {
-
- private static final HandlerList HANDLERS = new HandlerList();
- @NotNull private final String originalHandshake;
- private boolean cancelled;
- @Nullable private String serverHostname;
- @Nullable private String socketAddressHostname;
- @Nullable private UUID uniqueId;
- @Nullable private String propertiesJson;
- private boolean failed;
- private String failMessage = "If you wish to use IP forwarding, please enable it in your BungeeCord config as well!";
-
- /**
- * Creates a new {@link PlayerHandshakeEvent}.
- *
- * @param originalHandshake the original handshake string
- * @param cancelled if this event is enabled
- */
- public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
- super(true);
- this.originalHandshake = originalHandshake;
- this.cancelled = cancelled;
- }
-
- /**
- * Determines if this event is cancelled.
- *
- * When this event is cancelled, custom handshake logic will not
- * be processed.
- *
- * @return {@code true} if this event is cancelled, {@code false} otherwise
- */
- @Override
- public boolean isCancelled() {
- return this.cancelled;
- }
-
- /**
- * Sets if this event is cancelled.
- *
- * When this event is cancelled, custom handshake logic will not
- * be processed.
- *
- * @param cancelled {@code true} if this event is cancelled, {@code false} otherwise
- */
- @Override
- public void setCancelled(boolean cancelled) {
- this.cancelled = cancelled;
- }
-
- /**
- * Gets the original handshake string.
- *
- * @return the original handshake string
- */
- @NotNull
- public String getOriginalHandshake() {
- return this.originalHandshake;
- }
-
- /**
- * Gets the server hostname string.
- *
- * This should not include the port.
- *
- * @return the server hostname string
- */
- @Nullable
- public String getServerHostname() {
- return this.serverHostname;
- }
-
- /**
- * Sets the server hostname string.
- *
- * This should not include the port.
- *
- * @param serverHostname the server hostname string
- */
- public void setServerHostname(@NotNull String serverHostname) {
- this.serverHostname = serverHostname;
- }
-
- /**
- * Gets the socket address hostname string.
- *
- * This should not include the port.
- *
- * @return the socket address hostname string
- */
- @Nullable
- public String getSocketAddressHostname() {
- return this.socketAddressHostname;
- }
-
- /**
- * Sets the socket address hostname string.
- *
- * This should not include the port.
- *
- * @param socketAddressHostname the socket address hostname string
- */
- public void setSocketAddressHostname(@NotNull String socketAddressHostname) {
- this.socketAddressHostname = socketAddressHostname;
- }
-
- /**
- * Gets the unique id.
- *
- * @return the unique id
- */
- @Nullable
- public UUID getUniqueId() {
- return this.uniqueId;
- }
-
- /**
- * Sets the unique id.
- *
- * @param uniqueId the unique id
- */
- public void setUniqueId(@NotNull UUID uniqueId) {
- this.uniqueId = uniqueId;
- }
-
- /**
- * Gets the profile properties.
- *
- * This should be a valid JSON string.
- *
- * @return the profile properties, as JSON
- */
- @Nullable
- public String getPropertiesJson() {
- return this.propertiesJson;
- }
-
- /**
- * Determines if authentication failed.
- *
- * When {@code true}, the client connecting will be disconnected
- * with the {@link #getFailMessage() fail message}.
- *
- * @return {@code true} if authentication failed, {@code false} otherwise
- */
- public boolean isFailed() {
- return this.failed;
- }
-
- /**
- * Sets if authentication failed and the client should be disconnected.
- *
- * When {@code true}, the client connecting will be disconnected
- * with the {@link #getFailMessage() fail message}.
- *
- * @param failed {@code true} if authentication failed, {@code false} otherwise
- */
- public void setFailed(boolean failed) {
- this.failed = failed;
- }
-
- /**
- * Sets the profile properties.
- *
- * This should be a valid JSON string.
- *
- * @param propertiesJson the profile properties, as JSON
- */
- public void setPropertiesJson(@NotNull String propertiesJson) {
- this.propertiesJson = propertiesJson;
- }
-
- /**
- * Gets the message to display to the client when authentication fails.
- *
- * @return the message to display to the client
- */
- @NotNull
- public String getFailMessage() {
- return this.failMessage;
- }
-
- /**
- * Sets the message to display to the client when authentication fails.
- *
- * @param failMessage the message to display to the client
- */
- public void setFailMessage(@NotNull String failMessage) {
- Validate.notEmpty(failMessage, "fail message cannot be null or empty");
- this.failMessage = failMessage;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return HANDLERS;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return HANDLERS;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
deleted file mode 100644
index 8e407eff1..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class PlayerInitialSpawnEvent extends PlayerEvent {
- private static final HandlerList handlers = new HandlerList();
- @NotNull private Location spawnLocation;
-
- public PlayerInitialSpawnEvent(@NotNull final Player player, @NotNull final Location spawnLocation) {
- super(player);
- this.spawnLocation = spawnLocation;
- }
-
- /**
- * Gets the current spawn location
- *
- * @return Location current spawn location
- */
- @NotNull
- public Location getSpawnLocation() {
- return this.spawnLocation;
- }
-
- /**
- * Sets the new spawn location
- *
- * @param spawnLocation new location for the spawn
- */
- public void setSpawnLocation(@NotNull Location spawnLocation) {
- this.spawnLocation = spawnLocation;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
deleted file mode 100644
index 289a0d784..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import com.google.common.base.Preconditions;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when the server detects the player is jumping.
- *
- * Added to avoid the overhead and special case logic that many plugins use
- * when checking for jumps via PlayerMoveEvent, this event is fired whenever
- * the server detects that the player is jumping.
- */
-public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancel = false;
- @NotNull private Location from;
- @NotNull private Location to;
-
- public PlayerJumpEvent(@NotNull final Player player, @NotNull final Location from, @NotNull final Location to) {
- super(player);
- this.from = from;
- this.to = to;
- }
-
- /**
- * Gets the cancellation state of this event. A cancelled event will not
- * be executed in the server, but will still pass to other plugins
- *
- * If a jump event is cancelled, the player will be moved or
- * teleported back to the Location as defined by getFrom(). This will not
- * fire an event
- *
- * @return true if this event is cancelled
- */
- public boolean isCancelled() {
- return cancel;
- }
-
- /**
- * Sets the cancellation state of this event. A cancelled event will not
- * be executed in the server, but will still pass to other plugins
- *
- * If a jump event is cancelled, the player will be moved or
- * teleported back to the Location as defined by getFrom(). This will not
- * fire an event
- *
- * @param cancel true if you wish to cancel this event
- */
- public void setCancelled(boolean cancel) {
- this.cancel = cancel;
- }
-
- /**
- * Gets the location this player jumped from
- *
- * @return Location the player jumped from
- */
- @NotNull
- public Location getFrom() {
- return from;
- }
-
- /**
- * Sets the location to mark as where the player jumped from
- *
- * @param from New location to mark as the players previous location
- */
- public void setFrom(@NotNull Location from) {
- validateLocation(from);
- this.from = from;
- }
-
- /**
- * Gets the location this player jumped to
- *
- * This information is based on what the client sends, it typically
- * has little relation to the arc of the jump at any given point.
- *
- * @return Location the player jumped to
- */
- @NotNull
- public Location getTo() {
- return to;
- }
-
- private void validateLocation(Location loc) {
- Preconditions.checkArgument(loc != null, "Cannot use null location!");
- Preconditions.checkArgument(loc.getWorld() != null, "Cannot use location with null world!");
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java
deleted file mode 100644
index 9074b2ede..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when a player shoots a projectile
- */
-public class PlayerLaunchProjectileEvent extends PlayerEvent implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- @NotNull private final Projectile projectile;
- @NotNull private final ItemStack itemStack;
- private boolean consumeItem = true;
- private boolean cancelled;
-
- public PlayerLaunchProjectileEvent(@NotNull Player shooter, @NotNull ItemStack itemStack, @NotNull Projectile projectile) {
- super(shooter);
- this.itemStack = itemStack;
- this.projectile = projectile;
- }
-
- /**
- * Gets the projectile which will be launched by this event
- *
- * @return the launched projectile
- */
- @NotNull
- public Projectile getProjectile() {
- return projectile;
- }
-
- /**
- * Get the ItemStack used to fire the projectile
- *
- * @return The ItemStack used
- */
- @NotNull
- public ItemStack getItemStack() {
- return itemStack;
- }
-
- /**
- * Get whether to consume the ItemStack or not
- *
- * @return True to consume
- */
- public boolean shouldConsume() {
- return consumeItem;
- }
-
- /**
- * Set whether to consume the ItemStack or not
- *
- * @param consumeItem True to consume
- */
- public void setShouldConsume(boolean consumeItem) {
- this.consumeItem = consumeItem;
- }
-
- public boolean isCancelled() {
- return cancelled;
- }
-
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
deleted file mode 100644
index 29dd763a9..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-
-/**
- * Called when the locale of the player is changed.
- *
- * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
- */
-@Deprecated
-public class PlayerLocaleChangeEvent extends PlayerEvent {
- private static final HandlerList handlers = new HandlerList();
- private final String oldLocale;
- private final String newLocale;
-
- public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
- super(player);
- this.oldLocale = oldLocale;
- this.newLocale = newLocale;
- }
-
- /**
- * Gets the locale the player switched from.
- *
- * @return player's old locale
- */
- public String getOldLocale() {
- return oldLocale;
- }
-
- /**
- * Gets the locale the player is changed to.
- *
- * @return player's new locale
- */
- public String getNewLocale() {
- return newLocale;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
deleted file mode 100644
index f7beb22d5..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.ExperienceOrb;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a player is attempting to pick up an experience orb
- */
-public class PlayerPickupExperienceEvent extends PlayerEvent implements Cancellable {
- @NotNull private final ExperienceOrb experienceOrb;
-
- public PlayerPickupExperienceEvent(@NotNull Player player, @NotNull ExperienceOrb experienceOrb) {
- super(player);
- this.experienceOrb = experienceOrb;
- }
-
- /**
- * @return Returns the Orb that the player is picking up
- */
- @NotNull
- public ExperienceOrb getExperienceOrb() {
- return experienceOrb;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * If true, Cancels picking up the experience orb, leaving it in the world
- * @param cancel true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
deleted file mode 100644
index 31f34b548..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired after a player has respawned
- */
-public class PlayerPostRespawnEvent extends PlayerEvent {
- private final static HandlerList handlers = new HandlerList();
- private final Location respawnedLocation;
- private final boolean isBedSpawn;
-
- public PlayerPostRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnedLocation, final boolean isBedSpawn) {
- super(respawnPlayer);
- this.respawnedLocation = respawnedLocation;
- this.isBedSpawn = isBedSpawn;
- }
-
- /**
- * Returns the location of the respawned player
- *
- * @return location of the respawned player
- */
- @NotNull
- public Location getRespawnedLocation() {
- return respawnedLocation.clone();
- }
-
- /**
- * Checks if the player respawned to their bed
- *
- * @return whether the player respawned to their bed
- */
- public boolean isBedSpawn() {
- return isBedSpawn;
- }
-
- @Override
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
deleted file mode 100644
index 5d04a22fd..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when a player is firing a bow and the server is choosing an arrow to use.
- */
-public class PlayerReadyArrowEvent extends PlayerEvent implements Cancellable {
- @NotNull private final ItemStack bow;
- @NotNull private final ItemStack arrow;
-
- public PlayerReadyArrowEvent(@NotNull Player player, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
- super(player);
- this.bow = bow;
- this.arrow = arrow;
- }
-
- /**
- * @return the player is using to fire the arrow
- */
- @NotNull
- public ItemStack getBow() {
- return bow;
- }
-
- /**
- * @return the arrow that is attempting to be used
- */
- @NotNull
- public ItemStack getArrow() {
- return arrow;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- /**
- * Whether or not use of this arrow is cancelled. On cancel, the server will try the next arrow available and fire another event.
- */
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * Cancel use of this arrow. On cancel, the server will try the next arrow available and fire another event.
- * @param cancel true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
deleted file mode 100644
index b8ec7ef2d..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Triggered when a player starts spectating an entity in spectator mode.
- */
-public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- @NotNull private final Entity currentSpectatorTarget;
- @NotNull private final Entity newSpectatorTarget;
-
- public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) {
- super(player);
- this.currentSpectatorTarget = currentSpectatorTarget;
- this.newSpectatorTarget = newSpectatorTarget;
- }
-
- /**
- * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything
- *
- * @return The entity the player is currently spectating (before they start spectating the new target).
- */
- @NotNull
- public Entity getCurrentSpectatorTarget() {
- return currentSpectatorTarget;
- }
-
- /**
- * Gets the new entity that the player will now be spectating
- *
- * @return The entity the player is now going to be spectating.
- */
- @NotNull
- public Entity getNewSpectatorTarget() {
- return newSpectatorTarget;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
-
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
deleted file mode 100644
index 693d119ab..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Triggered when a player stops spectating an entity in spectator mode.
- */
-public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
- private boolean cancelled;
- @NotNull private final Entity spectatorTarget;
-
- public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) {
- super(player);
- this.spectatorTarget = spectatorTarget;
- }
-
- /**
- * Gets the entity that the player is spectating
- *
- * @return The entity the player is currently spectating (before they will stop).
- */
- @NotNull
- public Entity getSpectatorTarget() {
- return spectatorTarget;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
deleted file mode 100644
index b64ab6eec..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.Location;
-import org.bukkit.block.EndGateway;
-import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerTeleportEvent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when a teleport is triggered for an End Gateway
- */
-public class PlayerTeleportEndGatewayEvent extends PlayerTeleportEvent {
- @NotNull private final EndGateway gateway;
-
- public PlayerTeleportEndGatewayEvent(@NotNull Player player, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
- super(player, from, to, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
- this.gateway = gateway;
- }
-
- /**
- * The gateway triggering the teleport
- *
- * @return EndGateway used
- */
- @NotNull
- public EndGateway getGateway() {
- return gateway;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/api/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
deleted file mode 100644
index 09cfdf48e..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.destroystokyo.paper.event.player;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.bukkit.inventory.EquipmentSlot;
-import org.jetbrains.annotations.NotNull;
-
-public class PlayerUseUnknownEntityEvent extends PlayerEvent {
-
- private static final HandlerList handlers = new HandlerList();
- private final int entityId;
- private final boolean attack;
- @NotNull private final EquipmentSlot hand;
-
- public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand) {
- super(who);
- this.entityId = entityId;
- this.attack = attack;
- this.hand = hand;
- }
-
- public int getEntityId() {
- return this.entityId;
- }
-
- public boolean isAttack() {
- return this.attack;
- }
-
- @NotNull
- public EquipmentSlot getHand() {
- return this.hand;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java b/api/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
deleted file mode 100644
index 71f36e9ca..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.profile;
-
-import com.destroystokyo.paper.profile.PlayerProfile;
-import com.destroystokyo.paper.profile.ProfileProperty;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.util.Set;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired once a profiles additional properties (such as textures) has been filled
- */
-public class FillProfileEvent extends Event {
- @NotNull private final PlayerProfile profile;
-
- public FillProfileEvent(@NotNull PlayerProfile profile) {
- super(!org.bukkit.Bukkit.isPrimaryThread());
- this.profile = profile;
- }
-
- /**
- * @return The Profile that had properties filled
- */
- @NotNull
- public PlayerProfile getPlayerProfile() {
- return profile;
- }
-
- /**
- * Same as .getPlayerProfile().getProperties()
- *
- * @see PlayerProfile#getProperties()
- * @return The new properties on the profile.
- */
- @NotNull
- public Set getProperties() {
- return profile.getProperties();
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java b/api/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
deleted file mode 100644
index 8df37c07c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.destroystokyo.paper.event.profile;
-
-import com.destroystokyo.paper.profile.PlayerProfile;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Allows a plugin to be notified anytime AFTER a Profile has been looked up from the Mojang API
- * This is an opportunity to view the response and potentially cache things.
- *
- * No guarantees are made about thread execution context for this event. If you need to know, check
- * event.isAsync()
- */
-public class LookupProfileEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull private final PlayerProfile profile;
-
- public LookupProfileEvent(@NotNull PlayerProfile profile) {
- super(!Bukkit.isPrimaryThread());
- this.profile = profile;
- }
-
- /**
- * @return The profile that was recently looked up. This profile can be mutated
- */
- @NotNull
- public PlayerProfile getPlayerProfile() {
- return profile;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java b/api/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
deleted file mode 100644
index 021bc8631..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.profile;
-
-import com.destroystokyo.paper.profile.PlayerProfile;
-import com.destroystokyo.paper.profile.ProfileProperty;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.util.Collection;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Fired when the server is requesting to fill in properties of an incomplete profile, such as textures.
- *
- * Allows plugins to pre populate cached properties and avoid a call to the Mojang API
- */
-public class PreFillProfileEvent extends Event {
- @NotNull private final PlayerProfile profile;
-
- public PreFillProfileEvent(@NotNull PlayerProfile profile) {
- super(!org.bukkit.Bukkit.isPrimaryThread());
- this.profile = profile;
- }
-
- /**
- * @return The profile that needs its properties filled
- */
- @NotNull
- public PlayerProfile getPlayerProfile() {
- return profile;
- }
-
- /**
- * Sets the properties on the profile, avoiding the call to the Mojang API
- * Same as .getPlayerProfile().setProperties(properties);
- *
- * @see PlayerProfile#setProperties(Collection)
- * @param properties The properties to set/append
- */
- public void setProperties(@NotNull Collection properties) {
- profile.setProperties(properties);
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/api/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
deleted file mode 100644
index 4dcf6242c..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.destroystokyo.paper.event.profile;
-
-import com.destroystokyo.paper.profile.PlayerProfile;
-import com.destroystokyo.paper.profile.ProfileProperty;
-import com.google.common.collect.ArrayListMultimap;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Allows a plugin to intercept a Profile Lookup for a Profile by name
- *
- * At the point of event fire, the UUID and properties are unset.
- *
- * If a plugin sets the UUID, and optionally the properties, the API call to look up the profile may be skipped.
- *
- * No guarantees are made about thread execution context for this event. If you need to know, check
- * event.isAsync()
- */
-public class PreLookupProfileEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
- @NotNull private final String name;
- private UUID uuid;
- @NotNull private Set properties = new HashSet<>();
-
- public PreLookupProfileEvent(@NotNull String name) {
- super(!Bukkit.isPrimaryThread());
- this.name = name;
- }
-
- /**
- * @return Name of the profile
- */
- @NotNull
- public String getName() {
- return name;
- }
-
- /**
- * If this value is left null by the completion of the event call, then the server will
- * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a
- * {@link LookupProfileEvent}
- *
- * @return The UUID of the profile if it has already been provided by a plugin
- */
- @Nullable
- public UUID getUUID() {
- return uuid;
- }
-
- /**
- * Sets the UUID for this player name. This will skip the initial API call to find the players UUID.
- *
- * However, if Profile Properties are needed by the server, you must also set them or else an API call might still be made.
- *
- * @param uuid the UUID to set for the profile or null to reset
- */
- public void setUUID(@Nullable UUID uuid) {
- this.uuid = uuid;
- }
-
- /**
- * @return The currently pending prepopulated properties.
- * Any property in this Set will be automatically prefilled on this Profile
- */
- @NotNull
- public Set getProfileProperties() {
- return this.properties;
- }
-
- /**
- * Clears any existing prepopulated properties and uses the supplied properties
- * Any property in this Set will be automatically prefilled on this Profile
- * @param properties The properties to add
- */
- public void setProfileProperties(@NotNull Set properties) {
- this.properties = new HashSet<>();
- this.properties.addAll(properties);
- }
-
- /**
- * Adds any properties currently missing to the prepopulated properties set, replacing any that already were set.
- * Any property in this Set will be automatically prefilled on this Profile
- * @param properties The properties to add
- */
- public void addProfileProperties(@NotNull Set properties) {
- this.properties.addAll(properties);
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/api/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
deleted file mode 100644
index b10176289..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.profile;
-
-import com.destroystokyo.paper.profile.PlayerProfile;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Fires when the server needs to verify if a player is whitelisted.
- *
- * Plugins may override/control the servers whitelist with this event,
- * and dynamically change the kick message.
- *
- */
-public class ProfileWhitelistVerifyEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- @NotNull private final PlayerProfile profile;
- private final boolean whitelistEnabled;
- private boolean whitelisted;
- private final boolean isOp;
- @Nullable private String kickMessage;
-
- public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) {
- this.profile = profile;
- this.whitelistEnabled = whitelistEnabled;
- this.whitelisted = whitelisted;
- this.isOp = isOp;
- this.kickMessage = kickMessage;
- }
-
- /**
- * @return the currently planned message to send to the user if they are not whitelisted
- */
- @Nullable
- public String getKickMessage() {
- return kickMessage;
- }
-
- /**
- * @param kickMessage The message to send to the player on kick if not whitelisted. May set to null to use the server configured default
- */
- public void setKickMessage(@Nullable String kickMessage) {
- this.kickMessage = kickMessage;
- }
-
- /**
- * @return The profile of the player trying to connect
- */
- @NotNull
- public PlayerProfile getPlayerProfile() {
- return profile;
- }
-
- /**
- * @return Whether the player is whitelisted to play on this server (whitelist may be off is why its true)
- */
- public boolean isWhitelisted() {
- return whitelisted;
- }
-
- /**
- * Changes the players whitelisted state. false will deny the login
- * @param whitelisted The new whitelisted state
- */
- public void setWhitelisted(boolean whitelisted) {
- this.whitelisted = whitelisted;
- }
-
- /**
- * @return if the player obtained whitelist status by having op
- */
- public boolean isOp() {
- return isOp;
- }
-
- /**
- * @return if the server even has whitelist on
- */
- public boolean isWhitelistEnabled() {
- return whitelistEnabled;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
deleted file mode 100644
index 619ed3716..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package com.destroystokyo.paper.event.server;
-
-import com.google.common.collect.ImmutableList;
-import org.apache.commons.lang.Validate;
-import org.bukkit.Location;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Allows plugins to compute tab completion results asynchronously. If this event provides completions, then the standard synchronous process will not be fired to populate the results. However, the synchronous TabCompleteEvent will fire with the Async results.
- *
- * Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
- */
-public class AsyncTabCompleteEvent extends Event implements Cancellable {
- @NotNull private final CommandSender sender;
- @NotNull private final String buffer;
- private final boolean isCommand;
- @Nullable
- private final Location loc;
- @NotNull private List completions;
- private boolean cancelled;
- private boolean handled = false;
- private boolean fireSyncHandler = true;
-
- public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
- super(true);
- this.sender = sender;
- this.completions = completions;
- this.buffer = buffer;
- this.isCommand = isCommand;
- this.loc = loc;
- }
-
- /**
- * Get the sender completing this command.
- *
- * @return the {@link CommandSender} instance
- */
- @NotNull
- public CommandSender getSender() {
- return sender;
- }
-
- /**
- * The list of completions which will be offered to the sender, in order.
- * This list is mutable and reflects what will be offered.
- *
- * If this collection is not empty after the event is fired, then
- * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
- * or current player names will not be called.
- *
- * @return a list of offered completions
- */
- @NotNull
- public List getCompletions() {
- return completions;
- }
-
- /**
- * Set the completions offered, overriding any already set.
- * If this collection is not empty after the event is fired, then
- * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
- * or current player names will not be called.
- *
- * The passed collection will be cloned to a new List. You must call {{@link #getCompletions()}} to mutate from here
- *
- * @param completions the new completions
- */
- public void setCompletions(@NotNull List completions) {
- Validate.notNull(completions);
- this.completions = new ArrayList<>(completions);
- }
-
- /**
- * Return the entire buffer which formed the basis of this completion.
- *
- * @return command buffer, as entered
- */
- @NotNull
- public String getBuffer() {
- return buffer;
- }
-
- /**
- * @return True if it is a command being tab completed, false if it is a chat message.
- */
- public boolean isCommand() {
- return isCommand;
- }
-
- /**
- * @return The position looked at by the sender, or null if none
- */
- @Nullable
- public Location getLocation() {
- return loc;
- }
-
- /**
- * If true, the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
- * or current player names will not be called.
- *
- * @return Is completions considered handled. Always true if completions is not empty.
- */
- public boolean isHandled() {
- return !completions.isEmpty() || handled;
- }
-
- /**
- * Sets whether or not to consider the completion request handled.
- * If true, the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
- * or current player names will not be called.
- *
- * @param handled if this completion should be marked as being handled
- */
- public void setHandled(boolean handled) {
- this.handled = handled;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- /**
- * Will provide no completions, and will not fire the synchronous process
- * @param cancelled true if you wish to cancel this event
- */
- @Override
- public void setCancelled(boolean cancelled) {
- this.cancelled = cancelled;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
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
deleted file mode 100644
index 77a19995f..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
+++ /dev/null
@@ -1,412 +0,0 @@
-package com.destroystokyo.paper.event.server;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * This event is fired if server is getting queried over GS4 Query protocol
- *
- * Adapted from Velocity's ProxyQueryEvent
- *
- * @author Mark Vainomaa
- */
-public final class GS4QueryEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
-
- private final QueryType queryType;
- private final InetAddress querierAddress;
- 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");
- }
-
- /**
- * Get query type
- * @return query type
- */
- @NotNull
- public QueryType getQueryType() {
- return queryType;
- }
-
- /**
- * Get querier address
- * @return querier address
- */
- @NotNull
- public InetAddress getQuerierAddress() {
- return querierAddress;
- }
-
- /**
- * Get query response
- * @return query response
- */
- @NotNull
- public QueryResponse getResponse() {
- return response;
- }
-
- /**
- * Set query response
- * @param response query response
- */
- public void setResponse(@NotNull QueryResponse response) {
- this.response = Preconditions.checkNotNull(response, "response");
- }
-
- @Override
- public String toString() {
- return "GS4QueryEvent{" +
- "queryType=" + queryType +
- ", querierAddress=" + querierAddress +
- ", response=" + response +
- '}';
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * The type of query
- */
- public enum QueryType {
- /**
- * Basic query asks only a subset of information, such as motd, game type (hardcoded to MINECRAFT
), map,
- * current players, max players, server port and server motd
- */
- BASIC,
-
- /**
- * Full query asks pretty much everything present on this event (only hardcoded values cannot be modified here).
- */
- FULL
- ;
- }
-
- public final static class QueryResponse {
- private final String motd;
- private final String gameVersion;
- private final String map;
- private final int currentPlayers;
- private final int maxPlayers;
- private final String hostname;
- private final int port;
- private final Collection players;
- private final String serverVersion;
- private final Collection plugins;
-
- private QueryResponse(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection players, String serverVersion, Collection plugins) {
- this.motd = motd;
- this.gameVersion = gameVersion;
- this.map = map;
- this.currentPlayers = currentPlayers;
- this.maxPlayers = maxPlayers;
- this.hostname = hostname;
- this.port = port;
- this.players = players;
- this.serverVersion = serverVersion;
- this.plugins = plugins;
- }
-
- /**
- * Get motd which will be used to reply to the query. By default it is {@link org.bukkit.Server#getMotd()}.
- * @return motd
- */
- @NotNull
- public String getMotd() {
- return motd;
- }
-
- /**
- * Get game version which will be used to reply to the query. By default supported Minecraft versions range is sent.
- * @return game version
- */
- @NotNull
- public String getGameVersion() {
- return gameVersion;
- }
-
- /**
- * Get map name which will be used to reply to the query. By default {@code world} is sent.
- * @return map name
- */
- @NotNull
- public String getMap() {
- return map;
- }
-
- /**
- * Get current online player count which will be used to reply to the query.
- * @return online player count
- */
- public int getCurrentPlayers() {
- return currentPlayers;
- }
-
- /**
- * Get max player count which will be used to reply to the query.
- * @return max player count
- */
- public int getMaxPlayers() {
- return maxPlayers;
- }
-
- /**
- * Get server (public facing) hostname
- * @return server hostname
- */
- @NotNull
- public String getHostname() {
- return hostname;
- }
-
- /**
- * Get server (public facing) port
- * @return server port
- */
- public int getPort() {
- return port;
- }
-
- /**
- * Get collection of players which will be used to reply to the query.
- * @return collection of players
- */
- @NotNull
- public Collection getPlayers() {
- return players;
- }
-
- /**
- * Get server software (name and version) which will be used to reply to the query.
- * @return server software
- */
- @NotNull
- public String getServerVersion() {
- return serverVersion;
- }
-
- /**
- * Get list of plugins which will be used to reply to the query.
- * @return collection of plugins
- */
- @NotNull
- public Collection getPlugins() {
- return plugins;
- }
-
-
- /**
- * Creates a new {@link Builder} instance from data represented by this response
- * @return {@link QueryResponse} builder
- */
- @NotNull
- public Builder toBuilder() {
- return QueryResponse.builder()
- .motd(getMotd())
- .gameVersion(getGameVersion())
- .map(getMap())
- .currentPlayers(getCurrentPlayers())
- .maxPlayers(getMaxPlayers())
- .hostname(getHostname())
- .port(getPort())
- .players(getPlayers())
- .serverVersion(getServerVersion())
- .plugins(getPlugins());
- }
-
- /**
- * Creates a new {@link Builder} instance
- * @return {@link QueryResponse} builder
- */
- @NotNull
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * A builder for {@link QueryResponse} objects.
- */
- public static final class Builder {
- private String motd;
- private String gameVersion;
- private String map;
- private String hostname;
- private String serverVersion;
-
- private int currentPlayers;
- private int maxPlayers;
- private int port;
-
- private List players = new ArrayList<>();
- private List plugins = new ArrayList<>();
-
- private Builder() {}
-
- @NotNull
- public Builder motd(@NotNull String motd) {
- this.motd = Preconditions.checkNotNull(motd, "motd");
- return this;
- }
-
- @NotNull
- public Builder gameVersion(@NotNull String gameVersion) {
- this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion");
- return this;
- }
-
- @NotNull
- public Builder map(@NotNull String map) {
- this.map = Preconditions.checkNotNull(map, "map");
- return this;
- }
-
- @NotNull
- public Builder currentPlayers(int currentPlayers) {
- Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative");
- this.currentPlayers = currentPlayers;
- return this;
- }
-
- @NotNull
- public Builder maxPlayers(int maxPlayers) {
- Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative");
- this.maxPlayers = maxPlayers;
- return this;
- }
-
- @NotNull
- public Builder hostname(@NotNull String hostname) {
- this.hostname = Preconditions.checkNotNull(hostname, "hostname");
- return this;
- }
-
- @NotNull
- public Builder port(int port) {
- Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535");
- this.port = port;
- return this;
- }
-
- @NotNull
- public Builder players(@NotNull Collection players) {
- this.players.addAll(Preconditions.checkNotNull(players, "players"));
- return this;
- }
-
- @NotNull
- public Builder players(@NotNull String... players) {
- this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players")));
- return this;
- }
-
- @NotNull
- public Builder clearPlayers() {
- this.players.clear();
- return this;
- }
-
- @NotNull
- public Builder serverVersion(@NotNull String serverVersion) {
- this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion");
- return this;
- }
-
- @NotNull
- public Builder plugins(@NotNull Collection plugins) {
- this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins"));
- return this;
- }
-
- @NotNull
- public Builder plugins(@NotNull PluginInformation... plugins) {
- this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins")));
- return this;
- }
-
- @NotNull
- public Builder clearPlugins() {
- this.plugins.clear();
- return this;
- }
-
- /**
- * Builds new {@link QueryResponse} with supplied data
- * @return response
- */
- @NotNull
- public QueryResponse build() {
- return new QueryResponse(
- Preconditions.checkNotNull(motd, "motd"),
- Preconditions.checkNotNull(gameVersion, "gameVersion"),
- Preconditions.checkNotNull(map, "map"),
- currentPlayers,
- maxPlayers,
- Preconditions.checkNotNull(hostname, "hostname"),
- port,
- ImmutableList.copyOf(players),
- Preconditions.checkNotNull(serverVersion, "serverVersion"),
- ImmutableList.copyOf(plugins)
- );
- }
- }
-
- /**
- * Plugin information
- */
- public static class PluginInformation {
- private String name;
- private String version;
-
- public PluginInformation(@NotNull String name, @NotNull String version) {
- this.name = Preconditions.checkNotNull(name, "name");
- this.version = Preconditions.checkNotNull(version, "version");
- }
-
- @NotNull
- public String getName() {
- return name;
- }
-
- public void setName(@NotNull String name) {
- this.name = name;
- }
-
- public void setVersion(@NotNull String version) {
- this.version = version;
- }
-
- @NotNull
- public String getVersion() {
- return version;
- }
-
- @NotNull
- public static PluginInformation of(@NotNull String name, @NotNull String version) {
- return new PluginInformation(name, version);
- }
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
deleted file mode 100644
index 0cc5dd573..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package com.destroystokyo.paper.event.server;
-
-import static java.util.Objects.requireNonNull;
-
-import com.destroystokyo.paper.network.StatusClient;
-import com.destroystokyo.paper.profile.PlayerProfile;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.server.ServerListPingEvent;
-import org.bukkit.util.CachedServerIcon;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.UUID;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Extended version of {@link ServerListPingEvent} that allows full control
- * of the response sent to the client.
- */
-public class PaperServerListPingEvent extends ServerListPingEvent implements Cancellable {
-
- @NotNull private final StatusClient client;
-
- private int numPlayers;
- private boolean hidePlayers;
- @NotNull private final List playerSample = new ArrayList<>();
-
- @NotNull private String version;
- private int protocolVersion;
-
- @Nullable private CachedServerIcon favicon;
-
- private boolean cancelled;
-
- private boolean originalPlayerCount = true;
- private Object[] players;
-
- public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
- @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
- super(client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
- this.client = client;
- this.numPlayers = numPlayers;
- this.version = version;
- this.protocolVersion = protocolVersion;
- setServerIcon(favicon);
- }
-
- /**
- * Returns the {@link StatusClient} pinging the server.
- *
- * @return The client
- */
- @NotNull
- public StatusClient getClient() {
- return this.client;
- }
-
- /**
- * {@inheritDoc}
- *
- * Returns {@code -1} if players are hidden using
- * {@link #shouldHidePlayers()}.
- */
- @Override
- public int getNumPlayers() {
- if (this.hidePlayers) {
- return -1;
- }
-
- return this.numPlayers;
- }
-
- /**
- * Sets the number of players displayed in the server list.
- *
- * Note that this won't have any effect if {@link #shouldHidePlayers()}
- * is enabled.
- *
- * @param numPlayers The number of online players
- */
- public void setNumPlayers(int numPlayers) {
- if (this.numPlayers != numPlayers) {
- this.numPlayers = numPlayers;
- this.originalPlayerCount = false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * Returns {@code -1} if players are hidden using
- * {@link #shouldHidePlayers()}.
- */
- @Override
- public int getMaxPlayers() {
- if (this.hidePlayers) {
- return -1;
- }
-
- return super.getMaxPlayers();
- }
-
- /**
- * Returns whether all player related information is hidden in the server
- * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
- * and {@link #getPlayerSample()} to be skipped in the response.
- *
- * The Vanilla Minecraft client will display the player count as {@code ???}
- * when this option is enabled.
- *
- * @return {@code true} if the player count is hidden
- */
- public boolean shouldHidePlayers() {
- return hidePlayers;
- }
-
- /**
- * Sets whether all player related information is hidden in the server
- * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
- * and {@link #getPlayerSample()} to be skipped in the response.
- *
- * The Vanilla Minecraft client will display the player count as {@code ???}
- * when this option is enabled.
- *
- * @param hidePlayers {@code true} if the player count should be hidden
- */
- public void setHidePlayers(boolean hidePlayers) {
- this.hidePlayers = hidePlayers;
- }
-
- /**
- * Returns a mutable list of {@link PlayerProfile} that will be displayed
- * as online players on the client.
- *
- * The Vanilla Minecraft client will display them when hovering the
- * player count with the mouse.
- *
- * @return The mutable player sample list
- */
- @NotNull
- public List getPlayerSample() {
- return this.playerSample;
- }
-
- /**
- * Returns the version that will be sent as server version on the client.
- *
- * @return The server version
- */
- @NotNull
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the version that will be sent as server version to the client.
- *
- * @param version The server version
- */
- public void setVersion(@NotNull String version) {
- this.version = requireNonNull(version, "version");
- }
-
- /**
- * Returns the protocol version that will be sent as the protocol version
- * of the server to the client.
- *
- * @return The protocol version of the server, or {@code -1} if the server
- * has not finished initialization yet
- */
- public int getProtocolVersion() {
- return protocolVersion;
- }
-
- /**
- * Sets the protocol version that will be sent as the protocol version
- * of the server to the client.
- *
- * @param protocolVersion The protocol version of the server
- */
- public void setProtocolVersion(int protocolVersion) {
- this.protocolVersion = protocolVersion;
- }
-
- /**
- * Gets the server icon sent to the client.
- *
- * @return The icon to send to the client, or {@code null} for none
- */
- @Nullable
- public CachedServerIcon getServerIcon() {
- return this.favicon;
- }
-
- /**
- * Sets the server icon sent to the client.
- *
- * @param icon The icon to send to the client, or {@code null} for none
- */
- @Override
- public void setServerIcon(@Nullable CachedServerIcon icon) {
- if (icon != null && icon.isEmpty()) {
- // Represent empty icons as null
- icon = null;
- }
-
- this.favicon = icon;
- }
-
- /**
- * {@inheritDoc}
- *
- * Cancelling this event will cause the connection to be closed immediately,
- * without sending a response to the client.
- */
- @Override
- public boolean isCancelled() {
- return this.cancelled;
- }
-
- /**
- * {@inheritDoc}
- *
- * Cancelling this event will cause the connection to be closed immediately,
- * without sending a response to the client.
- */
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- /**
- * {@inheritDoc}
- *
- * Note: For compatibility reasons, this method will return all
- * online players, not just the ones referenced in {@link #getPlayerSample()}.
- * Removing a player will:
- *
- *
- * - Decrement the online player count (if and only if) the player
- * count wasn't changed by another plugin before.
- * - Remove all entries from {@link #getPlayerSample()} that refer to
- * the removed player (based on their {@link UUID}).
- *
- */
- @NotNull
- @Override
- public Iterator iterator() {
- if (this.players == null) {
- this.players = getOnlinePlayers();
- }
-
- return new PlayerIterator();
- }
-
- @NotNull
- protected Object[] getOnlinePlayers() {
- return Bukkit.getOnlinePlayers().toArray();
- }
-
- @NotNull
- protected Player getBukkitPlayer(@NotNull Object player) {
- return (Player) player;
- }
-
- private final class PlayerIterator implements Iterator {
-
- private int next;
- private int current;
- @Nullable private Player player;
-
- @Override
- public boolean hasNext() {
- for (; this.next < players.length; this.next++) {
- if (players[this.next] != null) {
- return true;
- }
- }
-
- return false;
- }
-
- @NotNull
- @Override
- public Player next() {
- if (!hasNext()) {
- this.player = null;
- throw new NoSuchElementException();
- }
-
- this.current = this.next++;
- return this.player = getBukkitPlayer(players[this.current]);
- }
-
- @Override
- public void remove() {
- if (this.player == null) {
- throw new IllegalStateException();
- }
-
- UUID uniqueId = this.player.getUniqueId();
- this.player = null;
-
- // Remove player from iterator
- players[this.current] = null;
-
- // Remove player from sample
- getPlayerSample().removeIf(p -> uniqueId.equals(p.getId()));
-
- // Decrement player count
- if (originalPlayerCount) {
- numPlayers--;
- }
- }
- }
-
-}
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
deleted file mode 100644
index 2f573299a..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-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;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called whenever an exception is thrown in a recoverable section of the server.
- */
-public class ServerExceptionEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- @NotNull private ServerException exception;
-
- public ServerExceptionEvent(@NotNull ServerException exception) {
- super(!Bukkit.isPrimaryThread());
- this.exception = Preconditions.checkNotNull(exception, "exception");
- }
-
- /**
- * Gets the wrapped exception that was thrown.
- *
- * @return Exception thrown
- */
- @NotNull
- public ServerException getException() {
- return exception;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
deleted file mode 100644
index 9fd28e036..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.destroystokyo.paper.event.server;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Called when the server has finished ticking the main loop
- */
-public class ServerTickEndEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
- private final int tickNumber;
- private final double tickDuration;
- private final long timeEnd;
-
- public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) {
- this.tickNumber = tickNumber;
- this.tickDuration = tickDuration;
- this.timeEnd = System.nanoTime() + timeRemaining;
- }
-
- /**
- * @return What tick this was since start (first tick = 1)
- */
- public int getTickNumber() {
- return tickNumber;
- }
-
- /**
- * @return Time in milliseconds of how long this tick took
- */
- public double getTickDuration() {
- return tickDuration;
- }
-
- /**
- * Amount of nanoseconds remaining before the next tick should start.
- *
- * If this value is negative, then that means the server has exceeded the tick time limit and TPS has been lost.
- *
- * Method will continously return the updated time remaining value. (return value is not static)
- *
- * @return Amount of nanoseconds remaining before the next tick should start
- */
- public long getTimeRemaining() {
- return this.timeEnd - System.nanoTime();
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
deleted file mode 100644
index eac85f1f4..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.destroystokyo.paper.event.server;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-public class ServerTickStartEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
- private final int tickNumber;
-
- public ServerTickStartEvent(int tickNumber) {
- this.tickNumber = tickNumber;
- }
-
- /**
- * @return What tick this is going be since start (first tick = 1)
- */
- public int getTickNumber() {
- return tickNumber;
- }
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/api/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
deleted file mode 100644
index fdd5eedb2..000000000
--- a/api/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.destroystokyo.paper.event.server;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * This event is fired when whitelist is toggled
- *
- * @author Mark Vainomaa
- */
-public class WhitelistToggleEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
-
- private boolean enabled;
-
- public WhitelistToggleEvent(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * Gets whether whitelist is going to be enabled or not
- *
- * @return Whether whitelist is going to be enabled or not
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
deleted file mode 100644
index 6fb39af04..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Thrown when a command throws an exception
- */
-public class ServerCommandException extends ServerException {
-
- private final Command command;
- private final CommandSender commandSender;
- private final String[] arguments;
-
- public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
- super(message, cause);
- this.commandSender = checkNotNull(commandSender, "commandSender");
- this.arguments = checkNotNull(arguments, "arguments");
- this.command = checkNotNull(command, "command");
- }
-
- public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
- super(cause);
- this.commandSender = checkNotNull(commandSender, "commandSender");
- this.arguments = checkNotNull(arguments, "arguments");
- this.command = checkNotNull(command, "command");
- }
-
- protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
- super(message, cause, enableSuppression, writableStackTrace);
- this.commandSender = checkNotNull(commandSender, "commandSender");
- this.arguments = checkNotNull(arguments, "arguments");
- this.command = checkNotNull(command, "command");
- }
-
- /**
- * Gets the command which threw the exception
- *
- * @return exception throwing command
- */
- public Command getCommand() {
- return command;
- }
-
- /**
- * Gets the command sender which executed the command request
- *
- * @return command sender of exception thrown command request
- */
- public CommandSender getCommandSender() {
- return commandSender;
- }
-
- /**
- * Gets the arguments which threw the exception for the command
- *
- * @return arguments of exception thrown command request
- */
- public String[] getArguments() {
- return arguments;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
deleted file mode 100644
index 410b24139..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.Listener;
-import org.bukkit.plugin.Plugin;
-
-import static com.google.common.base.Preconditions.*;
-
-/**
- * Exception thrown when a server event listener throws an exception
- */
-public class ServerEventException extends ServerPluginException {
-
- private final Listener listener;
- private final Event event;
-
- public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
- super(message, cause, responsiblePlugin);
- this.listener = checkNotNull(listener, "listener");
- this.event = checkNotNull(event, "event");
- }
-
- public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
- super(cause, responsiblePlugin);
- this.listener = checkNotNull(listener, "listener");
- this.event = checkNotNull(event, "event");
- }
-
- protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
- super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
- this.listener = checkNotNull(listener, "listener");
- this.event = checkNotNull(event, "event");
- }
-
- /**
- * Gets the listener which threw the exception
- *
- * @return event listener
- */
- public Listener getListener() {
- return listener;
- }
-
- /**
- * Gets the event which caused the exception
- *
- * @return event
- */
- public Event getEvent() {
- return event;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerException.java
deleted file mode 100644
index c06ea3942..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-/**
- * Wrapper exception for all exceptions that are thrown by the server.
- */
-public class ServerException extends Exception {
-
- public ServerException(String message) {
- super(message);
- }
-
- public ServerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ServerException(Throwable cause) {
- super(cause);
- }
-
- protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
deleted file mode 100644
index e762ed0db..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.Bukkit;
-import com.destroystokyo.paper.event.server.ServerExceptionEvent;
-
-/**
- * Thrown when the internal server throws a recoverable exception.
- */
-public class ServerInternalException extends ServerException {
-
- public ServerInternalException(String message) {
- super(message);
- }
-
- public ServerInternalException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ServerInternalException(Throwable cause) {
- super(cause);
- }
-
- protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-
- public static void reportInternalException(Throwable cause) {
- try {
- Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
- ;
- } catch (Throwable t) {
- t.printStackTrace(); // Don't want to rethrow!
- }
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
deleted file mode 100644
index f016ba3b1..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.plugin.Plugin;
-
-/**
- * Thrown whenever there is an exception with any enabling or disabling of plugins.
- */
-public class ServerPluginEnableDisableException extends ServerPluginException {
- public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
- super(message, cause, responsiblePlugin);
- }
-
- public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
- super(cause, responsiblePlugin);
- }
-
- protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
- super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
- }
-}
\ No newline at end of file
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
deleted file mode 100644
index 6defac287..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.Validate;
-import org.bukkit.plugin.Plugin;
-
-import static com.google.common.base.Preconditions.*;
-
-/**
- * Wrapper exception for all cases to which a plugin can be immediately blamed for
- */
-public class ServerPluginException extends ServerException {
- public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
- super(message, cause);
- this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
- }
-
- public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
- super(cause);
- this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
- }
-
- protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
- super(message, cause, enableSuppression, writableStackTrace);
- this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
- }
-
- private final Plugin responsiblePlugin;
-
- /**
- * Gets the plugin which is directly responsible for the exception being thrown
- *
- * @return plugin which is responsible for the exception throw
- */
- public Plugin getResponsiblePlugin() {
- return responsiblePlugin;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
deleted file mode 100644
index 89e132525..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-import static com.google.common.base.Preconditions.*;
-
-/**
- * Thrown when an incoming plugin message channel throws an exception
- */
-public class ServerPluginMessageException extends ServerPluginException {
-
- private final Player player;
- private final String channel;
- private final byte[] data;
-
- public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
- super(message, cause, responsiblePlugin);
- this.player = checkNotNull(player, "player");
- this.channel = checkNotNull(channel, "channel");
- this.data = checkNotNull(data, "data");
- }
-
- public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
- super(cause, responsiblePlugin);
- this.player = checkNotNull(player, "player");
- this.channel = checkNotNull(channel, "channel");
- this.data = checkNotNull(data, "data");
- }
-
- protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
- super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
- this.player = checkNotNull(player, "player");
- this.channel = checkNotNull(channel, "channel");
- this.data = checkNotNull(data, "data");
- }
-
- /**
- * Gets the channel to which the error occurred from recieving data from
- *
- * @return exception channel
- */
- public String getChannel() {
- return channel;
- }
-
- /**
- * Gets the data to which the error occurred from
- *
- * @return exception data
- */
- public byte[] getData() {
- return data;
- }
-
- /**
- * Gets the player which the plugin message causing the exception originated from
- *
- * @return exception player
- */
- public Player getPlayer() {
- return player;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
deleted file mode 100644
index 2d0b2d4a9..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.scheduler.BukkitTask;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Thrown when a plugin's scheduler fails with an exception
- */
-public class ServerSchedulerException extends ServerPluginException {
-
- private final BukkitTask task;
-
- public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
- super(message, cause, task.getOwner());
- this.task = checkNotNull(task, "task");
- }
-
- public ServerSchedulerException(Throwable cause, BukkitTask task) {
- super(cause, task.getOwner());
- this.task = checkNotNull(task, "task");
- }
-
- protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
- super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
- this.task = checkNotNull(task, "task");
- }
-
- /**
- * Gets the task which threw the exception
- *
- * @return exception throwing task
- */
- public BukkitTask getTask() {
- return task;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/api/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
deleted file mode 100644
index 5582999fe..000000000
--- a/api/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.destroystokyo.paper.exception;
-
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-
-/**
- * Called when a tab-complete request throws an exception
- */
-public class ServerTabCompleteException extends ServerCommandException {
-
- public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
- super(message, cause, command, commandSender, arguments);
- }
-
- public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
- super(cause, command, commandSender, arguments);
- }
-
- protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
- super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java b/api/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
deleted file mode 100644
index 43e6576b1..000000000
--- a/api/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.destroystokyo.paper.inventory;
-
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.RecipeChoice;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Allows crafting Items that require full matching itemstacks to complete the recipe for custom items
- * @deprecated Draft API
- */
-@Deprecated
-public class ItemStackRecipeChoice implements RecipeChoice {
-
- protected final List choices = new ArrayList<>();
-
- public ItemStackRecipeChoice(ItemStack choices) {
- this.choices.add(choices);
- }
-
- public ItemStackRecipeChoice(List choices) {
- this.choices.addAll(choices);
- }
-
- @Override
- public ItemStack getItemStack() {
- return choices.isEmpty() ? null : choices.get(0);
- }
-
- @Override
- public RecipeChoice clone() {
- try {
- ItemStackRecipeChoice clone = (ItemStackRecipeChoice) super.clone();
- clone.choices.addAll(this.choices);
- return clone;
- } catch (CloneNotSupportedException ex) {
- throw new AssertionError(ex);
- }
- }
-
- @Override
- public boolean test(ItemStack itemStack) {
- for (ItemStack stack : choices) {
- if (stack.isSimilar(itemStack)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java b/api/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java
deleted file mode 100644
index 7e4acfff1..000000000
--- a/api/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.destroystokyo.paper.inventory.meta;
-
-import org.bukkit.inventory.meta.ItemMeta;
-
-public interface ArmorStandMeta extends ItemMeta {
-
- /**
- * Gets whether the ArmorStand should be invisible when spawned
- *
- * @return true if this should be invisible
- */
- boolean isInvisible();
-
- /**
- * Gets whether this ArmorStand should have no base plate when spawned
- *
- * @return true if it will not have a base plate
- */
- boolean hasNoBasePlate();
-
- /**
- * Gets whether this ArmorStand should show arms when spawned
- *
- * @return true if it will show arms
- */
- boolean shouldShowArms();
-
- /**
- * Gets whether this ArmorStand will be small when spawned
- *
- * @return true if it will be small
- */
- boolean isSmall();
-
- /**
- * Gets whether this ArmorStand will be a marker when spawned
- * The exact details of this flag are an implementation detail
- *
- * @return true if it will be a marker
- */
- boolean isMarker();
-
- /**
- * Sets that this ArmorStand should be invisible when spawned
- *
- * @param invisible true if set invisible
- */
- void setInvisible(boolean invisible);
-
- /**
- * Sets that this ArmorStand should have no base plate when spawned
- *
- * @param noBasePlate true if no base plate
- */
- void setNoBasePlate(boolean noBasePlate);
-
- /**
- * Sets that this ArmorStand should show arms when spawned
- *
- * @param showArms true if show arms
- */
- void setShowArms(boolean showArms);
-
- /**
- * Sets that this ArmorStand should be small when spawned
- *
- * @param small true if small
- */
- void setSmall(boolean small);
-
- /**
- * Sets that this ArmorStand should be a marker when spawned
- * The exact details of this flag are an implementation detail
- *
- * @param marker true if a marker
- */
- void setMarker(boolean marker);
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java b/api/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
deleted file mode 100644
index 92d7b853a..000000000
--- a/api/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.destroystokyo.paper.loottable;
-
-import org.bukkit.block.Block;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents an Inventory that can generate loot, such as Chests inside of Fortresses and Mineshafts
- */
-public interface LootableBlockInventory extends LootableInventory {
-
- /**
- * Gets the block that is lootable
- * @return The Block
- */
- @NotNull
- Block getBlock();
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java b/api/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
deleted file mode 100644
index b387894fe..000000000
--- a/api/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.destroystokyo.paper.loottable;
-
-import org.bukkit.entity.Entity;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents an Inventory that can generate loot, such as Minecarts inside of Mineshafts
- */
-public interface LootableEntityInventory extends LootableInventory {
-
- /**
- * Gets the entity that is lootable
- * @return The Entity
- */
- @NotNull
- Entity getEntity();
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java b/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
deleted file mode 100644
index 97815eeb2..000000000
--- a/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.destroystokyo.paper.loottable;
-
-import org.bukkit.entity.Player;
-import org.bukkit.loot.Lootable;
-
-import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Represents an Inventory that contains a Loot Table associated to it that will
- * automatically fill on first open.
- *
- * A new feature and API is provided to support automatically refreshing the contents
- * of the inventory based on that Loot Table after a configurable amount of time has passed.
- *
- * The behavior of how the Inventory is filled based on the loot table may vary based
- * on Minecraft versions and the Loot Table feature.
- */
-public interface LootableInventory extends Lootable {
-
- /**
- * Server owners have to enable whether or not an object in a world should refill
- *
- * @return If the world this inventory is currently in has Replenishable Lootables enabled
- */
- boolean isRefillEnabled();
-
- /**
- * Whether or not this object has ever been filled
- * @return Has ever been filled
- */
- boolean hasBeenFilled();
-
- /**
- * Has this player ever looted this block
- * @param player The player to check
- * @return Whether or not this player has looted this block
- */
- default boolean hasPlayerLooted(@NotNull Player player) {
- return hasPlayerLooted(player.getUniqueId());
- }
-
- /**
- * Has this player ever looted this block
- * @param player The player to check
- * @return Whether or not this player has looted this block
- */
- boolean hasPlayerLooted(@NotNull UUID player);
-
- /**
- * Gets the timestamp, in milliseconds, of when the player last looted this object
- *
- * @param player The player to check
- * @return Timestamp last looted, or null if player has not looted this object
- */
- @Nullable
- default Long getLastLooted(@NotNull Player player) {
- return getLastLooted(player.getUniqueId());
- }
-
- /**
- * Gets the timestamp, in milliseconds, of when the player last looted this object
- *
- * @param player The player to check
- * @return Timestamp last looted, or null if player has not looted this object
- */
- @Nullable
- Long getLastLooted(@NotNull UUID player);
-
- /**
- * Change the state of whether or not a player has looted this block
- * @param player The player to change state for
- * @param looted true to add player to looted list, false to remove
- * @return The previous state of whether the player had looted this or not
- */
- default boolean setHasPlayerLooted(@NotNull Player player, boolean looted) {
- return setHasPlayerLooted(player.getUniqueId(), looted);
- }
-
- /**
- * Change the state of whether or not a player has looted this block
- * @param player The player to change state for
- * @param looted true to add player to looted list, false to remove
- * @return The previous state of whether the player had looted this or not
- */
- boolean setHasPlayerLooted(@NotNull UUID player, boolean looted);
-
- /**
- * Returns Whether or not this object has been filled and now has a pending refill
- * @return Has pending refill
- */
- boolean hasPendingRefill();
-
- /**
- * Gets the timestamp in milliseconds that the Lootable object was last refilled
- *
- * @return -1 if it was never refilled, or timestamp in milliseconds
- */
- long getLastFilled();
-
- /**
- * Gets the timestamp in milliseconds that the Lootable object will refill
- *
- * @return -1 if it is not scheduled for refill, or timestamp in milliseconds
- */
- long getNextRefill();
-
- /**
- * Sets the timestamp in milliseconds of the next refill for this object
- *
- * @param refillAt timestamp in milliseconds. -1 to clear next refill
- * @return The previous scheduled time to refill, or -1 if was not scheduled
- */
- long setNextRefill(long refillAt);
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java b/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
deleted file mode 100644
index fd184f13f..000000000
--- a/api/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.destroystokyo.paper.loottable;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class LootableInventoryReplenishEvent extends PlayerEvent implements Cancellable {
- @NotNull private final LootableInventory inventory;
-
- public LootableInventoryReplenishEvent(@NotNull Player player, @NotNull LootableInventory inventory) {
- super(player);
- this.inventory = inventory;
- }
-
- @NotNull
- public LootableInventory getInventory() {
- return inventory;
- }
-
- private static final HandlerList handlers = new HandlerList();
-
- @NotNull
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- private boolean cancelled = false;
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/network/NetworkClient.java b/api/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
deleted file mode 100644
index 7b2af1bd7..000000000
--- a/api/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.destroystokyo.paper.network;
-
-import java.net.InetSocketAddress;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Represents a client connected to the server.
- */
-public interface NetworkClient {
-
- /**
- * Returns the socket address of the client.
- *
- * @return The client's socket address
- */
- @NotNull
- InetSocketAddress getAddress();
-
- /**
- * Returns the protocol version of the client.
- *
- * @return The client's protocol version, or {@code -1} if unknown
- * @see List of protocol
- * version numbers
- */
- int getProtocolVersion();
-
- /**
- * Returns the virtual host the client is connected to.
- *
- * The virtual host refers to the hostname/port the client used to
- * connect to the server.
- *
- * @return The client's virtual host, or {@code null} if unknown
- */
- @Nullable
- InetSocketAddress getVirtualHost();
-
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/api/src/main/java/com/destroystokyo/paper/network/StatusClient.java
deleted file mode 100644
index ffda9f6a8..000000000
--- a/api/src/main/java/com/destroystokyo/paper/network/StatusClient.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.destroystokyo.paper.network;
-
-import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
-
-/**
- * Represents a client requesting the current status from the server (e.g. from
- * the server list).
- *
- * @see PaperServerListPingEvent
- */
-public interface StatusClient extends NetworkClient {
-
- /**
- * Returns whether the client is using an older version that doesn't
- * support all of the features in {@link PaperServerListPingEvent}.
- *
- * For Vanilla, this returns {@code true} for all clients older than 1.7.
- *
- * @return {@code true} if the client is using legacy ping
- */
- default boolean isLegacy() {
- return false;
- }
-
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/api/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
deleted file mode 100644
index 476151d2a..000000000
--- a/api/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.destroystokyo.paper.profile;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.UUID;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Represents a players profile for the game, such as UUID, Name, and textures.
- */
-public interface PlayerProfile {
-
- /**
- * @return The players name, if set
- */
- @Nullable
- String getName();
-
- /**
- * Sets this profiles Name
- *
- * @param name The new Name
- * @return The previous Name
- */
- @NotNull
- String setName(@Nullable String name);
-
- /**
- * @return The players unique identifier, if set
- */
- @Nullable UUID getId();
-
- /**
- * Sets this profiles UUID
- *
- * @param uuid The new UUID
- * @return The previous UUID
- */
- @Nullable
- UUID setId(@Nullable UUID uuid);
-
- /**
- * @return A Mutable set of this players properties, such as textures.
- * Values specified here are subject to implementation details.
- */
- @NotNull Set getProperties();
-
- /**
- * Check if the Profile has the specified property
- * @param property Property name to check
- * @return If the property is set
- */
- boolean hasProperty(@Nullable String property);
-
- /**
- * Sets a property. If the property already exists, the previous one will be replaced
- * @param property Property to set.
- */
- void setProperty(@NotNull ProfileProperty property);
-
- /**
- * Sets multiple properties. If any of the set properties already exist, it will be replaced
- * @param properties The properties to set
- */
- void setProperties(@NotNull Collection properties);
-
- /**
- * Removes a specific property from this profile
- * @param property The property to remove
- * @return If a property was removed
- */
- boolean removeProperty(@Nullable String property);
-
- /**
- * Removes a specific property from this profile
- * @param property The property to remove
- * @return If a property was removed
- */
- default boolean removeProperty(@NotNull ProfileProperty property) {
- return removeProperty(property.getName());
- }
-
- /**
- * Removes all properties in the collection
- * @param properties The properties to remove
- * @return If any property was removed
- */
- default boolean removeProperties(@NotNull Collection properties) {
- boolean removed = false;
- for (ProfileProperty property : properties) {
- if (removeProperty(property)) {
- removed = true;
- }
- }
- return removed;
- }
-
- /**
- * Clears all properties on this profile
- */
- void clearProperties();
-
- /**
- * @return If the profile is now complete (has UUID and Name)
- */
- boolean isComplete();
-
- /**
- * Like {@link #complete(boolean)} but will try only from cache, and not make network calls
- * Does not account for textures.
- *
- * @return If the profile is now complete (has UUID and Name)
- */
- boolean completeFromCache();
-
- /**
- * If this profile is not complete, then make the API call to complete it.
- * This is a blocking operation and should be done asynchronously.
- *
- * This will also complete textures. If you do not want to load textures, use {{@link #complete(boolean)}}
- * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
- */
- default boolean complete() {
- return complete(true);
- }
-
- /**
- * If this profile is not complete, then make the API call to complete it.
- * This is a blocking operation and should be done asynchronously.
- *
- * Optionally will also fill textures.
- * @param textures controls if we should fill the profile with texture properties
- * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
- */
- boolean complete(boolean textures);
-
- /**
- * Whether or not this Profile has textures associated to it
- * @return If has a textures property
- */
- default boolean hasTextures() {
- return hasProperty("textures");
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java b/api/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
deleted file mode 100644
index 7b3b6ef53..000000000
--- a/api/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.destroystokyo.paper.profile;
-
-import com.google.common.base.Preconditions;
-
-import java.util.Objects;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Represents a property on a {@link PlayerProfile}
- */
-public class ProfileProperty {
- private final String name;
- private final String value;
- private final String signature;
-
- public ProfileProperty(@NotNull String name, @NotNull String value) {
- this(name, value, null);
- }
-
- public ProfileProperty(@NotNull String name, @NotNull String value, @Nullable String signature) {
- this.name = Preconditions.checkNotNull(name, "ProfileProperty name can not be null");
- this.value = Preconditions.checkNotNull(value, "ProfileProperty value can not be null");
- this.signature = signature;
- }
-
- /**
- * @return The property name, ie "textures"
- */
- @NotNull
- public String getName() {
- return name;
- }
-
- /**
- * @return The property value, likely to be base64 encoded
- */
- @NotNull
- public String getValue() {
- return value;
- }
-
- /**
- * @return A signature from Mojang for signed properties
- */
- @Nullable
- public String getSignature() {
- return signature;
- }
-
- /**
- * @return If this property has a signature or not
- */
- public boolean isSigned() {
- return this.signature != null;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- ProfileProperty that = (ProfileProperty) o;
- return Objects.equals(name, that.name) &&
- Objects.equals(value, that.value) &&
- Objects.equals(signature, that.signature);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name);
- }
-}
diff --git a/api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
deleted file mode 100644
index 9db0056ab..000000000
--- a/api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.destroystokyo.paper.util;
-
-import org.jetbrains.annotations.NotNull;
-
-public class SneakyThrow {
-
- public static void sneaky(@NotNull Throwable exception) {
- SneakyThrow.throwSneaky(exception);
- }
-
- @SuppressWarnings("unchecked")
- private static void throwSneaky(@NotNull Throwable exception) throws T {
- throw (T) 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
deleted file mode 100644
index 2a2651299..000000000
--- a/api/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
+++ /dev/null
@@ -1,44 +0,0 @@
-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
- *