[ci skip] Cleanup events (#10202)
Dieser Commit ist enthalten in:
Ursprung
b3c81089ae
Commit
294347bee2
@ -206,10 +206,10 @@ index 0000000000000000000000000000000000000000..2ad76b1751ba707f7ae0d283aa1cbaf6
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java b/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ed8e885f226b02b9875b23ae2294a9056d2e8b29
|
||||
index 0000000000000000000000000000000000000000..a0fd845bc9b2540c398fe1dbbf821803a7017a28
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java
|
||||
@@ -0,0 +1,125 @@
|
||||
@@ -0,0 +1,127 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import io.papermc.paper.chat.ChatRenderer;
|
||||
@ -231,12 +231,14 @@ index 0000000000000000000000000000000000000000..ed8e885f226b02b9875b23ae2294a905
|
||||
+ */
|
||||
+@ApiStatus.NonExtendable
|
||||
+public abstract class AbstractChatEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private final Set<Audience> viewers;
|
||||
+ private final Component originalMessage;
|
||||
+ private final SignedMessage signedMessage;
|
||||
+ private ChatRenderer renderer;
|
||||
+ private Component message;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ AbstractChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage, final @NotNull SignedMessage signedMessage) {
|
||||
+ super(player, async);
|
||||
@ -331,8 +333,8 @@ index 0000000000000000000000000000000000000000..ed8e885f226b02b9875b23ae2294a905
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final void setCancelled(final boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ public final void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java
|
||||
@ -371,16 +373,17 @@ index 0000000000000000000000000000000000000000..feece00981ebf932e64760e7a10a04ad
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474af4e10afd
|
||||
index 0000000000000000000000000000000000000000..9e1eb774d841e2c7ffa8bef688d832bdffaa0944
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
|
||||
@@ -0,0 +1,117 @@
|
||||
@@ -0,0 +1,120 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
@ -393,7 +396,8 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+ * message here, and use the chat events for modifying receivers and later the chat type. If you
|
||||
+ * want to keep the message as "signed" for the clients who get it, be sure to include the entire
|
||||
+ * original message somewhere in the final message.
|
||||
+ * @see AsyncChatCommandDecorateEvent for the decoration of messages sent via commands
|
||||
+ * <br>
|
||||
+ * See {@link AsyncChatCommandDecorateEvent} for the decoration of messages sent via commands
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public class AsyncChatDecorateEvent extends ServerEvent implements Cancellable {
|
||||
@ -403,6 +407,7 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+ private final Player player;
|
||||
+ private final Component originalMessage;
|
||||
+ private Component result;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
@ -419,7 +424,7 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+ * Certain commands request decorations without a player context
|
||||
+ * which is why this is possibly null.
|
||||
+ *
|
||||
+ * @return the player or null
|
||||
+ * @return the player or {@code null}
|
||||
+ */
|
||||
+ public @Nullable Player player() {
|
||||
+ return this.player;
|
||||
@ -437,7 +442,7 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+ /**
|
||||
+ * Gets the decoration result. This may already be different from
|
||||
+ * {@link #originalMessage()} if some other listener to this event
|
||||
+ * <b>OR</b> the legacy preview event ({@link org.bukkit.event.player.AsyncPlayerChatPreviewEvent}
|
||||
+ * <b>OR</b> the legacy preview event ({@link AsyncPlayerChatPreviewEvent})
|
||||
+ * changed the result.
|
||||
+ *
|
||||
+ * @return the result
|
||||
@ -458,10 +463,10 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+ /**
|
||||
+ * If this decorating is part of a preview request/response.
|
||||
+ *
|
||||
+ * @return true if part of previewing
|
||||
+ * @return {@code true} if part of previewing
|
||||
+ * @deprecated chat preview was removed in 1.19.3
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ @Deprecated(forRemoval = true, since = "1.19.3")
|
||||
+ @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+ @Contract(value = "-> false", pure = true)
|
||||
+ public boolean isPreview() {
|
||||
@ -494,10 +499,10 @@ index 0000000000000000000000000000000000000000..667bfa6afc35f8a8f475431171ee474a
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4d2eddba7dc88ba23b241ac7849114a30af968d3
|
||||
index 0000000000000000000000000000000000000000..4adae8b8a8640ffbd6a86b0908ca21fded737b88
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java
|
||||
@@ -0,0 +1,47 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import java.util.Set;
|
||||
@ -524,11 +529,9 @@ index 0000000000000000000000000000000000000000..4d2eddba7dc88ba23b241ac7849114a3
|
||||
+ * appropriately.
|
||||
+ */
|
||||
+public final class AsyncChatEvent extends AbstractChatEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ /**
|
||||
+ * @param viewers A mutable set of viewers
|
||||
+ */
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage, final @NotNull SignedMessage signedMessage) {
|
||||
+ super(async, player, viewers, renderer, message, originalMessage, signedMessage);
|
||||
@ -537,20 +540,20 @@ index 0000000000000000000000000000000000000000..4d2eddba7dc88ba23b241ac7849114a3
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/ChatEvent.java b/src/main/java/io/papermc/paper/event/player/ChatEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..af025704e978dc0b11be277ab4646da77eb3a60b
|
||||
index 0000000000000000000000000000000000000000..7411f58f9f36beaadcc47c2264a4af313956ee03
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/ChatEvent.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -0,0 +1,41 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import java.util.Set;
|
||||
@ -567,16 +570,15 @@ index 0000000000000000000000000000000000000000..af025704e978dc0b11be277ab4646da7
|
||||
+/**
|
||||
+ * An event fired when a {@link Player} sends a chat message to the server.
|
||||
+ *
|
||||
+ * @deprecated Listening to this event forces chat to wait for the main thread, delaying chat messages. It is recommended to use {@link AsyncChatEvent} instead, wherever possible.
|
||||
+ * @deprecated Listening to this event forces chat to wait for the main thread, delaying chat messages.
|
||||
+ * It is recommended to use {@link AsyncChatEvent} instead, wherever possible.
|
||||
+ */
|
||||
+@Deprecated
|
||||
+@Warning(reason = "Listening to this event forces chat to wait for the main thread, delaying chat messages.")
|
||||
+public final class ChatEvent extends AbstractChatEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ /**
|
||||
+ * @param viewers A mutable set of viewers
|
||||
+ */
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage, final @NotNull SignedMessage signedMessage) {
|
||||
+ super(false, player, viewers, renderer, message, originalMessage, signedMessage);
|
||||
@ -585,12 +587,12 @@ index 0000000000000000000000000000000000000000..af025704e978dc0b11be277ab4646da7
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors.
|
||||
Uses method handles for private or static methods.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index cbe75dc937409af36528e4eef6f257f323cd4d12..7fbb782ccf17e581a759429ffac6db608c08e3cf 100644
|
||||
index b577114c2b89fe2053123d1a542d37dff7fa8d5a..af6c528ccc4356f5bba3ce0b9bf6de237d77376e 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -47,6 +47,9 @@ dependencies {
|
||||
@ -69,10 +69,10 @@ index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656b
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c83672427324bd068ed52916f700b68446a226f6
|
||||
index 0000000000000000000000000000000000000000..827f2b27f70a7ec0bc11d039305c3e58c02a4ef4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,43 @@
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
@ -83,7 +83,6 @@ index 0000000000000000000000000000000000000000..c83672427324bd068ed52916f700b684
|
||||
+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;
|
||||
@ -218,20 +217,18 @@ index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac99477e9f2c08041aeff31abc1d1edee58d0a67
|
||||
index 0000000000000000000000000000000000000000..abcc966d8ee01d73c1d1480237ab46fa0ab55fdc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
@@ -0,0 +1,66 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+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();
|
||||
|
@ -6,16 +6,18 @@ Subject: [PATCH] Add PlayerLocaleChangeEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bb7baa91fd4ba763fd8ce216bc9043c5e2c4b7b7
|
||||
index 0000000000000000000000000000000000000000..57f6c47e4e759abf0af9aa8962551225cc12246c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
@@ -0,0 +1,51 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the locale of the player is changed.
|
||||
@ -24,11 +26,14 @@ index 0000000000000000000000000000000000000000..bb7baa91fd4ba763fd8ce216bc9043c5
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class PlayerLocaleChangeEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String oldLocale;
|
||||
+ private final String newLocale;
|
||||
+
|
||||
+ public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerLocaleChangeEvent(final @NotNull Player player, final @Nullable String oldLocale, final @NotNull String newLocale) {
|
||||
+ super(player);
|
||||
+ this.oldLocale = oldLocale;
|
||||
+ this.newLocale = newLocale;
|
||||
@ -39,8 +44,9 @@ index 0000000000000000000000000000000000000000..bb7baa91fd4ba763fd8ce216bc9043c5
|
||||
+ *
|
||||
+ * @return player's old locale
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getOldLocale() {
|
||||
+ return oldLocale;
|
||||
+ return this.oldLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -48,16 +54,19 @@ index 0000000000000000000000000000000000000000..bb7baa91fd4ba763fd8ce216bc9043c5
|
||||
+ *
|
||||
+ * @return player's new locale
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getNewLocale() {
|
||||
+ return newLocale;
|
||||
+ return this.newLocale;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091a46b56ac
|
||||
index 0000000000000000000000000000000000000000..7270c1feece2dc15a4a0503c4bca93a1288f8f13
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -0,0 +1,86 @@
|
||||
@@ -0,0 +1,91 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -18,18 +18,23 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final boolean primary;
|
||||
+ private PotionEffect effect;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
@ -37,16 +42,6 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
@ -54,7 +49,7 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return effect;
|
||||
+ return this.effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -73,26 +68,36 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return true if this event represents a primary effect
|
||||
+ * @return {@code true} if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return primary;
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,10 +7,10 @@ For modifying a player's initial spawn location as they join the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..febd384b43560d7d55c96bda5b0701a27fc9e18e
|
||||
index 0000000000000000000000000000000000000000..49e97ae79facceca5fc44c84c3d5f342d64cabc2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
@@ -0,0 +1,18 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -25,7 +25,8 @@ index 0000000000000000000000000000000000000000..febd384b43560d7d55c96bda5b0701a2
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
|
||||
+
|
||||
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {
|
||||
+ super(who, spawnLocation);
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerInitialSpawnEvent(@NotNull Player player, @NotNull Location spawnLocation) {
|
||||
+ super(player, spawnLocation);
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,29 +6,32 @@ Subject: [PATCH] Add exception reporting event
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..306dbd975e9380c22dae0dad526725cc47a36f16
|
||||
index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc010f66957
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import com.destroystokyo.paper.exception.ServerException;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ServerException exception;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerExceptionEvent(@NotNull ServerException exception) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.exception = Preconditions.checkNotNull(exception, "exception");
|
||||
+ this.exception = exception;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -38,18 +41,18 @@ index 0000000000000000000000000000000000000000..306dbd975e9380c22dae0dad526725cc
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ServerException getException() {
|
||||
+ return exception;
|
||||
+ return this.exception;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
|
@ -6,26 +6,32 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..982a0abd9a90fcb99f8d7c60a89021a5b1bb8264
|
||||
index 0000000000000000000000000000000000000000..1d8e3c93a139bba11affca74b742269f24300d2c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
@@ -0,0 +1,41 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being added to the world for any reason (including a chunk loading).
|
||||
+ *
|
||||
+ * Not to be confused with {@link org.bukkit.event.entity.CreatureSpawnEvent}
|
||||
+ * <p>
|
||||
+ * Not to be confused with {@link CreatureSpawnEvent}
|
||||
+ */
|
||||
+public class EntityAddToWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityAddToWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
@ -36,33 +42,32 @@ index 0000000000000000000000000000000000000000..982a0abd9a90fcb99f8d7c60a89021a5
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return world;
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b58e2e7b8707c6221773b8f023f58a4eb9c7d4b9
|
||||
index 0000000000000000000000000000000000000000..d75e6a8334c7408ea8c3f155414fc14dc427f190
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,43 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -70,8 +75,12 @@ index 0000000000000000000000000000000000000000..b58e2e7b8707c6221773b8f023f58a4e
|
||||
+ * Note: The entity is updated prior to this event being called, as such, the entity's world may not be equal to {@link #getWorld()}.
|
||||
+ */
|
||||
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
@ -82,18 +91,16 @@ index 0000000000000000000000000000000000000000..b58e2e7b8707c6221773b8f023f58a4e
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return world;
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,10 +7,10 @@ Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..63e46b2fb1b12b36fcb1e98b178cf29dd2e3d1b5
|
||||
index 0000000000000000000000000000000000000000..5804497f34bac9a9b6b16c6e5decb0119467df7b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
@@ -0,0 +1,82 @@
|
||||
@@ -0,0 +1,87 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -18,78 +18,83 @@ index 0000000000000000000000000000000000000000..63e46b2fb1b12b36fcb1e98b178cf29d
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity decides to start moving towards a location.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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) {
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private final Entity targetEntity;
|
||||
+ @NotNull private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPathfindEvent(@NotNull Entity entity, @NotNull Location location, @Nullable Entity targetEntity) {
|
||||
+ super(entity);
|
||||
+ this.targetEntity = targetEntity;
|
||||
+ this.loc = loc;
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Entity that is pathfinding.
|
||||
+ *
|
||||
+ * @return The Entity that is pathfinding.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return entity;
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If the Entity is trying to pathfind to an entity, this is the entity in relation.
|
||||
+ * <br>
|
||||
+ * Otherwise this will return {@code null}.
|
||||
+ *
|
||||
+ * Otherwise this will return null.
|
||||
+ *
|
||||
+ * @return The entity target or null
|
||||
+ * @return The entity target or {@code null}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getTargetEntity() {
|
||||
+ return targetEntity;
|
||||
+ return this.targetEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Location of where the entity is about to move to.
|
||||
+ *
|
||||
+ * <br>
|
||||
+ * 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;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -10,17 +10,19 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f3f48000f
|
||||
index 0000000000000000000000000000000000000000..f64b253f1794c7987a32a4313df19d7512bea1bc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
@@ -0,0 +1,82 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+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.event.player.PlayerInteractAtEntityEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -33,14 +35,16 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
|
||||
+ */
|
||||
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int entityId;
|
||||
+ private final boolean attack;
|
||||
+ private final @NotNull EquipmentSlot hand;
|
||||
+ private final @Nullable Vector clickedPosition;
|
||||
+
|
||||
+ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) {
|
||||
+ super(who);
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerUseUnknownEntityEvent(@NotNull Player player, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) {
|
||||
+ super(player);
|
||||
+ this.entityId = entityId;
|
||||
+ this.attack = attack;
|
||||
+ this.hand = hand;
|
||||
@ -59,7 +63,7 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
|
||||
+ /**
|
||||
+ * Returns whether the interaction was an attack.
|
||||
+ *
|
||||
+ * @return true if the player is attacking the entity, false if the player is interacting with the entity
|
||||
+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity
|
||||
+ */
|
||||
+ public boolean isAttack() {
|
||||
+ return this.attack;
|
||||
@ -75,11 +79,11 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the position relative to the entity that was clicked, or null if not available.
|
||||
+ * See {@link org.bukkit.event.player.PlayerInteractAtEntityEvent} for more details.
|
||||
+ * Returns the position relative to the entity that was clicked, or {@code null} if not available.
|
||||
+ * See {@link PlayerInteractAtEntityEvent} for more details.
|
||||
+ *
|
||||
+ * @return the position relative to the entity that was clicked, or null if not available
|
||||
+ * @see org.bukkit.event.player.PlayerInteractAtEntityEvent
|
||||
+ * @return the position relative to the entity that was clicked, or {@code null} if not available
|
||||
+ * @see PlayerInteractAtEntityEvent
|
||||
+ */
|
||||
+ public @Nullable Vector getClickedRelativePosition() {
|
||||
+ return this.clickedPosition != null ? this.clickedPosition.clone() : null;
|
||||
@ -88,11 +92,11 @@ index 0000000000000000000000000000000000000000..a7228e248e3d8eb2e9f011dfe2c7dd9f
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,10 +7,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3
|
||||
index 0000000000000000000000000000000000000000..7c049bad187b94331f42f96833d1cf4ce03ef477
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -0,0 +1,277 @@
|
||||
@@ -0,0 +1,267 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
@ -20,6 +20,7 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -27,18 +28,18 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired during a player handshake.
|
||||
+ *
|
||||
+ * <p>If there are no listeners listening to this event, the logic default
|
||||
+ * to your server platform will be ran.</p>
|
||||
+ * <p>
|
||||
+ * If there are no listeners listening to this event, the logic default
|
||||
+ * to your server platform will be run.
|
||||
+ *
|
||||
+ * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
+ */
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final String originalHandshake;
|
||||
+ @NotNull private final String originalSocketAddressHostname;
|
||||
+ private boolean cancelled;
|
||||
+ @Nullable private String serverHostname;
|
||||
+ @Nullable private String socketAddressHostname;
|
||||
+ @Nullable private UUID uniqueId;
|
||||
@ -46,26 +47,15 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+ private boolean failed;
|
||||
+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link PlayerHandshakeEvent}.
|
||||
+ *
|
||||
+ * @param originalHandshake the original handshake string
|
||||
+ * @param cancelled if this event is enabled
|
||||
+ *
|
||||
+ * @deprecated in favour of {@link PlayerHandshakeEvent(String, String, boolean)}
|
||||
+ */
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
||||
+ this(originalHandshake, "127.0.0.1", cancelled);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link PlayerHandshakeEvent}.
|
||||
+ *
|
||||
+ * @param originalHandshake the original handshake string
|
||||
+ * @param originalSocketAddressHostname the original socket address hostname
|
||||
+ * @param cancelled if this event is enabled
|
||||
+ */
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled) {
|
||||
+ super(true);
|
||||
+ this.originalHandshake = originalHandshake;
|
||||
@ -75,9 +65,9 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if this event is cancelled.
|
||||
+ *
|
||||
+ * <p>When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.</p>
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * @return {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
@ -88,15 +78,15 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this event is cancelled.
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * <p>When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.</p>
|
||||
+ *
|
||||
+ * @param cancelled {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ * @param cancel {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -201,9 +191,9 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if authentication failed.
|
||||
+ *
|
||||
+ * <p>When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.</p>
|
||||
+ * <p>
|
||||
+ * When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.
|
||||
+ *
|
||||
+ * @return {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
@ -213,9 +203,9 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if authentication failed and the client should be disconnected.
|
||||
+ *
|
||||
+ * <p>When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.</p>
|
||||
+ * <p>
|
||||
+ * 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
|
||||
+ */
|
||||
@ -280,11 +270,11 @@ index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca68
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -189,21 +189,27 @@ index 0000000000000000000000000000000000000000..2b01a50b6e18856f4c9e28340a7a111c
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fd184f13f5e8ee5cf829fff4f44696e1f760430b
|
||||
index 0000000000000000000000000000000000000000..5ee1a04aaaa4ef09559f2cf757811e463e2a1be6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -0,0 +1,47 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class LootableInventoryReplenishEvent extends PlayerEvent implements Cancellable {
|
||||
+ @NotNull private final LootableInventory inventory;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final LootableInventory inventory;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public LootableInventoryReplenishEvent(@NotNull Player player, @NotNull LootableInventory inventory) {
|
||||
+ super(player);
|
||||
+ this.inventory = inventory;
|
||||
@ -211,31 +217,27 @@ index 0000000000000000000000000000000000000000..fd184f13f5e8ee5cf829fff4f44696e1
|
||||
+
|
||||
+ @NotNull
|
||||
+ public LootableInventory getInventory() {
|
||||
+ return inventory;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Barrel.java b/src/main/java/org/bukkit/block/Barrel.java
|
||||
|
@ -6,13 +6,12 @@ Subject: [PATCH] Add EntityZapEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1c5fa066c9e5e1b1a06df30842a4c7acc4742df8
|
||||
index 0000000000000000000000000000000000000000..dc6d15975a47e68c5bd939e68ddd2773028a6ac8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
||||
@@ -0,0 +1,64 @@
|
||||
@@ -0,0 +1,69 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LightningStrike;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
@ -20,91 +19,89 @@ index 0000000000000000000000000000000000000000..1c5fa066c9e5e1b1a06df30842a4c7ac
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when lightning strikes an entity
|
||||
+ * 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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final LightningStrike bolt;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) {
|
||||
+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
|
||||
+ Preconditions.checkNotNull(bolt);
|
||||
+ Preconditions.checkNotNull(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;
|
||||
+ return this.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();
|
||||
+ return super.getTransformedEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/PigZapEvent.java b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
index 0e0ed93b568fd2c0d8f6e359c31dc29cb0fa71c2..d3949edfc736b3d67a627ef378748b374769e183 100644
|
||||
index 0e0ed93b568fd2c0d8f6e359c31dc29cb0fa71c2..085337f3d3d6adef5fd4ecda133c607e4b77bd93 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
||||
|
||||
import java.util.Collections;
|
||||
import org.bukkit.entity.Entity;
|
||||
+import com.destroystokyo.paper.event.entity.EntityZapEvent;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
@@ -12,14 +13,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,14 +12,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Stores data for pigs being zapped
|
||||
*/
|
||||
-public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
+public class PigZapEvent extends EntityZapEvent implements Cancellable {
|
||||
+ //private static final HandlerList handlers = new HandlerList();
|
||||
+public class PigZapEvent extends com.destroystokyo.paper.event.entity.EntityZapEvent implements Cancellable { // Paper
|
||||
+ // private static final HandlerList handlers = new HandlerList(); // Paper - moved in the super class
|
||||
private boolean canceled;
|
||||
private final PigZombie pigzombie;
|
||||
private final LightningStrike bolt;
|
||||
|
||||
public PigZapEvent(@NotNull final Pig pig, @NotNull final LightningStrike bolt, @NotNull final PigZombie pigzombie) {
|
||||
- super(pig, Collections.singletonList((Entity) pigzombie), TransformReason.LIGHTNING);
|
||||
+ super(pig, bolt, pigzombie);
|
||||
+ super(pig, bolt, pigzombie); // Paper
|
||||
this.bolt = bolt;
|
||||
this.pigzombie = pigzombie;
|
||||
}
|
||||
@@ -63,6 +64,8 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
@@ -63,6 +63,8 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
return pigzombie;
|
||||
}
|
||||
|
||||
@ -113,7 +110,7 @@ index 0e0ed93b568fd2c0d8f6e359c31dc29cb0fa71c2..d3949edfc736b3d67a627ef378748b37
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -73,4 +76,6 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
@@ -73,4 +75,6 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
@ -7,41 +7,40 @@ Now deprecated and replaced with ProjectileHitEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6ae2bc3d952d34f298220738856024e0b6594199
|
||||
index 0000000000000000000000000000000000000000..3caff9cbb990e03d4331bd601272aec5090affcf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
@@ -0,0 +1,74 @@
|
||||
+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.EntityDamageByEntityEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a projectile collides with an entity
|
||||
+ * <p>
|
||||
+ * This event is called <b>before</b> {@link org.bukkit.event.entity.EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying
|
||||
+ * This event is called <b>before</b> {@link EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying
|
||||
+ *
|
||||
+ * @deprecated Deprecated, use {@link org.bukkit.event.entity.ProjectileHitEvent} and check if there is a hit entity
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class ProjectileCollideEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Entity collidedWith;
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity the projectile collided with
|
||||
+ *
|
||||
+ * @return the entity collided with
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getCollidedWith() {
|
||||
+ return collidedWith;
|
||||
+ }
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public ProjectileCollideEvent(@NotNull Projectile what, @NotNull Entity collidedWith) {
|
||||
+ super(what);
|
||||
+ @ApiStatus.Internal
|
||||
+ public ProjectileCollideEvent(@NotNull Projectile projectile, @NotNull Entity collidedWith) {
|
||||
+ super(projectile);
|
||||
+ this.collidedWith = collidedWith;
|
||||
+ }
|
||||
+
|
||||
@ -55,28 +54,34 @@ index 0000000000000000000000000000000000000000..6ae2bc3d952d34f298220738856024e0
|
||||
+ return (Projectile) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlerList = new HandlerList();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity the projectile collided with
|
||||
+ *
|
||||
+ * @return the entity collided with
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlerList;
|
||||
+ public Entity getCollidedWith() {
|
||||
+ return this.collidedWith;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlerList;
|
||||
+ }
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -9,16 +9,16 @@ Lets plugins change the kick message and if it should kick or not.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java b/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8d8e9b16f2a6707d2af7567c7682dfc5db51a737
|
||||
index 0000000000000000000000000000000000000000..8dc5971ba441395f7bc13568c5ee88ca34837e95
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
|
||||
@@ -0,0 +1,74 @@
|
||||
@@ -0,0 +1,67 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -27,20 +27,24 @@ index 0000000000000000000000000000000000000000..8d8e9b16f2a6707d2af7567c7682dfc5
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class IllegalPacketEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private final String type;
|
||||
+ @Nullable private final String ex;
|
||||
+ @Nullable private final String exceptionMessage;
|
||||
+ @Nullable private String kickMessage;
|
||||
+ private boolean shouldKick = true;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ 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();
|
||||
+ this.exceptionMessage = e.getMessage();
|
||||
+ }
|
||||
+
|
||||
+ public boolean isShouldKick() {
|
||||
+ return shouldKick;
|
||||
+ return this.shouldKick;
|
||||
+ }
|
||||
+
|
||||
+ public void setShouldKick(boolean shouldKick) {
|
||||
@ -49,7 +53,7 @@ index 0000000000000000000000000000000000000000..8d8e9b16f2a6707d2af7567c7682dfc5
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getKickMessage() {
|
||||
+ return kickMessage;
|
||||
+ return this.kickMessage;
|
||||
+ }
|
||||
+
|
||||
+ public void setKickMessage(@Nullable String kickMessage) {
|
||||
@ -58,32 +62,21 @@ index 0000000000000000000000000000000000000000..8d8e9b16f2a6707d2af7567c7682dfc5
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getType() {
|
||||
+ return type;
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getExceptionMessage() {
|
||||
+ return ex;
|
||||
+ return this.exceptionMessage;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @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());
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,24 +7,27 @@ Allows you to access the Gateway being used in a teleport event
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b64ab6eecd8bc4ca9c109b9d83c82861d6260793
|
||||
index 0000000000000000000000000000000000000000..40bd79fbe30f19bc93e34da52d2b2bf0768be974
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
|
||||
@@ -0,0 +1,29 @@
|
||||
@@ -0,0 +1,32 @@
|
||||
+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.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ 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;
|
||||
@ -37,6 +40,6 @@ index 0000000000000000000000000000000000000000..b64ab6eecd8bc4ca9c109b9d83c82861
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EndGateway getGateway() {
|
||||
+ return gateway;
|
||||
+ return this.gateway;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,33 +6,39 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eeee1cbc61e
|
||||
index 0000000000000000000000000000000000000000..13e4b1309ea9965a07fc8b276d5a7e606e205824
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java
|
||||
@@ -0,0 +1,90 @@
|
||||
@@ -0,0 +1,96 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Item;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a player attempts to pick an item up from the ground
|
||||
+ */
|
||||
+public class PlayerAttemptPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Item item;
|
||||
+ private final int remaining;
|
||||
+ private boolean flyAtPlayer = true;
|
||||
+ private boolean isCancelled = false;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @Deprecated // Remove in 1.13 // Remove in 1.14?
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item) {
|
||||
+ this(player, item, 0);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item, final int remaining) {
|
||||
+ super(player);
|
||||
+ this.item = item;
|
||||
@ -46,7 +52,7 @@ index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eee
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Item getItem() {
|
||||
+ return item;
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -55,14 +61,14 @@ index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eee
|
||||
+ * @return amount that will remain on the ground
|
||||
+ */
|
||||
+ public int getRemaining() {
|
||||
+ return remaining;
|
||||
+ return this.remaining;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set if the item will fly at the player
|
||||
+ * <p>Cancelling the event will set this value to false.</p>
|
||||
+ *
|
||||
+ * @param flyAtPlayer True for item to fly at player
|
||||
+ * @param flyAtPlayer {@code true} for item to fly at player
|
||||
+ */
|
||||
+ public void setFlyAtPlayer(boolean flyAtPlayer) {
|
||||
+ this.flyAtPlayer = flyAtPlayer;
|
||||
@ -71,7 +77,7 @@ index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eee
|
||||
+ /**
|
||||
+ * Gets if the item will fly at the player
|
||||
+ *
|
||||
+ * @return True if the item will fly at the player
|
||||
+ * @return {@code true} if the item will fly at the player
|
||||
+ */
|
||||
+ public boolean getFlyAtPlayer() {
|
||||
+ return this.flyAtPlayer;
|
||||
@ -80,23 +86,23 @@ index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eee
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.isCancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.isCancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ this.flyAtPlayer = !cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add UnknownCommandEvent
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee417dc866c
|
||||
index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b06a58a76
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
@@ -0,0 +1,110 @@
|
||||
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
@ -25,11 +26,14 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+ * Thrown when a player executes a command that is not defined
|
||||
+ */
|
||||
+public class UnknownCommandEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private CommandSender sender;
|
||||
+ @NotNull private String commandLine;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final CommandSender sender;
|
||||
+ @NotNull private final String commandLine;
|
||||
+ @Nullable private Component message;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
|
||||
+ super(false);
|
||||
+ this.sender = sender;
|
||||
@ -39,29 +43,26 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the CommandSender or ConsoleCommandSender
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Sender of the command
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender getSender() {
|
||||
+ return sender;
|
||||
+ return this.sender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command that was send
|
||||
+ * <p>
|
||||
+ * Gets the command that was sent
|
||||
+ *
|
||||
+ * @return Command sent
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getCommandLine() {
|
||||
+ return commandLine;
|
||||
+ return this.commandLine;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets message that will be returned
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Unknown command message
|
||||
+ * @deprecated use {@link #message()}
|
||||
@ -75,9 +76,9 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+ /**
|
||||
+ * Sets message that will be returned
|
||||
+ * <p>
|
||||
+ * Set to null to avoid any message being sent
|
||||
+ * Set to {@code null} to avoid any message being sent
|
||||
+ *
|
||||
+ * @param message the message to be returned, or null
|
||||
+ * @param message the message to be returned, or {@code null}
|
||||
+ * @deprecated use {@link #message(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
@ -87,7 +88,6 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+
|
||||
+ /**
|
||||
+ * Gets message that will be returned
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Unknown command message
|
||||
+ */
|
||||
@ -100,9 +100,9 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+ /**
|
||||
+ * Sets message that will be returned
|
||||
+ * <p>
|
||||
+ * Set to null to avoid any message being sent
|
||||
+ * Set to {@code null} to avoid any message being sent
|
||||
+ *
|
||||
+ * @param message the message to be returned, or null
|
||||
+ * @param message the message to be returned, or {@code null}
|
||||
+ */
|
||||
+ public void message(@Nullable Component message) {
|
||||
+ this.message = message;
|
||||
@ -111,12 +111,12 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
||||
index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b571998332090b785730 100644
|
||||
index 951ea2cc763973655beedcba3c75332d3f297313..e528d811f651696069dbd2fd21c5ffad294b26af 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@ -16,16 +16,17 @@ index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b57199833209
|
||||
private boolean cancel = false;
|
||||
private final int remaining;
|
||||
|
||||
@@ -45,6 +46,27 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
@@ -45,6 +46,28 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
return remaining;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set if the item will fly at the player
|
||||
+ * <p>Cancelling the event will set this value to false.</p>
|
||||
+ * <p>
|
||||
+ * Cancelling the event will set this value to false.
|
||||
+ *
|
||||
+ * @param flyAtPlayer True for item to fly at player
|
||||
+ * @param flyAtPlayer true for item to fly at player
|
||||
+ */
|
||||
+ public void setFlyAtPlayer(boolean flyAtPlayer) {
|
||||
+ this.flyAtPlayer = flyAtPlayer;
|
||||
@ -34,7 +35,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b57199833209
|
||||
+ /**
|
||||
+ * Gets if the item will fly at the player
|
||||
+ *
|
||||
+ * @return True if the item will fly at the player
|
||||
+ * @return true if the item will fly at the player
|
||||
+ */
|
||||
+ public boolean getFlyAtPlayer() {
|
||||
+ return flyAtPlayer;
|
||||
@ -44,7 +45,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b57199833209
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
@@ -53,6 +75,7 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
@@ -53,6 +76,7 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
|
@ -8,10 +8,10 @@ profiles that had to be looked up.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8df37c07cd55ddf110d1dd68183d7b697f7a6756
|
||||
index 0000000000000000000000000000000000000000..2ad2782aafe76f8b10565c0f0419d6b9c665b267
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,48 @@
|
||||
+package com.destroystokyo.paper.event.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
@ -19,21 +19,23 @@ index 0000000000000000000000000000000000000000..8df37c07cd55ddf110d1dd68183d7b69
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * No guarantees are made about thread execution context for this event. If you need to know, check
|
||||
+ * event.isAsync()
|
||||
+ * {@link Event#isAsynchronous()}
|
||||
+ */
|
||||
+public class LookupProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile profile;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public LookupProfileEvent(@NotNull PlayerProfile profile) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.profile = profile;
|
||||
@ -44,31 +46,29 @@ index 0000000000000000000000000000000000000000..8df37c07cd55ddf110d1dd68183d7b69
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile;
|
||||
+ return this.profile;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729ed29f8c85
|
||||
index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533dfa474356
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
@@ -0,0 +1,108 @@
|
||||
@@ -0,0 +1,112 @@
|
||||
+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;
|
||||
@ -76,26 +76,30 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Allows a plugin to intercept a Profile Lookup for a Profile by name
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * At the point of event fire, the UUID and properties are unset.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * If a plugin sets the UUID, and optionally the properties, the API call to look up the profile may be skipped.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * No guarantees are made about thread execution context for this event. If you need to know, check
|
||||
+ * event.isAsync()
|
||||
+ * {@link Event#isAsynchronous()}
|
||||
+ */
|
||||
+public class PreLookupProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final String name;
|
||||
+
|
||||
+ private UUID uuid;
|
||||
+ @NotNull private Set<ProfileProperty> properties = new HashSet<>();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreLookupProfileEvent(@NotNull String name) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.name = name;
|
||||
@ -106,11 +110,11 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getName() {
|
||||
+ return name;
|
||||
+ return this.name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If this value is left null by the completion of the event call, then the server will
|
||||
+ * If this value is left {@code 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}
|
||||
+ *
|
||||
@ -118,22 +122,22 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public UUID getUUID() {
|
||||
+ return uuid;
|
||||
+ return this.uuid;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the UUID for this player name. This will skip the initial API call to find the players UUID.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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
|
||||
+ * @param uuid the UUID to set for the profile or {@code null} to reset
|
||||
+ */
|
||||
+ public void setUUID(@Nullable UUID uuid) {
|
||||
+ this.uuid = uuid;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The currently pending prepopulated properties.
|
||||
+ * @return The currently pending pre-populated properties.
|
||||
+ * Any property in this Set will be automatically prefilled on this Profile
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -142,8 +146,9 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clears any existing prepopulated properties and uses the supplied properties
|
||||
+ * Clears any existing pre-populated 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<ProfileProperty> properties) {
|
||||
@ -152,8 +157,9 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Adds any properties currently missing to the prepopulated properties set, replacing any that already were set.
|
||||
+ * Adds any properties currently missing to the pre-populated 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<ProfileProperty> properties) {
|
||||
@ -163,12 +169,12 @@ index 0000000000000000000000000000000000000000..4dcf6242c9acc62d030a94f67b78729e
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
|
@ -9,10 +9,10 @@ Allows you to do dynamic whitelisting and change of kick message
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568a25793fa
|
||||
index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab8133478f7c6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
|
||||
@@ -0,0 +1,142 @@
|
||||
@@ -0,0 +1,147 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License
|
||||
+ *
|
||||
@ -43,28 +43,33 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Fires when the server needs to verify if a player is whitelisted.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile profile;
|
||||
+ private final boolean whitelistEnabled;
|
||||
+ private boolean whitelisted;
|
||||
+ private final boolean isOp;
|
||||
+ private boolean whitelisted;
|
||||
+ @Nullable private Component kickMessage;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) {
|
||||
+ this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage));
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable Component kickMessage) {
|
||||
+ this.profile = profile;
|
||||
+ this.whitelistEnabled = whitelistEnabled;
|
||||
@ -80,11 +85,11 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
|
||||
+ @Deprecated
|
||||
+ @Nullable
|
||||
+ public String getKickMessage() {
|
||||
+ return this.kickMessage == null ? null : LegacyComponentSerializer.legacySection().serialize(kickMessage);
|
||||
+ return this.kickMessage == null ? null : LegacyComponentSerializer.legacySection().serialize(this.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
|
||||
+ * @param kickMessage The message to send to the player on kick if not whitelisted. May set to {@code null} to use the server configured default
|
||||
+ * @deprecated Use {@link #kickMessage(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
@ -101,7 +106,7 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param kickMessage The message to send to the player on kick if not whitelisted. May set to null to use the server configured default
|
||||
+ * @param kickMessage The message to send to the player on kick if not whitelisted. May set to {@code null} to use the server configured default
|
||||
+ */
|
||||
+ public void kickMessage(@Nullable Component kickMessage) {
|
||||
+ this.kickMessage = kickMessage;
|
||||
@ -112,18 +117,18 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile;
|
||||
+ return this.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;
|
||||
+ return this.whitelisted;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Changes the players whitelisted state. false will deny the login
|
||||
+ * Changes the players whitelisted state. {@code false} will deny the login
|
||||
+ * @param whitelisted The new whitelisted state
|
||||
+ */
|
||||
+ public void setWhitelisted(boolean whitelisted) {
|
||||
@ -134,24 +139,24 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
|
||||
+ * @return if the player obtained whitelist status by having op
|
||||
+ */
|
||||
+ public boolean isOp() {
|
||||
+ return isOp;
|
||||
+ return this.isOp;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return if the server even has whitelist on
|
||||
+ */
|
||||
+ public boolean isWhitelistEnabled() {
|
||||
+ return whitelistEnabled;
|
||||
+ return this.whitelistEnabled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerJumpEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd166096b1849a1
|
||||
index 0000000000000000000000000000000000000000..d3c319298d360967b853cf0168c0a1833f094779
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
||||
@@ -0,0 +1,106 @@
|
||||
@ -18,21 +18,27 @@ index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd16609
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerMoveEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the server detects the player is jumping.
|
||||
+ * <p>
|
||||
+ * Added to avoid the overhead and special case logic that many plugins use
|
||||
+ * when checking for jumps via PlayerMoveEvent, this event is fired whenever
|
||||
+ * when checking for jumps via {@link 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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Location to;
|
||||
+ @NotNull private Location from;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerJumpEvent(@NotNull final Player player, @NotNull final Location from, @NotNull final Location to) {
|
||||
+ super(player);
|
||||
+ this.from = from;
|
||||
@ -40,31 +46,29 @@ index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd16609
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by getFrom(). This will not
|
||||
+ * teleported back to the Location as defined by {@link #getFrom()}. This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ * @return {@code true} if this event is cancelled
|
||||
+ */
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by getFrom(). This will not
|
||||
+ * teleported back to the Location as defined by {@link #getFrom()}. This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ * @param cancel {@code true} if you wish to cancel this event
|
||||
+ */
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -74,7 +78,7 @@ index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd16609
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getFrom() {
|
||||
+ return from;
|
||||
+ return this.from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -83,13 +87,14 @@ index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd16609
|
||||
+ * @param from New location to mark as the players previous location
|
||||
+ */
|
||||
+ public void setFrom(@NotNull Location from) {
|
||||
+ validateLocation(from);
|
||||
+ Preconditions.checkArgument(from != null, "Cannot use null from location!");
|
||||
+ Preconditions.checkArgument(from.getWorld() != null, "Cannot use from location with null world!");
|
||||
+ this.from = from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player jumped to
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * This information is based on what the client sends, it typically
|
||||
+ * has little relation to the arc of the jump at any given point.
|
||||
+ *
|
||||
@ -97,22 +102,17 @@ index 0000000000000000000000000000000000000000..289a0d784a3c74caf8a7231b4dd16609
|
||||
+ */
|
||||
+ @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!");
|
||||
+ return this.to;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185fd37e9ee
|
||||
index 0000000000000000000000000000000000000000..ab08219497f7e362f113321c4bcfd180b335bf20
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
|
||||
@@ -0,0 +1,139 @@
|
||||
@@ -0,0 +1,127 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
@ -18,9 +18,6 @@ index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
@ -34,7 +31,8 @@ index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185
|
||||
+ * Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong>
|
||||
+ */
|
||||
+public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final SlotType slotType;
|
||||
+ @NotNull private final ItemStack oldItem;
|
||||
@ -78,20 +76,15 @@ index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185
|
||||
+ return this.newItem;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "ArmorChangeEvent{" + "player=" + player + ", slotType=" + slotType + ", oldItem=" + oldItem + ", newItem=" + newItem + '}';
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum SlotType {
|
||||
@ -100,11 +93,10 @@ index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185
|
||||
+ LEGS(NETHERITE_LEGGINGS, DIAMOND_LEGGINGS, GOLDEN_LEGGINGS, IRON_LEGGINGS, CHAINMAIL_LEGGINGS, LEATHER_LEGGINGS),
|
||||
+ FEET(NETHERITE_BOOTS, DIAMOND_BOOTS, GOLDEN_BOOTS, IRON_BOOTS, CHAINMAIL_BOOTS, LEATHER_BOOTS);
|
||||
+
|
||||
+ private final Set<Material> mutableTypes = new HashSet<>();
|
||||
+ private Set<Material> immutableTypes;
|
||||
+ private final Set<Material> types;
|
||||
+
|
||||
+ SlotType(Material... types) {
|
||||
+ this.mutableTypes.addAll(Arrays.asList(types));
|
||||
+ this.types = Set.of(types);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -115,18 +107,14 @@ index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Set<Material> getTypes() {
|
||||
+ if (immutableTypes == null) {
|
||||
+ immutableTypes = Collections.unmodifiableSet(mutableTypes);
|
||||
+ }
|
||||
+
|
||||
+ return immutableTypes;
|
||||
+ return this.types;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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
|
||||
+ * @return slot type the material will go in, or {@code null} if it won't
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public static SlotType getByMaterial(@NotNull Material material) {
|
||||
|
@ -15,10 +15,10 @@ Co-authored-by: Aikar <aikar@aikar.co>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077dedadcef9f5d
|
||||
index 0000000000000000000000000000000000000000..e0847b6f0202bd8267c537f72a5e8c8cb7c6b1db
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
@@ -0,0 +1,328 @@
|
||||
@@ -0,0 +1,339 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -59,47 +59,57 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Objects;
|
||||
+import java.util.stream.Stream;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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.
|
||||
+ *
|
||||
+ * Allows plugins to compute tab completion results asynchronously.
|
||||
+ * <p>
|
||||
+ * 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.
|
||||
+ * <p>
|
||||
+ * Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
|
||||
+ */
|
||||
+public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final CommandSender sender;
|
||||
+ @NotNull private final String buffer;
|
||||
+ private final boolean isCommand;
|
||||
+ @Nullable
|
||||
+ private final Location loc;
|
||||
+ private final Location location;
|
||||
+ private final List<Completion> completions = new ArrayList<>();
|
||||
+ private final List<String> stringCompletions = new TransformingRandomAccessList<>(
|
||||
+ this.completions,
|
||||
+ Completion::suggestion,
|
||||
+ Completion::completion
|
||||
+ );
|
||||
+ private boolean handled;
|
||||
+ private boolean cancelled;
|
||||
+ private boolean handled = false;
|
||||
+ private boolean fireSyncHandler = true;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
+ super(true);
|
||||
+ this.sender = sender;
|
||||
+ this.buffer = buffer;
|
||||
+ this.isCommand = isCommand;
|
||||
+ this.loc = loc;
|
||||
+ this.location = loc;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
+ super(true);
|
||||
+ this.sender = sender;
|
||||
+ this.completions.addAll(fromStrings(completions));
|
||||
+ this.buffer = buffer;
|
||||
+ this.isCommand = isCommand;
|
||||
+ this.loc = loc;
|
||||
+ this.location = loc;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -109,13 +119,13 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender getSender() {
|
||||
+ return sender;
|
||||
+ return this.sender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The list of completions which will be offered to the sender, in order.
|
||||
+ * This list is mutable and reflects what will be offered.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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.
|
||||
@ -132,16 +142,16 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ * 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
|
||||
+ * <p>
|
||||
+ * The passed collection will be cloned to a new {@code List}. You must call {{@link #getCompletions()}} to mutate from here
|
||||
+ *
|
||||
+ * @param completions the new completions
|
||||
+ */
|
||||
+ public void setCompletions(@NotNull List<String> completions) {
|
||||
+ Preconditions.checkArgument(completions != null, "Completions list cannot be null");
|
||||
+ if (completions == this.stringCompletions) {
|
||||
+ return;
|
||||
+ }
|
||||
+ Preconditions.checkNotNull(completions);
|
||||
+ this.completions.clear();
|
||||
+ this.completions.addAll(fromStrings(completions));
|
||||
+ }
|
||||
@ -166,12 +176,12 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
|
||||
+ * or current player names will not be called.
|
||||
+ * <p>
|
||||
+ * The passed collection will be cloned to a new List. You must call {{@link #completions()}} to mutate from here
|
||||
+ * The passed collection will be cloned to a new {@code List}. You must call {@link #completions()} to mutate from here
|
||||
+ *
|
||||
+ * @param newCompletions the new completions
|
||||
+ */
|
||||
+ public void completions(final @NotNull List<Completion> newCompletions) {
|
||||
+ Preconditions.checkNotNull(newCompletions, "new completions");
|
||||
+ Preconditions.checkArgument(newCompletions != null, "new completions cannot be null");
|
||||
+ this.completions.clear();
|
||||
+ this.completions.addAll(newCompletions);
|
||||
+ }
|
||||
@ -183,37 +193,37 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getBuffer() {
|
||||
+ return buffer;
|
||||
+ return this.buffer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return True if it is a command being tab completed, false if it is a chat message.
|
||||
+ * @return {@code true} if it is a command being tab completed, {@code false} if it is a chat message.
|
||||
+ */
|
||||
+ public boolean isCommand() {
|
||||
+ return isCommand;
|
||||
+ return this.isCommand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The position looked at by the sender, or null if none
|
||||
+ * @return The position looked at by the sender, or {@code null} if none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getLocation() {
|
||||
+ return loc;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If true, the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
|
||||
+ * If {@code 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.
|
||||
+ * @return Is completions considered handled. Always {@code true} if completions is not empty.
|
||||
+ */
|
||||
+ public boolean isHandled() {
|
||||
+ return !completions.isEmpty() || handled;
|
||||
+ return !this.completions.isEmpty() || this.handled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether or not to consider the completion request handled.
|
||||
+ * If true, the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
|
||||
+ * Sets whether to consider the completion request handled.
|
||||
+ * If {@code 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
|
||||
@ -222,37 +232,35 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ this.handled = handled;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <br>
|
||||
+ * 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;
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> strings) {
|
||||
+ final List<Completion> list = new ArrayList<>();
|
||||
+ for (final String it : strings) {
|
||||
+ list.add(new CompletionImpl(it, null));
|
||||
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> suggestions) {
|
||||
+ final List<Completion> list = new ArrayList<>(suggestions.size());
|
||||
+ for (final String suggestion : suggestions) {
|
||||
+ list.add(new CompletionImpl(suggestion, null));
|
||||
+ }
|
||||
+ return list;
|
||||
+ }
|
||||
@ -261,6 +269,7 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ * A rich tab completion, consisting of a string suggestion, and a nullable {@link Component} tooltip.
|
||||
+ */
|
||||
+ public interface Completion extends Examinable {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the suggestion string for this {@link Completion}.
|
||||
+ *
|
||||
@ -292,11 +301,11 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+
|
||||
+ /**
|
||||
+ * Create a new {@link Completion} from a suggestion string and a tooltip {@link Component}.
|
||||
+ *
|
||||
+ * <p>If the provided component is null, the suggestion will not have a tooltip.</p>
|
||||
+ * <p>
|
||||
+ * If the provided component is {@code null}, the suggestion will not have a tooltip.
|
||||
+ *
|
||||
+ * @param suggestion suggestion string
|
||||
+ * @param tooltip tooltip component, or null
|
||||
+ * @param tooltip tooltip component, or {@code null}
|
||||
+ * @return new completion instance
|
||||
+ */
|
||||
+ static @NotNull Completion completion(final @NotNull String suggestion, final @Nullable Component tooltip) {
|
||||
@ -304,7 +313,9 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static final class CompletionImpl implements Completion {
|
||||
+
|
||||
+ private final String suggestion;
|
||||
+ private final Component tooltip;
|
||||
+
|
||||
@ -333,12 +344,12 @@ index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077deda
|
||||
+ }
|
||||
+ final CompletionImpl that = (CompletionImpl) o;
|
||||
+ return this.suggestion.equals(that.suggestion)
|
||||
+ && java.util.Objects.equals(this.tooltip, that.tooltip);
|
||||
+ && Objects.equals(this.tooltip, that.tooltip);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return java.util.Objects.hash(this.suggestion, this.tooltip);
|
||||
+ return Objects.hash(this.suggestion, this.tooltip);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -7,10 +7,10 @@ Allows plugins to cancel a player picking up an experience orb
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f7beb22d5105157940b39efe594ace9d4cb153f5
|
||||
index 0000000000000000000000000000000000000000..0ef10ac6bac990837e21520c800d89420a18e3d4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
@@ -0,0 +1,83 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -39,17 +39,22 @@ index 0000000000000000000000000000000000000000..f7beb22d5105157940b39efe594ace9d
|
||||
+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.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ExperienceOrb experienceOrb;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPickupExperienceEvent(@NotNull Player player, @NotNull ExperienceOrb experienceOrb) {
|
||||
+ super(player);
|
||||
+ this.experienceOrb = experienceOrb;
|
||||
@ -60,34 +65,32 @@ index 0000000000000000000000000000000000000000..f7beb22d5105157940b39efe594ace9d
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ExperienceOrb getExperienceOrb() {
|
||||
+ return experienceOrb;
|
||||
+ return this.experienceOrb;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <br>
|
||||
+ * If {@code true}, cancels picking up the experience orb, leaving it in the world
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -9,10 +9,10 @@ metadata such as spawn reason, or conditionally move data from source to target.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0ce3e397716c28c30ed05e153babd0bfb9dd354a
|
||||
index 0000000000000000000000000000000000000000..c520e5517861c4686806df233d1ef5e6bfb76ad3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
@@ -0,0 +1,91 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -42,15 +42,22 @@ index 0000000000000000000000000000000000000000..0ce3e397716c28c30ed05e153babd0bf
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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 {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ExperienceOrb mergeTarget;
|
||||
+ @NotNull private final ExperienceOrb mergeSource;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ExperienceOrbMergeEvent(@NotNull ExperienceOrb mergeTarget, @NotNull ExperienceOrb mergeSource) {
|
||||
+ super(mergeTarget);
|
||||
+ this.mergeTarget = mergeTarget;
|
||||
@ -62,7 +69,7 @@ index 0000000000000000000000000000000000000000..0ce3e397716c28c30ed05e153babd0bf
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ExperienceOrb getMergeTarget() {
|
||||
+ return mergeTarget;
|
||||
+ return this.mergeTarget;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -70,33 +77,30 @@ index 0000000000000000000000000000000000000000..0ce3e397716c28c30ed05e153babd0bf
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ExperienceOrb getMergeSource() {
|
||||
+ return mergeSource;
|
||||
+ return this.mergeSource;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param cancel {@code true} if you wish to cancel this event, and prevent the orbs from merging
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -16,41 +16,47 @@ See: https://github.com/PaperMC/Paper/issues/917
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3f2fdc9aa
|
||||
index 0000000000000000000000000000000000000000..1d582118f19a41b499ee73b5e27ddb66ed34f06b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
|
||||
@@ -0,0 +1,105 @@
|
||||
@@ -0,0 +1,109 @@
|
||||
+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.ApiStatus;
|
||||
+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".
|
||||
+ * WARNING: This event only fires for a limited number of cases, and not for every case that {@link CreatureSpawnEvent} does.
|
||||
+ * <p>
|
||||
+ * You should still listen to {@link CreatureSpawnEvent} as a backup, and only use this event as an "enhancement".
|
||||
+ * The intent of this event is to improve server performance, so it fires even if the spawning might fail later, for
|
||||
+ * example when the entity would be unable to spawn due to limited space or lighting.
|
||||
+ *
|
||||
+ * Currently: NATURAL and SPAWNER based reasons. Please submit a Pull Request for future additions.
|
||||
+ * <p>
|
||||
+ * 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 {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Location location;
|
||||
+ @NotNull private final EntityType type;
|
||||
+ @NotNull private final CreatureSpawnEvent.SpawnReason reason;
|
||||
+ private boolean shouldAbortSpawn;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.location = Preconditions.checkNotNull(location, "Location may not be null");
|
||||
+ this.type = Preconditions.checkNotNull(type, "Type may not be null");
|
||||
+ this.reason = Preconditions.checkNotNull(reason, "Reason may not be null");
|
||||
+ this.location = location;
|
||||
+ this.type = type;
|
||||
+ this.reason = reason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -58,7 +64,7 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getSpawnLocation() {
|
||||
+ return location;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -66,7 +72,7 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getType() {
|
||||
+ return type;
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -74,14 +80,14 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CreatureSpawnEvent.SpawnReason getReason() {
|
||||
+ return reason;
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return If the spawn process should be aborted vs trying more attempts
|
||||
+ */
|
||||
+ public boolean shouldAbortSpawn() {
|
||||
+ return shouldAbortSpawn;
|
||||
+ return this.shouldAbortSpawn;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -94,34 +100,32 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
|
||||
+ 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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancelling this event is more efficient than cancelling CreatureSpawnEvent
|
||||
+ * @param cancel true if you wish to cancel this event, and abort the spawn of this creature
|
||||
+ * Cancelling this event is more efficient than cancelling {@link CreatureSpawnEvent}
|
||||
+ *
|
||||
+ * @param cancel {@code true} if you wish to cancel this event, and abort the spawn of this creature
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -10,25 +10,30 @@ Also a highly more effecient way to blanket block spawns in a world
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..112a0dbf522b8e74ce882678434923814e6b187f
|
||||
index 0000000000000000000000000000000000000000..7fcee73d61347165cefef7b92f0e63e0bed8ad73
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
|
||||
@@ -0,0 +1,64 @@
|
||||
@@ -0,0 +1,66 @@
|
||||
+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.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private byte radius;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerNaturallySpawnCreaturesEvent(@NotNull Player player, byte radius) {
|
||||
+ super(player);
|
||||
+ this.radius = radius;
|
||||
@ -38,7 +43,7 @@ index 0000000000000000000000000000000000000000..112a0dbf522b8e74ce88267843492381
|
||||
+ * @return The radius of chunks around this player to be included in natural spawn selection
|
||||
+ */
|
||||
+ public byte getSpawnRadius() {
|
||||
+ return radius;
|
||||
+ return this.radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -48,33 +53,30 @@ index 0000000000000000000000000000000000000000..112a0dbf522b8e74ce88267843492381
|
||||
+ 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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param cancel true if you wish to cancel this event, and not include this players chunks for natural spawning
|
||||
+ * @param cancel {@code 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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,10 +7,10 @@ Co-authored-by: The456gamer <the456gamer@the456gamer.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..99dac77befbf7c0c067f50150e62fe6d6ddaec7c
|
||||
index 0000000000000000000000000000000000000000..9502f94b3567fc22c4b61fea5aa251d738dde7ae
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
||||
@@ -0,0 +1,78 @@
|
||||
@@ -0,0 +1,84 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.advancement.Advancement;
|
||||
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..99dac77befbf7c0c067f50150e62fe6d
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -26,17 +27,21 @@ index 0000000000000000000000000000000000000000..99dac77befbf7c0c067f50150e62fe6d
|
||||
+ * If cancelled the criteria will be revoked.
|
||||
+ */
|
||||
+public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Advancement advancement;
|
||||
+ @NotNull private final String criterion;
|
||||
+ @NotNull private final AdvancementProgress advancementProgress;
|
||||
+ private boolean cancel = false;
|
||||
+
|
||||
+ public PlayerAdvancementCriterionGrantEvent(@NotNull Player who, @NotNull Advancement advancement, @NotNull String criterion) {
|
||||
+ super(who);
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAdvancementCriterionGrantEvent(@NotNull Player player, @NotNull Advancement advancement, @NotNull String criterion) {
|
||||
+ super(player);
|
||||
+ this.advancement = advancement;
|
||||
+ this.criterion = criterion;
|
||||
+ this.advancementProgress = who.getAdvancementProgress(advancement);
|
||||
+ this.advancementProgress = player.getAdvancementProgress(advancement);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -46,7 +51,7 @@ index 0000000000000000000000000000000000000000..99dac77befbf7c0c067f50150e62fe6d
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Advancement getAdvancement() {
|
||||
+ return advancement;
|
||||
+ return this.advancement;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -56,36 +61,37 @@ index 0000000000000000000000000000000000000000..99dac77befbf7c0c067f50150e62fe6d
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getCriterion() {
|
||||
+ return criterion;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ return this.criterion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current AdvancementProgress.
|
||||
+ * See {@link PlayerAdvancementCriterionGrantEvent}
|
||||
+ *
|
||||
+ * @return advancement progress
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public AdvancementProgress getAdvancementProgress() {
|
||||
+ return advancementProgress;
|
||||
+ return this.advancementProgress;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -12,10 +12,10 @@ This is useful for implementing a ProfileCache for Player Skulls
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018de959040a
|
||||
index 0000000000000000000000000000000000000000..c97ded9f9ef1c550cca7d0a3a3b09a85e5999cdf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
|
||||
@@ -0,0 +1,75 @@
|
||||
@@ -0,0 +1,79 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -47,14 +47,19 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired once a profiles additional properties (such as textures) has been filled
|
||||
+ */
|
||||
+public class FillProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile profile;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public FillProfileEvent(@NotNull PlayerProfile profile) {
|
||||
+ super(!org.bukkit.Bukkit.isPrimaryThread());
|
||||
+ this.profile = profile;
|
||||
@ -65,7 +70,7 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile;
|
||||
+ return this.profile;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -76,27 +81,26 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Set<ProfileProperty> getProperties() {
|
||||
+ return profile.getProperties();
|
||||
+ return this.profile.getProperties();
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb8927802726399c
|
||||
index 0000000000000000000000000000000000000000..e2a47c4af2c368a361e4a370a01111abe8e48062
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,81 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -128,16 +132,21 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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
|
||||
+ * <p>
|
||||
+ * Allows plugins to pre-populate cached properties and avoid a call to the Mojang API
|
||||
+ */
|
||||
+public class PreFillProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile profile;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreFillProfileEvent(@NotNull PlayerProfile profile) {
|
||||
+ super(!org.bukkit.Bukkit.isPrimaryThread());
|
||||
+ this.profile = profile;
|
||||
@ -148,7 +157,7 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile;
|
||||
+ return this.profile;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -159,18 +168,17 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
|
||||
+ * @param properties The properties to set/append
|
||||
+ */
|
||||
+ public void setProperties(@NotNull Collection<ProfileProperty> properties) {
|
||||
+ profile.setProperties(properties);
|
||||
+ this.profile.setProperties(properties);
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,20 +7,19 @@ Co-authored-by: Connor Linfoot <connorlinfoot@me.com>
|
||||
Co-authored-by: MCMDEV <john-m.1@gmx.de>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015e73d2a75 100644
|
||||
index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..bdb7d2345e7d3a48a2f0561832ce126a16781e89 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
@@ -2,6 +2,9 @@ package org.bukkit.event.player;
|
||||
@@ -2,6 +2,8 @@ package org.bukkit.event.player;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
+
|
||||
+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;
|
||||
@@ -22,9 +25,10 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -22,9 +24,10 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Result result;
|
||||
private net.kyori.adventure.text.Component message; // Paper
|
||||
@ -33,7 +32,7 @@ index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015
|
||||
|
||||
@Deprecated
|
||||
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
|
||||
@@ -32,12 +36,29 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -32,12 +35,29 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
|
||||
@ -65,7 +64,7 @@ index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +221,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -200,7 +220,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
@NotNull
|
||||
public String getName() {
|
||||
@ -74,14 +73,14 @@ index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,9 +241,48 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -220,9 +240,48 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
@NotNull
|
||||
public UUID getUniqueId() {
|
||||
- return uniqueId;
|
||||
+ return profile.getId(); // Paper
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the PlayerProfile of the player logging in
|
||||
@ -107,8 +106,8 @@ index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015
|
||||
+ @NotNull
|
||||
+ public InetAddress getRawAddress() {
|
||||
+ return rawAddress;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Gets the hostname that the player used to connect to the server, or
|
||||
+ * blank if unknown
|
||||
|
@ -8,10 +8,10 @@ and allows full control of the response sent to the client.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96ec5b3b9dc
|
||||
index 0000000000000000000000000000000000000000..0bb6fdbdd05ae6a8fb413e0f6b8d84302d697267
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||
@@ -0,0 +1,334 @@
|
||||
@@ -0,0 +1,338 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import static java.util.Objects.requireNonNull;
|
||||
@ -30,6 +30,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+import java.util.NoSuchElementException;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -56,6 +57,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ private Object[] players;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ 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);
|
||||
@ -66,6 +68,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ setServerIcon(favicon);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
|
||||
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
|
||||
+ super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
|
||||
@ -103,9 +106,9 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of players displayed in the server list.
|
||||
+ *
|
||||
+ * <p>Note that this won't have any effect if {@link #shouldHidePlayers()}
|
||||
+ * is enabled.</p>
|
||||
+ * <p>
|
||||
+ * Note that this won't have any effect if {@link #shouldHidePlayers()}
|
||||
+ * is enabled.
|
||||
+ *
|
||||
+ * @param numPlayers The number of online players
|
||||
+ */
|
||||
@ -118,9 +121,9 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Returns {@code -1} if players are hidden using
|
||||
+ * {@link #shouldHidePlayers()}.</p>
|
||||
+ * <p>
|
||||
+ * Returns {@code -1} if players are hidden using
|
||||
+ * {@link #shouldHidePlayers()}.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public int getMaxPlayers() {
|
||||
@ -135,23 +138,23 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
|
||||
+ * when this option is enabled.</p>
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+ return this.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.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
|
||||
+ * when this option is enabled.</p>
|
||||
+ * <p>
|
||||
+ * 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
|
||||
+ */
|
||||
@ -162,9 +165,9 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ /**
|
||||
+ * Returns a mutable list of {@link PlayerProfile} that will be displayed
|
||||
+ * as online players on the client.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display them when hovering the
|
||||
+ * player count with the mouse.</p>
|
||||
+ * <p>
|
||||
+ * The Vanilla Minecraft client will display them when hovering the
|
||||
+ * player count with the mouse.
|
||||
+ *
|
||||
+ * @return The mutable player sample list
|
||||
+ */
|
||||
@ -180,7 +183,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getVersion() {
|
||||
+ return version;
|
||||
+ return this.version;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -200,7 +203,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ * has not finished initialization yet
|
||||
+ */
|
||||
+ public int getProtocolVersion() {
|
||||
+ return protocolVersion;
|
||||
+ return this.protocolVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -240,9 +243,9 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.</p>
|
||||
+ * <p>
|
||||
+ * Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
@ -251,9 +254,9 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.</p>
|
||||
+ * <p>
|
||||
+ * Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
@ -262,10 +265,10 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p><b>Note:</b> For compatibility reasons, this method will return all
|
||||
+ * <p>
|
||||
+ * <b>Note:</b> For compatibility reasons, this method will return all
|
||||
+ * online players, not just the ones referenced in {@link #getPlayerSample()}.
|
||||
+ * Removing a player will:</p>
|
||||
+ * Removing a player will:
|
||||
+ *
|
||||
+ * <ul>
|
||||
+ * <li>Decrement the online player count (if and only if) the player
|
||||
@ -294,6 +297,7 @@ index 0000000000000000000000000000000000000000..e886ac04c0c14ae5dfb87212e262b96e
|
||||
+ return (Player) player;
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ private final class PlayerIterator implements Iterator<Player> {
|
||||
+
|
||||
+ private int next;
|
||||
|
@ -9,23 +9,27 @@ You may cancel this, enabling ranged attacks to damage the enderman for example.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..806112a8b5a7ce31166675f5b074ceaf42e364b6
|
||||
index 0000000000000000000000000000000000000000..f6be848c44d5efaca3fbc03c3be7451411943c24
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
|
||||
+ @NotNull private final Reason reason;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Reason reason;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EndermanEscapeEvent(@NotNull Enderman entity, @NotNull Reason reason) {
|
||||
+ super(entity);
|
||||
+ this.reason = reason;
|
||||
@ -42,39 +46,34 @@ index 0000000000000000000000000000000000000000..806112a8b5a7ce31166675f5b074ceaf
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Reason getReason() {
|
||||
+ return reason;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancels the escape.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Reason {
|
||||
@ -95,7 +94,7 @@ index 0000000000000000000000000000000000000000..806112a8b5a7ce31166675f5b074ceaf
|
||||
+ */
|
||||
+ STARE,
|
||||
+ /**
|
||||
+ * Specific case for CRITICAL_HIT where the enderman is taking rain damage
|
||||
+ * Specific case for {@link #CRITICAL_HIT} where the enderman is taking rain damage
|
||||
+ */
|
||||
+ DROWN
|
||||
+ }
|
||||
|
@ -9,7 +9,7 @@ This allows you to override/extend the pumpkin/stare logic.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f530a3d9314e17d1da896cac633f6a422258d9a9
|
||||
index 0000000000000000000000000000000000000000..ae34e679723a2ef436da04c116038272743a8f35
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
|
||||
@@ -0,0 +1,101 @@
|
||||
@ -39,23 +39,27 @@ index 0000000000000000000000000000000000000000..f530a3d9314e17d1da896cac633f6a42
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Enderman determines if it should attack a player or not.
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Player player;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) {
|
||||
+ super(entity);
|
||||
+ this.player = player;
|
||||
@ -79,38 +83,34 @@ index 0000000000000000000000000000000000000000..f530a3d9314e17d1da896cac633f6a42
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <br>
|
||||
+ * 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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,10 +7,10 @@ Fires when a witch consumes the potion in their hand
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fbbace36d69373046a7f3618ed5c1c1318b489b9
|
||||
index 0000000000000000000000000000000000000000..773079aa92280bb97e9b4c0e62d9ead08135610a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,73 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Witch;
|
||||
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..fbbace36d69373046a7f3618ed5c1c13
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -25,8 +26,13 @@ index 0000000000000000000000000000000000000000..fbbace36d69373046a7f3618ed5c1c13
|
||||
+ * Fired when a witch consumes the potion in their hand to buff themselves.
|
||||
+ */
|
||||
+public class WitchConsumePotionEvent extends EntityEvent implements Cancellable {
|
||||
+ @Nullable private ItemStack potion;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchConsumePotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.potion = potion;
|
||||
@ -43,80 +49,38 @@ index 0000000000000000000000000000000000000000..fbbace36d69373046a7f3618ed5c1c13
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ return potion;
|
||||
+ return this.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
|
||||
+ * @return Event was cancelled or potion was {@code null}
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled || potion == null;
|
||||
+ return this.cancelled || this.potion == null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6ef6367b67261c2b653a97322b9703a9409b3499
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+public class WitchThrowPotionEvent extends Event implements Cancellable {
|
||||
+ public WitchThrowPotionEvent() {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,37 +6,41 @@ Subject: [PATCH] WitchThrowPotionEvent
|
||||
Fired when a witch throws a potion at a player
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
|
||||
index 6ef6367b67261c2b653a97322b9703a9409b3499..688a596aa2b925651a92bf092e1ef4d77a47258c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f621ea043a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
|
||||
@@ -1,29 +1,77 @@
|
||||
package com.destroystokyo.paper.event.entity;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
+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.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
|
||||
-public class WitchThrowPotionEvent extends Event implements Cancellable {
|
||||
- public WitchThrowPotionEvent() {
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a witch throws a potion at a player
|
||||
+ */
|
||||
+public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final LivingEntity target;
|
||||
+ @Nullable private ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchThrowPotionEvent(@NotNull Witch witch, @NotNull LivingEntity target, @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.target = target;
|
||||
+ this.potion = potion;
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Witch getEntity() {
|
||||
@ -48,7 +52,7 @@ index 6ef6367b67261c2b653a97322b9703a9409b3499..688a596aa2b925651a92bf092e1ef4d7
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getTarget() {
|
||||
+ return target;
|
||||
+ return this.target;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -56,38 +60,39 @@ index 6ef6367b67261c2b653a97322b9703a9409b3499..688a596aa2b925651a92bf092e1ef4d7
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ return potion;
|
||||
+ return this.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
|
||||
+ * @return Event was cancelled or potion was {@code null}
|
||||
+ */
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
- return cancelled;
|
||||
+ return cancelled || potion == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled || this.potion == null;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ }
|
||||
+}
|
||||
|
@ -7,44 +7,34 @@ Control what potion the witch readies to use
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..57f93af14acc6346c5a343e05fe8f5d44d6adbc6
|
||||
index 0000000000000000000000000000000000000000..7feca06e72bd585bbfa219df38a2161b77e8d4c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
@@ -0,0 +1,68 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public class WitchReadyPotionEvent extends EntityEvent implements Cancellable {
|
||||
+ private ItemStack potion;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchReadyPotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.potion = potion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Fires the 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() {
|
||||
@ -56,38 +46,36 @@ index 0000000000000000000000000000000000000000..57f93af14acc6346c5a343e05fe8f5d4
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ return potion;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Add EntityTeleportEndGatewayEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bfc69a43c291fbed91b9d0387e4ef18b0ed1b9de
|
||||
index 0000000000000000000000000000000000000000..88b9c059f9d66877260c66496443ad0aefaf8f47
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
@@ -0,0 +1,31 @@
|
||||
@@ -0,0 +1,33 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -25,8 +26,9 @@ index 0000000000000000000000000000000000000000..bfc69a43c291fbed91b9d0387e4ef18b
|
||||
+
|
||||
+ @NotNull private final EndGateway gateway;
|
||||
+
|
||||
+ public EntityTeleportEndGatewayEvent(@NotNull Entity what, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
|
||||
+ super(what, from, to);
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityTeleportEndGatewayEvent(@NotNull Entity entity, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
|
||||
+ super(entity, from, to);
|
||||
+ this.gateway = gateway;
|
||||
+ }
|
||||
+
|
||||
@ -37,7 +39,7 @@ index 0000000000000000000000000000000000000000..bfc69a43c291fbed91b9d0387e4ef18b
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EndGateway getGateway() {
|
||||
+ return gateway;
|
||||
+ return this.gateway;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
|
@ -8,10 +8,10 @@ Plugins can skip selection of certain arrows and control which is used.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5d04a22fd6964d8d44a2aa069c9629722893b1f4
|
||||
index 0000000000000000000000000000000000000000..f30c4c372c92a79fb6c3fe80c4b51b5c8c0d4d3b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
|
||||
@@ -0,0 +1,93 @@
|
||||
@@ -0,0 +1,94 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
|
||||
+ *
|
||||
@ -39,7 +39,6 @@ index 0000000000000000000000000000000000000000..5d04a22fd6964d8d44a2aa069c962972
|
||||
+
|
||||
+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;
|
||||
@ -49,9 +48,14 @@ index 0000000000000000000000000000000000000000..5d04a22fd6964d8d44a2aa069c962972
|
||||
+ * Called when a player is firing a bow and the server is choosing an arrow to use.
|
||||
+ */
|
||||
+public class PlayerReadyArrowEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ItemStack bow;
|
||||
+ @NotNull private final ItemStack arrow;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerReadyArrowEvent(@NotNull Player player, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
|
||||
+ super(player);
|
||||
+ this.bow = bow;
|
||||
@ -63,7 +67,7 @@ index 0000000000000000000000000000000000000000..5d04a22fd6964d8d44a2aa069c962972
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getBow() {
|
||||
+ return bow;
|
||||
+ return this.bow;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -71,37 +75,34 @@ index 0000000000000000000000000000000000000000..5d04a22fd6964d8d44a2aa069c962972
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getArrow() {
|
||||
+ return arrow;
|
||||
+ return this.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.
|
||||
+ * {@inheritDoc}
|
||||
+ * <br>
|
||||
+ * Whether 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;
|
||||
+ return this.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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -8,26 +8,28 @@ Co-authored-by: aerulion <aerulion@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..42fdf7a5bfab99a61ff2fbf562f2872ac360bef2
|
||||
index 0000000000000000000000000000000000000000..e0ba692c9b107f2b042a9c06549185e1c4777e27
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,48 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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 EntityPushedByEntityAttackEvent {
|
||||
+
|
||||
+ private final float knockbackStrength;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackByEntityEvent(@NotNull LivingEntity entity, @NotNull Entity hitBy, float knockbackStrength, @NotNull Vector acceleration) {
|
||||
+ super(entity, hitBy, acceleration);
|
||||
+ this.knockbackStrength = knockbackStrength;
|
||||
@ -46,7 +48,7 @@ index 0000000000000000000000000000000000000000..42fdf7a5bfab99a61ff2fbf562f2872a
|
||||
+ * @return the original knockback strength.
|
||||
+ */
|
||||
+ public float getKnockbackStrength() {
|
||||
+ return knockbackStrength;
|
||||
+ return this.knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -60,10 +62,10 @@ index 0000000000000000000000000000000000000000..42fdf7a5bfab99a61ff2fbf562f2872a
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c15401cd206eb9e1a7a8b7154aba0247e2da1e19
|
||||
index 0000000000000000000000000000000000000000..70d6e72d4dc0c040c8bccf7acc383e84db472514
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,74 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@ -71,6 +73,7 @@ index 0000000000000000000000000000000000000000..c15401cd206eb9e1a7a8b7154aba0247
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -82,38 +85,20 @@ index 0000000000000000000000000000000000000000..c15401cd206eb9e1a7a8b7154aba0247
|
||||
+ */
|
||||
+public class EntityPushedByEntityAttackEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final @NotNull Entity pushedBy;
|
||||
+ private final @NotNull Vector acceleration;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPushedByEntityAttackEvent(@NotNull Entity entity, @NotNull Entity pushedBy, @NotNull Vector acceleration) {
|
||||
+ super(entity);
|
||||
+ this.pushedBy = pushedBy;
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity which pushed the affected entity.
|
||||
+ *
|
||||
@ -121,7 +106,7 @@ index 0000000000000000000000000000000000000000..c15401cd206eb9e1a7a8b7154aba0247
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getPushedBy() {
|
||||
+ return pushedBy;
|
||||
+ return this.pushedBy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -131,6 +116,27 @@ index 0000000000000000000000000000000000000000..c15401cd206eb9e1a7a8b7154aba0247
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Vector getAcceleration() {
|
||||
+ return acceleration;
|
||||
+ return this.acceleration;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.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;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] EnderDragon Events
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..615bc4c973ff371d87f996e981207fc15b70275b
|
||||
index 0000000000000000000000000000000000000000..bf5f82c8ba36bd245e1536fd4f654487aa8f6e21
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,79 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.AreaEffectCloud;
|
||||
@ -27,11 +27,12 @@ index 0000000000000000000000000000000000000000..615bc4c973ff371d87f996e981207fc1
|
||||
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
||||
+ */
|
||||
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Collection<LivingEntity> targets;
|
||||
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
||||
+ private boolean cancelled = false;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @NotNull Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
|
||||
@ -56,7 +57,7 @@ index 0000000000000000000000000000000000000000..615bc4c973ff371d87f996e981207fc1
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getTargets() {
|
||||
+ return targets;
|
||||
+ return this.targets;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -64,20 +65,21 @@ index 0000000000000000000000000000000000000000..615bc4c973ff371d87f996e981207fc1
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public AreaEffectCloud getAreaEffectCloud() {
|
||||
+ return areaEffectCloud;
|
||||
+ return this.areaEffectCloud;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
@ -89,10 +91,10 @@ index 0000000000000000000000000000000000000000..615bc4c973ff371d87f996e981207fc1
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1915177f4b8f8013656fbdb41240f6c5c88f95d7
|
||||
index 0000000000000000000000000000000000000000..4a61878152c95a07160f4216e78b042ca45d24b3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
@@ -0,0 +1,63 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.AreaEffectCloud;
|
||||
@ -100,14 +102,20 @@ index 0000000000000000000000000000000000000000..1915177f4b8f8013656fbdb41240f6c5
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
|
||||
+ super(enderDragon);
|
||||
+ this.areaEffectCloud = areaEffectCloud;
|
||||
@ -127,39 +135,35 @@ index 0000000000000000000000000000000000000000..1915177f4b8f8013656fbdb41240f6c5
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public AreaEffectCloud getAreaEffectCloud() {
|
||||
+ return areaEffectCloud;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8414bd805ec68d7b305fbf645c59f8d5b762c9ce
|
||||
index 0000000000000000000000000000000000000000..3c6c3db37d91aad3638aef107a3bf8ca1d4f7085
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.DragonFireball;
|
||||
@ -167,14 +171,20 @@ index 0000000000000000000000000000000000000000..8414bd805ec68d7b305fbf645c59f8d5
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an EnderDragon shoots a fireball
|
||||
+ */
|
||||
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
||||
+ @NotNull private final DragonFireball fireball;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final DragonFireball fireball;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
|
||||
+ super(entity);
|
||||
+ this.fireball = fireball;
|
||||
@ -194,30 +204,27 @@ index 0000000000000000000000000000000000000000..8414bd805ec68d7b305fbf645c59f8d5
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonFireball getFireball() {
|
||||
+ return fireball;
|
||||
+ return this.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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] PlayerElytraBoostEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e9a76a25fa5445905a09dbc2fd5b35bff56d80b3
|
||||
index 0000000000000000000000000000000000000000..42375d44ed0db457b96165414e9b45a557bac1ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerElytraBoostEvent.java
|
||||
@@ -0,0 +1,85 @@
|
||||
@@ -0,0 +1,90 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Firework;
|
||||
@ -18,18 +18,23 @@ index 0000000000000000000000000000000000000000..e9a76a25fa5445905a09dbc2fd5b35bf
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ItemStack itemStack;
|
||||
+ @NotNull private Firework firework;
|
||||
+ @NotNull private final Firework firework;
|
||||
+ private boolean consume = true;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerElytraBoostEvent(@NotNull Player player, @NotNull ItemStack itemStack, @NotNull Firework firework) {
|
||||
+ super(player);
|
||||
+ this.itemStack = itemStack;
|
||||
@ -43,7 +48,7 @@ index 0000000000000000000000000000000000000000..e9a76a25fa5445905a09dbc2fd5b35bf
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -53,45 +58,45 @@ index 0000000000000000000000000000000000000000..e9a76a25fa5445905a09dbc2fd5b35bf
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Firework getFirework() {
|
||||
+ return firework;
|
||||
+ return this.firework;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get whether to consume the firework or not
|
||||
+ *
|
||||
+ * @return True to consume
|
||||
+ * @return {@code true} to consume
|
||||
+ */
|
||||
+ public boolean shouldConsume() {
|
||||
+ return consume;
|
||||
+ return this.consume;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether to consume the firework or not
|
||||
+ *
|
||||
+ * @param consume True to consume
|
||||
+ * @param consume {@code 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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,34 +6,40 @@ Subject: [PATCH] PlayerLaunchProjectileEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5450575459f2d95be93db5a8c6d4d88c69deb2ec
|
||||
index 0000000000000000000000000000000000000000..efd947eb0aa0633891d9c6a8bde66d33e29020d7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLaunchProjectileEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
@@ -0,0 +1,95 @@
|
||||
+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.entity.EntityShootBowEvent;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player shoots a projectile.
|
||||
+ * <p>
|
||||
+ * Notably this event is not called for arrows as the player does not launch them, rather shoots them with the help
|
||||
+ * of a bow or crossbow. A plugin may listen to {@link org.bukkit.event.entity.EntityShootBowEvent} for these actions
|
||||
+ * instead.
|
||||
+ * of a bow or crossbow. A plugin may listen to {@link EntityShootBowEvent}
|
||||
+ * for these actions instead.
|
||||
+ */
|
||||
+public class PlayerLaunchProjectileEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Projectile projectile;
|
||||
+ @NotNull private final ItemStack itemStack;
|
||||
+ private boolean consumeItem = true;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerLaunchProjectileEvent(@NotNull Player shooter, @NotNull ItemStack itemStack, @NotNull Projectile projectile) {
|
||||
+ super(shooter);
|
||||
+ this.itemStack = itemStack;
|
||||
@ -47,7 +53,7 @@ index 0000000000000000000000000000000000000000..5450575459f2d95be93db5a8c6d4d88c
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Projectile getProjectile() {
|
||||
+ return projectile;
|
||||
+ return this.projectile;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -57,43 +63,45 @@ index 0000000000000000000000000000000000000000..5450575459f2d95be93db5a8c6d4d88c
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get whether to consume the ItemStack or not
|
||||
+ *
|
||||
+ * @return True to consume
|
||||
+ * @return {@code true} to consume
|
||||
+ */
|
||||
+ public boolean shouldConsume() {
|
||||
+ return consumeItem;
|
||||
+ return this.consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether to consume the ItemStack or not
|
||||
+ *
|
||||
+ * @param consumeItem True to consume
|
||||
+ * @param consumeItem {@code true} to consume
|
||||
+ */
|
||||
+ public void setShouldConsume(boolean consumeItem) {
|
||||
+ this.consumeItem = consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,34 +6,38 @@ Subject: [PATCH] EntityTransformedEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c6802ca6acad1b841c01284eef0a601774486f55
|
||||
index 0000000000000000000000000000000000000000..9ce2638aeec5745f1a2b88e1cc125f57f8c8debe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
||||
@@ -0,0 +1,93 @@
|
||||
@@ -0,0 +1,95 @@
|
||||
+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;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an entity transforms into another entity
|
||||
+ * <p>
|
||||
+ * If the event is cancelled, the entity will not transform
|
||||
+ * @deprecated Bukkit has added {@link EntityTransformEvent}, you should start using that
|
||||
+ *
|
||||
+ * @deprecated Bukkit has added {@link org.bukkit.event.entity.EntityTransformEvent}, you should start using that
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class EntityTransformedEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Entity transformed;
|
||||
+ private final TransformedReason reason;
|
||||
+
|
||||
+ public EntityTransformedEvent(Entity entity, Entity transformed, TransformedReason reason) {
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityTransformedEvent(@NotNull Entity entity, @NotNull Entity transformed, @NotNull TransformedReason reason) {
|
||||
+ super(entity);
|
||||
+ this.transformed = transformed;
|
||||
+ this.reason = reason;
|
||||
@ -43,40 +47,39 @@ index 0000000000000000000000000000000000000000..c6802ca6acad1b841c01284eef0a6017
|
||||
+ * The entity after it has transformed
|
||||
+ *
|
||||
+ * @return Transformed entity
|
||||
+ * @deprecated see {@link EntityTransformEvent#getTransformedEntity()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ public Entity getTransformed() {
|
||||
+ return transformed;
|
||||
+ return this.transformed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The reason for the transformation
|
||||
+ * @deprecated see {@link EntityTransformEvent#getTransformReason()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ public TransformedReason getReason() {
|
||||
+ return reason;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers(){
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList(){
|
||||
+ return handlers;
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled(){
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel){
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers(){
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList(){
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum TransformedReason {
|
||||
@ -97,9 +100,8 @@ index 0000000000000000000000000000000000000000..c6802ca6acad1b841c01284eef0a6017
|
||||
+ */
|
||||
+ SHEARED,
|
||||
+ /**
|
||||
+ * When a pig turns to a zombiepigman
|
||||
+ * When a pig turns to a zombified piglin
|
||||
+ */
|
||||
+ LIGHTNING
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] SkeletonHorse Additions
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9ce2948dfaa56d0adf53fe9b6117a90d7773b771
|
||||
index 0000000000000000000000000000000000000000..f6724e6e5754996ac10888aaa92baf2dcc6134d3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||
@@ -0,0 +1,62 @@
|
||||
@@ -0,0 +1,68 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..9ce2948dfaa56d0adf53fe9b6117a90d
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
@ -26,14 +27,19 @@ index 0000000000000000000000000000000000000000..9ce2948dfaa56d0adf53fe9b6117a90d
|
||||
+ * 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;
|
||||
+ private final List<HumanEntity> eligibleHumans;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final List<HumanEntity> eligibleHumans;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
|
||||
+ this(horse, ImmutableList.of());
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse, @NotNull List<HumanEntity> eligibleHumans) {
|
||||
+ super(horse);
|
||||
+ this.eligibleHumans = eligibleHumans;
|
||||
@ -45,9 +51,14 @@ index 0000000000000000000000000000000000000000..9ce2948dfaa56d0adf53fe9b6117a90d
|
||||
+ return (SkeletonHorse) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public List<HumanEntity> getEligibleHumans() {
|
||||
+ return this.eligibleHumans;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -56,19 +67,14 @@ index 0000000000000000000000000000000000000000..9ce2948dfaa56d0adf53fe9b6117a90d
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public List<HumanEntity> getEligibleHumans() {
|
||||
+ return eligibleHumans;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] AnvilDamageEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0cdc69fe2
|
||||
index 0000000000000000000000000000000000000000..4f88c101d81e5c3a8a065260304d5816337666d7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
@@ -0,0 +1,151 @@
|
||||
@@ -0,0 +1,154 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
@ -27,10 +27,11 @@ index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0
|
||||
+ * Called when an anvil is damaged from being used
|
||||
+ */
|
||||
+public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancel;
|
||||
+ private DamageState damageState;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @Nullable BlockData blockData) {
|
||||
@ -51,7 +52,7 @@ index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DamageState getDamageState() {
|
||||
+ return damageState;
|
||||
+ return this.damageState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -66,31 +67,33 @@ index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0
|
||||
+ /**
|
||||
+ * Gets if anvil is breaking on this use
|
||||
+ *
|
||||
+ * @return True if breaking
|
||||
+ * @return {@code true} if breaking
|
||||
+ */
|
||||
+ public boolean isBreaking() {
|
||||
+ return damageState == DamageState.BROKEN;
|
||||
+ return this.damageState == DamageState.BROKEN;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if anvil is breaking on this use
|
||||
+ *
|
||||
+ * @param breaking True if breaking
|
||||
+ * @param breaking {@code true} if breaking
|
||||
+ */
|
||||
+ public void setBreaking(boolean breaking) {
|
||||
+ if (breaking) {
|
||||
+ damageState = DamageState.BROKEN;
|
||||
+ } else if (damageState == DamageState.BROKEN) {
|
||||
+ damageState = DamageState.DAMAGED;
|
||||
+ this.damageState = DamageState.BROKEN;
|
||||
+ } else if (this.damageState == DamageState.BROKEN) {
|
||||
+ this.damageState = DamageState.DAMAGED;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
@ -125,7 +128,7 @@ index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getMaterial() {
|
||||
+ return material;
|
||||
+ return this.material;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -153,7 +156,7 @@ index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0
|
||||
+ return BROKEN;
|
||||
+ }
|
||||
+ for (DamageState state : values()) {
|
||||
+ if (state.material == material) {
|
||||
+ if (state.getMaterial() == material) {
|
||||
+ return state;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -6,24 +6,29 @@ Subject: [PATCH] Add TNTPrimeEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0b2ec47da
|
||||
index 0000000000000000000000000000000000000000..d8de7332b63feb16c855bf7ea1986fd229489c7c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
@@ -0,0 +1,116 @@
|
||||
@@ -0,0 +1,125 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.TNTPrimed;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when TNT block is about to turn into {@link org.bukkit.entity.TNTPrimed}
|
||||
+ * Called when TNT block is about to turn into {@link TNTPrimed}
|
||||
+ * <p>
|
||||
+ * Cancelling it won't turn TNT into {@link org.bukkit.entity.TNTPrimed} and leaves
|
||||
+ * Cancelling it won't turn TNT into {@link TNTPrimed} and leaves
|
||||
+ * the TNT block as-is
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
@ -31,11 +36,15 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PrimeReason reason;
|
||||
+ @Nullable private final Entity primerEntity;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
|
||||
+ super(theBlock);
|
||||
+ this.reason = reason;
|
||||
@ -54,10 +63,10 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
|
||||
+
|
||||
+ /**
|
||||
+ * 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}
|
||||
+ * <p>
|
||||
+ * It's {@code null} if {@link #getReason()} is {@link PrimeReason#REDSTONE} or {@link PrimeReason#FIRE}.
|
||||
+ * It's not {@code null} if {@link #getReason()} is {@link PrimeReason#ITEM} or {@link PrimeReason#PROJECTILE}
|
||||
+ * It might be {@code null} if {@link #getReason()} is {@link PrimeReason#EXPLOSION}
|
||||
+ *
|
||||
+ * @return The {@link Entity} who primed the TNT
|
||||
+ */
|
||||
@ -67,9 +76,9 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ * Gets whether spawning {@link TNTPrimed} should be cancelled or not
|
||||
+ *
|
||||
+ * @return Whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ * @return Whether spawning {@link TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
@ -77,24 +86,24 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether to cancel spawning {@link org.bukkit.entity.TNTPrimed} or not
|
||||
+ * Sets whether to cancel spawning {@link TNTPrimed} or not
|
||||
+ *
|
||||
+ * @param cancel whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ * @param cancel whether spawning {@link TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum PrimeReason {
|
||||
@ -109,14 +118,14 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
|
||||
+ 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
|
||||
+ * When {@link Player} used {@link Material#FLINT_AND_STEEL} or
|
||||
+ * {@link 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
|
||||
+ * using a bow with {@link Enchantment#ARROW_FIRE} enchantment
|
||||
+ */
|
||||
+ PROJECTILE,
|
||||
+
|
||||
|
@ -6,14 +6,14 @@ Subject: [PATCH] Slime Pathfinder Events
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..473fbded8ab534308f2c0bd0b87512fcce5c9e58
|
||||
index 0000000000000000000000000000000000000000..30864539574e23bbe9e4c5dc73ad6614de782ac2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
|
||||
@@ -0,0 +1,38 @@
|
||||
@@ -0,0 +1,40 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -22,9 +22,11 @@ index 0000000000000000000000000000000000000000..473fbded8ab534308f2c0bd0b87512fc
|
||||
+ * 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 {
|
||||
+public class SlimeChangeDirectionEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ private float yaw;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) {
|
||||
+ super(slime);
|
||||
+ this.yaw = yaw;
|
||||
@ -36,7 +38,7 @@ index 0000000000000000000000000000000000000000..473fbded8ab534308f2c0bd0b87512fc
|
||||
+ * @return Chosen yaw
|
||||
+ */
|
||||
+ public float getNewYaw() {
|
||||
+ return yaw;
|
||||
+ return this.yaw;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -50,16 +52,17 @@ index 0000000000000000000000000000000000000000..473fbded8ab534308f2c0bd0b87512fc
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..14b67da109321ae6521eab2ac6f6945f05d02db5
|
||||
index 0000000000000000000000000000000000000000..706ed85a5415d688aaa5f138cbf583b9e2bab27d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
|
||||
@@ -0,0 +1,53 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -69,6 +72,12 @@ index 0000000000000000000000000000000000000000..14b67da109321ae6521eab2ac6f6945f
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+public class SlimePathfindEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimePathfindEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
@ -80,43 +89,39 @@ index 0000000000000000000000000000000000000000..14b67da109321ae6521eab2ac6f6945f
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Slime getEntity() {
|
||||
+ return (Slime) entity;
|
||||
+ return (Slime) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c8dd49d11da5a90a1bac965a75f2b65fd825f3f7
|
||||
index 0000000000000000000000000000000000000000..65e8a29751e338b0f0acda7bef9e014852a73e6e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -125,22 +130,24 @@ index 0000000000000000000000000000000000000000..c8dd49d11da5a90a1bac965a75f2b65f
|
||||
+ * 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 class SlimeSwimEvent extends SlimeWanderEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeSwimEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e9ba32799ed838779e49cd4c5011b7515b3363cb
|
||||
index 0000000000000000000000000000000000000000..87c64b04dfec232e98361c3ec29da7664498c65b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
|
||||
@@ -0,0 +1,31 @@
|
||||
@@ -0,0 +1,33 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -149,9 +156,11 @@ index 0000000000000000000000000000000000000000..e9ba32799ed838779e49cd4c5011b751
|
||||
+ * 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 {
|
||||
+public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ @NotNull private final LivingEntity target;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) {
|
||||
+ super(slime);
|
||||
+ this.target = target;
|
||||
@ -164,19 +173,19 @@ index 0000000000000000000000000000000000000000..e9ba32799ed838779e49cd4c5011b751
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getTarget() {
|
||||
+ return target;
|
||||
+ return this.target;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4683a7237d2ed527fc85b9b4e5b2eaaf5ae3d797
|
||||
index 0000000000000000000000000000000000000000..2ad9cc1673ffbb8b48349e461d1154d1d4ec2874
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -185,7 +194,9 @@ index 0000000000000000000000000000000000000000..4683a7237d2ed527fc85b9b4e5b2eaaf
|
||||
+ * 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 class SlimeWanderEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeWanderEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PhantomPreSpawnEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d8f3f1c354331bc5e6fc1d9aa013476baf2daf05
|
||||
index 0000000000000000000000000000000000000000..ff7d9ff618ab821eeece6923a694a9a4eea8585d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
@@ -0,0 +1,33 @@
|
||||
@@ -0,0 +1,32 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -18,13 +18,12 @@ index 0000000000000000000000000000000000000000..d8f3f1c354331bc5e6fc1d9aa013476b
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
@ -36,11 +35,11 @@ index 0000000000000000000000000000000000000000..d8f3f1c354331bc5e6fc1d9aa013476b
|
||||
+ /**
|
||||
+ * Get the entity this phantom is spawning for
|
||||
+ *
|
||||
+ * @return Entity
|
||||
+ * @return the Entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getSpawningEntity() {
|
||||
+ return entity;
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Add More Creeper API
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e9768c919a1860881802ab68eff559874590ac1c
|
||||
index 0000000000000000000000000000000000000000..e86500337f26fcb6bb04545c68c67df32021ce25
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
@@ -0,0 +1,56 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -24,10 +25,13 @@ index 0000000000000000000000000000000000000000..e9768c919a1860881802ab68eff55987
|
||||
+ * {@link Creeper#setIgnited(boolean)}.
|
||||
+ */
|
||||
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+ private boolean ignited;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean ignited;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
|
||||
+ super(creeper);
|
||||
+ this.ignited = ignited;
|
||||
@ -36,11 +40,11 @@ index 0000000000000000000000000000000000000000..e9768c919a1860881802ab68eff55987
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Creeper getEntity() {
|
||||
+ return (Creeper) entity;
|
||||
+ return (Creeper) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ public boolean isIgnited() {
|
||||
+ return ignited;
|
||||
+ return this.ignited;
|
||||
+ }
|
||||
+
|
||||
+ public void setIgnited(boolean ignited) {
|
||||
@ -48,22 +52,22 @@ index 0000000000000000000000000000000000000000..e9768c919a1860881802ab68eff55987
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
|
||||
|
@ -12,36 +12,36 @@ Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..48cff063594840a07aeaf35513780e28ea019a76
|
||||
index 0000000000000000000000000000000000000000..9a450a0095ed0aa9c92655c2f4e5732bccdd59c9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
|
||||
@@ -0,0 +1,29 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called before an entity is spawned into a world by a spawner.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ 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");
|
||||
+ this.spawnerLocation = spawnerLocation;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Location getSpawnerLocation() {
|
||||
+ return spawnerLocation;
|
||||
+ return this.spawnerLocation;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,25 +6,29 @@ Subject: [PATCH] Turtle API
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b3795883233
|
||||
index 0000000000000000000000000000000000000000..cfbc8aaf862ac90e794ee38bf8a6cb9ea414b13e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
||||
@@ -0,0 +1,49 @@
|
||||
@@ -0,0 +1,53 @@
|
||||
+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.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleGoHomeEvent(@NotNull Turtle turtle) {
|
||||
+ super(turtle);
|
||||
+ }
|
||||
@ -36,35 +40,35 @@ index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b37
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf884837b8b
|
||||
index 0000000000000000000000000000000000000000..e917e64e8ea266a3fc7387c42aad95927f0f0501
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
@@ -0,0 +1,92 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -72,18 +76,23 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Location location;
|
||||
+ private int eggCount;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
@ -97,7 +106,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -107,7 +116,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -116,7 +125,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+ * @return Number of eggs
|
||||
+ */
|
||||
+ public int getEggCount() {
|
||||
+ return eggCount;
|
||||
+ return this.eggCount;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -126,7 +135,7 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+ */
|
||||
+ public void setEggCount(int eggCount) {
|
||||
+ if (eggCount < 1) {
|
||||
+ cancelled = true;
|
||||
+ this.cancelled = true;
|
||||
+ return;
|
||||
+ }
|
||||
+ this.eggCount = Math.min(eggCount, 4);
|
||||
@ -134,30 +143,30 @@ index 0000000000000000000000000000000000000000..bcc8dba50e3a3df0206c4827bb468bf8
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688bd97cf78
|
||||
index 0000000000000000000000000000000000000000..5cdc6b0c3db43279e2bb8043922b31f750ddb3f5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
@@ -0,0 +1,62 @@
|
||||
@@ -0,0 +1,66 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -165,16 +174,20 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+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;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
@ -187,7 +200,7 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -197,27 +210,27 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java
|
||||
|
@ -8,10 +8,10 @@ Subject: [PATCH] Add spectator target events
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a01f47e16
|
||||
index 0000000000000000000000000000000000000000..a70a64d2273414d95d77e601a41a208cce78e345
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
||||
@@ -0,0 +1,67 @@
|
||||
@@ -0,0 +1,71 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -26,11 +27,14 @@ index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a
|
||||
+ */
|
||||
+public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Entity currentSpectatorTarget;
|
||||
+ @NotNull private final Entity newSpectatorTarget;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) {
|
||||
+ super(player);
|
||||
+ this.currentSpectatorTarget = currentSpectatorTarget;
|
||||
@ -44,7 +48,7 @@ index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getCurrentSpectatorTarget() {
|
||||
+ return currentSpectatorTarget;
|
||||
+ return this.currentSpectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -54,12 +58,12 @@ index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getNewSpectatorTarget() {
|
||||
+ return newSpectatorTarget;
|
||||
+ return this.newSpectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -70,21 +74,21 @@ index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631715ec0ad
|
||||
index 0000000000000000000000000000000000000000..a6a5ebc534cc380740ba42790149c8b85f52aabb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
@@ -0,0 +1,57 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@ -92,6 +96,7 @@ index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -99,10 +104,12 @@ index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631
|
||||
+ */
|
||||
+public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private final Entity spectatorTarget;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Entity spectatorTarget;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) {
|
||||
+ super(player);
|
||||
+ this.spectatorTarget = spectatorTarget;
|
||||
@ -115,12 +122,12 @@ index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getSpectatorTarget() {
|
||||
+ return spectatorTarget;
|
||||
+ return this.spectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -131,11 +138,11 @@ index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -35,10 +35,10 @@ is undefined.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..12c1c6fe9dc8dc5f5faf6dcf99f6857219ef22b8
|
||||
index 0000000000000000000000000000000000000000..d0fb13adc140f1ca74d0c3448f92baa60684f3e2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
@@ -0,0 +1,95 @@
|
||||
@@ -0,0 +1,88 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
@ -46,6 +46,9 @@ index 0000000000000000000000000000000000000000..12c1c6fe9dc8dc5f5faf6dcf99f68572
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
+import org.bukkit.event.player.PlayerQuitEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -53,45 +56,35 @@ index 0000000000000000000000000000000000000000..12c1c6fe9dc8dc5f5faf6dcf99f68572
|
||||
+ * 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.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * {@link PlayerQuitEvent} is only invoked on players who have logged into the world.
|
||||
+ * <p>
|
||||
+ * 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.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * event is invoked AFTER {@link PlayerQuitEvent}, if the player has already logged into the world.
|
||||
+ * <p>
|
||||
+ * This event is guaranteed to never fire unless {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} has
|
||||
+ * This event is guaranteed to never fire unless {@link 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.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * {@link AsyncPlayerPreLoginEvent} for the same connection.
|
||||
+ * <p>
|
||||
+ * Cancelling the {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} guarantees the corresponding
|
||||
+ * Cancelling the {@link AsyncPlayerPreLoginEvent} guarantees the corresponding
|
||||
+ * {@code PlayerConnectionCloseEvent} is never called.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * The event may be invoked asynchronously or synchronously. Plugins should check
|
||||
+ * {@link Event#isAsynchronous()} and handle accordingly.
|
||||
+ * </p>
|
||||
+ */
|
||||
+public class PlayerConnectionCloseEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final UUID playerUniqueId;
|
||||
+ @NotNull private final String playerName;
|
||||
+ @NotNull private final InetAddress ipAddress;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
|
||||
+ super(async);
|
||||
+ this.playerUniqueId = playerUniqueId;
|
||||
@ -126,11 +119,11 @@ index 0000000000000000000000000000000000000000..12c1c6fe9dc8dc5f5faf6dcf99f68572
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -12,7 +12,7 @@ This can replace many uses of BlockPhysicsEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019bd21906e4
|
||||
index 0000000000000000000000000000000000000000..d0421a4cbcb672cc06b40ad41fc06a67f6d2dbbb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
|
||||
@@ -0,0 +1,123 @@
|
||||
@ -30,23 +30,22 @@ index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019b
|
||||
+ * 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".
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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",
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
|
||||
+ *
|
||||
+ */
|
||||
+public class BlockDestroyEvent extends BlockExpEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final BlockData newState;
|
||||
+ private boolean willDrop;
|
||||
+ private boolean playEffect = true;
|
||||
+ private BlockData effectBlock;
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) {
|
||||
@ -58,6 +57,7 @@ index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019b
|
||||
+
|
||||
+ /**
|
||||
+ * Get the effect that will be played when the block is broken.
|
||||
+ *
|
||||
+ * @return block break effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019b
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the effect that will be played when the block is broken.
|
||||
+ * Note: {@link BlockDestroyEvent#playEffect()} must be true in order for this effect to be
|
||||
+ * Note: {@link BlockDestroyEvent#playEffect()} must be {@code true} in order for this effect to be
|
||||
+ * played.
|
||||
+ *
|
||||
+ * @param effectBlock block effect
|
||||
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019b
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BlockData getNewState() {
|
||||
+ return newState;
|
||||
+ return this.newState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -117,25 +117,25 @@ index 0000000000000000000000000000000000000000..278f26bed374fe79ff3cd135a76f019b
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,14 +6,15 @@ Subject: [PATCH] Add WhitelistToggleEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fdd5eedb2b7401439912a3a4343a920f32edc860
|
||||
index 0000000000000000000000000000000000000000..22fa169c278639f31aec2695259963038de0af8a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,43 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -22,10 +23,12 @@ index 0000000000000000000000000000000000000000..fdd5eedb2b7401439912a3a4343a920f
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public class WhitelistToggleEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean enabled;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final boolean enabled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WhitelistToggleEvent(boolean enabled) {
|
||||
+ this.enabled = enabled;
|
||||
+ }
|
||||
@ -36,17 +39,17 @@ index 0000000000000000000000000000000000000000..fdd5eedb2b7401439912a3a4343a920f
|
||||
+ * @return Whether whitelist is going to be enabled or not
|
||||
+ */
|
||||
+ public boolean isEnabled() {
|
||||
+ return enabled;
|
||||
+ return this.enabled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,16 +6,18 @@ Subject: [PATCH] Add GS4 Query event
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda0f42df5b
|
||||
index 0000000000000000000000000000000000000000..8edc33bde29e967cec488d0f5e2f1097291978a6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
|
||||
@@ -0,0 +1,412 @@
|
||||
@@ -0,0 +1,424 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
@ -25,79 +27,76 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired if server is getting queried over GS4 Query protocol
|
||||
+ *
|
||||
+ * This event is fired if server is getting queried over GS4 Query protocol.
|
||||
+ * <br>
|
||||
+ * Adapted from Velocity's ProxyQueryEvent
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public final class GS4QueryEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final QueryType queryType;
|
||||
+ private final InetAddress querierAddress;
|
||||
+ private QueryResponse response;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ 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");
|
||||
+ this.queryType = queryType;
|
||||
+ this.querierAddress = querierAddress;
|
||||
+ this.response = response;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query type
|
||||
+ *
|
||||
+ * @return query type
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public QueryType getQueryType() {
|
||||
+ return queryType;
|
||||
+ return this.queryType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get querier address
|
||||
+ *
|
||||
+ * @return querier address
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public InetAddress getQuerierAddress() {
|
||||
+ return querierAddress;
|
||||
+ return this.querierAddress;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query response
|
||||
+ *
|
||||
+ * @return query response
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public QueryResponse getResponse() {
|
||||
+ return response;
|
||||
+ return this.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;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -114,10 +113,10 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ * 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;
|
||||
@ -143,95 +142,105 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get motd which will be used to reply to the query. By default it is {@link org.bukkit.Server#getMotd()}.
|
||||
+ * Get motd which will be used to reply to the query. By default it is {@link Server#getMotd()}.
|
||||
+ *
|
||||
+ * @return motd
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getMotd() {
|
||||
+ return motd;
|
||||
+ return this.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;
|
||||
+ return this.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;
|
||||
+ return this.map;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get current online player count which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return online player count
|
||||
+ */
|
||||
+ public int getCurrentPlayers() {
|
||||
+ return currentPlayers;
|
||||
+ return this.currentPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get max player count which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return max player count
|
||||
+ */
|
||||
+ public int getMaxPlayers() {
|
||||
+ return maxPlayers;
|
||||
+ return this.maxPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) hostname
|
||||
+ * Get server (public facing) hostname.
|
||||
+ *
|
||||
+ * @return server hostname
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getHostname() {
|
||||
+ return hostname;
|
||||
+ return this.hostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) port
|
||||
+ * Get server (public facing) port.
|
||||
+ *
|
||||
+ * @return server port
|
||||
+ */
|
||||
+ public int getPort() {
|
||||
+ return port;
|
||||
+ return this.port;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get collection of players which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return collection of players
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<String> getPlayers() {
|
||||
+ return players;
|
||||
+ return this.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;
|
||||
+ return this.serverVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get list of plugins which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return collection of plugins
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<PluginInformation> getPlugins() {
|
||||
+ return plugins;
|
||||
+ return this.plugins;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance from data represented by this response
|
||||
+ * Creates a new {@link Builder} instance from data represented by this response.
|
||||
+ *
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -250,7 +259,8 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance
|
||||
+ * Creates a new {@link Builder} instance.
|
||||
+ *
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -272,8 +282,8 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ private int maxPlayers;
|
||||
+ private int port;
|
||||
+
|
||||
+ private List<String> players = new ArrayList<>();
|
||||
+ private List<PluginInformation> plugins = new ArrayList<>();
|
||||
+ private final List<String> players = new ArrayList<>();
|
||||
+ private final List<PluginInformation> plugins = new ArrayList<>();
|
||||
+
|
||||
+ private Builder() {}
|
||||
+
|
||||
@ -365,7 +375,8 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Builds new {@link QueryResponse} with supplied data
|
||||
+ * Builds new {@link QueryResponse} with supplied data.
|
||||
+ *
|
||||
+ * @return response
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -389,6 +400,7 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+ * Plugin information
|
||||
+ */
|
||||
+ public static class PluginInformation {
|
||||
+
|
||||
+ private String name;
|
||||
+ private String version;
|
||||
+
|
||||
@ -399,7 +411,7 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getName() {
|
||||
+ return name;
|
||||
+ return this.name;
|
||||
+ }
|
||||
+
|
||||
+ public void setName(@NotNull String name) {
|
||||
@ -412,7 +424,7 @@ index 0000000000000000000000000000000000000000..77a19995f6792a182c5a43d6714e7bda
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getVersion() {
|
||||
+ return version;
|
||||
+ return this.version;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
|
@ -6,26 +6,30 @@ Subject: [PATCH] Add PlayerPostRespawnEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..31f34b54801f6699ce43355fa2a0a51f1ad0c997
|
||||
index 0000000000000000000000000000000000000000..16961aac061e78fb84029f8435ab5f7c493b1362
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
|
||||
@@ -0,0 +1,52 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+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.ApiStatus;
|
||||
+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 static HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Location respawnedLocation;
|
||||
+ private final boolean isBedSpawn;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPostRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnedLocation, final boolean isBedSpawn) {
|
||||
+ super(respawnPlayer);
|
||||
+ this.respawnedLocation = respawnedLocation;
|
||||
@ -39,7 +43,7 @@ index 0000000000000000000000000000000000000000..31f34b54801f6699ce43355fa2a0a51f
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getRespawnedLocation() {
|
||||
+ return respawnedLocation.clone();
|
||||
+ return this.respawnedLocation.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -48,18 +52,18 @@ index 0000000000000000000000000000000000000000..31f34b54801f6699ce43355fa2a0a51f
|
||||
+ * @return whether the player respawned to their bed
|
||||
+ */
|
||||
+ public boolean isBedSpawn() {
|
||||
+ return isBedSpawn;
|
||||
+ return this.isBedSpawn;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
|
@ -7,14 +7,15 @@ Fires event at start and end of a server tick
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dd7327c70fb72089dec6552317ba28961236db56
|
||||
index 0000000000000000000000000000000000000000..17e9f39ce1cc7489e936c96f95b8b0579528b222
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
@@ -0,0 +1,62 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -22,11 +23,13 @@ index 0000000000000000000000000000000000000000..dd7327c70fb72089dec6552317ba2896
|
||||
+ */
|
||||
+public class ServerTickEndEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int tickNumber;
|
||||
+ private final double tickDuration;
|
||||
+ private final long timeEnd;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ this.tickDuration = tickDuration;
|
||||
@ -37,21 +40,21 @@ index 0000000000000000000000000000000000000000..dd7327c70fb72089dec6552317ba2896
|
||||
+ * @return What tick this was since start (first tick = 1)
|
||||
+ */
|
||||
+ public int getTickNumber() {
|
||||
+ return tickNumber;
|
||||
+ return this.tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return Time in milliseconds of how long this tick took
|
||||
+ */
|
||||
+ public double getTickDuration() {
|
||||
+ return tickDuration;
|
||||
+ return this.tickDuration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Amount of nanoseconds remaining before the next tick should start.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * If this value is negative, then that means the server has exceeded the tick time limit and TPS has been lost.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Method will continuously return the updated time remaining value. (return value is not static)
|
||||
+ *
|
||||
+ * @return Amount of nanoseconds remaining before the next tick should start
|
||||
@ -62,31 +65,34 @@ index 0000000000000000000000000000000000000000..dd7327c70fb72089dec6552317ba2896
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eac85f1f49088bb71afb01eff4d5f53887306461
|
||||
index 0000000000000000000000000000000000000000..fb5bbfffea8b883e4c8769484a2b64dd895cb617
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
|
||||
@@ -0,0 +1,32 @@
|
||||
@@ -0,0 +1,35 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class ServerTickStartEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int tickNumber;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerTickStartEvent(int tickNumber) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ }
|
||||
@ -95,16 +101,16 @@ index 0000000000000000000000000000000000000000..eac85f1f49088bb71afb01eff4d5f538
|
||||
+ * @return What tick this is going be since start (first tick = 1)
|
||||
+ */
|
||||
+ public int getTickNumber() {
|
||||
+ return tickNumber;
|
||||
+ return this.tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -8,16 +8,18 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d380187c9c
|
||||
index 0000000000000000000000000000000000000000..092bab9be36acc0f04c7ea5b3510879169a0a125
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
@@ -0,0 +1,115 @@
|
||||
@@ -0,0 +1,120 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.entity.Egg;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -26,12 +28,15 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc.
|
||||
+ */
|
||||
+public class ThrownEggHatchEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Egg egg;
|
||||
+ private boolean hatching;
|
||||
+ private EntityType hatchType;
|
||||
+ private byte numHatches;
|
||||
+ private EntityType hatchType;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) {
|
||||
+ this.egg = egg;
|
||||
+ this.hatching = hatching;
|
||||
@ -46,7 +51,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Egg getEgg() {
|
||||
+ return egg;
|
||||
+ return this.egg;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -56,13 +61,13 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ * @return boolean Whether the egg is going to hatch or not
|
||||
+ */
|
||||
+ public boolean isHatching() {
|
||||
+ return hatching;
|
||||
+ return this.hatching;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the egg will hatch or not.
|
||||
+ *
|
||||
+ * @param hatching true if you want the egg to hatch, false if you want it
|
||||
+ * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it
|
||||
+ * not to
|
||||
+ */
|
||||
+ public void setHatching(boolean hatching) {
|
||||
@ -70,13 +75,13 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the type of the mob being hatched (EntityType.CHICKEN by default)
|
||||
+ * Get the type of the mob being hatched ({@link EntityType#CHICKEN} by default)
|
||||
+ *
|
||||
+ * @return The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getHatchingType() {
|
||||
+ return hatchType;
|
||||
+ return this.hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -85,7 +90,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ * @param hatchType The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ public void setHatchingType(@NotNull EntityType hatchType) {
|
||||
+ if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
|
||||
+ Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!");
|
||||
+ this.hatchType = hatchType;
|
||||
+ }
|
||||
+
|
||||
@ -93,22 +98,22 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ * Get the number of mob hatches from the egg. By default the number will
|
||||
+ * be the number the server would've done
|
||||
+ * <ul>
|
||||
+ * <li>7/8 chance of being 0
|
||||
+ * <li>31/256 ~= 1/8 chance to be 1
|
||||
+ * <li>1/256 chance to be 4
|
||||
+ * <li>7/8 chance of being 0
|
||||
+ * <li>31/256 ~= 1/8 chance to be 1
|
||||
+ * <li>1/256 chance to be 4
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @return The number of mobs going to be hatched by the egg
|
||||
+ */
|
||||
+ public byte getNumHatches() {
|
||||
+ return numHatches;
|
||||
+ return this.numHatches;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the number of mobs coming out of the hatched egg
|
||||
+ * <p>
|
||||
+ * The boolean hatching will override this number. Ie. If hatching =
|
||||
+ * false, this number will not matter
|
||||
+ * The boolean hatching will override this number. I.e. If hatching is
|
||||
+ * {@code false}, this number will not matter
|
||||
+ *
|
||||
+ * @param numHatches The number of mobs coming out of the egg
|
||||
+ */
|
||||
@ -119,11 +124,11 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Entity Jump API
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f0152ecb4
|
||||
index 0000000000000000000000000000000000000000..a6306c957fcacdcbcc8037b4ee33a167d21ff29e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,50 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -24,9 +25,12 @@ index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f
|
||||
+ * Cancelling the event will stop the entity from jumping
|
||||
+ */
|
||||
+public class EntityJumpEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityJumpEvent(@NotNull LivingEntity entity) {
|
||||
+ super(entity);
|
||||
+ }
|
||||
@ -34,26 +38,26 @@ index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
|
@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..4a0c39405d4fbed457787e3c6ded4cc6
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f525d3b057d
|
||||
index 0000000000000000000000000000000000000000..1757055d821d9ec7c728aa6c1b52fa6aea591ae5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
@@ -0,0 +1,134 @@
|
||||
@@ -0,0 +1,136 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.destroystokyo.paper.ClientOption;
|
||||
@ -103,6 +103,7 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Map;
|
||||
@ -112,7 +113,7 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
|
||||
+ */
|
||||
+public class PlayerClientOptionsChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String locale;
|
||||
+ private final int viewDistance;
|
||||
@ -136,6 +137,7 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
|
||||
+ this.textFilteringEnabled = false;
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull Map<ClientOption<?>, ?> options) {
|
||||
+ super(player);
|
||||
+
|
||||
@ -151,81 +153,81 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getLocale() {
|
||||
+ return locale;
|
||||
+ return this.locale;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasLocaleChanged() {
|
||||
+ return !locale.equals(player.getClientOption(ClientOption.LOCALE));
|
||||
+ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE));
|
||||
+ }
|
||||
+
|
||||
+ public int getViewDistance() {
|
||||
+ return viewDistance;
|
||||
+ return this.viewDistance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasViewDistanceChanged() {
|
||||
+ return viewDistance != player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChatVisibility getChatVisibility() {
|
||||
+ return chatVisibility;
|
||||
+ return this.chatVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatVisibilityChanged() {
|
||||
+ return chatVisibility != player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabled() {
|
||||
+ return chatColors;
|
||||
+ return this.chatColors;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabledChanged() {
|
||||
+ return chatColors != player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public SkinParts getSkinParts() {
|
||||
+ return skinparts;
|
||||
+ return this.skinparts;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasSkinPartsChanged() {
|
||||
+ return skinparts.getRaw() != player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public MainHand getMainHand() {
|
||||
+ return mainHand;
|
||||
+ return this.mainHand;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasMainHandChanged() {
|
||||
+ return mainHand != player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ }
|
||||
+
|
||||
+ public boolean allowsServerListings() {
|
||||
+ return allowsServerListings;
|
||||
+ return this.allowsServerListings;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasAllowServerListingsChanged() {
|
||||
+ return allowsServerListings != player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringEnabled() {
|
||||
+ return textFilteringEnabled;
|
||||
+ return this.textFilteringEnabled;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringChanged() {
|
||||
+ return textFilteringEnabled != player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ebdebe7b6ec6ed5aadc7ee925ba0147e61e6bc84
|
||||
index 0000000000000000000000000000000000000000..5ceaff1a499d08575ddcdcbead8e2cef6cfbea47
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
@@ -0,0 +1,76 @@
|
||||
@@ -0,0 +1,77 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..ebdebe7b6ec6ed5aadc7ee925ba0147e
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -24,56 +25,27 @@ index 0000000000000000000000000000000000000000..ebdebe7b6ec6ed5aadc7ee925ba0147e
|
||||
+ */
|
||||
+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private final float cooledAttackStrength;
|
||||
+ private boolean cancel = false;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private final Entity attackedEntity;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ public PlayerAttackEntityCooldownResetEvent(@NotNull Player who, @NotNull Entity attackedEntity, float cooledAttackStrength) {
|
||||
+ super(who);
|
||||
+ @NotNull private final Entity attackedEntity;
|
||||
+ private final float cooledAttackStrength;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAttackEntityCooldownResetEvent(@NotNull Player player, @NotNull Entity attackedEntity, float cooledAttackStrength) {
|
||||
+ super(player);
|
||||
+ this.attackedEntity = attackedEntity;
|
||||
+ this.cooledAttackStrength = cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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 an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset.
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the value of the players cooldown attack strength when they initiated the attack
|
||||
+ *
|
||||
+ * @return returns the original player cooldown value
|
||||
+ */
|
||||
+ public float getCooledAttackStrength() {
|
||||
+ return cooledAttackStrength;
|
||||
+ return this.cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -83,6 +55,35 @@ index 0000000000000000000000000000000000000000..ebdebe7b6ec6ed5aadc7ee925ba0147e
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getAttackedEntity() {
|
||||
+ return attackedEntity;
|
||||
+ return this.attackedEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6522eb262
|
||||
index 0000000000000000000000000000000000000000..c38ac6d0e0ac4ecbdc73d2bedd7731ff34c9d192
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
@@ -0,0 +1,84 @@
|
||||
@@ -0,0 +1,89 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.NamespacedKey;
|
||||
@ -17,17 +17,22 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player clicks a recipe in the recipe book
|
||||
+ */
|
||||
+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancel = false;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private NamespacedKey recipe;
|
||||
+ private boolean makeAll;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) {
|
||||
+ super(player);
|
||||
+ this.recipe = recipe;
|
||||
@ -41,7 +46,7 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public NamespacedKey getRecipe() {
|
||||
+ return recipe;
|
||||
+ return this.recipe;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -54,17 +59,17 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a boolean which indicates whether or not the player requested to make the maximum amount of results. This is
|
||||
+ * true if shift is pressed while the recipe is clicked in the recipe book
|
||||
+ * Gets a boolean which indicates whether the player requested to make the maximum amount of results. This is
|
||||
+ * {@code true} if shift is pressed while the recipe is clicked in the recipe book
|
||||
+ *
|
||||
+ * @return {@code true} if shift is pressed while the recipe is clicked
|
||||
+ */
|
||||
+ public boolean isMakeAll() {
|
||||
+ return makeAll;
|
||||
+ return this.makeAll;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether or not the maximum amount of results should be made. If this is true, the request is handled as if
|
||||
+ * Sets whether the maximum amount of results should be made. If this is {@code true}, the request is handled as if
|
||||
+ * the player had pressed shift while clicking on the recipe
|
||||
+ *
|
||||
+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results
|
||||
@ -75,23 +80,23 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java
|
||||
|
@ -11,27 +11,30 @@ Grindstone is a backwards compat from a previous PrepareGrindstoneEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83bfb7276b458bae1e21cb7ba9f4f7c4c2acf76f
|
||||
index 0000000000000000000000000000000000000000..b31e6777f5d163c61309da9ff204ad5773ba7f54
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
||||
@@ -0,0 +1,28 @@
|
||||
@@ -0,0 +1,31 @@
|
||||
+package com.destroystokyo.paper.event.inventory;
|
||||
+
|
||||
+import org.bukkit.Warning;
|
||||
+import org.bukkit.inventory.GrindstoneInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is put in a slot for grinding in a Grindstone
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent}
|
||||
+ */
|
||||
+@Deprecated
|
||||
+@Warning(false)
|
||||
+@Warning
|
||||
+public class PrepareGrindstoneEvent extends PrepareResultEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
+ super(inventory, result);
|
||||
+ }
|
||||
@ -45,15 +48,16 @@ index 0000000000000000000000000000000000000000..83bfb7276b458bae1e21cb7ba9f4f7c4
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..25e5f0354b3b65c656d6c173ec108825f1e8b1be
|
||||
index 0000000000000000000000000000000000000000..c305c606bef93866993095cec5f50e191c5a382a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
||||
@@ -0,0 +1,37 @@
|
||||
@@ -0,0 +1,40 @@
|
||||
+package com.destroystokyo.paper.event.inventory;
|
||||
+
|
||||
+import org.bukkit.event.inventory.PrepareInventoryResultEvent;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -63,12 +67,14 @@ index 0000000000000000000000000000000000000000..25e5f0354b3b65c656d6c173ec108825
|
||||
+public class PrepareResultEvent extends PrepareInventoryResultEvent {
|
||||
+
|
||||
+ // HandlerList on PrepareInventoryResultEvent to ensure api compat
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
+ super(inventory, result);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get result item, may be null.
|
||||
+ * Get result item, may be {@code null}.
|
||||
+ *
|
||||
+ * @return result item
|
||||
+ */
|
||||
@ -78,7 +84,7 @@ index 0000000000000000000000000000000000000000..25e5f0354b3b65c656d6c173ec108825
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set result item, may be null.
|
||||
+ * Set result item, may be {@code null}.
|
||||
+ *
|
||||
+ * @param result result item
|
||||
+ */
|
||||
|
@ -8,26 +8,28 @@ village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..548aeeab7d45173f36616a4a2f215f5838696089
|
||||
index 0000000000000000000000000000000000000000..7d3f04d5ab620f37d2253b575ae370d95ecf21ef
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,22 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a bell is rung.
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.block.BellRingEvent}
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class BellRingEvent extends org.bukkit.event.block.BellRingEvent implements Cancellable {
|
||||
+public class BellRingEvent extends org.bukkit.event.block.BellRingEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BellRingEvent(@NotNull Block block, @NotNull BlockFace direction, @Nullable Entity entity) {
|
||||
+ super(block, direction, entity);
|
||||
+ }
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerItemCooldownEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb06f07c57c
|
||||
index 0000000000000000000000000000000000000000..c2764ffd51831351b934568e1301b2e4073dc0c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,82 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
@ -18,18 +18,23 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a player receives an item cooldown.
|
||||
+ */
|
||||
+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Material type;
|
||||
+ private boolean cancelled;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) {
|
||||
+ super(player);
|
||||
+ this.type = type;
|
||||
@ -43,7 +48,7 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getType() {
|
||||
+ return type;
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -52,7 +57,7 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
|
||||
+ * @return cooldown in ticks
|
||||
+ */
|
||||
+ public int getCooldown() {
|
||||
+ return cooldown;
|
||||
+ return this.cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -68,7 +73,7 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -79,11 +84,11 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerShearBlockEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f42838758bfd
|
||||
index 0000000000000000000000000000000000000000..9bb4a79320eac7d662d9d04765664b6a7e955a4f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java
|
||||
@@ -0,0 +1,108 @@
|
||||
@@ -0,0 +1,113 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
@ -32,15 +33,19 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb.
|
||||
+ */
|
||||
+public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block block;
|
||||
+ private final ItemStack item;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private final List<ItemStack> drops;
|
||||
+
|
||||
+ public PlayerShearBlockEvent(@NotNull Player who, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops) {
|
||||
+ super(who);
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerShearBlockEvent(@NotNull Player player, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops) {
|
||||
+ super(player);
|
||||
+ this.block = block;
|
||||
+ this.item = item;
|
||||
+ this.hand = hand;
|
||||
@ -54,7 +59,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBlock() {
|
||||
+ return block;
|
||||
+ return this.block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -64,7 +69,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -74,7 +79,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -84,7 +89,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return drops;
|
||||
+ return this.drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -94,7 +99,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -110,11 +115,11 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,95 +6,101 @@ Subject: [PATCH] Player Chunk Load/Unload Events
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2c1cda1126e577a88f19071e958eddb5a38785af
|
||||
index 0000000000000000000000000000000000000000..3ddbc099a13df939b3912f30b54e7635840ba5a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package io.papermc.paper.event.packet;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.ChunkEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when a {@link org.bukkit.entity.Player} receives a {@link org.bukkit.Chunk}
|
||||
+ * Is called when a {@link Player} receives a {@link Chunk}
|
||||
+ * <p>
|
||||
+ * Can for example be used for spawning a fake entity when the player receives a chunk.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Should only be used for packet/clientside related stuff.
|
||||
+ * Not intended for modifying server side state.
|
||||
+ */
|
||||
+public class PlayerChunkLoadEvent extends ChunkEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerChunkLoadEvent(@NotNull Chunk chunk, @NotNull Player player) {
|
||||
+ super(chunk);
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..12163a7b0591a7d022dc7eb9ee6608a1b6c39d9b
|
||||
index 0000000000000000000000000000000000000000..2cac7e27991c04a9ced261f2dd8ad8657ccddf6b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,43 @@
|
||||
+package io.papermc.paper.event.packet;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.ChunkEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when a {@link Player} receives a chunk unload packet.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Should only be used for packet/clientside related stuff.
|
||||
+ * Not intended for modifying server side.
|
||||
+ */
|
||||
+public class PlayerChunkUnloadEvent extends ChunkEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerChunkUnloadEvent(@NotNull Chunk chunk, @NotNull Player player) {
|
||||
+ super(chunk);
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -13,36 +13,40 @@ event being about villager trades.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff5c0624fb
|
||||
index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43e9b50bfc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java
|
||||
@@ -0,0 +1,112 @@
|
||||
@@ -0,0 +1,109 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import java.util.Objects;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+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.MerchantRecipe;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player trades with a standalone merchant GUI.
|
||||
+ */
|
||||
+public class PlayerPurchaseEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ private boolean increaseTradeUses;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean rewardExp;
|
||||
+ private boolean increaseTradeUses;
|
||||
+ private MerchantRecipe trade;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPurchaseEvent(@NotNull Player player,
|
||||
+ @NotNull MerchantRecipe trade,
|
||||
+ boolean rewardExp,
|
||||
+ boolean increaseTradeUses) {
|
||||
+ super(Objects.requireNonNull(player, "Player cannot be null!"));
|
||||
+ super(player);
|
||||
+ setTrade(trade);
|
||||
+ this.rewardExp = rewardExp;
|
||||
+ this.increaseTradeUses = increaseTradeUses;
|
||||
@ -50,6 +54,7 @@ index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the associated trade with this event
|
||||
+ *
|
||||
+ * @return the trade
|
||||
+ */
|
||||
+ @NotNull
|
||||
@ -59,10 +64,12 @@ index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the trade. This is then used to determine the next prices
|
||||
+ *
|
||||
+ * @param trade the trade to use
|
||||
+ */
|
||||
+ public void setTrade(@NotNull MerchantRecipe trade) {
|
||||
+ this.trade = Objects.requireNonNull(trade, "Trade cannot be null!");
|
||||
+ Preconditions.checkArgument(trade != null, "Trade cannot be null!");
|
||||
+ this.trade = trade;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -74,6 +81,7 @@ index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the trade will try to reward exp
|
||||
+ *
|
||||
+ * @param rewardExp try to reward exp
|
||||
+ */
|
||||
+ public void setRewardExp(boolean rewardExp) {
|
||||
@ -81,37 +89,26 @@ index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return whether or not the trade will count as a use of the trade
|
||||
+ * @return whether the trade will count as a use of the trade
|
||||
+ */
|
||||
+ public boolean willIncreaseTradeUses() {
|
||||
+ return this.increaseTradeUses;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether or not the trade will count as a use
|
||||
+ * @param increaseTradeUses true to count/false to not count
|
||||
+ * Sets whether the trade will count as a use
|
||||
+ *
|
||||
+ * @param increaseTradeUses {@code true} to count, {@code false} otherwise
|
||||
+ */
|
||||
+ public void setIncreaseTradeUses(boolean increaseTradeUses) {
|
||||
+ this.increaseTradeUses = increaseTradeUses;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
@ -120,26 +117,27 @@ index 0000000000000000000000000000000000000000..c5648055c5e815474bf1e564a5c192ff
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java
|
||||
new file mode 100755
|
||||
index 0000000000000000000000000000000000000000..a41fc186746b87f76347dfcc1f80d0969398322b
|
||||
index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0888890ac
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java
|
||||
@@ -0,0 +1,29 @@
|
||||
@@ -0,0 +1,32 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.AbstractVillager;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.inventory.MerchantRecipe;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -149,6 +147,7 @@ index 0000000000000000000000000000000000000000..a41fc186746b87f76347dfcc1f80d096
|
||||
+
|
||||
+ private final AbstractVillager villager;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerTradeEvent(@NotNull Player player, @NotNull AbstractVillager villager, @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses) {
|
||||
+ super(player, trade, rewardExp, increaseTradeUses);
|
||||
+ this.villager = villager;
|
||||
@ -156,6 +155,7 @@ index 0000000000000000000000000000000000000000..a41fc186746b87f76347dfcc1f80d096
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Villager or Wandering trader associated with this event
|
||||
+ *
|
||||
+ * @return the villager or wandering trader
|
||||
+ */
|
||||
+ @NotNull
|
||||
|
@ -6,19 +6,21 @@ Subject: [PATCH] Add TargetHitEvent API
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cc067ae118af9957b1b9f5c8d45f63f9154f4942
|
||||
index 0000000000000000000000000000000000000000..5247e7f78e0076089c1e1bdea2afbb455c43732a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
@@ -0,0 +1,61 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.entity.Projectile;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Target Block is hit by a projectile.
|
||||
@ -27,44 +29,25 @@ index 0000000000000000000000000000000000000000..cc067ae118af9957b1b9f5c8d45f63f9
|
||||
+ * and in the case that the shooter is a player, will stop them from receiving
|
||||
+ * advancement criteria.
|
||||
+ */
|
||||
+public class TargetHitEvent extends ProjectileHitEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+public class TargetHitEvent extends ProjectileHitEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private int signalStrength;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TargetHitEvent(@NotNull Projectile projectile, @NotNull Block block, @NotNull BlockFace blockFace, int signalStrength) {
|
||||
+ super(projectile, null, block, blockFace);
|
||||
+ this.signalStrength = signalStrength;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the strength of the redstone signal to be emitted by the Target block
|
||||
+ *
|
||||
+ * @return the strength of the redstone signal to be emitted
|
||||
+ */
|
||||
+ public int getSignalStrength() {
|
||||
+ return signalStrength;
|
||||
+ public @Range(from = 0, to = 15) int getSignalStrength() {
|
||||
+ return this.signalStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -72,10 +55,19 @@ index 0000000000000000000000000000000000000000..cc067ae118af9957b1b9f5c8d45f63f9
|
||||
+ *
|
||||
+ * @param signalStrength the strength of the redstone signal to be emitted
|
||||
+ */
|
||||
+ public void setSignalStrength(int signalStrength) {
|
||||
+ if (signalStrength < 0 || signalStrength > 15) {
|
||||
+ throw new IllegalArgumentException("Signal strength out of range (" + signalStrength + "), must be in range [0,15]");
|
||||
+ }
|
||||
+ public void setSignalStrength(@Range(from = 0, to = 15) int signalStrength) {
|
||||
+ Preconditions.checkArgument(signalStrength >= 0 && signalStrength <= 15, "Signal strength out of range (%s), must be in range [0,15]", signalStrength);
|
||||
+ this.signalStrength = signalStrength;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd012d9e521
|
||||
index 0000000000000000000000000000000000000000..373a6ec68fb575b82b06bf250768c1a6909efe38
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
|
||||
@@ -0,0 +1,82 @@
|
||||
@@ -0,0 +1,85 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -18,13 +18,15 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player places an item in or takes an item out of a flowerpot.
|
||||
+ */
|
||||
+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Block flowerpot;
|
||||
@ -32,8 +34,9 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+ private final ItemStack item;
|
||||
+ private final boolean placing;
|
||||
+
|
||||
+ private boolean cancel = false;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerFlowerPotManipulateEvent(@NotNull final Player player, @NotNull final Block flowerpot, @NotNull final ItemStack item, final boolean placing) {
|
||||
+ super(player);
|
||||
+ this.flowerpot = flowerpot;
|
||||
@ -41,16 +44,6 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+ this.placing = placing;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the flowerpot that is involved in this event.
|
||||
+ *
|
||||
@ -58,7 +51,7 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getFlowerpot() {
|
||||
+ return flowerpot;
|
||||
+ return this.flowerpot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -69,7 +62,7 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -78,17 +71,27 @@ index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd0
|
||||
+ * @return if the item is being placed into the flowerpot
|
||||
+ */
|
||||
+ public boolean isPlacing() {
|
||||
+ return placing;
|
||||
+ return this.placing;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add EntityLoadCrossbowEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8f01ac5b6
|
||||
index 0000000000000000000000000000000000000000..8434ea803e3135380f9351c82a414ccb65c478a9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
|
||||
@@ -0,0 +1,98 @@
|
||||
@@ -0,0 +1,96 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
@ -25,12 +25,14 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
|
||||
+ * Called when a LivingEntity loads a crossbow with a projectile.
|
||||
+ */
|
||||
+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack crossbow;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ private boolean consumeItem = true;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) {
|
||||
@ -42,7 +44,7 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -52,7 +54,7 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getCrossbow() {
|
||||
+ return crossbow;
|
||||
+ return this.crossbow;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -62,19 +64,17 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ *
|
||||
+ * @return should the itemstack be consumed
|
||||
+ */
|
||||
+ public boolean shouldConsumeItem() {
|
||||
+ return consumeItem;
|
||||
+ return this.consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ *
|
||||
+ * @param consume should the item be consumed
|
||||
+ */
|
||||
+ public void setConsumeItem(boolean consume) {
|
||||
@ -83,14 +83,12 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether or not to cancel the crossbow being loaded. If canceled, the
|
||||
+ * Set whether to cancel the crossbow being loaded. If canceled, the
|
||||
+ * projectile that would be loaded into the crossbow will not be consumed.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
|
@ -6,19 +6,19 @@ Subject: [PATCH] Added WorldGameRuleChangeEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6462904bf
|
||||
index 0000000000000000000000000000000000000000..2831fb8ad22e457f85523f65be9cba2432109f01
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java
|
||||
@@ -0,0 +1,91 @@
|
||||
@@ -0,0 +1,92 @@
|
||||
+package io.papermc.paper.event.world;
|
||||
+
|
||||
+import org.bukkit.GameRule;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -34,6 +34,7 @@ index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6
|
||||
+ private String value;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WorldGameRuleChangeEvent(@NotNull World world, @Nullable CommandSender commandSender, @NotNull GameRule<?> gameRule, @NotNull String value) {
|
||||
+ super(world);
|
||||
+ this.commandSender = commandSender;
|
||||
@ -48,7 +49,7 @@ index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public CommandSender getCommandSender() {
|
||||
+ return commandSender;
|
||||
+ return this.commandSender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -58,7 +59,7 @@ index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public GameRule<?> getGameRule() {
|
||||
+ return gameRule;
|
||||
+ return this.gameRule;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -68,7 +69,7 @@ index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getValue() {
|
||||
+ return value;
|
||||
+ return this.value;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -82,7 +83,7 @@ index 0000000000000000000000000000000000000000..20c25a0f9d65188402e8bb3981348bc6
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,21 +6,21 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7a8d6815c17a107039399298f7ac9f0612faee02
|
||||
index 0000000000000000000000000000000000000000..a7ed7d6b6469e175d3949ffa9c502cbfde609215
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java
|
||||
@@ -0,0 +1,48 @@
|
||||
@@ -0,0 +1,49 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload)
|
||||
+ * <p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ * </p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ */
|
||||
+public class ServerResourcesReloadedEvent extends ServerEvent {
|
||||
+
|
||||
@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..7a8d6815c17a107039399298f7ac9f06
|
||||
+
|
||||
+ private final Cause cause;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerResourcesReloadedEvent(@NotNull Cause cause) {
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
@ -39,7 +40,7 @@ index 0000000000000000000000000000000000000000..7a8d6815c17a107039399298f7ac9f06
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
|
@ -6,25 +6,28 @@ Subject: [PATCH] Add BlockFailedDispenseEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dab794341170ed10d5a05c1b4c180d164e0f70e2
|
||||
index 0000000000000000000000000000000000000000..d531b034b49b163e5095e840a5c9c4fe5eb73319
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
@@ -0,0 +1,57 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block tries to dispense an item, but its inventory is empty.
|
||||
+ */
|
||||
+public class BlockFailedDispenseEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean shouldPlayEffect = true;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockFailedDispenseEvent(@NotNull Block theBlock) {
|
||||
+ super(theBlock);
|
||||
+ }
|
||||
@ -46,8 +49,6 @@ index 0000000000000000000000000000000000000000..dab794341170ed10d5a05c1b4c180d16
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * @return {@link #shouldPlayEffect()}
|
||||
+ */
|
||||
+ @Override
|
||||
@ -57,13 +58,11 @@ index 0000000000000000000000000000000000000000..dab794341170ed10d5a05c1b4c180d16
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull
|
||||
+ HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull
|
||||
+ HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Added PlayerLecternPageChangeEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786a7305810
|
||||
index 0000000000000000000000000000000000000000..6ed2a6c8c033937d933b6d4834953b8112a98bb3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java
|
||||
@@ -0,0 +1,115 @@
|
||||
@@ -0,0 +1,117 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.Lectern;
|
||||
@ -18,20 +18,22 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public class PlayerLecternPageChangeEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final Lectern lectern;
|
||||
+ private final ItemStack book;
|
||||
+ private final PageChangeDirection pageChangeDirection;
|
||||
+ private final int oldPage;
|
||||
+ private int newPage;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerLecternPageChangeEvent(@NotNull Player player, @NotNull Lectern lectern, @NotNull ItemStack book, @NotNull PageChangeDirection pageChangeDirection, int oldPage, int newPage) {
|
||||
+ super(player);
|
||||
+ this.lectern = lectern;
|
||||
@ -48,7 +50,7 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Lectern getLectern() {
|
||||
+ return lectern;
|
||||
+ return this.lectern;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -68,7 +70,7 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PageChangeDirection getPageChangeDirection() {
|
||||
+ return pageChangeDirection;
|
||||
+ return this.pageChangeDirection;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -77,7 +79,7 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+ * @return the page changed from
|
||||
+ */
|
||||
+ public int getOldPage() {
|
||||
+ return oldPage;
|
||||
+ return this.oldPage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -86,7 +88,7 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+ * @return the page changed to
|
||||
+ */
|
||||
+ public int getNewPage() {
|
||||
+ return newPage;
|
||||
+ return this.newPage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -101,7 +103,7 @@ index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Added PlayerLoomPatternSelectEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41b90a7d8b
|
||||
index 0000000000000000000000000000000000000000..c614bd1a725adee0c434a9331099d0c35d7411f6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,80 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.banner.PatternType;
|
||||
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.LoomInventory;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -27,10 +28,12 @@ index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final LoomInventory loomInventory;
|
||||
+ private PatternType patternType;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerLoomPatternSelectEvent(@NotNull Player player, @NotNull LoomInventory loomInventory, @NotNull PatternType patternType) {
|
||||
+ super(player);
|
||||
+ this.loomInventory = loomInventory;
|
||||
@ -44,7 +47,7 @@ index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LoomInventory getLoomInventory() {
|
||||
+ return loomInventory;
|
||||
+ return this.loomInventory;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -54,7 +57,7 @@ index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PatternType getPatternType() {
|
||||
+ return patternType;
|
||||
+ return this.patternType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -68,7 +71,7 @@ index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -7,10 +7,10 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741c500df81
|
||||
index 0000000000000000000000000000000000000000..1ac3369455972aeb1ade5dc023d1f818cd3535fa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
@@ -0,0 +1,158 @@
|
||||
@@ -0,0 +1,163 @@
|
||||
+package io.papermc.paper.event.world;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -32,18 +32,23 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ * <li>An Explorer/Treasure Map is activated.</li>
|
||||
+ * <li>{@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.</li>
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @deprecated no longer used, see {@link StructuresLocateEvent}
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class StructureLocateEvent extends WorldEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Location origin;
|
||||
+ private Location result = null;
|
||||
+ private StructureType type;
|
||||
+ private int radius;
|
||||
+ private boolean findUnexplored;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) {
|
||||
+ super(world);
|
||||
+ this.origin = origin;
|
||||
@ -52,29 +57,18 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ this.findUnexplored = findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location set as the structure location, if it was defined.
|
||||
+ * <p>
|
||||
+ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}.
|
||||
+ * Since this event fires <i>before</i> the search is done, the actual location is unknown at this point.
|
||||
+ *
|
||||
+ * @return The result location, if it has been set. null if it has not.
|
||||
+ * @return The result location, if it has been set. {@code null} if it has not.
|
||||
+ * @see World#locateNearestStructure(Location, StructureType, int, boolean)
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getResult() {
|
||||
+ return result;
|
||||
+ return this.result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -93,7 +87,7 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public StructureType getType() {
|
||||
+ return type;
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -112,7 +106,7 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getOrigin() {
|
||||
+ return origin;
|
||||
+ return this.origin;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -123,7 +117,7 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ * @return the search radius.
|
||||
+ */
|
||||
+ public int getRadius() {
|
||||
+ return radius;
|
||||
+ return this.radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -145,7 +139,7 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+ * @return Whether to search for only unexplored structures.
|
||||
+ */
|
||||
+ public boolean shouldFindUnexplored() {
|
||||
+ return findUnexplored;
|
||||
+ return this.findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -161,20 +155,31 @@ index 0000000000000000000000000000000000000000..679677cf6a889ee23822b728b882e741
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4342b162f69b6509503e9772ddd2c5ac6659545a
|
||||
index 0000000000000000000000000000000000000000..be86894561ff808d911e123b09bda72c9ed09185
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java
|
||||
@@ -0,0 +1,210 @@
|
||||
@@ -0,0 +1,213 @@
|
||||
+package io.papermc.paper.event.world;
|
||||
+
|
||||
+import io.papermc.paper.math.Position;
|
||||
@ -190,6 +195,7 @@ index 0000000000000000000000000000000000000000..4342b162f69b6509503e9772ddd2c5ac
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.bukkit.generator.structure.Structure;
|
||||
+import org.bukkit.generator.structure.StructureType;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.UnmodifiableView;
|
||||
@ -217,8 +223,10 @@ index 0000000000000000000000000000000000000000..4342b162f69b6509503e9772ddd2c5ac
|
||||
+ private List<ConfiguredStructure> legacy$structures;
|
||||
+ private int radius;
|
||||
+ private boolean findUnexplored;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List<Structure> structures, int radius, boolean findUnexplored) {
|
||||
+ super(world);
|
||||
+ this.origin = origin;
|
||||
@ -242,8 +250,8 @@ index 0000000000000000000000000000000000000000..4342b162f69b6509503e9772ddd2c5ac
|
||||
+ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}.
|
||||
+ * Since this event fires <i>before</i> the search is done, the actual result is unknown at this point.
|
||||
+ *
|
||||
+ * @return The result location and structure, if it has been set. null if it has not.
|
||||
+ * @see World#locateNearestStructure(Location, org.bukkit.generator.structure.StructureType, int, boolean)
|
||||
+ * @return The result location and structure, if it has been set. {@code null} if it has not.
|
||||
+ * @see World#locateNearestStructure(Location, StructureType, int, boolean)
|
||||
+ */
|
||||
+ public @Nullable Result getResult() {
|
||||
+ return this.result;
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add BlockPreDispenseEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e9c00e77b
|
||||
index 0000000000000000000000000000000000000000..62547d5853e7355a805fa1e7f1e5f56d06fca4ba
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
@@ -0,0 +1,65 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -17,14 +17,19 @@ index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack itemStack;
|
||||
+ private final int slot;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) {
|
||||
+ super(block);
|
||||
+ this.itemStack = itemStack;
|
||||
@ -38,7 +43,7 @@ index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -47,17 +52,7 @@ index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e
|
||||
+ * @return The inventory slot
|
||||
+ */
|
||||
+ public int getSlot() {
|
||||
+ return slot;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return this.slot;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -69,4 +64,14 @@ index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ 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..812712b3b233c454dfab039fb9f16d6becca2d93
|
||||
index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6f4c2c4ff
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
|
||||
@@ -0,0 +1,143 @@
|
||||
@@ -0,0 +1,137 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -26,21 +26,21 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ * Called when a player sets the effect for a beacon
|
||||
+ */
|
||||
+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block beacon;
|
||||
+ private PotionEffectType primary;
|
||||
+ private PotionEffectType secondary;
|
||||
+ private final Block beacon;
|
||||
+ private boolean consumeItem = true;
|
||||
+
|
||||
+ private boolean isCancelled;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @NotNull Block beacon) {
|
||||
+ super(player);
|
||||
+ this.primary = primary;
|
||||
+ this.secondary = secondary;
|
||||
+ this.isCancelled = false;
|
||||
+ this.beacon = beacon;
|
||||
+ }
|
||||
+
|
||||
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ * @return the primary effect
|
||||
+ */
|
||||
+ @Nullable public PotionEffectType getPrimary() {
|
||||
+ return primary;
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ * @return the secondary effect
|
||||
+ */
|
||||
+ @Nullable public PotionEffectType getSecondary() {
|
||||
+ return secondary;
|
||||
+ return this.secondary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBeacon() {
|
||||
+ return beacon;
|
||||
+ return this.beacon;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -95,10 +95,10 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ * Independent of {@link #isCancelled()}. If the event is cancelled
|
||||
+ * the item will <b>NOT</b> be consumed.
|
||||
+ *
|
||||
+ * @return true if item will be consumed
|
||||
+ * @return {@code true} if item will be consumed
|
||||
+ */
|
||||
+ public boolean willConsumeItem() {
|
||||
+ return consumeItem;
|
||||
+ return this.consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -107,40 +107,34 @@ index 0000000000000000000000000000000000000000..812712b3b233c454dfab039fb9f16d6b
|
||||
+ * Independent of {@link #isCancelled()}. If the event is cancelled
|
||||
+ * the item will <b>NOT</b> be consumed.
|
||||
+ *
|
||||
+ * @param consumeItem true if item should be consumed
|
||||
+ * @param consumeItem {@code 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
|
||||
+ * {@inheritDoc}
|
||||
+ * <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;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * {@inheritDoc}
|
||||
+ * <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;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,10 +6,10 @@ 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
|
||||
index 0000000000000000000000000000000000000000..8a7e1cb49ace104af3f9571fbc36b80687141736
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
@ -24,10 +24,11 @@ index 0000000000000000000000000000000000000000..fb1bca3a9d12096c9a2b2663f466a8ff
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final StonecutterInventory stonecutterInventory;
|
||||
+ private StonecuttingRecipe stonecuttingRecipe;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerStonecutterRecipeSelectEvent(@NotNull Player player, @NotNull StonecutterInventory stonecutterInventory, @NotNull StonecuttingRecipe stonecuttingRecipe) {
|
||||
+ super(player);
|
||||
+ this.stonecutterInventory = stonecutterInventory;
|
||||
@ -36,12 +37,12 @@ index 0000000000000000000000000000000000000000..fb1bca3a9d12096c9a2b2663f466a8ff
|
||||
+
|
||||
+ @NotNull
|
||||
+ public StonecutterInventory getStonecutterInventory() {
|
||||
+ return stonecutterInventory;
|
||||
+ return this.stonecutterInventory;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public StonecuttingRecipe getStonecuttingRecipe() {
|
||||
+ return stonecuttingRecipe;
|
||||
+ return this.stonecuttingRecipe;
|
||||
+ }
|
||||
+
|
||||
+ public void setStonecuttingRecipe(@NotNull StonecuttingRecipe stonecuttingRecipe) {
|
||||
@ -50,7 +51,7 @@ index 0000000000000000000000000000000000000000..fb1bca3a9d12096c9a2b2663f466a8ff
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] add DragonEggFormEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5495b87330518363498e1ac5d8f0a832be35fefb
|
||||
index 0000000000000000000000000000000000000000..695c21a296c6d12e1204eba33b92c44e7c2d98b8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
||||
@@ -0,0 +1,63 @@
|
||||
@@ -0,0 +1,55 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
@ -17,59 +17,51 @@ index 0000000000000000000000000000000000000000..5495b87330518363498e1ac5d8f0a832
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.boss.DragonBattle;
|
||||
+import org.bukkit.entity.EnderDragon;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockFormEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle},
|
||||
+ * causing a {@link Material#DRAGON_EGG} (more formally: {@link #getNewState()})
|
||||
+ * to possibly appear depending on {@link #isCancelled()}.
|
||||
+ * <p>
|
||||
+ * <b>This event might be cancelled by default depending on
|
||||
+ * eg. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration.</b>
|
||||
+ * e.g. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration.</b>
|
||||
+ */
|
||||
+public class DragonEggFormEvent extends BlockFormEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final DragonBattle dragonBattle;
|
||||
+ private boolean cancelled;
|
||||
+public class DragonEggFormEvent extends BlockFormEvent {
|
||||
+
|
||||
+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState,
|
||||
+ @NotNull DragonBattle dragonBattle) {
|
||||
+ super(block, newState);
|
||||
+ this.dragonBattle = dragonBattle;
|
||||
+ }
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+ private final DragonBattle dragonBattle;
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+ @ApiStatus.Internal
|
||||
+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState, @NotNull DragonBattle dragonBattle) {
|
||||
+ super(block, newState);
|
||||
+ this.dragonBattle = dragonBattle;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link DragonBattle} associated with this event.
|
||||
+ * Keep in mind that the {@link EnderDragon} is already dead
|
||||
+ * when this event is called.
|
||||
+ *
|
||||
+ * @return the dragon battle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonBattle getDragonBattle() {
|
||||
+ return dragonBattle;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Gets the {@link DragonBattle} associated with this event.
|
||||
+ * Keep in mind that the {@link EnderDragon} is already dead
|
||||
+ * when this event is called.
|
||||
+ *
|
||||
+ * @return the dragon battle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonBattle getDragonBattle() {
|
||||
+ return this.dragonBattle;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] EntityMoveEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc663897f62b
|
||||
index 0000000000000000000000000000000000000000..46990a220f70b04218b14aec1e9efbd46c2ad77c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java
|
||||
@@ -0,0 +1,143 @@
|
||||
@@ -0,0 +1,150 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.event.player.PlayerMoveEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -27,11 +28,15 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ * Does not fire for players; use {@link PlayerMoveEvent} for player movement.
|
||||
+ */
|
||||
+public class EntityMoveEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private Location from;
|
||||
+ private Location to;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityMoveEvent(@NotNull LivingEntity entity, @NotNull Location from, @NotNull Location to) {
|
||||
+ super(entity);
|
||||
+ this.from = from;
|
||||
@ -41,15 +46,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -59,7 +56,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getFrom() {
|
||||
+ return from;
|
||||
+ return this.from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -79,7 +76,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getTo() {
|
||||
+ return to;
|
||||
+ return this.to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -98,7 +95,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ * @return whether the entity has changed position or not
|
||||
+ */
|
||||
+ public boolean hasChangedPosition() {
|
||||
+ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld());
|
||||
+ return hasExplicitlyChangedPosition() || !this.from.getWorld().equals(this.to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -107,7 +104,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ * @return whether the entity has changed position or not
|
||||
+ */
|
||||
+ public boolean hasExplicitlyChangedPosition() {
|
||||
+ return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ();
|
||||
+ return this.from.getX() != this.to.getX() || this.from.getY() != this.to.getY() || this.from.getZ() != this.to.getZ();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -125,7 +122,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ * @return whether the entity has moved to a new block or not
|
||||
+ */
|
||||
+ public boolean hasExplicitlyChangedBlock() {
|
||||
+ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ();
|
||||
+ return this.from.getBlockX() != this.to.getBlockX() || this.from.getBlockY() != this.to.getBlockY() || this.from.getBlockZ() != this.to.getBlockZ();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -134,7 +131,7 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ * @return whether the entity has changed orientation or not
|
||||
+ */
|
||||
+ public boolean hasChangedOrientation() {
|
||||
+ return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
|
||||
+ return this.from.getPitch() != this.to.getPitch() || this.from.getYaw() != this.to.getYaw();
|
||||
+ }
|
||||
+
|
||||
+ private void validateLocation(@NotNull Location loc) {
|
||||
@ -143,13 +140,23 @@ index 0000000000000000000000000000000000000000..245d56ba7e8e37e3555b606f5e85fc66
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Add worldborder events
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235f9c4cbdb
|
||||
index 0000000000000000000000000000000000000000..02ac479840c137ca5afcec149ef884e5a5d62928
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -0,0 +1,117 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -31,6 +32,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ private long duration;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WorldBorderBoundsChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Type type, double oldSize, double newSize, long duration) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.type = type;
|
||||
@ -46,7 +48,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Type getType() {
|
||||
+ return type;
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -55,7 +57,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ * @return the old size
|
||||
+ */
|
||||
+ public double getOldSize() {
|
||||
+ return oldSize;
|
||||
+ return this.oldSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -64,7 +66,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ * @return the new size
|
||||
+ */
|
||||
+ public double getNewSize() {
|
||||
+ return newSize;
|
||||
+ return this.newSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -73,8 +75,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ * @param newSize the new size
|
||||
+ */
|
||||
+ public void setNewSize(double newSize) {
|
||||
+ // PAIL: TODO: Magic Values
|
||||
+ this.newSize = Math.min(6.0E7D, Math.max(1.0D, newSize));
|
||||
+ this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -83,7 +84,7 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ * @return the time in milliseconds for the change
|
||||
+ */
|
||||
+ public long getDuration() {
|
||||
+ return duration;
|
||||
+ return this.duration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -95,12 +96,14 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+ public void setDuration(long duration) {
|
||||
+ // PAIL: TODO: Magic Values
|
||||
+ this.duration = Math.min(9223372036854775L, Math.max(0L, duration));
|
||||
+ if (duration >= 0 && type == Type.INSTANT_MOVE) type = Type.STARTED_MOVE;
|
||||
+ if (duration >= 0 && this.type == Type.INSTANT_MOVE) {
|
||||
+ this.type = Type.STARTED_MOVE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -126,15 +129,16 @@ index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..60eabed056ee9b9cdd6f5d13307b9be38705330f
|
||||
index 0000000000000000000000000000000000000000..a44964593b7f78c5086dc4928e75ad892e624671
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java
|
||||
@@ -0,0 +1,65 @@
|
||||
@@ -0,0 +1,67 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -148,6 +152,7 @@ index 0000000000000000000000000000000000000000..60eabed056ee9b9cdd6f5d13307b9be3
|
||||
+ private final double newSize;
|
||||
+ private final double duration;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WorldBorderBoundsChangeFinishEvent(@NotNull World world, @NotNull WorldBorder worldBorder, double oldSize, double newSize, double duration) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.oldSize = oldSize;
|
||||
@ -161,7 +166,7 @@ index 0000000000000000000000000000000000000000..60eabed056ee9b9cdd6f5d13307b9be3
|
||||
+ * @return the old size
|
||||
+ */
|
||||
+ public double getOldSize() {
|
||||
+ return oldSize;
|
||||
+ return this.oldSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -170,18 +175,18 @@ index 0000000000000000000000000000000000000000..60eabed056ee9b9cdd6f5d13307b9be3
|
||||
+ * @return the new size
|
||||
+ */
|
||||
+ public double getNewSize() {
|
||||
+ return newSize;
|
||||
+ return this.newSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the duration this worldborder took to make the change.
|
||||
+ * <p>
|
||||
+ * Can be 0 if handlers for {@link io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent} set the duration to 0.
|
||||
+ * Can be 0 if handlers for {@link WorldBorderCenterChangeEvent} set the duration to 0.
|
||||
+ *
|
||||
+ * @return the duration of the transition
|
||||
+ */
|
||||
+ public double getDuration() {
|
||||
+ return duration;
|
||||
+ return this.duration;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
@ -197,10 +202,10 @@ index 0000000000000000000000000000000000000000..60eabed056ee9b9cdd6f5d13307b9be3
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74c1363fd7
|
||||
index 0000000000000000000000000000000000000000..a90f67e902c6ae35b2399e6f72a3ff8a5c15d05a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,79 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -208,7 +213,7 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -220,8 +225,10 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+
|
||||
+ private final Location oldCenter;
|
||||
+ private Location newCenter;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WorldBorderCenterChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Location oldCenter, @NotNull Location newCenter) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.oldCenter = oldCenter;
|
||||
@ -235,7 +242,7 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getOldCenter() {
|
||||
+ return oldCenter;
|
||||
+ return this.oldCenter;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -245,7 +252,7 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getNewCenter() {
|
||||
+ return newCenter;
|
||||
+ return this.newCenter;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -259,7 +266,7 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -280,29 +287,30 @@ index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67bd469d3680c9554ce6c1d5493826a252682835
|
||||
index 0000000000000000000000000000000000000000..adb244f9be35c43ff99dbc3a771e1fdfb21da68c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java
|
||||
@@ -0,0 +1,22 @@
|
||||
@@ -0,0 +1,23 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public abstract class WorldBorderEvent extends WorldEvent {
|
||||
+
|
||||
+ private final WorldBorder worldBorder;
|
||||
+ protected final WorldBorder worldBorder;
|
||||
+
|
||||
+ public WorldBorderEvent(@NotNull World world, @NotNull WorldBorder worldBorder) {
|
||||
+ @ApiStatus.Internal
|
||||
+ protected WorldBorderEvent(@NotNull World world, @NotNull WorldBorder worldBorder) {
|
||||
+ super(world);
|
||||
+ this.worldBorder = worldBorder;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public WorldBorder getWorldBorder() {
|
||||
+ return worldBorder;
|
||||
+ return this.worldBorder;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] added PlayerNameEntityEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java
|
||||
new file mode 100755
|
||||
index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297acb9d1986
|
||||
index 0000000000000000000000000000000000000000..84736d4a438e9023fbdeac1aea4d8b741cc39b61
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java
|
||||
@@ -0,0 +1,118 @@
|
||||
@@ -0,0 +1,110 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -26,11 +27,15 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+ */
|
||||
+public class PlayerNameEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private LivingEntity entity;
|
||||
+ private Component name;
|
||||
+ private boolean persistent;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerNameEntityEvent(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Component name, boolean persistent) {
|
||||
+ super(player);
|
||||
+ this.entity = entity;
|
||||
@ -40,11 +45,12 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the name to be given to the entity.
|
||||
+ *
|
||||
+ * @return the name
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component getName() {
|
||||
+ return name;
|
||||
+ return this.name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -63,7 +69,7 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return entity;
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -81,7 +87,7 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+ * @return persistent
|
||||
+ */
|
||||
+ public boolean isPersistent() {
|
||||
+ return persistent;
|
||||
+ return this.persistent;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -93,30 +99,16 @@ index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297a
|
||||
+ this.persistent = persistent;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Added PlayerDeepSleepEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e3ee540bb0a5bc578b148fbcf8b5e39ab9c8575c
|
||||
index 0000000000000000000000000000000000000000..54cf2ec5e025fac9a0c8f151ff4f8c83a62b8405
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,48 @@
|
||||
+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.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -31,13 +32,14 @@ index 0000000000000000000000000000000000000000..e3ee540bb0a5bc578b148fbcf8b5e39a
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerDeepSleepEvent(@NotNull Player player) {
|
||||
+ super(player);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Added PlayerBedFailEnterEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3cadb133948
|
||||
index 0000000000000000000000000000000000000000..6cd803e108dc2e6c0b8afda123123450403ef729
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java
|
||||
@@ -0,0 +1,119 @@
|
||||
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -29,8 +30,10 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+ private final Block bed;
|
||||
+ private boolean willExplode;
|
||||
+ private Component message;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerBedFailEnterEvent(@NotNull Player player, @NotNull FailReason failReason, @NotNull Block bed, boolean willExplode, @Nullable Component message) {
|
||||
+ super(player);
|
||||
+ this.failReason = failReason;
|
||||
@ -41,16 +44,16 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+
|
||||
+ @NotNull
|
||||
+ public FailReason getFailReason() {
|
||||
+ return failReason;
|
||||
+ return this.failReason;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Block getBed() {
|
||||
+ return bed;
|
||||
+ return this.bed;
|
||||
+ }
|
||||
+
|
||||
+ public boolean getWillExplode() {
|
||||
+ return willExplode;
|
||||
+ return this.willExplode;
|
||||
+ }
|
||||
+
|
||||
+ public void setWillExplode(boolean willExplode) {
|
||||
@ -59,7 +62,7 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Component getMessage() {
|
||||
+ return message;
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
+ public void setMessage(@Nullable Component message) {
|
||||
@ -68,19 +71,18 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancel this event.
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * <b>NOTE: This does not cancel the player getting in the bed, but any messages/explosions
|
||||
+ * that may occur because of the interaction.</b>
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ * <b>NOTE</b>: This does not cancel the player getting in the bed, but any messages/explosions
|
||||
+ * that may occur because of the interaction.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
@ -94,7 +96,7 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static enum FailReason {
|
||||
+ public enum FailReason {
|
||||
+ /**
|
||||
+ * The world doesn't allow sleeping (ex. Nether or The End). Entering
|
||||
+ * the bed is prevented and the bed explodes.
|
||||
@ -124,8 +126,6 @@ index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3ca
|
||||
+ /**
|
||||
+ * Entering the bed is prevented due to there being monsters nearby.
|
||||
+ */
|
||||
+ NOT_SAFE;
|
||||
+
|
||||
+ public static final FailReason[] VALUES = values();
|
||||
+ NOT_SAFE
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,16 +6,17 @@ Subject: [PATCH] Introduce beacon activation/deactivation events
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7575ca7dd84dee89528ec2e5e5f99f97d8a10f58
|
||||
index 0000000000000000000000000000000000000000..05609ec9df637c9aa53528218cbc8cda30f0aea1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,43 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Beacon;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -23,8 +24,10 @@ index 0000000000000000000000000000000000000000..7575ca7dd84dee89528ec2e5e5f99f97
|
||||
+ * Activation occurs when the beacon beam becomes visible.
|
||||
+ */
|
||||
+public class BeaconActivatedEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconActivatedEvent(@NotNull Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
@ -36,26 +39,26 @@ index 0000000000000000000000000000000000000000..7575ca7dd84dee89528ec2e5e5f99f97
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Beacon getBeacon() {
|
||||
+ return (Beacon) block.getState();
|
||||
+ return (Beacon) this.block.getState();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34f18468b4cfc08717cc3442778c9e85124e5a22
|
||||
index 0000000000000000000000000000000000000000..dc106d6bfbd9d0ab84b17597d71381a5c0b07d64
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java
|
||||
@@ -0,0 +1,43 @@
|
||||
@@ -0,0 +1,46 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
@ -63,6 +66,7 @@ index 0000000000000000000000000000000000000000..34f18468b4cfc08717cc3442778c9e85
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -70,32 +74,34 @@ index 0000000000000000000000000000000000000000..34f18468b4cfc08717cc3442778c9e85
|
||||
+ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed.
|
||||
+ */
|
||||
+public class BeaconDeactivatedEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconDeactivatedEvent(@NotNull Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the beacon that was deactivated.
|
||||
+ * This will return null if the beacon does not exist.
|
||||
+ * This will return {@code null} if the beacon does not exist.
|
||||
+ * (which can occur after the deactivation of a now broken beacon)
|
||||
+ *
|
||||
+ * @return The beacon that got deactivated, or null if it does not exist.
|
||||
+ * @return The beacon that got deactivated, or {@code null} if it does not exist.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Beacon getBeacon() {
|
||||
+ return block.getType() == Material.BEACON ? (Beacon) block.getState() : null;
|
||||
+ return this.block.getType() == Material.BEACON ? (Beacon) this.block.getState() : null;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add EntityInsideBlockEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..109dd7e6d0e7bb0a83fc4c5230f7d5dc122f2bb5
|
||||
index 0000000000000000000000000000000000000000..3e98db83060e614c606de41dcd4b4ac4f242edc9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java
|
||||
@@ -0,0 +1,84 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..109dd7e6d0e7bb0a83fc4c5230f7d5dc
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -58,6 +59,7 @@ index 0000000000000000000000000000000000000000..109dd7e6d0e7bb0a83fc4c5230f7d5dc
|
||||
+ private final Block block;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) {
|
||||
+ super(entity);
|
||||
+ this.block = block;
|
||||
@ -70,12 +72,12 @@ index 0000000000000000000000000000000000000000..109dd7e6d0e7bb0a83fc4c5230f7d5dc
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBlock() {
|
||||
+ return block;
|
||||
+ return this.block;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -6,26 +6,30 @@ Subject: [PATCH] Add PufferFishStateChangeEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8011ad3c9
|
||||
index 0000000000000000000000000000000000000000..4e04b49c1e2bc2a965c9be2388539d9ed5a58f89
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
@@ -0,0 +1,87 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.PufferFish;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called just before a {@link PufferFish} inflates or deflates.
|
||||
+ */
|
||||
+public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private int newPuffState;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int newPuffState;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) {
|
||||
+ super(entity);
|
||||
+ this.newPuffState = newPuffState;
|
||||
@ -34,7 +38,7 @@ index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public PufferFish getEntity() {
|
||||
+ return (PufferFish) entity;
|
||||
+ return (PufferFish) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -42,6 +46,7 @@ index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8
|
||||
+ * <p>
|
||||
+ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.<br>
|
||||
+ * Refer to {@link PufferFish#getPuffState()} to get the current puff state.
|
||||
+ *
|
||||
+ * @return The <strong>new</strong> puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated
|
||||
+ */
|
||||
+ public int getNewPuffState() {
|
||||
@ -50,24 +55,26 @@ index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to inflate.
|
||||
+ * @return If its going to inflate
|
||||
+ *
|
||||
+ * @return If it's going to inflate
|
||||
+ */
|
||||
+ public boolean isInflating() {
|
||||
+ return getNewPuffState() > getEntity().getPuffState();
|
||||
+ return this.newPuffState > this.getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to deflate.
|
||||
+ * @return If its going to deflate
|
||||
+ *
|
||||
+ * @return If it's going to deflate
|
||||
+ */
|
||||
+ public boolean isDeflating() {
|
||||
+ return getNewPuffState() < getEntity().getPuffState();
|
||||
+ return this.newPuffState < this.getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether or not to cancel the {@link PufferFish} (in/de)flating.
|
||||
+ * Set whether to cancel the {@link PufferFish} (in/de)flating.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel the (in/de)flation
|
||||
+ * @param cancel {@code true} if you wish to cancel the (in/de)flation
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
@ -76,17 +83,17 @@ index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,34 +6,37 @@ Subject: [PATCH] Add BellRevealRaiderEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac14cb18fe29391899f6adeb00beacb755a556c7
|
||||
index 0000000000000000000000000000000000000000..e41599405514cd7eea93d842243f6c5c938b93f1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
@@ -0,0 +1,63 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Raider;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a {@link org.bukkit.entity.Raider} is revealed by a bell.
|
||||
+ * Called when a {@link Raider} is revealed by a bell.
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.block.BellResonateEvent}
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class BellRevealRaiderEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Raider raider;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Entity raider) {
|
||||
+ @ApiStatus.Internal
|
||||
+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Raider raider) {
|
||||
+ super(theBlock);
|
||||
+ this.raider = (Raider) raider;
|
||||
+ this.raider = raider;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -43,12 +46,12 @@ index 0000000000000000000000000000000000000000..ac14cb18fe29391899f6adeb00beacb7
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Raider getEntity() {
|
||||
+ return raider;
|
||||
+ return this.raider;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -63,10 +66,10 @@ index 0000000000000000000000000000000000000000..ac14cb18fe29391899f6adeb00beacb7
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,35 +6,33 @@ Subject: [PATCH] Add ElderGuardianAppearanceEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4cd551c8311ff8f7321ed2dc6a4efc87162dadfe
|
||||
index 0000000000000000000000000000000000000000..47eabdc8b1a3a3207f197eeca00f3ca5c9940b89
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
@@ -0,0 +1,67 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.ElderGuardian;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when an {@link org.bukkit.entity.ElderGuardian} appears in front of a {@link org.bukkit.entity.Player}.
|
||||
+ * Is called when an {@link ElderGuardian} appears in front of a {@link Player}.
|
||||
+ */
|
||||
+public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final Player affectedPlayer;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public ElderGuardianAppearanceEvent(@NotNull Entity what, @NotNull Player affectedPlayer) {
|
||||
+ super(what);
|
||||
+ @ApiStatus.Internal
|
||||
+ public ElderGuardianAppearanceEvent(@NotNull ElderGuardian guardian, @NotNull Player affectedPlayer) {
|
||||
+ super(guardian);
|
||||
+ this.affectedPlayer = affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
@ -45,7 +43,7 @@ index 0000000000000000000000000000000000000000..4cd551c8311ff8f7321ed2dc6a4efc87
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getAffectedPlayer() {
|
||||
+ return affectedPlayer;
|
||||
+ return this.affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -55,12 +53,12 @@ index 0000000000000000000000000000000000000000..4cd551c8311ff8f7321ed2dc6a4efc87
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ElderGuardian getEntity() {
|
||||
+ return (ElderGuardian) entity;
|
||||
+ return (ElderGuardian) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -71,11 +69,11 @@ index 0000000000000000000000000000000000000000..4cd551c8311ff8f7321ed2dc6a4efc87
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add WaterBottleSplashEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4c4c645a1597b5afb62f78dc1cfae62c5fe60fcf
|
||||
index 0000000000000000000000000000000000000000..749d37256b9298fe866852e2d00cee99d8079f07
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java
|
||||
@@ -0,0 +1,125 @@
|
||||
@@ -0,0 +1,130 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..4c4c645a1597b5afb62f78dc1cfae62c
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.ThrownPotion;
|
||||
+import org.bukkit.event.entity.PotionSplashEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+
|
||||
@ -27,9 +28,11 @@ index 0000000000000000000000000000000000000000..4c4c645a1597b5afb62f78dc1cfae62c
|
||||
+ * different entities in different ways.
|
||||
+ */
|
||||
+public class WaterBottleSplashEvent extends PotionSplashEvent {
|
||||
+
|
||||
+ private final @NotNull Set<LivingEntity> rehydrate;
|
||||
+ private final @NotNull Set<LivingEntity> extinguish;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WaterBottleSplashEvent(
|
||||
+ final @NotNull ThrownPotion potion,
|
||||
+ final @NotNull Map<LivingEntity, Double> affectedEntities,
|
||||
@ -114,6 +117,7 @@ index 0000000000000000000000000000000000000000..4c4c645a1597b5afb62f78dc1cfae62c
|
||||
+
|
||||
+ /**
|
||||
+ * Doesn't make sense for this event as intensity doesn't vary.
|
||||
+ *
|
||||
+ * @return a confusing value
|
||||
+ * @deprecated check if {@link #getToDamage()} contains an entity
|
||||
+ */
|
||||
@ -125,6 +129,7 @@ index 0000000000000000000000000000000000000000..4c4c645a1597b5afb62f78dc1cfae62c
|
||||
+
|
||||
+ /**
|
||||
+ * Doesn't make sense for this event as intensity doesn't vary.
|
||||
+ *
|
||||
+ * @deprecated use {@link #damageAsWaterSensitive(LivingEntity)}
|
||||
+ * or {@link #doNotDamageAsWaterSensitive(LivingEntity)} to change which entities are
|
||||
+ * damaged
|
||||
|
@ -6,22 +6,24 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ce76b07cfaa9173c78e2844add2bc5bb437b1106
|
||||
index 0000000000000000000000000000000000000000..3e8cbd13eb16e0926130bb8b07e2101602b19565
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -0,0 +1,29 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
+import org.bukkit.event.player.PlayerAnimationType;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class PlayerArmSwingEvent extends PlayerAnimationEvent {
|
||||
+
|
||||
+ private final EquipmentSlot equipmentSlot;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerArmSwingEvent(@NotNull Player player, @NotNull EquipmentSlot equipmentSlot) {
|
||||
+ super(player, equipmentSlot == EquipmentSlot.HAND ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);
|
||||
+ this.equipmentSlot = equipmentSlot;
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerSetSpawnEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7b0af8b2a
|
||||
index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c15525acce
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
@@ -0,0 +1,175 @@
|
||||
@@ -0,0 +1,178 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@ -18,11 +18,13 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player's spawn is set, either by themselves or otherwise.<br>
|
||||
+ * Called when a player's spawn is set, either by themselves or otherwise.
|
||||
+ * <br>
|
||||
+ * Cancelling this event will prevent the spawn from being set.
|
||||
+ */
|
||||
+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
|
||||
@ -37,8 +39,9 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerSetSpawnEvent(@NotNull Player who, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
|
||||
+ super(who);
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerSetSpawnEvent(@NotNull Player player, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
|
||||
+ super(player);
|
||||
+ this.cause = cause;
|
||||
+ this.location = location;
|
||||
+ this.forced = forced;
|
||||
@ -53,7 +56,7 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -62,18 +65,18 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ * will change the resulting spawn point of the player. Use
|
||||
+ * {@link Location#clone()} to get a copy of this location.
|
||||
+ *
|
||||
+ * @return the spawn location, or null if removing the location
|
||||
+ * @return the spawn location, or {@code null} if removing the location
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location to be set as the spawn location. The yaw
|
||||
+ * of this location is the spawn angle.
|
||||
+ *
|
||||
+ * @param location the spawn location, or null to remove the spawn location
|
||||
+ * @param location the spawn location, or {@code null} to remove the spawn location
|
||||
+ */
|
||||
+ public void setLocation(@Nullable Location location) {
|
||||
+ this.location = location;
|
||||
@ -82,16 +85,16 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ /**
|
||||
+ * Gets if this is a force spawn location
|
||||
+ *
|
||||
+ * @return true if forced
|
||||
+ * @return {@code true} if forced
|
||||
+ */
|
||||
+ public boolean isForced() {
|
||||
+ return forced;
|
||||
+ return this.forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this is a forced spawn location
|
||||
+ *
|
||||
+ * @param forced true to force
|
||||
+ * @param forced {@code true} to force
|
||||
+ */
|
||||
+ public void setForced(boolean forced) {
|
||||
+ this.forced = forced;
|
||||
@ -101,17 +104,17 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ * Gets if this action will notify the player their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @return true to notify
|
||||
+ * @return {@code true} to notify
|
||||
+ */
|
||||
+ public boolean willNotifyPlayer() {
|
||||
+ return notifyPlayer;
|
||||
+ return this.notifyPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this action will notify the player that their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @param notifyPlayer true to notify
|
||||
+ * @param notifyPlayer {@code true} to notify
|
||||
+ */
|
||||
+ public void setNotifyPlayer(boolean notifyPlayer) {
|
||||
+ this.notifyPlayer = notifyPlayer;
|
||||
@ -121,17 +124,17 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ * Gets the notification message that will be sent to the player
|
||||
+ * if {@link #willNotifyPlayer()} returns true.
|
||||
+ *
|
||||
+ * @return null if no notification
|
||||
+ * @return {@code null} if no notification
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component getNotification() {
|
||||
+ return notification;
|
||||
+ return this.notification;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the notification message that will be sent to the player.
|
||||
+ *
|
||||
+ * @param notification null to send no message
|
||||
+ * @param notification {@code null} to send no message
|
||||
+ */
|
||||
+ public void setNotification(@Nullable Component notification) {
|
||||
+ this.notification = notification;
|
||||
@ -175,8 +178,8 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7
|
||||
+ */
|
||||
+ COMMAND,
|
||||
+ /**
|
||||
+ * When a plugin uses {@link Player#setBedSpawnLocation(Location)} or
|
||||
+ * {@link Player#setBedSpawnLocation(Location, boolean)}.
|
||||
+ * When a plugin uses {@link Player#setRespawnLocation(Location)} or
|
||||
+ * {@link Player#setRespawnLocation(Location, boolean)}.
|
||||
+ */
|
||||
+ PLUGIN,
|
||||
+ /**
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Added EntityDamageItemEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47278efcce
|
||||
index 0000000000000000000000000000000000000000..72ac972dea684a3ffac3bd48726746be0620af2e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,81 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -28,10 +29,13 @@ index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47
|
||||
+public class EntityDamageItemEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack item;
|
||||
+ private int damage;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityDamageItemEvent(@NotNull Entity entity, @NotNull ItemStack item, int damage) {
|
||||
+ super(entity);
|
||||
+ this.item = item;
|
||||
@ -45,7 +49,7 @@ index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -54,7 +58,7 @@ index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47
|
||||
+ * @return durability change
|
||||
+ */
|
||||
+ public int getDamage() {
|
||||
+ return damage;
|
||||
+ return this.damage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -68,12 +72,12 @@ index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
|
@ -6,17 +6,17 @@ Subject: [PATCH] Add BlockBreakBlockEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..51129c5c90dafdba08b7f533a71448ace56381d5
|
||||
index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993eace410d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
@@ -0,0 +1,61 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.event.block.BlockExpEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
@ -30,9 +30,10 @@ index 0000000000000000000000000000000000000000..51129c5c90dafdba08b7f533a71448ac
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final List<ItemStack> drops;
|
||||
+ private final Block source;
|
||||
+ private final List<ItemStack> drops;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List<ItemStack> drops) {
|
||||
+ super(block, 0);
|
||||
+ this.source = source;
|
||||
@ -40,13 +41,13 @@ index 0000000000000000000000000000000000000000..51129c5c90dafdba08b7f533a71448ac
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the drops of this event
|
||||
+ * Gets the drops of this event
|
||||
+ *
|
||||
+ * @return the drops
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return drops;
|
||||
+ return this.drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -56,7 +57,7 @@ index 0000000000000000000000000000000000000000..51129c5c90dafdba08b7f533a71448ac
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getSource() {
|
||||
+ return source;
|
||||
+ return this.source;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
|
@ -6,19 +6,19 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..451fb94a5802755c255e04aebb40f178bbfbf996
|
||||
index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f563552414488079e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
|
||||
@@ -0,0 +1,97 @@
|
||||
@@ -0,0 +1,104 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.entity.ItemFrame;
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
@ -27,12 +27,15 @@ index 0000000000000000000000000000000000000000..451fb94a5802755c255e04aebb40f178
|
||||
+ */
|
||||
+public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final ItemFrame itemFrame;
|
||||
+ private ItemStack itemStack;
|
||||
+ private final ItemFrameChangeAction action;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemFrame itemFrame;
|
||||
+ private final ItemFrameChangeAction action;
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemFrameChangeEvent(@NotNull Player player, @NotNull ItemFrame itemFrame,
|
||||
+ @NotNull ItemStack itemStack, @NotNull ItemFrameChangeAction action) {
|
||||
+ super(player);
|
||||
@ -43,46 +46,50 @@ index 0000000000000000000000000000000000000000..451fb94a5802755c255e04aebb40f178
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemFrame} involved in this event.
|
||||
+ *
|
||||
+ * @return the {@link ItemFrame}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemFrame getItemFrame() {
|
||||
+ return itemFrame;
|
||||
+ return this.itemFrame;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemStack} involved in this event.
|
||||
+ * This is the item being added, rotated, or removed from the {@link ItemFrame}.
|
||||
+ * <p>If this method returns air, then the resulting item in the ItemFrame will be empty.</p>
|
||||
+ * <p>
|
||||
+ * If this method returns air, then the resulting item in the ItemFrame will be empty.
|
||||
+ *
|
||||
+ * @return the {@link ItemStack} being added, rotated, or removed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the {@link ItemStack} that this {@link ItemFrame} holds.
|
||||
+ * If null is provided, the ItemStack will become air and the result in the ItemFrame will be empty.
|
||||
+ * If {@code null} is provided, the ItemStack will become air and the result in the ItemFrame will be empty.
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemFrame} item
|
||||
+ */
|
||||
+ public void setItemStack(@Nullable ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack == null ? new ItemStack(Material.AIR) : itemStack;
|
||||
+ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the action that was performed on this {@link ItemFrame}.
|
||||
+ * @see ItemFrameChangeAction
|
||||
+ *
|
||||
+ * @return action performed on the item frame in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemFrameChangeAction getAction() {
|
||||
+ return action;
|
||||
+ return this.action;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -93,12 +100,12 @@ index 0000000000000000000000000000000000000000..451fb94a5802755c255e04aebb40f178
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum ItemFrameChangeAction {
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add TameableDeathMessageEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..70cd37aefbd5d64c798ab2fc3b6d502134690348
|
||||
index 0000000000000000000000000000000000000000..5d449b90829bca7a6ff3060b637561d8f99dc156
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
@@ -0,0 +1,72 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..70cd37aefbd5d64c798ab2fc3b6d5021
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
@ -24,12 +25,14 @@ index 0000000000000000000000000000000000000000..70cd37aefbd5d64c798ab2fc3b6d5021
|
||||
+ */
|
||||
+public class TameableDeathMessageEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private Component deathMessage;
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ public TameableDeathMessageEvent(@NotNull Tameable what, @NotNull Component deathMessage) {
|
||||
+ super(what);
|
||||
+ private Component deathMessage;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TameableDeathMessageEvent(@NotNull Tameable tameable, @NotNull Component deathMessage) {
|
||||
+ super(tameable);
|
||||
+ this.deathMessage = deathMessage;
|
||||
+ }
|
||||
+
|
||||
@ -49,12 +52,18 @@ index 0000000000000000000000000000000000000000..70cd37aefbd5d64c798ab2fc3b6d5021
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Component deathMessage() {
|
||||
+ return deathMessage;
|
||||
+ return this.deathMessage;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Tameable getEntity() {
|
||||
+ return (Tameable) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -64,18 +73,12 @@ index 0000000000000000000000000000000000000000..70cd37aefbd5d64c798ab2fc3b6d5021
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Tameable getEntity() {
|
||||
+ return (Tameable) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -37,33 +37,39 @@ index 0000000000000000000000000000000000000000..bb68e6a2528eee81eb3f26f22b9c3550
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aefbaccd32f1ab25a4da63bdc878922e0c220478
|
||||
index 0000000000000000000000000000000000000000..c43a3ad32902dbb13287e801375213745ce07b3c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java
|
||||
@@ -0,0 +1,75 @@
|
||||
@@ -0,0 +1,81 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.DyeColor;
|
||||
+import org.bukkit.entity.Cat;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.Sheep;
|
||||
+import org.bukkit.entity.Wolf;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity is dyed. Currently, this is called for {@link org.bukkit.entity.Sheep}
|
||||
+ * being dyed, and {@link org.bukkit.entity.Wolf}/{@link org.bukkit.entity.Cat} collars being dyed.
|
||||
+ * Called when an entity is dyed. Currently, this is called for {@link Sheep}
|
||||
+ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed.
|
||||
+ */
|
||||
+public class EntityDyeEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private DyeColor dyeColor;
|
||||
+ private final Player player;
|
||||
+ private boolean cancel;
|
||||
+ private DyeColor dyeColor;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityDyeEvent(@NotNull Entity entity, @NotNull DyeColor dyeColor, @Nullable Player player) {
|
||||
+ super(entity);
|
||||
+ this.dyeColor = dyeColor;
|
||||
@ -91,20 +97,20 @@ index 0000000000000000000000000000000000000000..aefbaccd32f1ab25a4da63bdc878922e
|
||||
+ /**
|
||||
+ * Returns the player dyeing the entity, if available.
|
||||
+ *
|
||||
+ * @return player or null
|
||||
+ * @return player or {@code null}
|
||||
+ */
|
||||
+ public @Nullable Player getPlayer() {
|
||||
+ return player;
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancel;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -117,7 +123,7 @@ index 0000000000000000000000000000000000000000..aefbaccd32f1ab25a4da63bdc878922e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
|
||||
index 9bc385682472418c787481bbc809f238194d5918..4ea1027c8540cdba82acf829d0720846b3a13e3e 100644
|
||||
index 0534fbc228f64cf3b361ab097d9b88212bdb0f36..d03adfaa4176617ef2ace2754fe02b63860e3aee 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Cat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Cat.java
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
In neuem Issue referenzieren
Einen Benutzer sperren