3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Farewell, lombok!

Dieser Commit ist enthalten in:
KennyTV 2020-04-23 21:07:12 +02:00
Ursprung 53b8c2328e
Commit 762c66ff42
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
23 geänderte Dateien mit 392 neuen und 115 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,6 @@
package us.myles.ViaVersion.bungee.platform;
import io.netty.buffer.ByteBuf;
import lombok.NonNull;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -20,8 +19,9 @@ import java.util.TreeSet;
import java.util.UUID;
public class BungeeViaAPI implements ViaAPI<ProxiedPlayer> {
@Override
public int getPlayerVersion(@NonNull ProxiedPlayer player) {
public int getPlayerVersion(ProxiedPlayer player) {
UserConnection conn = Via.getManager().getConnection(player.getUniqueId());
if (conn == null) {
return player.getPendingConnection().getVersion();
@ -30,7 +30,7 @@ public class BungeeViaAPI implements ViaAPI<ProxiedPlayer> {
}
@Override
public int getPlayerVersion(@NonNull UUID uuid) {
public int getPlayerVersion(UUID uuid) {
return getPlayerVersion(ProxyServer.getInstance().getPlayer(uuid));
}

Datei anzeigen

@ -1,6 +1,5 @@
package us.myles.ViaVersion.bungee.service;
import lombok.Getter;
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.config.ServerInfo;
@ -15,9 +14,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class ProtocolDetectorService implements Runnable {
private static final Map<String, Integer> detectedProtocolIds = new ConcurrentHashMap<>();
private BungeePlugin plugin;
@Getter
private static ProtocolDetectorService instance;
private final BungeePlugin plugin;
public ProtocolDetectorService(BungeePlugin plugin) {
this.plugin = plugin;
@ -84,4 +82,11 @@ public class ProtocolDetectorService implements Runnable {
return new HashMap<>(detectedProtocolIds);
}
public static ProtocolDetectorService getInstance() {
return instance;
}
public BungeePlugin getPlugin() {
return plugin;
}
}

Datei anzeigen

@ -1,15 +1,14 @@
package us.myles.ViaVersion.bungee.storage;
import lombok.EqualsAndHashCode;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
import java.lang.reflect.Field;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
@EqualsAndHashCode(callSuper = true)
public class BungeeStorage extends StoredObject {
private static Field bossField;
@ -59,4 +58,22 @@ public class BungeeStorage extends StoredObject {
public Set<UUID> getBossbar() {
return bossbar;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BungeeStorage that = (BungeeStorage) o;
if (!Objects.equals(player, that.player)) return false;
if (!Objects.equals(currentServer, that.currentServer)) return false;
return Objects.equals(bossbar, that.bossbar);
}
@Override
public int hashCode() {
int result = player != null ? player.hashCode() : 0;
result = 31 * result + (currentServer != null ? currentServer.hashCode() : 0);
result = 31 * result + (bossbar != null ? bossbar.hashCode() : 0);
return result;
}
}

Datei anzeigen

@ -1,6 +1,5 @@
package us.myles.ViaVersion;
import lombok.Builder;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.platform.ViaInjector;
@ -29,7 +28,6 @@ public class ViaManager {
private final Set<String> subPlatforms = new HashSet<>();
private boolean debug;
@Builder
public ViaManager(ViaPlatform<?> platform, ViaInjector injector, ViaCommandHandler commandHandler, ViaPlatformLoader loader) {
this.platform = platform;
this.injector = injector;
@ -37,6 +35,10 @@ public class ViaManager {
this.loader = loader;
}
public static ViaManagerBuilder builder() {
return new ViaManagerBuilder();
}
public void init() {
if (System.getProperty("ViaVersion") != null) {
// Reload?
@ -136,17 +138,6 @@ public class ViaManager {
platform.getConnectionManager().onLoginSuccess(info);
}
public void handleDisconnect(UUID id) {
UserConnection connection = getConnection(id);
if (connection != null) {
handleDisconnect(connection);
}
}
public void handleDisconnect(UserConnection info) {
platform.getConnectionManager().onDisconnect(info);
}
public ViaPlatform<?> getPlatform() {
return platform;
}
@ -188,4 +179,35 @@ public class ViaManager {
public UserConnection getConnection(UUID playerUUID) {
return platform.getConnectionManager().getConnectedClient(playerUUID);
}
public static final class ViaManagerBuilder {
private ViaPlatform<?> platform;
private ViaInjector injector;
private ViaCommandHandler commandHandler;
private ViaPlatformLoader loader;
public ViaManagerBuilder platform(ViaPlatform<?> platform) {
this.platform = platform;
return this;
}
public ViaManagerBuilder injector(ViaInjector injector) {
this.injector = injector;
return this;
}
public ViaManagerBuilder loader(ViaPlatformLoader loader) {
this.loader = loader;
return this;
}
public ViaManagerBuilder commandHandler(ViaCommandHandler commandHandler) {
this.commandHandler = commandHandler;
return this;
}
public ViaManager build() {
return new ViaManager(platform, injector, commandHandler, loader);
}
}
}

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -27,8 +25,6 @@ public class Entity1_10Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, ENTITY),
@ -126,6 +122,11 @@ public class Entity1_10Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);
@ -137,10 +138,18 @@ public class Entity1_10Types {
return Optional.empty();
return Optional.ofNullable(TYPES.get(id));
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
}
@AllArgsConstructor
@Getter
public enum ObjectType implements us.myles.ViaVersion.api.entities.ObjectType {
BOAT(1, EntityType.BOAT),
ITEM(2, EntityType.DROPPED_ITEM),
@ -179,6 +188,21 @@ public class Entity1_10Types {
}
}
ObjectType(int id, EntityType type) {
this.id = id;
this.type = type;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getType() {
return type;
}
public static Optional<ObjectType> findById(int id) {
if (id == -1)
return Optional.empty();

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -27,8 +25,6 @@ public class Entity1_11Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, ENTITY),
@ -154,6 +150,21 @@ public class Entity1_11Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);
@ -167,8 +178,6 @@ public class Entity1_11Types {
}
}
@AllArgsConstructor
@Getter
public enum ObjectType implements us.myles.ViaVersion.api.entities.ObjectType {
BOAT(1, EntityType.BOAT),
ITEM(2, EntityType.DROPPED_ITEM),
@ -209,6 +218,21 @@ public class Entity1_11Types {
}
}
ObjectType(int id, EntityType type) {
this.id = id;
this.type = type;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getType() {
return type;
}
public static Optional<ObjectType> findById(int id) {
if (id == -1)
return Optional.empty();

Datei anzeigen

@ -10,8 +10,6 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -37,8 +35,6 @@ public class Entity1_12Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, ENTITY),
@ -167,6 +163,21 @@ public class Entity1_12Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);
@ -180,8 +191,6 @@ public class Entity1_12Types {
}
}
@AllArgsConstructor
@Getter
public enum ObjectType implements us.myles.ViaVersion.api.entities.ObjectType {
BOAT(1, EntityType.BOAT),
ITEM(2, EntityType.DROPPED_ITEM),
@ -222,6 +231,21 @@ public class Entity1_12Types {
}
}
ObjectType(int id, EntityType type) {
this.id = id;
this.type = type;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getType() {
return type;
}
public static Optional<ObjectType> findById(int id) {
if (id == -1)
return Optional.empty();

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -27,8 +25,6 @@ public class Entity1_13Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
// Auto generated
@ -209,6 +205,21 @@ public class Entity1_13Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);
@ -222,8 +233,6 @@ public class Entity1_13Types {
}
}
@AllArgsConstructor
@Getter
public enum ObjectType implements us.myles.ViaVersion.api.entities.ObjectType {
BOAT(1, EntityType.BOAT),
ITEM(2, EntityType.ITEM),
@ -265,6 +274,21 @@ public class Entity1_13Types {
}
}
ObjectType(int id, EntityType type) {
this.id = id;
this.type = type;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getType() {
return type;
}
public static Optional<ObjectType> findById(int id) {
if (id == -1)
return Optional.empty();

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -22,8 +20,6 @@ public class Entity1_14Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
// Auto generated
@ -211,6 +207,21 @@ public class Entity1_14Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -22,9 +20,6 @@ public class Entity1_15Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
@ -211,6 +206,21 @@ public class Entity1_15Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.api.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import us.myles.ViaVersion.api.Via;
import java.util.HashMap;
@ -22,9 +20,6 @@ public class Entity1_16Types {
return type.get();
}
@AllArgsConstructor
@Getter
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
@ -216,6 +211,21 @@ public class Entity1_16Types {
this.parent = null;
}
EntityType(int id, EntityType parent) {
this.id = id;
this.parent = parent;
}
@Override
public int getId() {
return id;
}
@Override
public EntityType getParent() {
return parent;
}
static {
for (EntityType type : EntityType.values()) {
TYPES.put(type.id, type);

Datei anzeigen

@ -1,12 +1,8 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
@RequiredArgsConstructor
@Getter
public enum MetaType1_12 implements MetaType {
Byte(0, Type.BYTE),
VarInt(1, Type.VAR_INT),
@ -27,8 +23,22 @@ public enum MetaType1_12 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_12(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_12 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,13 +1,9 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_13;
@RequiredArgsConstructor
@Getter
public enum MetaType1_13 implements MetaType {
Byte(0, Type.BYTE),
VarInt(1, Type.VAR_INT),
@ -30,8 +26,22 @@ public enum MetaType1_13 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_13(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_13 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,13 +1,9 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
@RequiredArgsConstructor
@Getter
public enum MetaType1_13_2 implements MetaType {
Byte(0, Type.BYTE),
VarInt(1, Type.VAR_INT),
@ -30,8 +26,22 @@ public enum MetaType1_13_2 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_13_2(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_13_2 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,13 +1,9 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
@RequiredArgsConstructor
@Getter
public enum MetaType1_14 implements MetaType {
Byte(0, Type.BYTE),
VarInt(1, Type.VAR_INT),
@ -33,8 +29,22 @@ public enum MetaType1_14 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_14(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_14 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,12 +1,8 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
@RequiredArgsConstructor
@Getter
public enum MetaType1_8 implements MetaType {
Byte(0, Type.BYTE),
Short(1, Type.SHORT),
@ -21,7 +17,22 @@ public enum MetaType1_8 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_8(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_8 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,12 +1,8 @@
package us.myles.ViaVersion.api.minecraft.metadata.types;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.type.Type;
@RequiredArgsConstructor
@Getter
public enum MetaType1_9 implements MetaType {
Byte(0, Type.BYTE),
VarInt(1, Type.VAR_INT),
@ -26,8 +22,22 @@ public enum MetaType1_9 implements MetaType {
private final int typeID;
private final Type type;
MetaType1_9(int typeID, Type type) {
this.typeID = typeID;
this.type = type;
}
public static MetaType1_9 byId(int id) {
return values()[id];
}
@Override
public int getTypeID() {
return typeID;
}
@Override
public Type getType() {
return type;
}
}

Datei anzeigen

@ -1,7 +1,5 @@
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage;
import lombok.Getter;
import lombok.Setter;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_14Types.EntityType;
@ -18,14 +16,8 @@ public class EntityTracker1_14 extends EntityTracker {
// 0x1 = sleeping, 0x2 = riptide
private final Map<Integer, Byte> sleepingAndRiptideData = new ConcurrentHashMap<>();
private final Map<Integer, Byte> playerEntityFlags = new ConcurrentHashMap<>();
@Getter
@Setter
private int latestTradeWindowId;
@Getter
@Setter
private boolean forceSendCenterChunk = true;
@Getter
@Setter
private int chunkCenterX, chunkCenterZ;
public EntityTracker1_14(UserConnection user) {
@ -101,4 +93,36 @@ public class EntityTracker1_14 extends EntityTracker {
public void setEntityFlags(int player, byte data) {
playerEntityFlags.put(player, data);
}
public int getLatestTradeWindowId() {
return latestTradeWindowId;
}
public void setLatestTradeWindowId(int latestTradeWindowId) {
this.latestTradeWindowId = latestTradeWindowId;
}
public boolean isForceSendCenterChunk() {
return forceSendCenterChunk;
}
public void setForceSendCenterChunk(boolean forceSendCenterChunk) {
this.forceSendCenterChunk = forceSendCenterChunk;
}
public int getChunkCenterX() {
return chunkCenterX;
}
public void setChunkCenterX(int chunkCenterX) {
this.chunkCenterX = chunkCenterX;
}
public int getChunkCenterZ() {
return chunkCenterZ;
}
public void setChunkCenterZ(int chunkCenterZ) {
this.chunkCenterZ = chunkCenterZ;
}
}

Datei anzeigen

@ -1,9 +1,13 @@
package us.myles.ViaVersion.util;
import lombok.SneakyThrows;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
/**
* Created by wea_ondara licensed under MIT
@ -54,16 +58,19 @@ public class ConcurrentList<E> extends ArrayList<E> {
}
@Override
@SneakyThrows
public Object clone() {
synchronized (lock) {
ConcurrentList<E> clist = (ConcurrentList<E>) super.clone();
clist.modCount = 0;
Field f = ArrayList.class.getDeclaredField("elementData");
f.setAccessible(true);
f.set(clist, Arrays.copyOf((Object[]) f.get(this), this.size()));
try {
ConcurrentList<E> clist = (ConcurrentList<E>) super.clone();
clist.modCount = 0;
Field f = ArrayList.class.getDeclaredField("elementData");
f.setAccessible(true);
f.set(clist, Arrays.copyOf((Object[]) f.get(this), this.size()));
return clist;
return clist;
} catch (ReflectiveOperationException e) {
throw new RuntimeException();
}
}
}

Datei anzeigen

@ -73,14 +73,6 @@
</repositories>
<dependencies>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- Javassist (Bytecode Library) -->
<dependency>
<groupId>org.javassist</groupId>

Datei anzeigen

@ -30,8 +30,7 @@
<configuration>
<!-- We only run lombok and not sponge in-built mcmod.info generator due to issues with multiversion -->
<annotationProcessors>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
</annotationProcessor>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
@ -52,6 +51,14 @@
</build>
<dependencies>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<!-- Common Module -->
<dependency>
<groupId>us.myles</groupId>

Datei anzeigen

@ -1,13 +1,11 @@
package us.myles.ViaVersion.sponge.platform;
import lombok.Getter;
import org.spongepowered.api.entity.living.player.Player;
import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossStyle;
import us.myles.ViaVersion.boss.CommonBoss;
@Getter
public class SpongeBossBar extends CommonBoss<Player> {
public SpongeBossBar(String title, float health, BossColor color, BossStyle style) {

Datei anzeigen

@ -1,7 +1,6 @@
package us.myles.ViaVersion.velocity.storage;
import com.velocitypowered.api.proxy.Player;
import lombok.EqualsAndHashCode;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.util.ReflectionUtil;
@ -9,9 +8,9 @@ import us.myles.ViaVersion.util.ReflectionUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@EqualsAndHashCode(callSuper = true)
public class VelocityStorage extends StoredObject {
private final Player player;
private String currentServer;
@ -72,4 +71,22 @@ public class VelocityStorage extends StoredObject {
public List<UUID> getCachedBossbar() {
return cachedBossbar;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VelocityStorage that = (VelocityStorage) o;
if (!Objects.equals(player, that.player)) return false;
if (!Objects.equals(currentServer, that.currentServer)) return false;
return Objects.equals(cachedBossbar, that.cachedBossbar);
}
@Override
public int hashCode() {
int result = player != null ? player.hashCode() : 0;
result = 31 * result + (currentServer != null ? currentServer.hashCode() : 0);
result = 31 * result + (cachedBossbar != null ? cachedBossbar.hashCode() : 0);
return result;
}
}