Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Javadoc additions
Dieser Commit ist enthalten in:
Ursprung
00b8289c61
Commit
b23c01c44b
@ -34,22 +34,67 @@ import java.util.Set;
|
|||||||
|
|
||||||
public interface ViaManager {
|
public interface ViaManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the protocol manager for registering/getting protocols and their mapping data loading.
|
||||||
|
*
|
||||||
|
* @return protocol manager
|
||||||
|
*/
|
||||||
ProtocolManager getProtocolManager();
|
ProtocolManager getProtocolManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns platform for handling platform specific configuration, tasks, and plugin data.
|
||||||
|
*
|
||||||
|
* @return platform
|
||||||
|
*/
|
||||||
ViaPlatform<?> getPlatform();
|
ViaPlatform<?> getPlatform();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the userconnection manager for handling clients connected to the server.
|
||||||
|
*
|
||||||
|
* @return userconnection manager
|
||||||
|
*/
|
||||||
ViaConnectionManager getConnectionManager();
|
ViaConnectionManager getConnectionManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the manager for Via providers.
|
||||||
|
*
|
||||||
|
* @return provider manager
|
||||||
|
*/
|
||||||
ViaProviders getProviders();
|
ViaProviders getProviders();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the injector for injecting netty handlers and initially getting the server protocol version.
|
||||||
|
*
|
||||||
|
* @return injector
|
||||||
|
*/
|
||||||
ViaInjector getInjector();
|
ViaInjector getInjector();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command handler for managing ViaVersion subcommands.
|
||||||
|
*
|
||||||
|
* @return command handler
|
||||||
|
*/
|
||||||
ViaVersionCommand getCommandHandler();
|
ViaVersionCommand getCommandHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the platform loader responsible for registering listeners, providers and such.
|
||||||
|
*
|
||||||
|
* @return platform loader
|
||||||
|
*/
|
||||||
ViaPlatformLoader getLoader();
|
ViaPlatformLoader getLoader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If debug is enabled, packets and other otherwise suppressed warnings will be logged.
|
||||||
|
*
|
||||||
|
* @return true if enabled
|
||||||
|
*/
|
||||||
boolean isDebug();
|
boolean isDebug();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the debug mode. If enabled, packets and other otherwise suppressed warnings will be logged.
|
||||||
|
*
|
||||||
|
* @param debug whether debug should be enabled
|
||||||
|
*/
|
||||||
void setDebug(boolean debug);
|
void setDebug(boolean debug);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -205,6 +205,8 @@ public class MappingDataLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns a map of the object entries hashed by their id value.
|
||||||
|
*
|
||||||
* @param object json object
|
* @param object json object
|
||||||
* @return map with indexes hashed by their id value
|
* @return map with indexes hashed by their id value
|
||||||
*/
|
*/
|
||||||
@ -218,6 +220,8 @@ public class MappingDataLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns a map of the array entries hashed by their id value.
|
||||||
|
*
|
||||||
* @param array json array
|
* @param array json array
|
||||||
* @return map with indexes hashed by their id value
|
* @return map with indexes hashed by their id value
|
||||||
*/
|
*/
|
||||||
|
@ -27,15 +27,24 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
public interface EntityType {
|
public interface EntityType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the entity id.
|
||||||
|
*
|
||||||
* @return entity id
|
* @return entity id
|
||||||
*/
|
*/
|
||||||
int getId();
|
int getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the parent entity type if present.
|
||||||
|
*
|
||||||
* @return parent entity type if present
|
* @return parent entity type if present
|
||||||
*/
|
*/
|
||||||
@Nullable EntityType getParent();
|
@Nullable EntityType getParent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity type name, not necessarily matching the Vanilla type name.
|
||||||
|
*
|
||||||
|
* @return entity type name
|
||||||
|
*/
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
default boolean is(EntityType... types) {
|
default boolean is(EntityType... types) {
|
||||||
@ -52,6 +61,8 @@ public interface EntityType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns whether the current type is equal to the given type, or has it as a parent type.
|
||||||
|
*
|
||||||
* @param type entity type to check against
|
* @param type entity type to check against
|
||||||
* @return true if the current type is equal to the given type, or has it as a parent type
|
* @return true if the current type is equal to the given type, or has it as a parent type
|
||||||
*/
|
*/
|
||||||
|
@ -25,21 +25,29 @@ package us.myles.ViaVersion.api.minecraft;
|
|||||||
public interface BlockChangeRecord {
|
public interface BlockChangeRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the relative x coordinate within the chunk section.
|
||||||
|
*
|
||||||
* @return relative x coordinate within the chunk section
|
* @return relative x coordinate within the chunk section
|
||||||
*/
|
*/
|
||||||
byte getSectionX();
|
byte getSectionX();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the relative y coordinate within the chunk section.
|
||||||
|
*
|
||||||
* @return relative y coordinate within the chunk section
|
* @return relative y coordinate within the chunk section
|
||||||
*/
|
*/
|
||||||
byte getSectionY();
|
byte getSectionY();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the relative z coordinate within the chunk section.
|
||||||
|
*
|
||||||
* @return relative z coordinate within the chunk section
|
* @return relative z coordinate within the chunk section
|
||||||
*/
|
*/
|
||||||
byte getSectionZ();
|
byte getSectionZ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the absolute y coordinate based on the given chunk section y.
|
||||||
|
*
|
||||||
* @param chunkSectionY chunk section
|
* @param chunkSectionY chunk section
|
||||||
* @return absolute y coordinate
|
* @return absolute y coordinate
|
||||||
*/
|
*/
|
||||||
|
@ -35,12 +35,16 @@ public interface Chunk {
|
|||||||
int getZ();
|
int getZ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether this chunk holds biome data, always true for 1.17+ chunks
|
* Returns whether this chunk holds biome data, always true for 1.17+ chunks.
|
||||||
|
*
|
||||||
|
* @return true if this chunk holds biome data
|
||||||
*/
|
*/
|
||||||
boolean isBiomeData();
|
boolean isBiomeData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether this is a full chunk, always true for 1.17+ chunks
|
* Returns whether this is a full chunk, always true for 1.17+ chunks.
|
||||||
|
*
|
||||||
|
* @return true if this is a full chunk
|
||||||
*/
|
*/
|
||||||
boolean isFullChunk();
|
boolean isFullChunk();
|
||||||
|
|
||||||
@ -54,6 +58,8 @@ public interface Chunk {
|
|||||||
void setIgnoreOldLightData(boolean ignoreOldLightData);
|
void setIgnoreOldLightData(boolean ignoreOldLightData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the chunk section bit mask for chunks < 1.17.
|
||||||
|
*
|
||||||
* @return chunk section bit mask for chunks < 1.17
|
* @return chunk section bit mask for chunks < 1.17
|
||||||
* @see #getChunkMask()
|
* @see #getChunkMask()
|
||||||
*/
|
*/
|
||||||
@ -62,7 +68,9 @@ public interface Chunk {
|
|||||||
void setBitmask(int bitmask);
|
void setBitmask(int bitmask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return chunk section bit mask, only non-null available for 1.17+ chunks
|
* Returns the chunk section bit mask, only non-null for 1.17+ chunks.
|
||||||
|
*
|
||||||
|
* @return chunk section bit mask, only non-null for 1.17+ chunks
|
||||||
* @see #getBitmask()
|
* @see #getBitmask()
|
||||||
*/
|
*/
|
||||||
@Nullable BitSet getChunkMask();
|
@Nullable BitSet getChunkMask();
|
||||||
|
@ -31,12 +31,16 @@ package us.myles.ViaVersion.api.protocol;
|
|||||||
public interface PacketType {
|
public interface PacketType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return name of the packet, to be consistent over multiple versions
|
* Returns the name of the packet, to be consistent over multiple versions.
|
||||||
|
*
|
||||||
|
* @return name of the packet
|
||||||
*/
|
*/
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ordinal, being the packet id for the implemented protocol
|
* Returns the ordinal, being the packet id for the implemented protocol.
|
||||||
|
*
|
||||||
|
* @return packet id for the implemented protocol
|
||||||
*/
|
*/
|
||||||
int ordinal();
|
int ordinal();
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,15 @@ package us.myles.ViaVersion.api.protocol;
|
|||||||
public interface ProtocolPathKey {
|
public interface ProtocolPathKey {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the client protocol version.
|
||||||
|
*
|
||||||
* @return client protocol version
|
* @return client protocol version
|
||||||
*/
|
*/
|
||||||
int getClientProtocolVersion();
|
int getClientProtocolVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the server protocol version.
|
||||||
|
*
|
||||||
* @return server protocol version
|
* @return server protocol version
|
||||||
*/
|
*/
|
||||||
int getServerProtocolVersion();
|
int getServerProtocolVersion();
|
||||||
|
@ -30,7 +30,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -91,6 +91,15 @@ public class ProtocolVersion {
|
|||||||
return register(version, -1, name, versionRange);
|
return register(version, -1, name, versionRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a protocol version.
|
||||||
|
*
|
||||||
|
* @param version release protocol version
|
||||||
|
* @param snapshotVersion snapshot protocol version, or -1 if not a snapshot
|
||||||
|
* @param name version name
|
||||||
|
* @param versionRange range of versions that are supported by this protocol version, null if not a range
|
||||||
|
* @return registered {@link ProtocolVersion}
|
||||||
|
*/
|
||||||
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
||||||
ProtocolVersion protocol = new ProtocolVersion(version, snapshotVersion, name, versionRange);
|
ProtocolVersion protocol = new ProtocolVersion(version, snapshotVersion, name, versionRange);
|
||||||
versionList.add(protocol);
|
versionList.add(protocol);
|
||||||
@ -101,10 +110,23 @@ public class ProtocolVersion {
|
|||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a protocol with the given protocol version is registered.
|
||||||
|
*
|
||||||
|
* @param id protocol version
|
||||||
|
* @return true if this protocol version has been registered
|
||||||
|
*/
|
||||||
public static boolean isRegistered(int id) {
|
public static boolean isRegistered(int id) {
|
||||||
return versions.containsKey(id);
|
return versions.containsKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a {@link ProtocolVersion} instance, even if this protocol version
|
||||||
|
* has not been registered. See {@link #isRegistered(int)} berorehand or {@link #isKnown()}.
|
||||||
|
*
|
||||||
|
* @param id protocol version
|
||||||
|
* @return registered or unknown {@link ProtocolVersion}
|
||||||
|
*/
|
||||||
public static @NonNull ProtocolVersion getProtocol(int id) {
|
public static @NonNull ProtocolVersion getProtocol(int id) {
|
||||||
ProtocolVersion protocolVersion = versions.get(id);
|
ProtocolVersion protocolVersion = versions.get(id);
|
||||||
if (protocolVersion != null) {
|
if (protocolVersion != null) {
|
||||||
@ -114,14 +136,33 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the internal index of the stored protocol version.
|
||||||
|
*
|
||||||
|
* @param version protocol version instance
|
||||||
|
* @return internal index of the stored protocol version
|
||||||
|
*/
|
||||||
public static int getIndex(ProtocolVersion version) {
|
public static int getIndex(ProtocolVersion version) {
|
||||||
return versionList.indexOf(version);
|
return versionList.indexOf(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an immutable list of registered protocol versions.
|
||||||
|
*
|
||||||
|
* @return immutable list of registered protocol versions
|
||||||
|
*/
|
||||||
public static List<ProtocolVersion> getProtocols() {
|
public static List<ProtocolVersion> getProtocols() {
|
||||||
return Collections.unmodifiableList(new ArrayList<>(versions.values()));
|
return Collections.unmodifiableList(new ArrayList<>(versions.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the registered protocol version if present, else null.
|
||||||
|
* This accepts the actual registered names (like "1.16.4/5") as well as
|
||||||
|
* included versions for version ranges and wildcards.
|
||||||
|
*
|
||||||
|
* @param protocol version name, e.g. "1.16.3"
|
||||||
|
* @return registered protocol version if present, else null
|
||||||
|
*/
|
||||||
public static @Nullable ProtocolVersion getClosest(String protocol) {
|
public static @Nullable ProtocolVersion getClosest(String protocol) {
|
||||||
for (ProtocolVersion version : versions.values()) {
|
for (ProtocolVersion version : versions.values()) {
|
||||||
String name = version.getName();
|
String name = version.getName();
|
||||||
@ -150,10 +191,20 @@ public class ProtocolVersion {
|
|||||||
private final boolean versionWildcard;
|
private final boolean versionWildcard;
|
||||||
private final Set<String> includedVersions;
|
private final Set<String> includedVersions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param version protocol version
|
||||||
|
* @param name version name
|
||||||
|
*/
|
||||||
public ProtocolVersion(int version, String name) {
|
public ProtocolVersion(int version, String name) {
|
||||||
this(version, -1, name, null);
|
this(version, -1, name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param version protocol version
|
||||||
|
* @param snapshotVersion actual snapshot protocol version, -1 if not a snapshot
|
||||||
|
* @param name version name
|
||||||
|
* @param versionRange range of versions that are supported by this protocol version, null if not a range
|
||||||
|
*/
|
||||||
public ProtocolVersion(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
public ProtocolVersion(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.snapshotVersion = snapshotVersion;
|
this.snapshotVersion = snapshotVersion;
|
||||||
@ -162,7 +213,7 @@ public class ProtocolVersion {
|
|||||||
|
|
||||||
Preconditions.checkArgument(!versionWildcard || versionRange == null, "A version cannot be a wildcard and a range at the same time!");
|
Preconditions.checkArgument(!versionWildcard || versionRange == null, "A version cannot be a wildcard and a range at the same time!");
|
||||||
if (versionRange != null) {
|
if (versionRange != null) {
|
||||||
includedVersions = new HashSet<>();
|
includedVersions = new LinkedHashSet<>();
|
||||||
for (int i = versionRange.getRangeFrom(); i <= versionRange.getRangeTo(); i++) {
|
for (int i = versionRange.getRangeFrom(); i <= versionRange.getRangeTo(); i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
includedVersions.add(versionRange.getBaseVersion()); // Keep both the base version and with ".0" appended
|
includedVersions.add(versionRange.getBaseVersion()); // Keep both the base version and with ".0" appended
|
||||||
@ -176,6 +227,8 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the release protocol version.
|
||||||
|
*
|
||||||
* @return release version
|
* @return release version
|
||||||
*/
|
*/
|
||||||
public int getVersion() {
|
public int getVersion() {
|
||||||
@ -183,6 +236,8 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the snapshot protocol version without the snapshot indicator bit if this is a snapshot protocol version.
|
||||||
|
*
|
||||||
* @return snapshot protocol version without the snapshot indicator bit
|
* @return snapshot protocol version without the snapshot indicator bit
|
||||||
* @throws IllegalArgumentException if the version if not a snapshot version
|
* @throws IllegalArgumentException if the version if not a snapshot version
|
||||||
* @see #isSnapshot()
|
* @see #isSnapshot()
|
||||||
@ -193,6 +248,8 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the snapshot protocol version with the snapshot indicator bit if this is a snapshot protocol version.
|
||||||
|
*
|
||||||
* @return snapshot protocol version with the snapshot indicator bit
|
* @return snapshot protocol version with the snapshot indicator bit
|
||||||
* @throws IllegalArgumentException if the version if not a snapshot version
|
* @throws IllegalArgumentException if the version if not a snapshot version
|
||||||
* @see #isSnapshot()
|
* @see #isSnapshot()
|
||||||
@ -203,18 +260,27 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the release version if release, snapshot version (with the snapshot indicator bit) if snapshot.
|
||||||
|
*
|
||||||
* @return release version if release, snapshot version (with the snapshot indicator bit) if snapshot
|
* @return release version if release, snapshot version (with the snapshot indicator bit) if snapshot
|
||||||
*/
|
*/
|
||||||
public int getOriginalVersion() {
|
public int getOriginalVersion() {
|
||||||
return snapshotVersion == -1 ? version : ((1 << 30) | snapshotVersion);
|
return snapshotVersion == -1 ? version : ((1 << 30) | snapshotVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the protocol is set. Should only be unknown for unregistered protocols returned by {@link #getProtocol(int)}.
|
||||||
|
*
|
||||||
|
* @return true if the protocol is set
|
||||||
|
*/
|
||||||
public boolean isKnown() {
|
public boolean isKnown() {
|
||||||
return version != -1;
|
return version != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the protocol includes a range of versions (but not an entire major version range), for example 1.7-1.7.5
|
* Returns whether the protocol includes a range of versions (but not an entire major version range), for example 1.7-1.7.5.
|
||||||
|
*
|
||||||
|
* @return true if the protocol includes a range of versions
|
||||||
* @see #getIncludedVersions()
|
* @see #getIncludedVersions()
|
||||||
*/
|
*/
|
||||||
public boolean isRange() {
|
public boolean isRange() {
|
||||||
@ -234,16 +300,28 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the protocol includes an entire major version range (for example 1.8.x)
|
* Returns whether the protocol includes an entire major version range (for example 1.8.x).
|
||||||
|
*
|
||||||
|
* @return true if the protocol includes an entire major version range
|
||||||
*/
|
*/
|
||||||
public boolean isVersionWildcard() {
|
public boolean isVersionWildcard() {
|
||||||
return versionWildcard;
|
return versionWildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the version name.
|
||||||
|
*
|
||||||
|
* @return version name
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this represents a snapshot version.
|
||||||
|
*
|
||||||
|
* @return true if this represents a snapshot version, false otherwise
|
||||||
|
*/
|
||||||
public boolean isSnapshot() {
|
public boolean isSnapshot() {
|
||||||
return snapshotVersion != -1;
|
return snapshotVersion != -1;
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,29 @@ public class VersionRange {
|
|||||||
this.rangeTo = rangeTo;
|
this.rangeTo = rangeTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the major version name.
|
||||||
|
*
|
||||||
|
* @return major version name
|
||||||
|
*/
|
||||||
public String getBaseVersion() {
|
public String getBaseVersion() {
|
||||||
return baseVersion;
|
return baseVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the lowest included minor version.
|
||||||
|
*
|
||||||
|
* @return lowest included minor version
|
||||||
|
*/
|
||||||
public int getRangeFrom() {
|
public int getRangeFrom() {
|
||||||
return rangeFrom;
|
return rangeFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the highest included minor version.
|
||||||
|
*
|
||||||
|
* @return highest included minor version
|
||||||
|
*/
|
||||||
public int getRangeTo() {
|
public int getRangeTo() {
|
||||||
return rangeTo;
|
return rangeTo;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,12 @@ import java.util.List;
|
|||||||
|
|
||||||
public class EntityTypeUtil {
|
public class EntityTypeUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an ordered array with each index representing the actual entity id.
|
||||||
|
*
|
||||||
|
* @param values entity types
|
||||||
|
* @return ordered array with each index representing the actual entity id
|
||||||
|
*/
|
||||||
public static EntityType[] toOrderedArray(EntityType[] values) {
|
public static EntityType[] toOrderedArray(EntityType[] values) {
|
||||||
List<EntityType> types = new ArrayList<>();
|
List<EntityType> types = new ArrayList<>();
|
||||||
for (EntityType type : values) {
|
for (EntityType type : values) {
|
||||||
@ -43,6 +49,14 @@ public class EntityTypeUtil {
|
|||||||
return types.toArray(new EntityType[0]);
|
return types.toArray(new EntityType[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity type from id, or the given fallback if out of bounds.
|
||||||
|
*
|
||||||
|
* @param values sorted entity type array
|
||||||
|
* @param typeId entity type id
|
||||||
|
* @param fallback fallback/base entity type
|
||||||
|
* @return entity type from id
|
||||||
|
*/
|
||||||
public static EntityType getTypeFromId(EntityType[] values, int typeId, EntityType fallback) {
|
public static EntityType getTypeFromId(EntityType[] values, int typeId, EntityType fallback) {
|
||||||
EntityType type;
|
EntityType type;
|
||||||
if (typeId < 0 || typeId >= values.length || (type = values[typeId]) == null) {
|
if (typeId < 0 || typeId >= values.length || (type = values[typeId]) == null) {
|
||||||
|
@ -34,14 +34,29 @@ public final class UnsupportedSoftware {
|
|||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the software name.
|
||||||
|
*
|
||||||
|
* @return software name
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fully qualified class name.
|
||||||
|
*
|
||||||
|
* @return fully qualified class name
|
||||||
|
*/
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the reason for being unsupported by Via.
|
||||||
|
*
|
||||||
|
* @return reason for being unsupported
|
||||||
|
*/
|
||||||
public String getReason() {
|
public String getReason() {
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,14 @@
|
|||||||
*/
|
*/
|
||||||
package us.myles.ViaVersion.util;
|
package us.myles.ViaVersion.util;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.platform.ViaPlatform;
|
||||||
|
|
||||||
public class VersionInfo {
|
public class VersionInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin version.
|
||||||
|
*
|
||||||
|
* @see ViaPlatform#getPluginVersion()
|
||||||
|
*/
|
||||||
public static final String VERSION = "$VERSION";
|
public static final String VERSION = "$VERSION";
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// Note: If manually starting tests doesn't work for you in IJ, change 'Gradle -> Run Tests Using' to 'IntelliJ IDEA'
|
||||||
testImplementation("io.netty", "netty-all", Versions.netty)
|
testImplementation("io.netty", "netty-all", Versions.netty)
|
||||||
testImplementation("com.google.guava", "guava", Versions.guava)
|
testImplementation("com.google.guava", "guava", Versions.guava)
|
||||||
testImplementation("org.junit.jupiter", "junit-jupiter-api", Versions.jUnit)
|
testImplementation("org.junit.jupiter", "junit-jupiter-api", Versions.jUnit)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren