2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
|
|
Date: Tue, 5 Jan 2021 10:19:11 +0200
|
|
|
|
Subject: [PATCH] Add missing effects
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
|
2022-12-14 06:03:57 +01:00
|
|
|
index 879d637691683ca862045402f74b751a892bf3ff..e6573b8bd45e0d3ae4f46d64996fa67f13d29f2b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Effect.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Effect.java
|
2022-12-14 06:03:57 +01:00
|
|
|
@@ -337,7 +337,100 @@ public enum Effect {
|
2021-09-11 19:27:48 +02:00
|
|
|
* block.
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
2021-09-11 19:27:48 +02:00
|
|
|
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start - add missing effects
|
|
|
|
+ /**
|
|
|
|
+ * The sound of a wither spawning
|
|
|
|
+ */
|
|
|
|
+ WITHER_SPAWNED(1023, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of an ender dragon dying
|
|
|
|
+ */
|
|
|
|
+ ENDER_DRAGON_DEATH(1028, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of an ender portal being created in the overworld
|
|
|
|
+ */
|
|
|
|
+ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of phantom's bites
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #PHANTOM_BITE}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ PHANTOM_BITES(1039, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of zombie converting to drowned zombie
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #ZOMBIE_CONVERTED_TO_DROWNED}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of a husk converting to zombie by drowning
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #HUSK_CONVERTED_TO_ZOMBIE}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of a grindstone being used
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #GRINDSTONE_USE}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ GRINDSTONE_USED(1042, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * The sound of a book page being turned
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #BOOK_PAGE_TURN}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ BOOK_PAGE_TURNED(1043, Type.SOUND),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayed when a composter composts
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #COMPOSTER_FILL_ATTEMPT}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ COMPOSTER_COMPOSTS(1500, Type.VISUAL),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayed when lava converts a block (either water to stone, or
|
|
|
|
+ * removing existing blocks such as torches)
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #LAVA_INTERACT}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ LAVA_CONVERTS_BLOCK(1501, Type.VISUAL),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayd when a redstone torch burns out
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #REDSTONE_TORCH_BURNOUT}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayed when an ender eye is placed
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #END_PORTAL_FRAME_FILL}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ ENDER_EYE_PLACED(1503, Type.VISUAL),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayed when an ender dragon destroys block
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #ENDER_DRAGON_DESTROY_BLOCK}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+ ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL),
|
|
|
|
+ /**
|
|
|
|
+ * Particles displayed when a wet sponge vaporizes in nether.
|
2021-09-11 19:27:48 +02:00
|
|
|
+ *
|
|
|
|
+ * @deprecated use {@link #SPONGE_DRY}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2021-09-11 19:27:48 +02:00
|
|
|
+ @Deprecated(forRemoval = true)
|
|
|
|
+ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL),
|
2021-06-11 14:02:28 +02:00
|
|
|
;
|
2021-09-11 19:27:48 +02:00
|
|
|
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
|
|
|
|
+ // Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
private final int id;
|
2021-09-11 19:27:48 +02:00
|
|
|
private final Type type;
|
2022-12-14 06:03:57 +01:00
|
|
|
@@ -397,10 +490,22 @@ public enum Effect {
|
2021-09-11 19:27:48 +02:00
|
|
|
|
|
|
|
static {
|
|
|
|
for (Effect effect : values()) {
|
|
|
|
+ if (!isDeprecated(effect)) // Paper
|
|
|
|
BY_ID.put(effect.id, effect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ private static boolean isDeprecated(Effect effect) {
|
|
|
|
+ try {
|
|
|
|
+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class);
|
|
|
|
+ } catch (NoSuchFieldException e) {
|
|
|
|
+ LOGGER.error("Error getting effect enum field {}", effect.name(), e);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents the type of an effect.
|
|
|
|
*/
|
|
|
|
diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java
|
|
|
|
index 54e621e86e8fe3414099494d419929b282b33489..759081f15992e07271567d65250f27f14f6c99c3 100644
|
|
|
|
--- a/src/test/java/org/bukkit/EffectTest.java
|
|
|
|
+++ b/src/test/java/org/bukkit/EffectTest.java
|
|
|
|
@@ -5,10 +5,24 @@ import static org.junit.Assert.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
public class EffectTest {
|
|
|
|
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper
|
|
|
|
+
|
|
|
|
@Test
|
|
|
|
public void getById() {
|
|
|
|
for (Effect effect : Effect.values()) {
|
|
|
|
+ if (!isDeprecated(effect)) // Paper
|
|
|
|
assertThat(Effect.getById(effect.getId()), is(effect));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ private static boolean isDeprecated(Effect effect) {
|
|
|
|
+ try {
|
|
|
|
+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class);
|
|
|
|
+ } catch (NoSuchFieldException e) {
|
|
|
|
+ LOGGER.error("Error getting effect enum field {}", effect.name(), e);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|