even moaar patches

This commit is contained in:
Jake 2021-11-24 11:02:36 -08:00 committed by MiniDigger | Martin
parent f331ac28e0
commit e141126891
17 changed files with 74 additions and 130 deletions

View file

@ -1,55 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 3 Jan 2021 20:03:40 -0800
Subject: [PATCH] Added Vanilla Entity Tags
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index 34d23f53acf00620223731c4fdacffde9cff41a8..a64d04310f1bc32224765e01dd4f020d289dad0c 100644
--- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java
@@ -698,6 +698,44 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla tag representing entities extra susceptible to freezing.
*/
Tag<EntityType> ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class);
+ // Paper start
+ /**
+ * Key for the built-in entity registry
+ * @deprecated use {@link #REGISTRY_ENTITY_TYPES}
+ */
+ @Deprecated(forRemoval = true)
+ String REGISTRY_ENTITIES = "entities";
+ /**
+ * Vanilla entity tag representing arrow entities.
+ * @deprecated use {@link #ENTITY_TYPES_ARROWS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> ARROWS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("arrows"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag representing entities that live in beehives
+ * @deprecated use {@link #ENTITY_TYPES_BEEHIVE_INHABITORS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> BEEHIVE_INHABITORS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("beehive_inhabitors"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag representing projectiles that impact
+ * @deprecated use {@link #ENTITY_TYPES_IMPACT_PROJECTILES}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> IMPACT_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("impact_projectiles"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag for village raiders
+ * @deprecated use {@link #ENTITY_TYPES_RAIDERS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> RAIDERS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("raiders"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag for skeleton types
+ * @deprecated use {@link #ENTITY_TYPES_SKELETONS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> SKELETONS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("skeletons"), org.bukkit.entity.EntityType.class);
+ // Paper end
/**
* Returns whether or not this tag has an entry for the specified item.

View file

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 5 Jul 2020 15:39:40 -0700
Subject: [PATCH] added Wither API
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index 426d3693317cd303d35d8203026b528d87e401d5..8c95cd6933f11076de936854f379e6fc8600b525 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -6,4 +6,34 @@ import com.destroystokyo.paper.entity.RangedEntity;
* Represents a Wither boss
*/
public interface Wither extends Monster, Boss, RangedEntity { // Paper
+ // Paper start
+ /**
+ * @return whether the wither is charged
+ */
+ boolean isCharged();
+
+ /**
+ * @return ticks the wither is invulnerable for
+ */
+ int getInvulnerableTicks();
+
+ /**
+ * Sets for how long in the future, the wither should be invulnerable.
+ *
+ * @param ticks ticks the wither is invulnerable for
+ */
+ void setInvulnerableTicks(int ticks);
+
+ /**
+ * @return whether the wither can travel through portals
+ */
+ boolean canTravelThroughPortals();
+
+ /**
+ * Sets whether the wither can travel through portals.
+ *
+ * @param value whether the wither can travel through portals
+ */
+ void setCanTravelThroughPortals(boolean value);
+ // Paper end
}

View file

@ -1,153 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 24 Jun 2020 15:12:18 -0600
Subject: [PATCH] Added PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c80183a79713b1e73549911e474a8c585cfdeb52
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
@@ -0,0 +1,141 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.potion.PotionEffectType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a player sets the effect for a beacon
+ */
+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private PotionEffectType primary;
+ private PotionEffectType secondary;
+ private final Block beacon;
+ private boolean consumeItem = true;
+
+ private boolean isCancelled;
+
+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @Nullable Block beacon) {
+ super(player);
+ this.primary = primary;
+ this.secondary = secondary;
+ this.isCancelled = false;
+ this.beacon = beacon;
+ }
+
+ /**
+ * @return the primary effect
+ */
+ @Nullable public PotionEffectType getPrimary() {
+ return primary;
+ }
+
+ /**
+ * Sets the primary effect
+ * <p>
+ * NOTE: The primary effect still has to be one of the valid effects for a beacon.
+ *
+ * @param primary the primary effect
+ */
+ public void setPrimary(@Nullable PotionEffectType primary) {
+ this.primary = primary;
+ }
+
+ /**
+ * @return the secondary effect
+ */
+ @Nullable public PotionEffectType getSecondary() {
+ return secondary;
+ }
+
+ /**
+ * Sets the secondary effect
+ * <p>
+ * This only has an effect when the beacon is able to accept a secondary effect.
+ * NOTE: The secondary effect still has to be a valid effect for a beacon.
+ *
+ * @param secondary the secondary effect
+ */
+ public void setSecondary(@Nullable PotionEffectType secondary) {
+ this.secondary = secondary;
+ }
+
+ /**
+ * @return the beacon block associated with this event, or null if not found
+ */
+ @Nullable
+ public Block getBeacon() {
+ return beacon;
+ }
+
+ /**
+ * Gets if the item used to change the beacon will be consume.
+ * <p>
+ * Independant of {@link #isCancelled()}. If the event is cancelled
+ * the item will <b>NOT</b> be consumed.
+ *
+ * @return true if item will be consumed
+ */
+ public boolean willConsumeItem() {
+ return consumeItem;
+ }
+
+ /**
+ * Sets if the item used to change the beacon should be consumed.
+ * <p>
+ * Independant of {@link #isCancelled()}. If the event is cancelled
+ * the item will <b>NOT</b> be consumed.
+ *
+ * @param consumeItem true if item should be consumed
+ */
+ public void setConsumeItem(boolean consumeItem) {
+ this.consumeItem = consumeItem;
+ }
+
+ /**
+ * Gets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins
+ * <p>
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will
+ * not take effect
+ *
+ * @return true if this event is cancelled
+ */
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ /**
+ * Sets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins
+ * <p>
+ * If cancelled, the item will <b>NOT</b> be consumed regardless of what {@link #willConsumeItem()} says
+ * <p>
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied
+ * or saved.
+ *
+ * @param cancel true if you wish to cancel this event
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.isCancelled = cancel;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View file

@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 27 Nov 2020 17:13:59 -0800
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb1bca3a9d12096c9a2b2663f466a8ff5f2b4319
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java
@@ -0,0 +1,59 @@
+package io.papermc.paper.event.player;
+
+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.StonecutterInventory;
+import org.bukkit.inventory.StonecuttingRecipe;
+import org.jetbrains.annotations.NotNull;
+
+public class PlayerStonecutterRecipeSelectEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private boolean cancelled;
+ private final StonecutterInventory stonecutterInventory;
+ private StonecuttingRecipe stonecuttingRecipe;
+
+ public PlayerStonecutterRecipeSelectEvent(@NotNull Player player, @NotNull StonecutterInventory stonecutterInventory, @NotNull StonecuttingRecipe stonecuttingRecipe) {
+ super(player);
+ this.stonecutterInventory = stonecutterInventory;
+ this.stonecuttingRecipe = stonecuttingRecipe;
+ }
+
+ @NotNull
+ public StonecutterInventory getStonecutterInventory() {
+ return stonecutterInventory;
+ }
+
+ @NotNull
+ public StonecuttingRecipe getStonecuttingRecipe() {
+ return stonecuttingRecipe;
+ }
+
+ public void setStonecuttingRecipe(@NotNull StonecuttingRecipe stonecuttingRecipe) {
+ this.stonecuttingRecipe = stonecuttingRecipe;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}