From 095237cd5db3b7169df1275759c885b42d9d8d45 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Tue, 19 Feb 2019 10:09:45 +0100 Subject: [PATCH] Flags#values() will no longer return deprecated flags Deprecated Flags are flags that will be removed. It is therefore better to not return them in this method. --- src/main/java/world/bentobox/bentobox/lists/Flags.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/bentobox/lists/Flags.java b/src/main/java/world/bentobox/bentobox/lists/Flags.java index 606ee62d6..97668db02 100644 --- a/src/main/java/world/bentobox/bentobox/lists/Flags.java +++ b/src/main/java/world/bentobox/bentobox/lists/Flags.java @@ -167,6 +167,8 @@ public final class Flags { * - The Crazy World of Arthur Brown */ public static final Flag FIRE = new Flag.Builder("FIRE", Material.FLINT_AND_STEEL).listener(new FireListener()).build(); + + public static final Flag FIRE_EXTINGUISH = new Flag.Builder("FIRE_EXTINGUISH", Material.POTION).build(); // Inventories @@ -335,7 +337,9 @@ public final class Flags { * @return List of all the flags in this class */ public static List values() { - return Arrays.stream(Flags.class.getFields()).map(field -> { + return Arrays.stream(Flags.class.getFields()) + .filter(field -> field.getAnnotation(Deprecated.class) == null) // Ensures it is not deprecated + .map(field -> { try { return (Flag)field.get(null); } catch (IllegalArgumentException | IllegalAccessException e) {