SPIGOT-4586: Change PotionEffectType#value to not include null

As the PotionEffectType class is containing a bunch of constant values
the values method now fits the general idea of the Enum#values method as
it no longer returns a null object at index 0

By: Bjarne Koll <LynxPlay101@gmail.com>
This commit is contained in:
Bukkit/Spigot 2019-01-22 16:29:09 +01:00
parent d0a2aeaa99
commit 5c113e7369

View file

@ -1,5 +1,6 @@
package org.bukkit.potion; package org.bukkit.potion;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -303,11 +304,11 @@ public abstract class PotionEffectType {
/** /**
* Returns an array of all the registered {@link PotionEffectType}s. * Returns an array of all the registered {@link PotionEffectType}s.
* This array is not necessarily in any particular order and may contain null. * This array is not necessarily in any particular order.
* *
* @return Array of types. * @return Array of types.
*/ */
public static PotionEffectType[] values() { public static PotionEffectType[] values() {
return byId.clone(); return Arrays.copyOfRange(byId, 1, byId.length);
} }
} }