#1029: Trial changing a small number of inner enums to classes/interfaces to better support custom values
This PR is a subset of the enum PR #660 and is designed as a low impact trial run of the design and backwards compatibility to inform subsequent development. Additional plugin compatibility features may be available by setting `settings.compatibility.enum-compatibility-mode` to `true` in `bukkit.yml`. By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
42
paper-api/src/main/java/org/bukkit/util/OldEnum.java
Normal file
42
paper-api/src/main/java/org/bukkit/util/OldEnum.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package org.bukkit.util;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Class which holds common methods which are present in an enum.
|
||||
*
|
||||
* @param <T> the type of the old enum.
|
||||
* @deprecated only for backwards compatibility.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@Deprecated(since = "1.21")
|
||||
public interface OldEnum<T extends OldEnum<T>> extends Comparable<T> {
|
||||
|
||||
/**
|
||||
* @param other to compare to.
|
||||
* @return negative if this old enum is lower, zero if equal and positive if
|
||||
* higher than the given old enum.
|
||||
* @deprecated only for backwards compatibility, old enums can not be
|
||||
* compared.
|
||||
*/
|
||||
@Deprecated(since = "1.21")
|
||||
@Override
|
||||
int compareTo(@NotNull T other);
|
||||
|
||||
/**
|
||||
* @return the name of the old enum.
|
||||
* @deprecated only for backwards compatibility.
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21")
|
||||
String name();
|
||||
|
||||
/**
|
||||
* @return the ordinal of the old enum.
|
||||
* @deprecated only for backwards compatibility, it is not guaranteed that
|
||||
* an old enum always has the same ordinal.
|
||||
*/
|
||||
@Deprecated(since = "1.21")
|
||||
int ordinal();
|
||||
}
|
||||
Reference in New Issue
Block a user