mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-14 10:55:20 +01:00
Farewell, lombok!
Also replaced some optionals with simple nullable objects
This commit is contained in:
parent
aca265956f
commit
83ef8572c1
@ -10,14 +10,10 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.entities.blockitem;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import nl.matsv.viabackwards.utils.Block;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class BlockItemSettings {
|
||||
private final int id;
|
||||
private Item repItem;
|
||||
@ -25,6 +21,10 @@ public class BlockItemSettings {
|
||||
private BlockEntityHandler blockEntityHandler;
|
||||
private ItemHandler itemHandler;
|
||||
|
||||
public BlockItemSettings(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public BlockItemSettings repItem(Item item) {
|
||||
this.repItem = item;
|
||||
return this;
|
||||
@ -61,6 +61,26 @@ public class BlockItemSettings {
|
||||
return itemHandler != null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Item getRepItem() {
|
||||
return repItem;
|
||||
}
|
||||
|
||||
public Block getRepBlock() {
|
||||
return repBlock;
|
||||
}
|
||||
|
||||
public BlockEntityHandler getBlockEntityHandler() {
|
||||
return blockEntityHandler;
|
||||
}
|
||||
|
||||
public ItemHandler getItemHandler() {
|
||||
return itemHandler;
|
||||
}
|
||||
|
||||
public interface BlockEntityHandler {
|
||||
CompoundTag handleOrNewCompoundTag(int block, CompoundTag tag);
|
||||
}
|
||||
@ -68,5 +88,4 @@ public class BlockItemSettings {
|
||||
public interface ItemHandler {
|
||||
Item handle(Item i);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,17 +10,13 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.entities.meta;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
||||
import us.myles.ViaVersion.api.entities.EntityType;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
|
||||
@ToString
|
||||
@Getter
|
||||
public class MetaHandlerSettings {
|
||||
private EntityType filterType;
|
||||
private boolean filterFamily = false;
|
||||
private boolean filterFamily;
|
||||
private int filterIndex = -1;
|
||||
private MetaHandler handler;
|
||||
|
||||
@ -97,4 +93,26 @@ public class MetaHandlerSettings {
|
||||
}
|
||||
return !hasIndex() || metadata.getId() == filterIndex;
|
||||
}
|
||||
|
||||
public EntityType getFilterType() {
|
||||
return filterType;
|
||||
}
|
||||
|
||||
public int getFilterIndex() {
|
||||
return filterIndex;
|
||||
}
|
||||
|
||||
public MetaHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetaHandlerSettings{" +
|
||||
"filterType=" + filterType +
|
||||
", filterFamily=" + filterFamily +
|
||||
", filterIndex=" + filterIndex +
|
||||
", handler=" + handler +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.entities.storage;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@ToString
|
||||
public class EntityData {
|
||||
private final int id;
|
||||
private final boolean isObject;
|
||||
@ -26,6 +19,13 @@ public class EntityData {
|
||||
private final int objectData;
|
||||
private MetaCreator defaultMeta;
|
||||
|
||||
public EntityData(int id, boolean isObject, int replacementId, int objectData) {
|
||||
this.id = id;
|
||||
this.isObject = isObject;
|
||||
this.replacementId = replacementId;
|
||||
this.objectData = objectData;
|
||||
}
|
||||
|
||||
public EntityData mobName(String name) {
|
||||
this.mobName = name;
|
||||
return this;
|
||||
@ -39,6 +39,42 @@ public class EntityData {
|
||||
return this.defaultMeta != null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isObject() {
|
||||
return isObject;
|
||||
}
|
||||
|
||||
public String getMobName() {
|
||||
return mobName;
|
||||
}
|
||||
|
||||
public int getReplacementId() {
|
||||
return replacementId;
|
||||
}
|
||||
|
||||
public int getObjectData() {
|
||||
return objectData;
|
||||
}
|
||||
|
||||
public MetaCreator getDefaultMeta() {
|
||||
return defaultMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntityData{" +
|
||||
"id=" + id +
|
||||
", isObject=" + isObject +
|
||||
", mobName='" + mobName + '\'' +
|
||||
", replacementId=" + replacementId +
|
||||
", objectData=" + objectData +
|
||||
", defaultMeta=" + defaultMeta +
|
||||
'}';
|
||||
}
|
||||
|
||||
public interface MetaCreator {
|
||||
|
||||
void handle(MetaStorage storage);
|
||||
|
@ -10,10 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.entities.storage;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
@ -63,14 +59,16 @@ public class EntityTracker extends StoredObject {
|
||||
}
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@ToString
|
||||
public static class StoredEntity {
|
||||
public static final class StoredEntity {
|
||||
private final int entityId;
|
||||
private final EntityType type;
|
||||
private final Map<Class<? extends EntityStorage>, EntityStorage> storedObjects = new ConcurrentHashMap<>();
|
||||
|
||||
private StoredEntity(final int entityId, final EntityType type) {
|
||||
this.entityId = entityId;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object from the storage
|
||||
*
|
||||
@ -100,5 +98,22 @@ public class EntityTracker extends StoredObject {
|
||||
public void put(EntityStorage object) {
|
||||
storedObjects.put(object.getClass(), object);
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoredEntity{" +
|
||||
"entityId=" + entityId +
|
||||
", type=" + type +
|
||||
", storedObjects=" + storedObjects +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,11 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.entities.storage;
|
||||
|
||||
import lombok.*;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class MetaStorage {
|
||||
@NonNull
|
||||
private List<Metadata> metaDataList;
|
||||
|
||||
public MetaStorage(List<Metadata> metaDataList) {
|
||||
@ -36,20 +30,20 @@ public class MetaStorage {
|
||||
}
|
||||
|
||||
public void delete(int index) {
|
||||
Optional<Metadata> data = get(index);
|
||||
if (data.isPresent())
|
||||
delete(data.get());
|
||||
metaDataList.removeIf(meta -> meta.getId() == index);
|
||||
}
|
||||
|
||||
public void add(Metadata data) {
|
||||
this.metaDataList.add(data);
|
||||
}
|
||||
|
||||
public Optional<Metadata> get(int index) {
|
||||
for (Metadata meta : this.metaDataList)
|
||||
if (index == meta.getId())
|
||||
return Optional.of(meta);
|
||||
return Optional.empty();
|
||||
public Metadata get(int index) {
|
||||
for (Metadata meta : this.metaDataList) {
|
||||
if (index == meta.getId()) {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Metadata getOrDefault(int index, Metadata data) {
|
||||
@ -57,10 +51,23 @@ public class MetaStorage {
|
||||
}
|
||||
|
||||
public Metadata getOrDefault(int index, boolean removeIfExists, Metadata data) {
|
||||
Optional<Metadata> existingData = get(index);
|
||||
Metadata existingData = get(index);
|
||||
if (removeIfExists && existingData != null) {
|
||||
delete(existingData);
|
||||
}
|
||||
return existingData != null ? existingData : data;
|
||||
}
|
||||
|
||||
if (removeIfExists && existingData.isPresent())
|
||||
delete(existingData.get());
|
||||
return existingData.orElse(data);
|
||||
public List<Metadata> getMetaDataList() {
|
||||
return metaDataList;
|
||||
}
|
||||
|
||||
public void setMetaDataList(List<Metadata> metaDataList) {
|
||||
this.metaDataList = metaDataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetaStorage{" + "metaDataList=" + metaDataList + '}';
|
||||
}
|
||||
}
|
||||
|
@ -66,12 +66,12 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
return entityTypes.containsKey(type);
|
||||
}
|
||||
|
||||
protected Optional<EntityData> getEntityData(EntityType type) {
|
||||
return Optional.ofNullable(entityTypes.get(type));
|
||||
protected EntityData getEntityData(EntityType type) {
|
||||
return entityTypes.get(type);
|
||||
}
|
||||
|
||||
protected Optional<EntityData> getObjectData(ObjectType type) {
|
||||
return Optional.ofNullable(objectTypes.get(type));
|
||||
protected EntityData getObjectData(ObjectType type) {
|
||||
return objectTypes.get(type);
|
||||
}
|
||||
|
||||
protected EntityData regEntType(EntityType oldEnt, EntityType replacement) {
|
||||
@ -158,16 +158,14 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
}
|
||||
|
||||
// Handle Entity Name
|
||||
Optional<Metadata> opMd = storage.get(displayNameIndex);
|
||||
if (opMd.isPresent()) {
|
||||
Optional<EntityData> opEd = getEntityData(type);
|
||||
if (opEd.isPresent()) {
|
||||
Metadata data = opMd.get();
|
||||
EntityData entData = opEd.get();
|
||||
if (entData.getMobName() != null &&
|
||||
Metadata data = storage.get(displayNameIndex);
|
||||
if (data != null) {
|
||||
EntityData entityData = getEntityData(type);
|
||||
if (entityData != null) {
|
||||
if (entityData.getMobName() != null &&
|
||||
(data.getValue() == null || ((String) data.getValue()).isEmpty()) &&
|
||||
data.getMetaType().getTypeID() == displayNameMetaType.getTypeID()) {
|
||||
String mobName = entData.getMobName();
|
||||
String mobName = entityData.getMobName();
|
||||
if (isDisplayNameJson) {
|
||||
mobName = ChatRewriter.legacyTextToJson(mobName);
|
||||
}
|
||||
@ -230,11 +228,10 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
MetaStorage storage = new MetaStorage(wrapper.get(newMetaType, 0));
|
||||
handleMeta(wrapper.user(), entityId, storage);
|
||||
|
||||
Optional<EntityData> optEntDat = getEntityData(type);
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
if (data.hasBaseMeta()) {
|
||||
data.getDefaultMeta().handle(storage);
|
||||
EntityData entityData = getEntityData(type);
|
||||
if (entityData != null) {
|
||||
if (entityData.hasBaseMeta()) {
|
||||
entityData.getDefaultMeta().handle(storage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,14 +335,12 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
MetaStorage storage = new MetaStorage(wrapper.get(metaType, 0));
|
||||
handleMeta(wrapper.user(), entityId, storage);
|
||||
|
||||
Optional<EntityData> optEntDat = getEntityData(type);
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
|
||||
int replacementId = getOldEntityId(data.getReplacementId());
|
||||
EntityData entityData = getEntityData(type);
|
||||
if (entityData != null) {
|
||||
int replacementId = getOldEntityId(entityData.getReplacementId());
|
||||
wrapper.set(Type.VAR_INT, 1, replacementId);
|
||||
if (data.hasBaseMeta()) {
|
||||
data.getDefaultMeta().handle(storage);
|
||||
if (entityData.hasBaseMeta()) {
|
||||
entityData.getDefaultMeta().handle(storage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.api.rewriters;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -67,12 +65,33 @@ public abstract class SoundRewriter<T extends BackwardsProtocol> extends Rewrite
|
||||
return data != null ? data.getNewPitch() : 1F;
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class SoundData {
|
||||
private int replacementSound;
|
||||
private boolean changePitch = false;
|
||||
private float newPitch = 1f;
|
||||
private boolean added;
|
||||
public static final class SoundData {
|
||||
private final int replacementSound;
|
||||
private final boolean changePitch;
|
||||
private final float newPitch;
|
||||
private final boolean added;
|
||||
|
||||
private SoundData(int replacementSound, boolean changePitch, float newPitch, boolean added) {
|
||||
this.replacementSound = replacementSound;
|
||||
this.changePitch = changePitch;
|
||||
this.newPitch = newPitch;
|
||||
this.added = added;
|
||||
}
|
||||
|
||||
public int getReplacementSound() {
|
||||
return replacementSound;
|
||||
}
|
||||
|
||||
public boolean isChangePitch() {
|
||||
return changePitch;
|
||||
}
|
||||
|
||||
public float getNewPitch() {
|
||||
return newPitch;
|
||||
}
|
||||
|
||||
public boolean isAdded() {
|
||||
return added;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_10to1_11;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.packets.BlockItemPackets1_11;
|
||||
@ -22,9 +21,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class Protocol1_10To1_11 extends BackwardsProtocol {
|
||||
@Getter
|
||||
private EntityPackets1_11 entityPackets; // Required for the item rewriter
|
||||
@Getter
|
||||
private BlockItemPackets1_11 blockItemPackets;
|
||||
|
||||
@Override
|
||||
@ -51,4 +48,12 @@ public class Protocol1_10To1_11 extends BackwardsProtocol {
|
||||
// Init protocol in EntityTracker
|
||||
user.get(EntityTracker.class).initProtocol(this);
|
||||
}
|
||||
|
||||
public EntityPackets1_11 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_11 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,8 @@ public class EntityPackets1_11 extends EntityRewriter<Protocol1_10To1_11> {
|
||||
Optional<Entity1_11Types.ObjectType> type = Entity1_11Types.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
||||
|
||||
if (type.isPresent()) {
|
||||
Optional<EntityData> optEntDat = getObjectData(type.get());
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
EntityData data = getObjectData(type.get());
|
||||
if (data != null) {
|
||||
wrapper.set(Type.BYTE, 0, ((Integer) data.getReplacementId()).byteValue());
|
||||
if (data.getObjectData() != -1)
|
||||
wrapper.set(Type.INT, 0, data.getObjectData());
|
||||
@ -141,12 +140,12 @@ public class EntityPackets1_11 extends EntityRewriter<Protocol1_10To1_11> {
|
||||
storage
|
||||
);
|
||||
|
||||
Optional<EntityData> optEntDat = getEntityData(type);
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, ((Integer) data.getReplacementId()).shortValue());
|
||||
if (data.hasBaseMeta())
|
||||
data.getDefaultMeta().handle(storage);
|
||||
EntityData entityData = getEntityData(type);
|
||||
if (entityData != null) {
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) entityData.getReplacementId());
|
||||
if (entityData.hasBaseMeta()) {
|
||||
entityData.getDefaultMeta().handle(storage);
|
||||
}
|
||||
}
|
||||
|
||||
// Rewrite Metadata
|
||||
@ -425,10 +424,10 @@ public class EntityPackets1_11 extends EntityRewriter<Protocol1_10To1_11> {
|
||||
}
|
||||
|
||||
private void handleZombieType(MetaStorage storage, int type) {
|
||||
Optional<Metadata> meta = storage.get(13);
|
||||
|
||||
if (!meta.isPresent())
|
||||
Metadata meta = storage.get(13);
|
||||
if (meta == null) {
|
||||
storage.add(getZombieTypeMeta(type));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -10,18 +10,48 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_10to1_11.storage;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityStorage;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class ChestedHorseStorage implements EntityStorage {
|
||||
private boolean chested = false;
|
||||
|
||||
private int liamaStrength = 0;
|
||||
private boolean chested;
|
||||
private int liamaStrength;
|
||||
private int liamaCarpetColor = -1;
|
||||
private int liamaVariant = 0;
|
||||
private int liamaVariant;
|
||||
|
||||
public boolean isChested() {
|
||||
return chested;
|
||||
}
|
||||
|
||||
public void setChested(boolean chested) {
|
||||
this.chested = chested;
|
||||
}
|
||||
|
||||
public int getLiamaStrength() {
|
||||
return liamaStrength;
|
||||
}
|
||||
|
||||
public void setLiamaStrength(int liamaStrength) {
|
||||
this.liamaStrength = liamaStrength;
|
||||
}
|
||||
|
||||
public int getLiamaCarpetColor() {
|
||||
return liamaCarpetColor;
|
||||
}
|
||||
|
||||
public void setLiamaCarpetColor(int liamaCarpetColor) {
|
||||
this.liamaCarpetColor = liamaCarpetColor;
|
||||
}
|
||||
|
||||
public int getLiamaVariant() {
|
||||
return liamaVariant;
|
||||
}
|
||||
|
||||
public void setLiamaVariant(int liamaVariant) {
|
||||
this.liamaVariant = liamaVariant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChestedHorseStorage{" + "chested=" + chested + ", liamaStrength=" + liamaStrength + ", liamaCarpetColor=" + liamaCarpetColor + ", liamaVariant=" + liamaVariant + '}';
|
||||
}
|
||||
}
|
||||
|
@ -10,15 +10,9 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_10to1_11.storage;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Setter
|
||||
public class WindowTracker extends StoredObject {
|
||||
private String inventory;
|
||||
private int entityId = -1;
|
||||
@ -26,5 +20,26 @@ public class WindowTracker extends StoredObject {
|
||||
public WindowTracker(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public String getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public void setInventory(String inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setEntityId(int entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WindowTracker{" + "inventory='" + inventory + '\'' + ", entityId=" + entityId + '}';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_11_1to1_12;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
||||
@ -18,7 +17,6 @@ import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.*;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_11_1To1_12 extends BackwardsProtocol {
|
||||
private EntityPackets1_12 entityPackets;
|
||||
private BlockItemPackets1_12 blockItemPackets;
|
||||
@ -47,4 +45,12 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol {
|
||||
// Init protocol in EntityTracker
|
||||
user.get(EntityTracker.class).initProtocol(this);
|
||||
}
|
||||
|
||||
public EntityPackets1_12 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_12 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,26 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityStorage;
|
||||
|
||||
@Data
|
||||
public class ParrotStorage implements EntityStorage {
|
||||
private boolean tamed = true;
|
||||
private boolean sitting = true;
|
||||
|
||||
public boolean isTamed() {
|
||||
return tamed;
|
||||
}
|
||||
|
||||
public void setTamed(boolean tamed) {
|
||||
this.tamed = tamed;
|
||||
}
|
||||
|
||||
public boolean isSitting() {
|
||||
return sitting;
|
||||
}
|
||||
|
||||
public void setSitting(boolean sitting) {
|
||||
this.sitting = sitting;
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
@ -22,9 +19,6 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class ShoulderTracker extends StoredObject {
|
||||
private int entityId;
|
||||
private String leftShoulder;
|
||||
@ -85,4 +79,33 @@ public class ShoulderTracker extends StoredObject {
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setEntityId(int entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public String getLeftShoulder() {
|
||||
return leftShoulder;
|
||||
}
|
||||
|
||||
public void setLeftShoulder(String leftShoulder) {
|
||||
this.leftShoulder = leftShoulder;
|
||||
}
|
||||
|
||||
public String getRightShoulder() {
|
||||
return rightShoulder;
|
||||
}
|
||||
|
||||
public void setRightShoulder(String rightShoulder) {
|
||||
this.rightShoulder = rightShoulder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ShoulderTracker{" + "entityId=" + entityId + ", leftShoulder='" + leftShoulder + '\'' + ", rightShoulder='" + rightShoulder + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,8 @@ public class EntityPackets1_12 extends EntityRewriter<Protocol1_11_1To1_12> {
|
||||
Optional<Entity1_12Types.ObjectType> type = Entity1_12Types.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
||||
|
||||
if (type.isPresent()) {
|
||||
Optional<EntityData> optEntDat = getObjectData(type.get());
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
EntityData data = getObjectData(type.get());
|
||||
if (data != null) {
|
||||
wrapper.set(Type.BYTE, 0, ((Integer) data.getReplacementId()).byteValue());
|
||||
if (data.getObjectData() != -1)
|
||||
wrapper.set(Type.INT, 0, data.getObjectData());
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_11to1_11_1;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.EntityPackets1_11_1;
|
||||
@ -18,7 +17,6 @@ import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.ItemPackets1_
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_11To1_11_1 extends BackwardsProtocol {
|
||||
private EntityPackets1_11_1 entityPackets;
|
||||
|
||||
@ -41,4 +39,8 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol {
|
||||
// Init protocol in EntityTracker
|
||||
user.get(EntityTracker.class).initProtocol(this);
|
||||
}
|
||||
|
||||
public EntityPackets1_11_1 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
}
|
||||
|
@ -57,9 +57,8 @@ public class EntityPackets1_11_1 extends EntityRewriter<Protocol1_11To1_11_1> {
|
||||
Optional<Entity1_11Types.ObjectType> type = Entity1_11Types.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
||||
|
||||
if (type.isPresent()) {
|
||||
Optional<EntityData> optEntDat = getObjectData(type.get());
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
EntityData data = getObjectData(type.get());
|
||||
if (data != null) {
|
||||
wrapper.set(Type.BYTE, 0, ((Integer) data.getReplacementId()).byteValue());
|
||||
if (data.getObjectData() != -1)
|
||||
wrapper.set(Type.INT, 0, data.getObjectData());
|
||||
|
@ -10,19 +10,26 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_1to1_12_2;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class KeepAliveTracker extends StoredObject {
|
||||
private long keepAlive = Integer.MAX_VALUE;
|
||||
|
||||
public KeepAliveTracker(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public long getKeepAlive() {
|
||||
return keepAlive;
|
||||
}
|
||||
|
||||
public void setKeepAlive(long keepAlive) {
|
||||
this.keepAlive = keepAlive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KeepAliveTracker{" + "keepAlive=" + keepAlive + '}';
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
|
||||
@Override
|
||||
public void handle(PacketWrapper packetWrapper) throws Exception {
|
||||
int keepAlive = packetWrapper.read(Type.VAR_INT);
|
||||
Long realKeepAlive = packetWrapper.user().get(KeepAliveTracker.class).getKeepAlive();
|
||||
if (keepAlive != realKeepAlive.hashCode()) {
|
||||
long realKeepAlive = packetWrapper.user().get(KeepAliveTracker.class).getKeepAlive();
|
||||
if (keepAlive != Long.hashCode(realKeepAlive)) {
|
||||
packetWrapper.cancel(); // Wrong data, cancel packet
|
||||
return;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
@ -34,7 +33,6 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
||||
|
||||
private BlockItemPackets1_13 blockItemPackets;
|
||||
@ -199,4 +197,8 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public BlockItemPackets1_13 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets.BlockItemPackets1_13;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
@ -158,12 +155,18 @@ public class ParticleMapping {
|
||||
int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data);
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public static class ParticleData {
|
||||
public static final class ParticleData {
|
||||
private final int historyId;
|
||||
private ParticleHandler handler;
|
||||
private final ParticleHandler handler;
|
||||
|
||||
private ParticleData(int historyId, ParticleHandler handler) {
|
||||
this.historyId = historyId;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
private ParticleData(int historyId) {
|
||||
this(historyId, null);
|
||||
}
|
||||
|
||||
public int[] rewriteData(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception {
|
||||
if (handler == null) return null;
|
||||
@ -174,5 +177,13 @@ public class ParticleMapping {
|
||||
if (handler == null) return null;
|
||||
return handler.rewrite(protocol, data);
|
||||
}
|
||||
|
||||
public int getHistoryId() {
|
||||
return historyId;
|
||||
}
|
||||
|
||||
public ParticleHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,7 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
|
||||
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
|
||||
public class Protocol1_12To1_12_1 extends BackwardsProtocol {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
@ -20,7 +19,6 @@ import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
||||
|
||||
private static final Integer[] A = new Integer[0];
|
||||
@ -321,4 +319,12 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
||||
if (!user.has(ChunkLightStorage.class))
|
||||
user.put(new ChunkLightStorage(user));
|
||||
}
|
||||
|
||||
public BlockItemPackets1_14 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
public EntityPackets1_14 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.EntityTypeRewrite
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityTypeMapping {
|
||||
private static final Map<Integer, Integer> entityTypes = new HashMap<>();
|
||||
@ -42,11 +41,7 @@ public class EntityTypeMapping {
|
||||
entityTypes.put(50, 48); // ocelot
|
||||
}
|
||||
|
||||
public static Optional<Integer> getOldId(int type1_14) {
|
||||
return Optional.ofNullable(entityTypes.get(type1_14));
|
||||
}
|
||||
|
||||
public static Optional<Integer> getObjectId(int type1_13) {
|
||||
return Optional.ofNullable(oldEntityToOldObject.get(type1_13));
|
||||
public static Integer getOldId(int type1_14) {
|
||||
return entityTypes.get(type1_14);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data;
|
||||
|
||||
import nl.matsv.viabackwards.api.rewriters.ItemRewriterBase;
|
||||
import nl.matsv.viabackwards.api.rewriters.LegacyBlockItemRewriter;
|
||||
import nl.matsv.viabackwards.api.rewriters.RecipeRewriter;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
|
@ -29,8 +29,6 @@ import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
|
||||
private EntityPositionHandler positionHandler;
|
||||
@ -113,7 +111,8 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int id = wrapper.get(Type.BYTE, 0);
|
||||
Entity1_13Types.EntityType entityType = Entity1_13Types.getTypeFromId(EntityTypeMapping.getOldId(id).orElse(id), false);
|
||||
Integer mappedId = EntityTypeMapping.getOldId(id);
|
||||
Entity1_13Types.EntityType entityType = Entity1_13Types.getTypeFromId(mappedId != null ? mappedId : id, false);
|
||||
Entity1_13Types.ObjectType objectType;
|
||||
if (entityType.isOrHasParent(Entity1_13Types.EntityType.MINECART_ABSTRACT)) {
|
||||
objectType = Entity1_13Types.ObjectType.MINECART;
|
||||
@ -186,17 +185,17 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
Entity1_14Types.EntityType entityType = Entity1_14Types.getTypeFromId(type);
|
||||
addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), entityType);
|
||||
|
||||
Optional<Integer> oldId = EntityTypeMapping.getOldId(type);
|
||||
if (!oldId.isPresent()) {
|
||||
Optional<EntityData> oldType = getEntityData(entityType);
|
||||
if (!oldType.isPresent()) {
|
||||
Integer oldId = EntityTypeMapping.getOldId(type);
|
||||
if (oldId == null) {
|
||||
EntityData entityData = getEntityData(entityType);
|
||||
if (entityData == null) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Could not find 1.13.2 entity type for 1.14 entity type " + type + "/" + entityType);
|
||||
wrapper.cancel();
|
||||
} else {
|
||||
wrapper.set(Type.VAR_INT, 1, oldType.get().getReplacementId());
|
||||
wrapper.set(Type.VAR_INT, 1, entityData.getReplacementId());
|
||||
}
|
||||
} else {
|
||||
wrapper.set(Type.VAR_INT, 1, oldId.get());
|
||||
wrapper.set(Type.VAR_INT, 1, oldId);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -583,6 +582,7 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
|
||||
@Override
|
||||
protected int getOldEntityId(final int newId) {
|
||||
return EntityTypeMapping.getOldId(newId).orElse(newId);
|
||||
Integer oldId = EntityTypeMapping.getOldId(newId);
|
||||
return oldId != null ? oldId : newId;
|
||||
}
|
||||
}
|
||||
|
@ -56,5 +56,6 @@ public class Protocol1_14_3To1_14_4 extends BackwardsProtocol {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection userConnection) {}
|
||||
public void init(UserConnection userConnection) {
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_9_4to1_10;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.BlockItemPackets1_10;
|
||||
@ -20,7 +19,6 @@ import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.SoundPackets1_
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_9_4To1_10 extends BackwardsProtocol {
|
||||
private EntityPackets1_10 entityPackets; // Required for the item rewriter
|
||||
private BlockItemPackets1_10 blockItemPackets;
|
||||
@ -44,4 +42,12 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol {
|
||||
// Init protocol in EntityTracker
|
||||
user.get(EntityTracker.class).initProtocol(this);
|
||||
}
|
||||
|
||||
public EntityPackets1_10 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_10 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,8 @@ public class EntityPackets1_10 extends EntityRewriter<Protocol1_9_4To1_10> {
|
||||
Optional<Entity1_11Types.ObjectType> type = Entity1_11Types.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
||||
|
||||
if (type.isPresent()) {
|
||||
Optional<EntityData> optEntDat = getObjectData(type.get());
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
EntityData data = getObjectData(type.get());
|
||||
if (data != null) {
|
||||
wrapper.set(Type.BYTE, 0, ((Integer) data.getReplacementId()).byteValue());
|
||||
if (data.getObjectData() != -1)
|
||||
wrapper.set(Type.INT, 0, data.getObjectData());
|
||||
@ -141,12 +140,11 @@ public class EntityPackets1_10 extends EntityRewriter<Protocol1_9_4To1_10> {
|
||||
storage
|
||||
);
|
||||
|
||||
Optional<EntityData> optEntDat = getEntityData(type);
|
||||
if (optEntDat.isPresent()) {
|
||||
EntityData data = optEntDat.get();
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, ((Integer) data.getReplacementId()).shortValue());
|
||||
if (data.hasBaseMeta())
|
||||
data.getDefaultMeta().handle(storage);
|
||||
EntityData entityData = getEntityData(type);
|
||||
if (entityData != null) {
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) entityData.getReplacementId());
|
||||
if (entityData.hasBaseMeta())
|
||||
entityData.getDefaultMeta().handle(storage);
|
||||
}
|
||||
|
||||
// Rewrite Metadata
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards.utils;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode
|
||||
public class Block {
|
||||
private final int id;
|
||||
private final int data;
|
||||
@ -38,4 +35,20 @@ public class Block {
|
||||
public Block withData(final int data) {
|
||||
return new Block(this.id, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Block block = (Block) o;
|
||||
if (id != block.id) return false;
|
||||
return data == block.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + data;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
package nl.matsv.viabackwards;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||
import nl.matsv.viabackwards.fabric.util.LoggerWrapper;
|
||||
@ -21,7 +20,6 @@ import java.nio.file.Path;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
||||
@Getter
|
||||
private final Logger logger = new LoggerWrapper(LogManager.getLogger("ViaBackwards"));
|
||||
private File configDir;
|
||||
|
||||
@ -41,4 +39,9 @@ public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
||||
public File getDataFolder() {
|
||||
return configDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,11 @@
|
||||
},
|
||||
"environment": "*",
|
||||
"authors": [
|
||||
"Matsv", "KennyTV", "Gerrygames", "creeper123123321", "ForceUpdate1"
|
||||
"Matsv",
|
||||
"KennyTV",
|
||||
"Gerrygames",
|
||||
"creeper123123321",
|
||||
"ForceUpdate1"
|
||||
],
|
||||
"entrypoints": {
|
||||
"viafabric:via_api_initialized": [
|
||||
|
7
pom.xml
7
pom.xml
@ -50,13 +50,6 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ViaVersion -->
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
|
@ -11,7 +11,6 @@
|
||||
package nl.matsv.viabackwards;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||
import nl.matsv.viabackwards.sponge.VersionInfo;
|
||||
import org.spongepowered.api.config.ConfigDir;
|
||||
@ -34,7 +33,6 @@ import java.util.logging.Logger;
|
||||
dependencies = {@Dependency(id = "viaversion")}
|
||||
)
|
||||
public class SpongePlugin implements ViaBackwardsPlatform {
|
||||
@Getter
|
||||
private Logger logger;
|
||||
@Inject
|
||||
private org.slf4j.Logger loggerSlf4j;
|
||||
@ -59,4 +57,9 @@ public class SpongePlugin implements ViaBackwardsPlatform {
|
||||
public File getDataFolder() {
|
||||
return configPath.toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.Dependency;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||
import nl.matsv.viabackwards.velocity.VersionInfo;
|
||||
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
|
||||
@ -34,7 +33,6 @@ import java.util.logging.Logger;
|
||||
dependencies = {@Dependency(id = "viaversion")}
|
||||
)
|
||||
public class VelocityPlugin implements ViaBackwardsPlatform {
|
||||
@Getter
|
||||
private Logger logger;
|
||||
@Inject
|
||||
private org.slf4j.Logger loggerSlf4j;
|
||||
@ -59,4 +57,9 @@ public class VelocityPlugin implements ViaBackwardsPlatform {
|
||||
public File getDataFolder() {
|
||||
return configPath.toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user