From ae7fcbc8ad0163d828c5e838fb1db7dc1d7b6a72 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Mon, 24 Jun 2019 17:14:01 -0300 Subject: [PATCH 1/7] trying to fix inconsistent types in block placement --- .../protocols/protocol1_9to1_8/packets/WorldPackets.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 9fcc90631..54398ad30 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -291,7 +291,7 @@ public class WorldPackets { wrapper.clearInputBuffer(); // First set this packet ID to Block placement wrapper.setId(0x08); - wrapper.write(Type.LONG, -1L); + wrapper.write(Type.POSITION, new Position((long) -1, (long) -1, (long) -1)); wrapper.write(Type.BYTE, (byte) 255); // Write item in hand Item item = Protocol1_9To1_8.getHandItem(wrapper.user()); @@ -315,9 +315,9 @@ public class WorldPackets { } wrapper.write(Type.ITEM, item); - wrapper.write(Type.BYTE, (byte) 0); - wrapper.write(Type.BYTE, (byte) 0); - wrapper.write(Type.BYTE, (byte) 0); + wrapper.write(Type.UNSIGNED_BYTE, (short) 0); + wrapper.write(Type.UNSIGNED_BYTE, (short) 0); + wrapper.write(Type.UNSIGNED_BYTE, (short) 0); } }); From a0e3d70a3f13f8e5dd6c6da7cf3a2aff9b6a973c Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Mon, 13 Apr 2020 14:01:28 -0300 Subject: [PATCH 2/7] unsigned byte --- .../protocols/protocol1_9to1_8/packets/WorldPackets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 54398ad30..7631919eb 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -292,7 +292,7 @@ public class WorldPackets { // First set this packet ID to Block placement wrapper.setId(0x08); wrapper.write(Type.POSITION, new Position((long) -1, (long) -1, (long) -1)); - wrapper.write(Type.BYTE, (byte) 255); + wrapper.write(Type.UNSIGNED_BYTE, (byte) 255); // Write item in hand Item item = Protocol1_9To1_8.getHandItem(wrapper.user()); // Blocking patch From 99abe3994c470eb13f2ff3ccd408caddea1ff341 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Mon, 13 Apr 2020 14:33:00 -0300 Subject: [PATCH 3/7] use short --- .../protocols/protocol1_9to1_8/packets/WorldPackets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 7631919eb..041a28353 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -292,7 +292,7 @@ public class WorldPackets { // First set this packet ID to Block placement wrapper.setId(0x08); wrapper.write(Type.POSITION, new Position((long) -1, (long) -1, (long) -1)); - wrapper.write(Type.UNSIGNED_BYTE, (byte) 255); + wrapper.write(Type.UNSIGNED_BYTE, (short) 255); // Write item in hand Item item = Protocol1_9To1_8.getHandItem(wrapper.user()); // Blocking patch From a91c72fb44a4c80e36c5467e7b7ea973b642c320 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Mon, 13 Apr 2020 14:42:48 -0300 Subject: [PATCH 4/7] position fix --- .../protocols/protocol1_9to1_8/packets/WorldPackets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 041a28353..5685a0370 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -291,7 +291,7 @@ public class WorldPackets { wrapper.clearInputBuffer(); // First set this packet ID to Block placement wrapper.setId(0x08); - wrapper.write(Type.POSITION, new Position((long) -1, (long) -1, (long) -1)); + wrapper.write(Type.POSITION, new Position(-1, (short) -1, -1)); wrapper.write(Type.UNSIGNED_BYTE, (short) 255); // Write item in hand Item item = Protocol1_9To1_8.getHandItem(wrapper.user()); From f173cf73d4db38715f54fe97ac0eb9b2cd338491 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Mon, 13 Apr 2020 19:30:06 +0200 Subject: [PATCH 5/7] Fix 1.15 EntityToggleGlideEvent cancelling on Bukkit Since 1.15, cancelling can only be done by updating the player's metadata --- bukkit/pom.xml | 2 +- .../EntityToggleGlideListener.java | 68 +++++++++++++++++++ .../protocol1_9to1_8/ArmorListener.java | 8 +-- .../bukkit/platform/BukkitViaLoader.java | 15 +++- 4 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java diff --git a/bukkit/pom.xml b/bukkit/pom.xml index ddecc1bc9..2d096d4d0 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -13,7 +13,7 @@ - 1.8.8-R0.1-SNAPSHOT + 1.12.2-R0.1-SNAPSHOT diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java new file mode 100644 index 000000000..59122387d --- /dev/null +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java @@ -0,0 +1,68 @@ +package us.myles.ViaVersion.bukkit.listeners.protocol1_15to1_14_4; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityToggleGlideEvent; +import org.bukkit.potion.PotionEffectType; +import us.myles.ViaVersion.ViaVersionPlugin; +import us.myles.ViaVersion.api.PacketWrapper; +import us.myles.ViaVersion.api.minecraft.metadata.Metadata; +import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; +import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.version.Types1_14; +import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; +import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; + +import java.util.Arrays; + +public class EntityToggleGlideListener extends ViaBukkitListener { + + public EntityToggleGlideListener(ViaVersionPlugin plugin) { + super(plugin, Protocol1_15To1_14_4.class); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void entityToggleGlide(EntityToggleGlideEvent event) { + if (!(event.getEntity() instanceof Player)) return; + + Player player = (Player) event.getEntity(); + if (!isOnPipe(player)) return; + + // Cancelling can only be done by updating the player's metadata + if (event.isGliding() && event.isCancelled()) { + PacketWrapper packet = new PacketWrapper(0x44, null, getUserConnection(player)); + try { + packet.write(Type.VAR_INT, player.getEntityId()); + + byte bitmask = 0; + if (player.getFireTicks() > 0) { + bitmask |= 0x01; + } + if (player.isSneaking()) { + bitmask |= 0x02; + } + // 0x04 is unused + if (player.isSprinting()) { + bitmask |= 0x08; + } + //TODO isswimming + /*if (player.isSprinting()) { + bitmask |= 0x10; + }*/ + if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + bitmask |= 0x20; + } + if (player.isGlowing()) { + bitmask |= 0x40; + } + + // leave 0x80 as 0 to stop gliding + packet.write(Types1_14.METADATA_LIST, Arrays.asList(new Metadata(0, MetaType1_14.Byte, bitmask))); + packet.send(Protocol1_15To1_14_4.class); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java index c40fc9b83..ce6192f2b 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java @@ -36,7 +36,6 @@ public class ArmorListener extends ViaBukkitListener { // Ensure that the player is on our pipe if (!isOnPipe(player)) return; - int armor = 0; for (ItemStack stack : player.getInventory().getArmorContents()) { armor += ArmorType.findById(stack.getTypeId()).getArmorPoints(); @@ -114,11 +113,6 @@ public class ArmorListener extends ViaBukkitListener { public void sendDelayedArmorUpdate(final Player player) { if (!isOnPipe(player)) return; // Don't start a task if the player is not on the pipe - Via.getPlatform().runSync(new Runnable() { - @Override - public void run() { - sendArmorUpdate(player); - } - }); + Via.getPlatform().runSync(() -> sendArmorUpdate(player)); } } \ No newline at end of file diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java index 50d5eba46..d394e3bb8 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java @@ -17,7 +17,12 @@ import us.myles.ViaVersion.api.protocol.ProtocolVersion; import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator; import us.myles.ViaVersion.bukkit.listeners.UpdateListener; import us.myles.ViaVersion.bukkit.listeners.multiversion.PlayerSneakListener; -import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.*; +import us.myles.ViaVersion.bukkit.listeners.protocol1_15to1_14_4.EntityToggleGlideListener; +import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.ArmorListener; +import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.BlockListener; +import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.DeathListener; +import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.HandItemCache; +import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.PaperPatch; import us.myles.ViaVersion.bukkit.providers.BukkitBlockConnectionProvider; import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider; import us.myles.ViaVersion.bukkit.providers.BukkitViaBulkChunkTranslator; @@ -99,6 +104,14 @@ public class BukkitViaLoader implements ViaPlatformLoader { } } + if (ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_15.getId()) { + try { + Class.forName("org.bukkit.event.entity.EntityToggleGlideEvent"); + storeListener(new EntityToggleGlideListener(plugin)).register(); + } catch (ClassNotFoundException ignored) { + } + } + if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper") || Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco") || Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch")) From fdb613733901f811b7702208bf6a3fcafa11ee1b Mon Sep 17 00:00:00 2001 From: KennyTV Date: Mon, 13 Apr 2020 20:19:55 +0200 Subject: [PATCH 6/7] Create bukkit-legacy module for 1.8 magic method usage No real changes to the classes other than them being moved --- bukkit-legacy/pom.xml | 63 +++++++++++++++++++ .../bukkit/listeners/ViaBukkitListener.java | 10 +-- .../protocol1_9to1_8/ArmorListener.java | 11 +--- .../protocol1_9to1_8/BlockListener.java | 4 +- .../protocol1_9to1_8/DeathListener.java | 5 +- .../protocol1_9to1_8/HandItemCache.java | 1 + .../protocol1_9to1_8/PaperPatch.java | 4 +- .../BukkitBlockConnectionProvider.java | 0 bukkit/pom.xml | 10 ++- .../EntityToggleGlideListener.java | 6 +- pom.xml | 13 ++++ sponge-legacy/pom.xml | 7 --- sponge/pom.xml | 7 --- velocity/pom.xml | 7 --- 14 files changed, 104 insertions(+), 44 deletions(-) create mode 100644 bukkit-legacy/pom.xml rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java (84%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java (93%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java (91%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java (95%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java (99%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java (96%) rename {bukkit => bukkit-legacy}/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitBlockConnectionProvider.java (100%) diff --git a/bukkit-legacy/pom.xml b/bukkit-legacy/pom.xml new file mode 100644 index 000000000..1a3bcd718 --- /dev/null +++ b/bukkit-legacy/pom.xml @@ -0,0 +1,63 @@ + + + + viaversion-parent + us.myles + 3.0.0-SNAPSHOT + + 4.0.0 + + viaversion-bukkit-legacy + + + 1.8.8-R0.1-SNAPSHOT + + + + + + . + true + src/main/resources/ + + * + + + + + + + + + us.myles + viaversion-common + ${project.parent.version} + provided + + + + + org.bukkit + bukkit + ${bukkitVersion} + provided + true + + + junit + junit + + + gson + com.google.code.gson + + + persistence-api + javax.persistence + + + + + \ No newline at end of file diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java similarity index 84% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java index a94bca5d3..e49620bf3 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java @@ -1,21 +1,17 @@ package us.myles.ViaVersion.bukkit.listeners; -import lombok.AccessLevel; -import lombok.Getter; import lombok.NonNull; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; -import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.api.ViaListener; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.Protocol; -@Getter(AccessLevel.PROTECTED) public class ViaBukkitListener extends ViaListener implements Listener { private final Plugin plugin; - public ViaBukkitListener(ViaVersionPlugin plugin, Class requiredPipeline) { + public ViaBukkitListener(Plugin plugin, Class requiredPipeline) { super(requiredPipeline); this.plugin = plugin; } @@ -50,4 +46,8 @@ public class ViaBukkitListener extends ViaListener implements Listener { plugin.getServer().getPluginManager().registerEvents(this, plugin); setRegistered(true); } + + public Plugin getPlugin() { + return plugin; + } } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java similarity index 93% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java index ce6192f2b..19aecfd04 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java @@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; -import us.myles.ViaVersion.ViaVersionPlugin; +import org.bukkit.plugin.Plugin; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.type.Type; @@ -28,7 +28,7 @@ public class ArmorListener extends ViaBukkitListener { private static final UUID ARMOR_ATTRIBUTE = UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"); - public ArmorListener(ViaVersionPlugin plugin) { + public ArmorListener(Plugin plugin) { super(plugin, Protocol1_9To1_8.class); } @@ -81,12 +81,7 @@ public class ArmorListener extends ViaBukkitListener { if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { final Player player = e.getPlayer(); // Due to odd bugs it's 3 ticks later - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { - @Override - public void run() { - sendArmorUpdate(player); - } - }, 3L); + Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> sendArmorUpdate(player), 3L); } } } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java similarity index 91% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java index 613ac2034..51212c4ab 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/BlockListener.java @@ -4,7 +4,7 @@ import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPlaceEvent; -import us.myles.ViaVersion.ViaVersionPlugin; +import org.bukkit.plugin.Plugin; import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; @@ -12,7 +12,7 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker1_9; public class BlockListener extends ViaBukkitListener { - public BlockListener(ViaVersionPlugin plugin) { + public BlockListener(Plugin plugin) { super(plugin, Protocol1_9To1_8.class); } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java similarity index 95% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java index 9182406a7..75df92843 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/DeathListener.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent; -import us.myles.ViaVersion.ViaVersionPlugin; +import org.bukkit.plugin.Plugin; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; @@ -14,7 +14,8 @@ import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; public class DeathListener extends ViaBukkitListener { - public DeathListener(ViaVersionPlugin plugin) { + + public DeathListener(Plugin plugin) { super(plugin, Protocol1_9To1_8.class); } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java similarity index 99% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java index 0acf86965..11603c003 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/HandItemCache.java @@ -13,6 +13,7 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public class HandItemCache extends BukkitRunnable { + private final Map handCache = new ConcurrentHashMap<>(); @Override diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java similarity index 96% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java index e4a3eb9bc..7281ed60f 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/PaperPatch.java @@ -6,13 +6,13 @@ import org.bukkit.block.BlockFace; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPlaceEvent; -import us.myles.ViaVersion.ViaVersionPlugin; +import org.bukkit.plugin.Plugin; import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; public class PaperPatch extends ViaBukkitListener { - public PaperPatch(ViaVersionPlugin plugin) { + public PaperPatch(Plugin plugin) { super(plugin, Protocol1_9To1_8.class); } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitBlockConnectionProvider.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitBlockConnectionProvider.java similarity index 100% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitBlockConnectionProvider.java rename to bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitBlockConnectionProvider.java diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 2d096d4d0..d20aad9cb 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -13,7 +13,7 @@ - 1.12.2-R0.1-SNAPSHOT + 1.15.2-R0.1-SNAPSHOT @@ -60,5 +60,13 @@ + + + + us.myles + viaversion-bukkit-legacy + ${project.parent.version} + compile + diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java index 59122387d..f2171ef35 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java @@ -36,6 +36,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener { packet.write(Type.VAR_INT, player.getEntityId()); byte bitmask = 0; + // Collect other metadata for the mitmask if (player.getFireTicks() > 0) { bitmask |= 0x01; } @@ -46,10 +47,9 @@ public class EntityToggleGlideListener extends ViaBukkitListener { if (player.isSprinting()) { bitmask |= 0x08; } - //TODO isswimming - /*if (player.isSprinting()) { + if (player.isSwimming()) { bitmask |= 0x10; - }*/ + } if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { bitmask |= 0x20; } diff --git a/pom.xml b/pom.xml index cce6f4403..ddb54884d 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ common bukkit + bukkit-legacy bungee fabric sponge @@ -52,6 +53,18 @@ https://oss.sonatype.org/content/repositories/snapshots + + + velocity + https://repo.velocitypowered.com/snapshots + + + + + sponge + https://repo.spongepowered.org/maven + + viaversion-repo diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 4b8400c32..149e777b5 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -12,13 +12,6 @@ viaversion-sponge-legacy jar - - - sponge - https://repo.spongepowered.org/maven - - - diff --git a/sponge/pom.xml b/sponge/pom.xml index 0ca5336ea..2fce07c34 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -11,13 +11,6 @@ viaversion-sponge - - - sponge - https://repo.spongepowered.org/maven - - - diff --git a/velocity/pom.xml b/velocity/pom.xml index 6dc467fa3..ccbb0ef36 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -11,13 +11,6 @@ viaversion-velocity - - - velocity - https://repo.velocitypowered.com/snapshots - - - From 8f08a32c5aebe55a65e488a0f2995287c66126df Mon Sep 17 00:00:00 2001 From: KennyTV Date: Mon, 13 Apr 2020 20:58:24 +0200 Subject: [PATCH 7/7] Bai bai to more lombok usage once more --- .../bukkit/listeners/ViaBukkitListener.java | 3 +- .../us/myles/ViaVersion/boss/ViaBossBar.java | 2 - .../bukkit/commands/BukkitCommandSender.java | 6 +- .../bukkit/platform/BukkitTaskId.java | 13 ++- .../bukkit/platform/BukkitViaAPI.java | 5 +- .../bungee/commands/BungeeCommandSender.java | 8 +- .../handlers/BungeeChannelInitializer.java | 6 +- .../bungee/platform/BungeeTaskId.java | 15 ++-- .../ViaVersion/api/data/UserConnection.java | 10 +-- .../ViaVersion/api/minecraft/item/Item.java | 14 ++- .../us/myles/ViaVersion/boss/CommonBoss.java | 50 ++++++++--- .../commands/ViaCommandHandler.java | 5 +- .../myles/ViaVersion/dump/DumpTemplate.java | 35 ++++++-- .../us/myles/ViaVersion/dump/PluginInfo.java | 43 ++++++--- .../us/myles/ViaVersion/dump/VersionInfo.java | 57 +++++++++--- .../protocols/base/ProtocolInfo.java | 52 ++++++++++- .../storage/ResourcePackTracker.java | 21 +++-- .../storage/ItemTransaction.java | 40 ++++++--- .../data/ParticleRewriter.java | 19 ++-- .../protocol1_13to1_12_2/data/RecipeData.java | 76 +++++++++++++++- .../data/SoundSource.java | 18 ++-- .../storage/BlockStorage.java | 26 ++++-- .../storage/TabCompleteTracker.java | 36 +++++++- .../storage/ClientWorld.java | 6 +- .../protocols/protocol1_9to1_8/ArmorType.java | 21 +++-- .../protocol1_9to1_8/chat/GameMode.java | 18 ++-- .../protocol1_9to1_8/metadata/MetaIndex.java | 22 ++++- .../BulkChunkTranslatorProvider.java | 42 ++++++++- .../sounds/SoundCategory.java | 18 ++-- .../protocol1_9to1_8/sounds/SoundEffect.java | 20 ++++- .../storage/ClientChunks.java | 10 ++- .../storage/CommandBlockStorage.java | 14 +-- .../storage/EntityTracker1_9.java | 90 ++++++++++++++++--- .../storage/InventoryTracker.java | 12 ++- .../storage/MovementTracker.java | 17 ++-- .../storage/PlaceBlockTracker.java | 16 +++- .../us/myles/ViaVersion/util/GsonUtil.java | 11 +-- .../sponge/commands/SpongeCommandSender.java | 8 +- .../handlers/SpongeChannelInitializer.java | 6 +- .../sponge/listeners/ViaSpongeListener.java | 6 +- .../sponge/platform/SpongeTaskId.java | 15 ++-- .../sponge/platform/SpongeViaAPI.java | 5 +- .../command/VelocityCommandSender.java | 8 +- .../handlers/VelocityChannelInitializer.java | 8 +- .../handlers/VelocityDecodeHandler.java | 6 +- .../handlers/VelocityEncodeHandler.java | 10 +-- .../velocity/platform/VelocityTaskId.java | 15 ++-- .../velocity/platform/VelocityViaAPI.java | 5 +- .../service/ProtocolDetectorService.java | 5 +- 49 files changed, 750 insertions(+), 224 deletions(-) diff --git a/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java index e49620bf3..33d245c87 100644 --- a/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java +++ b/bukkit-legacy/src/main/java/us/myles/ViaVersion/bukkit/listeners/ViaBukkitListener.java @@ -1,6 +1,5 @@ package us.myles.ViaVersion.bukkit.listeners; -import lombok.NonNull; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; @@ -22,7 +21,7 @@ public class ViaBukkitListener extends ViaListener implements Listener { * @param player Player object * @return The UserConnection */ - protected UserConnection getUserConnection(@NonNull Player player) { + protected UserConnection getUserConnection(Player player) { return getUserConnection(player.getUniqueId()); } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java b/bukkit/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java index 7083ac7d8..5314b93a6 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java @@ -1,12 +1,10 @@ package us.myles.ViaVersion.boss; -import lombok.Getter; import org.bukkit.entity.Player; import us.myles.ViaVersion.api.boss.BossBar; import us.myles.ViaVersion.api.boss.BossColor; import us.myles.ViaVersion.api.boss.BossStyle; -@Getter public class ViaBossBar extends CommonBoss { public ViaBossBar(String title, float health, BossColor color, BossStyle style) { diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/commands/BukkitCommandSender.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/commands/BukkitCommandSender.java index 9e08186ca..6eca4a5cf 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/commands/BukkitCommandSender.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/commands/BukkitCommandSender.java @@ -1,16 +1,18 @@ package us.myles.ViaVersion.bukkit.commands; -import lombok.AllArgsConstructor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import us.myles.ViaVersion.api.command.ViaCommandSender; import java.util.UUID; -@AllArgsConstructor public class BukkitCommandSender implements ViaCommandSender { private final CommandSender sender; + public BukkitCommandSender(CommandSender sender) { + this.sender = sender; + } + @Override public boolean hasPermission(String permission) { return sender.hasPermission(permission); diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitTaskId.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitTaskId.java index 462aa0848..e2cd22fb5 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitTaskId.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitTaskId.java @@ -1,11 +1,16 @@ package us.myles.ViaVersion.bukkit.platform; -import lombok.AllArgsConstructor; -import lombok.Getter; import us.myles.ViaVersion.api.platform.TaskId; -@Getter -@AllArgsConstructor public class BukkitTaskId implements TaskId { private final Integer object; + + public BukkitTaskId(Integer object) { + this.object = object; + } + + @Override + public Integer getObject() { + return object; + } } diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaAPI.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaAPI.java index 8ff4ec35d..446ce87fe 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaAPI.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaAPI.java @@ -1,7 +1,6 @@ package us.myles.ViaVersion.bukkit.platform; import io.netty.buffer.ByteBuf; -import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import us.myles.ViaVersion.ViaVersionPlugin; @@ -29,12 +28,12 @@ public class BukkitViaAPI implements ViaAPI { } @Override - public int getPlayerVersion(@NonNull Player player) { + public int getPlayerVersion(Player player) { return getPlayerVersion(player.getUniqueId()); } @Override - public int getPlayerVersion(@NonNull UUID uuid) { + public int getPlayerVersion(UUID uuid) { if (!isPorted(uuid)) return getExternalVersion(Bukkit.getPlayer(uuid)); return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion(); diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/BungeeCommandSender.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/BungeeCommandSender.java index 5b9e43382..c6c549af2 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/BungeeCommandSender.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/BungeeCommandSender.java @@ -1,15 +1,17 @@ package us.myles.ViaVersion.bungee.commands; -import lombok.AllArgsConstructor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import us.myles.ViaVersion.api.command.ViaCommandSender; import java.util.UUID; -@AllArgsConstructor public class BungeeCommandSender implements ViaCommandSender { - private CommandSender sender; + private final CommandSender sender; + + public BungeeCommandSender(CommandSender sender) { + this.sender = sender; + } @Override public boolean hasPermission(String permission) { diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeChannelInitializer.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeChannelInitializer.java index 3902ddf56..ac7cba74c 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeChannelInitializer.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeChannelInitializer.java @@ -2,15 +2,12 @@ package us.myles.ViaVersion.bungee.handlers; import io.netty.channel.Channel; import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import lombok.Getter; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.ProtocolPipeline; import java.lang.reflect.Method; public class BungeeChannelInitializer extends ChannelInitializer { - @Getter private final ChannelInitializer original; private Method method; @@ -40,6 +37,9 @@ public class BungeeChannelInitializer extends ChannelInitializer { socketChannel.pipeline().addBefore("packet-encoder", "via-encoder", encoder); socketChannel.pipeline().addBefore("packet-decoder", "via-decoder", decoder); + } + public ChannelInitializer getOriginal() { + return original; } } diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeTaskId.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeTaskId.java index cde0c6098..96b9a8045 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeTaskId.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeTaskId.java @@ -1,11 +1,16 @@ package us.myles.ViaVersion.bungee.platform; -import lombok.AllArgsConstructor; -import lombok.Getter; import us.myles.ViaVersion.api.platform.TaskId; -@Getter -@AllArgsConstructor public class BungeeTaskId implements TaskId { - private Integer object; + private final Integer object; + + public BungeeTaskId(Integer object) { + this.object = object; + } + + @Override + public Integer getObject() { + return object; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java b/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java index c1d8dda58..dab0fc13c 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java +++ b/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java @@ -17,8 +17,6 @@ import us.myles.ViaVersion.util.PipelineUtil; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; @Data public class UserConnection { @@ -156,12 +154,12 @@ public class UserConnection { if (conf.getMaxWarnings() > 0 && conf.getTrackingPeriod() > 0) { if (secondsObserved > conf.getTrackingPeriod()) { // Reset - setWarnings(0); - setSecondsObserved(1); + warnings = 0; + secondsObserved = 1; } else { - setSecondsObserved(secondsObserved + 1); + secondsObserved++; if (packetsPerSecond >= conf.getWarningPPS()) { - setWarnings(warnings + 1); + warnings++; } if (warnings >= conf.getMaxWarnings()) { diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/item/Item.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/item/Item.java index 93e77bfe0..0ea2c766b 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/item/Item.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/item/Item.java @@ -2,11 +2,7 @@ package us.myles.ViaVersion.api.minecraft.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.google.gson.annotations.SerializedName; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor public class Item { @SerializedName(value = "identifier", alternate = "id") private int identifier; @@ -14,6 +10,16 @@ public class Item { private short data; private CompoundTag tag; + public Item() { + } + + public Item(int identifier, byte amount, short data, CompoundTag tag) { + this.identifier = identifier; + this.amount = amount; + this.data = data; + this.tag = tag; + } + public Item(Item toCopy) { this(toCopy.getIdentifier(), toCopy.getAmount(), toCopy.getData(), toCopy.getTag()); } diff --git a/common/src/main/java/us/myles/ViaVersion/boss/CommonBoss.java b/common/src/main/java/us/myles/ViaVersion/boss/CommonBoss.java index 748c7aae7..bbdb5de77 100644 --- a/common/src/main/java/us/myles/ViaVersion/boss/CommonBoss.java +++ b/common/src/main/java/us/myles/ViaVersion/boss/CommonBoss.java @@ -1,8 +1,6 @@ package us.myles.ViaVersion.boss; import com.google.common.base.Preconditions; -import lombok.Getter; -import lombok.NonNull; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.boss.BossBar; @@ -14,9 +12,12 @@ import us.myles.ViaVersion.api.protocol.ProtocolVersion; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; -@Getter public abstract class CommonBoss extends BossBar { private final UUID uuid; private String title; @@ -42,7 +43,8 @@ public abstract class CommonBoss extends BossBar { } @Override - public BossBar setTitle(@NonNull String title) { + public BossBar setTitle(String title) { + Preconditions.checkNotNull(title); this.title = title; sendPacket(CommonBoss.UpdateAction.UPDATE_TITLE); return this; @@ -62,14 +64,16 @@ public abstract class CommonBoss extends BossBar { } @Override - public BossBar setColor(@NonNull BossColor color) { + public BossBar setColor(BossColor color) { + Preconditions.checkNotNull(color); this.color = color; sendPacket(CommonBoss.UpdateAction.UPDATE_STYLE); return this; } @Override - public BossBar setStyle(@NonNull BossStyle style) { + public BossBar setStyle(BossStyle style) { + Preconditions.checkNotNull(style); this.style = style; sendPacket(CommonBoss.UpdateAction.UPDATE_STYLE); return this; @@ -98,7 +102,8 @@ public abstract class CommonBoss extends BossBar { } @Override - public BossBar addFlag(@NonNull BossFlag flag) { + public BossBar addFlag(BossFlag flag) { + Preconditions.checkNotNull(flag); if (!hasFlag(flag)) flags.add(flag); sendPacket(CommonBoss.UpdateAction.UPDATE_FLAGS); @@ -106,7 +111,8 @@ public abstract class CommonBoss extends BossBar { } @Override - public BossBar removeFlag(@NonNull BossFlag flag) { + public BossBar removeFlag(BossFlag flag) { + Preconditions.checkNotNull(flag); if (hasFlag(flag)) flags.remove(flag); sendPacket(CommonBoss.UpdateAction.UPDATE_FLAGS); @@ -114,7 +120,8 @@ public abstract class CommonBoss extends BossBar { } @Override - public boolean hasFlag(@NonNull BossFlag flag) { + public boolean hasFlag(BossFlag flag) { + Preconditions.checkNotNull(flag); return flags.contains(flag); } @@ -145,6 +152,29 @@ public abstract class CommonBoss extends BossBar { return uuid; } + public UUID getUuid() { + return uuid; + } + + @Override + public String getTitle() { + return title; + } + + @Override + public float getHealth() { + return health; + } + + @Override + public BossStyle getStyle() { + return style; + } + + public Set getFlags() { + return flags; + } + private void setVisible(boolean value) { if (visible != value) { visible = value; diff --git a/common/src/main/java/us/myles/ViaVersion/commands/ViaCommandHandler.java b/common/src/main/java/us/myles/ViaVersion/commands/ViaCommandHandler.java index 9935fc48c..fa35133fa 100644 --- a/common/src/main/java/us/myles/ViaVersion/commands/ViaCommandHandler.java +++ b/common/src/main/java/us/myles/ViaVersion/commands/ViaCommandHandler.java @@ -1,7 +1,6 @@ package us.myles.ViaVersion.commands; import com.google.common.base.Preconditions; -import lombok.NonNull; import net.md_5.bungee.api.ChatColor; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.command.ViaCommandSender; @@ -24,7 +23,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand { } @Override - public void registerSubCommand(@NonNull ViaSubCommand command) throws Exception { + public void registerSubCommand(ViaSubCommand command) throws Exception { Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid sub-command name."); if (hasSubCommand(command.name())) throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later. @@ -163,7 +162,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand { * @param message The message * @param args The objects to replace */ - public static void sendMessage(@NonNull ViaCommandSender sender, String message, Object... args) { + public static void sendMessage(ViaCommandSender sender, String message, Object... args) { sender.sendMessage(color(args == null ? message : String.format(message, args))); } } diff --git a/common/src/main/java/us/myles/ViaVersion/dump/DumpTemplate.java b/common/src/main/java/us/myles/ViaVersion/dump/DumpTemplate.java index ec15a1e40..e1db18b34 100644 --- a/common/src/main/java/us/myles/ViaVersion/dump/DumpTemplate.java +++ b/common/src/main/java/us/myles/ViaVersion/dump/DumpTemplate.java @@ -1,16 +1,35 @@ package us.myles.ViaVersion.dump; import com.google.gson.JsonObject; -import lombok.AllArgsConstructor; -import lombok.Data; import java.util.Map; -@Data -@AllArgsConstructor public class DumpTemplate { - private VersionInfo versionInfo; - private Map configuration; - private JsonObject platformDump; - private JsonObject injectionDump; + private final VersionInfo versionInfo; + private final Map configuration; + private final JsonObject platformDump; + private final JsonObject injectionDump; + + public DumpTemplate(VersionInfo versionInfo, Map configuration, JsonObject platformDump, JsonObject injectionDump) { + this.versionInfo = versionInfo; + this.configuration = configuration; + this.platformDump = platformDump; + this.injectionDump = injectionDump; + } + + public VersionInfo getVersionInfo() { + return versionInfo; + } + + public Map getConfiguration() { + return configuration; + } + + public JsonObject getPlatformDump() { + return platformDump; + } + + public JsonObject getInjectionDump() { + return injectionDump; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/dump/PluginInfo.java b/common/src/main/java/us/myles/ViaVersion/dump/PluginInfo.java index cbe273a7c..86078d024 100644 --- a/common/src/main/java/us/myles/ViaVersion/dump/PluginInfo.java +++ b/common/src/main/java/us/myles/ViaVersion/dump/PluginInfo.java @@ -1,16 +1,39 @@ package us.myles.ViaVersion.dump; -import lombok.AllArgsConstructor; -import lombok.Data; - import java.util.List; -@Data -@AllArgsConstructor public class PluginInfo { - private boolean enabled; - private String name; - private String version; - private String main; - private List authors; + private final boolean enabled; + private final String name; + private final String version; + private final String main; + private final List authors; + + public PluginInfo(boolean enabled, String name, String version, String main, List authors) { + this.enabled = enabled; + this.name = name; + this.version = version; + this.main = main; + this.authors = authors; + } + + public boolean isEnabled() { + return enabled; + } + + public String getName() { + return name; + } + + public String getVersion() { + return version; + } + + public String getMain() { + return main; + } + + public List getAuthors() { + return authors; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/dump/VersionInfo.java b/common/src/main/java/us/myles/ViaVersion/dump/VersionInfo.java index 3c7f81110..0ab5711a4 100644 --- a/common/src/main/java/us/myles/ViaVersion/dump/VersionInfo.java +++ b/common/src/main/java/us/myles/ViaVersion/dump/VersionInfo.java @@ -1,19 +1,52 @@ package us.myles.ViaVersion.dump; -import lombok.AllArgsConstructor; -import lombok.Data; - import java.util.Set; -@Data -@AllArgsConstructor public class VersionInfo { - private String javaVersion; - private String operatingSystem; - private int serverProtocol; - private Set enabledProtocols; - private String platformName; - private String platformVersion; - private String pluginVersion; + private final String javaVersion; + private final String operatingSystem; + private final int serverProtocol; + private final Set enabledProtocols; + private final String platformName; + private final String platformVersion; + private final String pluginVersion; + + public VersionInfo(String javaVersion, String operatingSystem, int serverProtocol, Set enabledProtocols, String platformName, String platformVersion, String pluginVersion) { + this.javaVersion = javaVersion; + this.operatingSystem = operatingSystem; + this.serverProtocol = serverProtocol; + this.enabledProtocols = enabledProtocols; + this.platformName = platformName; + this.platformVersion = platformVersion; + this.pluginVersion = pluginVersion; + } + + public String getJavaVersion() { + return javaVersion; + } + + public String getOperatingSystem() { + return operatingSystem; + } + + public int getServerProtocol() { + return serverProtocol; + } + + public Set getEnabledProtocols() { + return enabledProtocols; + } + + public String getPlatformName() { + return platformName; + } + + public String getPlatformVersion() { + return platformVersion; + } + + public String getPluginVersion() { + return pluginVersion; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/base/ProtocolInfo.java b/common/src/main/java/us/myles/ViaVersion/protocols/base/ProtocolInfo.java index 855d2bfbf..565eab34b 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/base/ProtocolInfo.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/base/ProtocolInfo.java @@ -1,7 +1,5 @@ package us.myles.ViaVersion.protocols.base; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.ProtocolPipeline; @@ -9,8 +7,6 @@ import us.myles.ViaVersion.packets.State; import java.util.UUID; -@Getter -@Setter public class ProtocolInfo extends StoredObject { private State state = State.HANDSHAKE; private int protocolVersion = -1; @@ -22,4 +18,52 @@ public class ProtocolInfo extends StoredObject { public ProtocolInfo(UserConnection user) { super(user); } + + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + public int getProtocolVersion() { + return protocolVersion; + } + + public void setProtocolVersion(int protocolVersion) { + this.protocolVersion = protocolVersion; + } + + public int getServerProtocolVersion() { + return serverProtocolVersion; + } + + public void setServerProtocolVersion(int serverProtocolVersion) { + this.serverProtocolVersion = serverProtocolVersion; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public ProtocolPipeline getPipeline() { + return pipeline; + } + + public void setPipeline(ProtocolPipeline pipeline) { + this.pipeline = pipeline; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/storage/ResourcePackTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/storage/ResourcePackTracker.java index d1fef3f43..7298016be 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/storage/ResourcePackTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/storage/ResourcePackTracker.java @@ -1,18 +1,27 @@ package us.myles.ViaVersion.protocols.protocol1_10to1_9_3.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 -@Setter -@ToString public class ResourcePackTracker extends StoredObject { private String lastHash = ""; public ResourcePackTracker(UserConnection user) { super(user); } + + public String getLastHash() { + return lastHash; + } + + public void setLastHash(String lastHash) { + this.lastHash = lastHash; + } + + @Override + public String toString() { + return "ResourcePackTracker{" + + "lastHash='" + lastHash + '\'' + + '}'; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_12to1_11_1/storage/ItemTransaction.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_12to1_11_1/storage/ItemTransaction.java index 9ae0109c2..00441065c 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_12to1_11_1/storage/ItemTransaction.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_12to1_11_1/storage/ItemTransaction.java @@ -1,14 +1,34 @@ package us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.ToString; - -@AllArgsConstructor -@ToString -@Getter public class ItemTransaction { - private short windowId; - private short slotId; - private short actionId; + private final short windowId; + private final short slotId; + private final short actionId; + + public ItemTransaction(short windowId, short slotId, short actionId) { + this.windowId = windowId; + this.slotId = slotId; + this.actionId = actionId; + } + + public short getWindowId() { + return windowId; + } + + public short getSlotId() { + return slotId; + } + + public short getActionId() { + return actionId; + } + + @Override + public String toString() { + return "ItemTransaction{" + + "windowId=" + windowId + + ", slotId=" + slotId + + ", actionId=" + actionId + + '}'; + } } \ No newline at end of file diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java index bde68c242..a9fa72eec 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java @@ -1,7 +1,5 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data; -import lombok.Data; -import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.type.Type; @@ -162,18 +160,27 @@ public class ParticleRewriter { Particle handler(Particle particle, Integer[] data); } - @Data - @RequiredArgsConstructor private static class NewParticle { private final int id; private final ParticleDataHandler handler; + public NewParticle(int id, ParticleDataHandler handler) { + this.id = id; + this.handler = handler; + } + public Particle handle(Particle particle, Integer[] data) { if (handler != null) return handler.handler(particle, data); return particle; } + + public int getId() { + return id; + } + + public ParticleDataHandler getHandler() { + return handler; + } } - - } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/RecipeData.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/RecipeData.java index 0be032fbe..4290b798e 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/RecipeData.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/RecipeData.java @@ -1,8 +1,6 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data; import com.google.gson.reflect.TypeToken; -import lombok.Data; -import lombok.NonNull; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.util.GsonUtil; @@ -33,9 +31,7 @@ public class RecipeData { } } - @Data public static class Recipe { - @NonNull private String type; private String group; private int width; @@ -45,5 +41,77 @@ public class RecipeData { private Item[] ingredient; private Item[][] ingredients; private Item result; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + public float getExperience() { + return experience; + } + + public void setExperience(float experience) { + this.experience = experience; + } + + public int getCookingTime() { + return cookingTime; + } + + public void setCookingTime(int cookingTime) { + this.cookingTime = cookingTime; + } + + public Item[] getIngredient() { + return ingredient; + } + + public void setIngredient(Item[] ingredient) { + this.ingredient = ingredient; + } + + public Item[][] getIngredients() { + return ingredients; + } + + public void setIngredients(Item[][] ingredients) { + this.ingredients = ingredients; + } + + public Item getResult() { + return result; + } + + public void setResult(Item result) { + this.result = result; + } } } \ No newline at end of file diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/SoundSource.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/SoundSource.java index 0d6ac2c44..c5a837e38 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/SoundSource.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/SoundSource.java @@ -1,12 +1,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data; -import lombok.AllArgsConstructor; -import lombok.Getter; - import java.util.Optional; -@Getter -@AllArgsConstructor public enum SoundSource { MASTER("master", 0), MUSIC("music", 1), @@ -22,10 +17,23 @@ public enum SoundSource { private final String name; private final int id; + SoundSource(String name, int id) { + this.name = name; + this.id = id; + } + public static Optional findBySource(String source) { for (SoundSource item : SoundSource.values()) if (item.name.equalsIgnoreCase(source)) return Optional.of(item); return Optional.empty(); } + + public String getName() { + return name; + } + + public int getId() { + return id; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/BlockStorage.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/BlockStorage.java index a15ce7004..dfdbf1b7c 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/BlockStorage.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/BlockStorage.java @@ -1,7 +1,5 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage; -import lombok.AllArgsConstructor; -import lombok.Data; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.Position; @@ -68,11 +66,29 @@ public class BlockStorage extends StoredObject { return blocks.remove(position); } - @Data - @AllArgsConstructor public static class ReplacementData { private int original; private int replacement; - } + public ReplacementData(int original, int replacement) { + this.original = original; + this.replacement = replacement; + } + + public int getOriginal() { + return original; + } + + public void setOriginal(int original) { + this.original = original; + } + + public int getReplacement() { + return replacement; + } + + public void setReplacement(int replacement) { + this.replacement = replacement; + } + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java index 775523167..b3d7e99c4 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java @@ -1,15 +1,11 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; -@Getter -@Setter public class TabCompleteTracker extends StoredObject { private int transactionId; private String input; @@ -33,4 +29,36 @@ public class TabCompleteTracker extends StoredObject { } lastTabComplete = null; } + + public int getTransactionId() { + return transactionId; + } + + public void setTransactionId(int transactionId) { + this.transactionId = transactionId; + } + + public String getInput() { + return input; + } + + public void setInput(final String input) { + this.input = input; + } + + public String getLastTabComplete() { + return lastTabComplete; + } + + public void setLastTabComplete(String lastTabComplete) { + this.lastTabComplete = lastTabComplete; + } + + public long getTimeToSend() { + return timeToSend; + } + + public void setTimeToSend(long timeToSend) { + this.timeToSend = timeToSend; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java index 9dcca3354..5e9be98a2 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java @@ -1,11 +1,9 @@ package us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage; -import lombok.Getter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.Environment; -@Getter public class ClientWorld extends StoredObject { private Environment environment; @@ -13,6 +11,10 @@ public class ClientWorld extends StoredObject { super(user); } + public Environment getEnvironment() { + return environment; + } + public void setEnvironment(int environmentId) { this.environment = getEnvFromId(environmentId); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ArmorType.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ArmorType.java index 1dd083af0..f302dbe88 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ArmorType.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ArmorType.java @@ -1,13 +1,8 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - import java.util.HashMap; import java.util.Map; -@RequiredArgsConstructor -@Getter public enum ArmorType { LEATHER_HELMET(1, 298, "minecraft:leather_helmet"), @@ -32,7 +27,7 @@ public enum ArmorType { GOLD_BOOTS(1, 317, "minecraft:gold_boots"), NONE(0, 0, "none"); - private static Map armor; + private static final Map armor; static { armor = new HashMap<>(); @@ -45,6 +40,20 @@ public enum ArmorType { private final int id; private final String type; + ArmorType(int armorPoints, int id, String type) { + this.armorPoints = armorPoints; + this.id = id; + this.type = type; + } + + public int getArmorPoints() { + return armorPoints; + } + + public String getType() { + return type; + } + /** * Find an armour type by the item id * diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/chat/GameMode.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/chat/GameMode.java index d3e31c239..cb69ee7d3 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/chat/GameMode.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/chat/GameMode.java @@ -1,10 +1,5 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.chat; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter public enum GameMode { SURVIVAL(0, "Survival Mode"), CREATIVE(1, "Creative Mode"), @@ -14,6 +9,19 @@ public enum GameMode { private final int id; private final String text; + GameMode(int id, String text) { + this.id = id; + this.text = text; + } + + public int getId() { + return id; + } + + public String getText() { + return text; + } + public static GameMode getById(int id) { for (GameMode gm : GameMode.values()) if (gm.getId() == id) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java index 8c6340d5d..1f05bc09b 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java @@ -1,6 +1,5 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata; -import lombok.Getter; import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.entities.Entity1_10Types; import us.myles.ViaVersion.api.entities.EntityType; @@ -12,7 +11,6 @@ import java.util.Optional; import static us.myles.ViaVersion.api.entities.Entity1_10Types.EntityType.*; -@Getter public enum MetaIndex { // entity @@ -172,6 +170,26 @@ public enum MetaIndex { this.newType = newType; } + public Entity1_10Types.EntityType getClazz() { + return clazz; + } + + public int getNewIndex() { + return newIndex; + } + + public MetaType1_9 getNewType() { + return newType; + } + + public MetaType1_8 getOldType() { + return oldType; + } + + public int getIndex() { + return index; + } + private static Optional getIndex(EntityType type, int index) { Pair pair = new Pair<>(type, index); return Optional.ofNullable(metadataRewrites.get(pair)); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/providers/BulkChunkTranslatorProvider.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/providers/BulkChunkTranslatorProvider.java index 4a8c46f33..1eaf59ba9 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/providers/BulkChunkTranslatorProvider.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/providers/BulkChunkTranslatorProvider.java @@ -1,6 +1,5 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.providers; -import lombok.Data; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.platform.providers.Provider; import us.myles.ViaVersion.api.type.Type; @@ -74,7 +73,6 @@ public class BulkChunkTranslatorProvider implements Provider { return true; } - @Data private static class ChunkBulkSection { private int x; private int z; @@ -93,5 +91,45 @@ public class BulkChunkTranslatorProvider implements Provider { return bulkSection; } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getZ() { + return z; + } + + public void setZ(int z) { + this.z = z; + } + + public int getBitMask() { + return bitMask; + } + + public void setBitMask(int bitMask) { + this.bitMask = bitMask; + } + + public int getLength() { + return length; + } + + public void setLength(int length) { + this.length = length; + } + + public byte[] getData() { + return data; + } + + public void setData(byte[] data) { + this.data = data; + } } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundCategory.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundCategory.java index 2d058cfbd..23b52e2f3 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundCategory.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundCategory.java @@ -1,13 +1,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter public enum SoundCategory { - MASTER("master", 0), MUSIC("music", 1), RECORD("record", 2), @@ -22,4 +16,16 @@ public enum SoundCategory { private final String name; private final int id; + SoundCategory(String name, int id) { + this.name = name; + this.id = id; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundEffect.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundEffect.java index 6f8a2dd5f..5f4c04a84 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundEffect.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/sounds/SoundEffect.java @@ -1,12 +1,9 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds; -import lombok.Getter; - import java.util.HashMap; import java.util.Locale; import java.util.Map; -@Getter public enum SoundEffect { MOB_HORSE_ZOMBIE_IDLE("mob.horse.zombie.idle", "entity.zombie_horse.ambient", SoundCategory.NEUTRAL), @@ -261,7 +258,7 @@ public enum SoundEffect { private final SoundCategory category; private final boolean breaksound; - private static Map effects; + private static final Map effects; static { effects = new HashMap<>(); @@ -289,4 +286,19 @@ public enum SoundEffect { return effects.get(name); } + public String getName() { + return name; + } + + public String getNewName() { + return newName; + } + + public SoundCategory getCategory() { + return category; + } + + public boolean isBreaksound() { + return breaksound; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/ClientChunks.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/ClientChunks.java index e4149ef73..aab46341f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/ClientChunks.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/ClientChunks.java @@ -1,7 +1,6 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; import com.google.common.collect.Sets; -import lombok.Getter; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; @@ -10,7 +9,6 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTransla import java.util.List; import java.util.Set; -@Getter public class ClientChunks extends StoredObject { private final Set loadedChunks = Sets.newConcurrentHashSet(); private final Set bulkChunks = Sets.newConcurrentHashSet(); @@ -26,4 +24,12 @@ public class ClientChunks extends StoredObject { public List transformMapChunkBulk(Object packet) throws Exception { return Via.getManager().getProviders().get(BulkChunkTranslatorProvider.class).transformMapChunkBulk(packet, this); } + + public Set getLoadedChunks() { + return loadedChunks; + } + + public Set getBulkChunks() { + return bulkChunks; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/CommandBlockStorage.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/CommandBlockStorage.java index f20d7e944..0edd8358b 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/CommandBlockStorage.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/CommandBlockStorage.java @@ -2,8 +2,6 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; @@ -14,9 +12,7 @@ import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; public class CommandBlockStorage extends StoredObject { - private Map, Map> storedCommandBlocks = new ConcurrentHashMap<>(); - @Setter - @Getter + private final Map, Map> storedCommandBlocks = new ConcurrentHashMap<>(); private boolean permissions = false; public CommandBlockStorage(UserConnection user) { @@ -71,4 +67,12 @@ public class CommandBlockStorage extends StoredObject { public void unloadChunks() { storedCommandBlocks.clear(); } + + public boolean isPermissions() { + return permissions; + } + + public void setPermissions(boolean permissions) { + this.permissions = permissions; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker1_9.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker1_9.java index 74d014817..82489026d 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker1_9.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker1_9.java @@ -1,10 +1,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; -import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.Sets; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.boss.BossBar; @@ -26,11 +23,15 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter1 import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.EntityIdProvider; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; -@Getter public class EntityTracker1_9 extends EntityTracker { private final Map uuidMap = new ConcurrentHashMap<>(); private final Map> metadataBuffer = new ConcurrentHashMap<>(); @@ -43,16 +44,11 @@ public class EntityTracker1_9 extends EntityTracker { .expireAfterAccess(250, TimeUnit.MILLISECONDS) .build() .asMap()); - @Setter private boolean blocking = false; - @Setter private boolean autoTeam = false; - @Setter private Position currentlyDigging = null; private boolean teamExists = false; - @Setter private GameMode gameMode; - @Setter private String currentTeam; public EntityTracker1_9(UserConnection user) { @@ -104,7 +100,7 @@ public class EntityTracker1_9 extends EntityTracker { } public boolean interactedBlockRecently(int x, int y, int z) { - return blockInteractions.contains(new Position(x, (short) y , z)); + return blockInteractions.contains(new Position(x, (short) y, z)); } public void addBlockInteraction(Position p) { @@ -308,4 +304,76 @@ public class EntityTracker1_9 extends EntityTracker { return getClientEntityId(); } } + + public Map getUuidMap() { + return uuidMap; + } + + public Map> getMetadataBuffer() { + return metadataBuffer; + } + + public Map getVehicleMap() { + return vehicleMap; + } + + public Map getBossBarMap() { + return bossBarMap; + } + + public Set getValidBlocking() { + return validBlocking; + } + + public Set getKnownHolograms() { + return knownHolograms; + } + + public Set getBlockInteractions() { + return blockInteractions; + } + + public boolean isBlocking() { + return blocking; + } + + public void setBlocking(boolean blocking) { + this.blocking = blocking; + } + + public boolean isAutoTeam() { + return autoTeam; + } + + public void setAutoTeam(boolean autoTeam) { + this.autoTeam = autoTeam; + } + + public Position getCurrentlyDigging() { + return currentlyDigging; + } + + public void setCurrentlyDigging(Position currentlyDigging) { + this.currentlyDigging = currentlyDigging; + } + + public boolean isTeamExists() { + return teamExists; + } + + public GameMode getGameMode() { + return gameMode; + } + + public void setGameMode(GameMode gameMode) { + this.gameMode = gameMode; + } + + public String getCurrentTeam() { + return currentTeam; + } + + public void setCurrentTeam(String currentTeam) { + this.currentTeam = currentTeam; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/InventoryTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/InventoryTracker.java index dccda08ee..0f2f443bc 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/InventoryTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/InventoryTracker.java @@ -1,16 +1,20 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; -@Getter -@Setter public class InventoryTracker extends StoredObject { private String inventory; public InventoryTracker(UserConnection user) { super(user); } + + public String getInventory() { + return inventory; + } + + public void setInventory(String inventory) { + this.inventory = inventory; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/MovementTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/MovementTracker.java index 06217b7b4..d56726d73 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/MovementTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/MovementTracker.java @@ -1,17 +1,12 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; public class MovementTracker extends StoredObject { private static final long IDLE_PACKET_DELAY = 50L; // Update every 50ms (20tps) private static final long IDLE_PACKET_LIMIT = 20; // Max 20 ticks behind - @Getter private long nextIdlePacket = 0L; - @Getter - @Setter private boolean ground = true; public MovementTracker(UserConnection user) { @@ -23,4 +18,16 @@ public class MovementTracker extends StoredObject { // Allow a maximum lag spike of 1 second (20 ticks/updates) this.nextIdlePacket = Math.max(nextIdlePacket + IDLE_PACKET_DELAY, System.currentTimeMillis() - IDLE_PACKET_DELAY * IDLE_PACKET_LIMIT); } + + public long getNextIdlePacket() { + return nextIdlePacket; + } + + public boolean isGround() { + return ground; + } + + public void setGround(boolean ground) { + this.ground = ground; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java index d3e5d718f..95c93854f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java @@ -1,15 +1,11 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.storage; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.Position; -@Getter public class PlaceBlockTracker extends StoredObject { private long lastPlaceTimestamp = 0; - @Setter private Position lastPlacedPosition = null; public PlaceBlockTracker(UserConnection user) { @@ -32,4 +28,16 @@ public class PlaceBlockTracker extends StoredObject { public void updateTime() { lastPlaceTimestamp = System.currentTimeMillis(); } + + public long getLastPlaceTimestamp() { + return lastPlaceTimestamp; + } + + public Position getLastPlacedPosition() { + return lastPlacedPosition; + } + + public void setLastPlacedPosition(Position lastPlacedPosition) { + this.lastPlacedPosition = lastPlacedPosition; + } } diff --git a/common/src/main/java/us/myles/ViaVersion/util/GsonUtil.java b/common/src/main/java/us/myles/ViaVersion/util/GsonUtil.java index 38af3892e..b7de9d6ee 100644 --- a/common/src/main/java/us/myles/ViaVersion/util/GsonUtil.java +++ b/common/src/main/java/us/myles/ViaVersion/util/GsonUtil.java @@ -2,18 +2,16 @@ package us.myles.ViaVersion.util; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import lombok.experimental.UtilityClass; -@UtilityClass -public class GsonUtil { - private final Gson gson = getGsonBuilder().create(); +public final class GsonUtil { + private static final Gson gson = getGsonBuilder().create(); /** * Get google's Gson magic * * @return Gson instance */ - public Gson getGson() { + public static Gson getGson() { return gson; } @@ -22,8 +20,7 @@ public class GsonUtil { * * @return GsonBuilder instance */ - public GsonBuilder getGsonBuilder() { + public static GsonBuilder getGsonBuilder() { return new GsonBuilder(); } - } diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/commands/SpongeCommandSender.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/commands/SpongeCommandSender.java index 915b2841b..e45f90014 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/commands/SpongeCommandSender.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/commands/SpongeCommandSender.java @@ -1,6 +1,5 @@ package us.myles.ViaVersion.sponge.commands; -import lombok.AllArgsConstructor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; import org.spongepowered.api.command.CommandSource; @@ -10,9 +9,12 @@ import us.myles.ViaVersion.api.command.ViaCommandSender; import java.util.UUID; -@AllArgsConstructor public class SpongeCommandSender implements ViaCommandSender { - private CommandSource source; + private final CommandSource source; + + public SpongeCommandSender(CommandSource source) { + this.source = source; + } @Override public boolean hasPermission(String permission) { diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeChannelInitializer.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeChannelInitializer.java index 99eb3af6b..c27c2a771 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeChannelInitializer.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeChannelInitializer.java @@ -5,7 +5,6 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.ByteToMessageDecoder; import io.netty.handler.codec.MessageToByteEncoder; -import lombok.Getter; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.ProtocolPipeline; import us.myles.ViaVersion.api.protocol.ProtocolRegistry; @@ -14,7 +13,6 @@ import java.lang.reflect.Method; public class SpongeChannelInitializer extends ChannelInitializer { - @Getter private final ChannelInitializer original; private Method method; @@ -51,4 +49,8 @@ public class SpongeChannelInitializer extends ChannelInitializer { this.method.invoke(this.original, channel); } } + + public ChannelInitializer getOriginal() { + return original; + } } diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/listeners/ViaSpongeListener.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/listeners/ViaSpongeListener.java index b000b7ee0..637f12a73 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/listeners/ViaSpongeListener.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/listeners/ViaSpongeListener.java @@ -1,6 +1,5 @@ package us.myles.ViaVersion.sponge.listeners; -import lombok.Getter; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; import us.myles.ViaVersion.SpongePlugin; @@ -13,7 +12,6 @@ import java.lang.reflect.Field; public class ViaSpongeListener extends ViaListener { private static Field entityIdField; - @Getter private final SpongePlugin plugin; public ViaSpongeListener(SpongePlugin plugin, Class requiredPipeline) { @@ -46,4 +44,8 @@ public class ViaSpongeListener extends ViaListener { Via.getPlatform().getLogger().severe("Could not get the entity id, please report this on our Github"); return -1; } + + public SpongePlugin getPlugin() { + return plugin; + } } diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeTaskId.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeTaskId.java index 879fa041c..4cae58f84 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeTaskId.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeTaskId.java @@ -1,12 +1,17 @@ package us.myles.ViaVersion.sponge.platform; -import lombok.AllArgsConstructor; -import lombok.Getter; import org.spongepowered.api.scheduler.Task; import us.myles.ViaVersion.api.platform.TaskId; -@Getter -@AllArgsConstructor public class SpongeTaskId implements TaskId { - private Task object; + private final Task object; + + public SpongeTaskId(Task object) { + this.object = object; + } + + @Override + public Task getObject() { + return object; + } } diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaAPI.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaAPI.java index c23452b80..c07c65b16 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaAPI.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaAPI.java @@ -1,7 +1,6 @@ package us.myles.ViaVersion.sponge.platform; import io.netty.buffer.ByteBuf; -import lombok.NonNull; import org.spongepowered.api.entity.living.player.Player; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.ViaAPI; @@ -20,14 +19,14 @@ import java.util.UUID; public class SpongeViaAPI implements ViaAPI { @Override - public int getPlayerVersion(@NonNull Player player) { + public int getPlayerVersion(Player player) { if (!isPorted(player.getUniqueId())) return ProtocolRegistry.SERVER_PROTOCOL; return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion(); } @Override - public int getPlayerVersion(@NonNull UUID uuid) { + public int getPlayerVersion(UUID uuid) { if (!isPorted(uuid)) return ProtocolRegistry.SERVER_PROTOCOL; return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion(); diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/command/VelocityCommandSender.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/command/VelocityCommandSender.java index 0abdf161b..e699f743d 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/command/VelocityCommandSender.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/command/VelocityCommandSender.java @@ -2,7 +2,6 @@ package us.myles.ViaVersion.velocity.command; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.proxy.Player; -import lombok.AllArgsConstructor; import net.kyori.text.serializer.gson.GsonComponentSerializer; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; @@ -10,9 +9,12 @@ import us.myles.ViaVersion.api.command.ViaCommandSender; import java.util.UUID; -@AllArgsConstructor public class VelocityCommandSender implements ViaCommandSender { - private CommandSource source; + private final CommandSource source; + + public VelocityCommandSender(CommandSource source) { + this.source = source; + } @Override public boolean hasPermission(String permission) { diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityChannelInitializer.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityChannelInitializer.java index 056021abf..bdd872b69 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityChannelInitializer.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityChannelInitializer.java @@ -2,17 +2,19 @@ package us.myles.ViaVersion.velocity.handlers; import io.netty.channel.Channel; import io.netty.channel.ChannelInitializer; -import lombok.AllArgsConstructor; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.ProtocolPipeline; import java.lang.reflect.Method; -@AllArgsConstructor public class VelocityChannelInitializer extends ChannelInitializer { - private ChannelInitializer original; + private final ChannelInitializer original; private static Method initChannel; + public VelocityChannelInitializer(ChannelInitializer original) { + this.original = original; + } + static { try { initChannel = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class); diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityDecodeHandler.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityDecodeHandler.java index 92fa49b72..322c066df 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityDecodeHandler.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityDecodeHandler.java @@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; -import lombok.AllArgsConstructor; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.type.Type; @@ -16,10 +15,13 @@ import us.myles.ViaVersion.util.PipelineUtil; import java.util.List; @ChannelHandler.Sharable -@AllArgsConstructor public class VelocityDecodeHandler extends MessageToMessageDecoder { private final UserConnection info; + public VelocityDecodeHandler(UserConnection info) { + this.info = info; + } + @Override protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List out) throws Exception { // use transformers diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityEncodeHandler.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityEncodeHandler.java index eed1d02f3..673ec7541 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityEncodeHandler.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityEncodeHandler.java @@ -6,8 +6,6 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.MessageToMessageEncoder; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; @@ -20,11 +18,13 @@ import us.myles.ViaVersion.util.PipelineUtil; import java.util.List; @ChannelHandler.Sharable -@RequiredArgsConstructor public class VelocityEncodeHandler extends MessageToMessageEncoder { - @NonNull private final UserConnection info; - private boolean handledCompression = false; + private boolean handledCompression; + + public VelocityEncodeHandler(UserConnection info) { + this.info = info; + } @Override protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List out) throws Exception { diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityTaskId.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityTaskId.java index 9d7edbb56..1df49c27e 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityTaskId.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityTaskId.java @@ -1,12 +1,17 @@ package us.myles.ViaVersion.velocity.platform; import com.velocitypowered.api.scheduler.ScheduledTask; -import lombok.AllArgsConstructor; -import lombok.Getter; import us.myles.ViaVersion.api.platform.TaskId; -@Getter -@AllArgsConstructor public class VelocityTaskId implements TaskId { - private ScheduledTask object; + private final ScheduledTask object; + + public VelocityTaskId(ScheduledTask object) { + this.object = object; + } + + @Override + public ScheduledTask getObject() { + return object; + } } diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaAPI.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaAPI.java index dc6674d6d..4d4d89f5b 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaAPI.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaAPI.java @@ -4,7 +4,6 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.Player; import io.netty.buffer.ByteBuf; -import lombok.NonNull; import us.myles.ViaVersion.VelocityPlugin; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.ViaAPI; @@ -22,14 +21,14 @@ import java.util.UUID; public class VelocityViaAPI implements ViaAPI { @Override - public int getPlayerVersion(@NonNull Player player) { + public int getPlayerVersion(Player player) { if (!isPorted(player.getUniqueId())) return player.getProtocolVersion().getProtocol(); return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion(); } @Override - public int getPlayerVersion(@NonNull UUID uuid) { + public int getPlayerVersion(UUID uuid) { if (!isPorted(uuid)) { return VelocityPlugin.PROXY.getPlayer(uuid) .map(InboundConnection::getProtocolVersion) diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/service/ProtocolDetectorService.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/service/ProtocolDetectorService.java index f87b83710..e7f68e798 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/service/ProtocolDetectorService.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/service/ProtocolDetectorService.java @@ -1,7 +1,6 @@ package us.myles.ViaVersion.velocity.service; import com.velocitypowered.api.proxy.server.RegisteredServer; -import lombok.Getter; import us.myles.ViaVersion.VelocityPlugin; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.protocol.ProtocolVersion; @@ -13,7 +12,6 @@ import java.util.concurrent.ConcurrentHashMap; public class ProtocolDetectorService implements Runnable { private static final Map detectedProtocolIds = new ConcurrentHashMap<>(); - @Getter private static ProtocolDetectorService instance; public ProtocolDetectorService() { @@ -79,4 +77,7 @@ public class ProtocolDetectorService implements Runnable { return new HashMap<>(detectedProtocolIds); } + public static ProtocolDetectorService getInstance() { + return instance; + } }