diff --git a/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java b/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java
index 59f62fbc4..9f9293115 100644
--- a/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java
+++ b/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java
@@ -87,7 +87,7 @@ public interface ViaVersionConfig extends Config {
*
* This option requires {@link #isShowShieldWhenSwordInHand()} to be disabled
*
- * @return {@code true} if non delayed shield blocking is enabled.
+ * @return {@code true} if non-delayed shield blocking is enabled.
*/
boolean isNoDelayShieldBlocking();
@@ -126,7 +126,7 @@ public interface ViaVersionConfig extends Config {
* Get if the boss bars for 1.9 & 1.10 clients are being stopped from flickering
* This will keep all boss bars on 100% (not recommended)
*
- * @return true if boss bar anti flickering is enabled
+ * @return true if boss bar anti-flickering is enabled
*/
boolean isBossbarAntiflicker();
@@ -384,7 +384,7 @@ public interface ViaVersionConfig extends Config {
boolean isTruncate1_14Books();
/**
- * Handles left handed info by using unused bit 7 on Client Settings packet
+ * Handles left-handed info by using unused bit 7 on Client Settings packet
*
* @return true if enabled
*/
@@ -443,7 +443,7 @@ public interface ViaVersionConfig extends Config {
/***
* Get the world names that should be returned for each Vanilla dimension.
- * Note that this can be overriden per-user by using {@link UserConnection#put(StorableObject)} with
+ * Note that this can be overridden per-user by using {@link UserConnection#put(StorableObject)} with
* a custom instance of {@link WorldIdentifiers} for the user's {@link UserConnection}.
*
* @return the global map from vanilla dimensions to world name
diff --git a/api/src/main/java/com/viaversion/viaversion/api/legacy/bossbar/BossBar.java b/api/src/main/java/com/viaversion/viaversion/api/legacy/bossbar/BossBar.java
index b06976132..deb1058b9 100644
--- a/api/src/main/java/com/viaversion/viaversion/api/legacy/bossbar/BossBar.java
+++ b/api/src/main/java/com/viaversion/viaversion/api/legacy/bossbar/BossBar.java
@@ -66,7 +66,7 @@ public interface BossBar {
BossColor getColor();
/**
- * Yay colors!
+ * Yay, colors!
*
* @param color Whatever color you want!
* @return The BossBar object
diff --git a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java
index 1f575e2c5..951d9699a 100644
--- a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java
+++ b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java
@@ -206,12 +206,13 @@ public interface ViaPlatform {
JsonObject getDump();
/**
- * Get if older clients are allowed to be used using ViaVersion.
- * (Only 1.9 on 1.9.2 server is supported by ViaVersion alone)
+ * Get if older clients are allowed using ViaVersion.
*
* @return True if allowed
*/
- boolean isOldClientsAllowed();
+ default boolean isOldClientsAllowed() {
+ return true;
+ }
/**
* Returns an immutable collection of classes to be checked as unsupported software with their software name.
diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/PaletteType1_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/PaletteType1_18.java
index 811e6ec0f..b206e5c33 100644
--- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/PaletteType1_18.java
+++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/PaletteType1_18.java
@@ -42,9 +42,7 @@ public final class PaletteType1_18 extends Type {
@Override
public DataPalette read(final ByteBuf buffer) throws Exception {
- final int originalBitsPerValue = buffer.readByte();
- int bitsPerValue = originalBitsPerValue;
-
+ int bitsPerValue = buffer.readByte();
final DataPaletteImpl palette;
if (bitsPerValue == 0) {
// Single value storage
diff --git a/api/src/main/java/com/viaversion/viaversion/util/ChatColorUtil.java b/api/src/main/java/com/viaversion/viaversion/util/ChatColorUtil.java
index b545dcc6b..bea5b9149 100644
--- a/api/src/main/java/com/viaversion/viaversion/util/ChatColorUtil.java
+++ b/api/src/main/java/com/viaversion/viaversion/util/ChatColorUtil.java
@@ -27,7 +27,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import java.util.regex.Pattern;
// Based on https://github.com/SpigotMC/BungeeCord/blob/master/chat/src/main/java/net/md_5/bungee/api/ChatColor.java
-public class ChatColorUtil {
+public final class ChatColorUtil {
public static final String ALL_CODES = "0123456789AaBbCcDdEeFfKkLlMmNnOoRrXx";
public static final char COLOR_CHAR = 'ยง';
diff --git a/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiHashMap.java b/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiHashMap.java
index 0acb0c3b4..6146b614e 100644
--- a/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiHashMap.java
+++ b/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiHashMap.java
@@ -27,6 +27,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.objects.ObjectSet;
+import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
public class Int2IntBiHashMap implements Int2IntBiMap {
@@ -91,6 +92,13 @@ public class Int2IntBiHashMap implements Int2IntBiMap {
return map.isEmpty();
}
+ @Override
+ public void putAll(@NonNull Map extends Integer, ? extends Integer> m) {
+ for (final Map.Entry extends Integer, ? extends Integer> entry : m.entrySet()) {
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
@Override
public void defaultReturnValue(final int rv) {
map.defaultReturnValue(rv);
diff --git a/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiMap.java b/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiMap.java
index b0314ce97..2ed83fa03 100644
--- a/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiMap.java
+++ b/api/src/main/java/com/viaversion/viaversion/util/Int2IntBiMap.java
@@ -23,8 +23,6 @@
package com.viaversion.viaversion.util;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
-import java.util.Map;
-import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Simple wrapper class for two {@link Int2IntMap}s.
@@ -50,10 +48,4 @@ public interface Int2IntBiMap extends Int2IntMap {
*/
@Override
int put(int key, int value);
-
- @Override
- @Deprecated
- default void putAll(@NonNull Map extends Integer, ? extends Integer> m) {
- throw new UnsupportedOperationException();
- }
}
diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java
index edf1eda66..37c2962c2 100644
--- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java
+++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java
@@ -53,23 +53,20 @@ public class DeathListener extends ViaBukkitListener {
}
private void sendPacket(final Player p, final String msg) {
- Via.getPlatform().runSync(new Runnable() {
- @Override
- public void run() {
- // If online
- UserConnection userConnection = getUserConnection(p);
- if (userConnection != null) {
- PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, null, userConnection);
- try {
- wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
- wrapper.write(Type.VAR_INT, p.getEntityId()); // Player ID
- wrapper.write(Type.INT, p.getEntityId()); // Entity ID
- Protocol1_9To1_8.FIX_JSON.write(wrapper, msg); // Message
+ Via.getPlatform().runSync(() -> {
+ // If online
+ UserConnection userConnection = getUserConnection(p);
+ if (userConnection != null) {
+ PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, null, userConnection);
+ try {
+ wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
+ wrapper.write(Type.VAR_INT, p.getEntityId()); // Player ID
+ wrapper.write(Type.INT, p.getEntityId()); // Entity ID
+ Protocol1_9To1_8.FIX_JSON.write(wrapper, msg); // Message
- wrapper.scheduleSend(Protocol1_9To1_8.class);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ wrapper.scheduleSend(Protocol1_9To1_8.class);
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
});
diff --git a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java
index 1e10ef095..fcc62ce87 100644
--- a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java
+++ b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java
@@ -21,7 +21,6 @@ import com.google.gson.JsonObject;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.ViaAPI;
import com.viaversion.viaversion.api.command.ViaCommandSender;
-import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.platform.PlatformTask;
import com.viaversion.viaversion.api.platform.UnsupportedSoftware;
import com.viaversion.viaversion.api.platform.ViaPlatform;
diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java
index 786456a53..ca36cf49b 100644
--- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java
+++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java
@@ -74,12 +74,9 @@ public class PlayerSneakListener extends ViaBukkitListener {
if (Via.getAPI().getServerVersion().lowestSupportedVersion() >= ProtocolVersion.v1_9.getVersion()) {
sneaking = new WeakHashMap<>();
useCache = true;
- plugin.getServer().getScheduler().runTaskTimer(plugin, new Runnable() {
- @Override
- public void run() {
- for (Map.Entry entry : sneaking.entrySet()) {
- setHeight(entry.getKey(), entry.getValue() ? HEIGHT_1_14 : HEIGHT_1_9);
- }
+ plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
+ for (Map.Entry entry : sneaking.entrySet()) {
+ setHeight(entry.getKey(), entry.getValue() ? HEIGHT_1_14 : HEIGHT_1_9);
}
}, 1, 1);
}
diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaLoader.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaLoader.java
index 5148178df..8c4fa95b0 100644
--- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaLoader.java
+++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaLoader.java
@@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.bukkit.compat.ProtocolSupportCompat;
-import com.viaversion.viaversion.bukkit.listeners.JoinListener;
import com.viaversion.viaversion.bukkit.listeners.UpdateListener;
import com.viaversion.viaversion.bukkit.listeners.multiversion.PlayerSneakListener;
import com.viaversion.viaversion.bukkit.listeners.protocol1_15to1_14_4.EntityToggleGlideListener;
diff --git a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java
index 9d74144eb..d9b01f274 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java
@@ -199,11 +199,6 @@ public class BungeePlugin extends Plugin implements ViaServerProxyPlatform getUnsupportedSoftwareClasses() {
final Collection list = new ArrayList<>(ViaServerProxyPlatform.super.getUnsupportedSoftwareClasses());
diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java
index 0e13154c1..b2f732bcc 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java
@@ -125,8 +125,8 @@ public class BungeeServerHandler implements Listener {
int playerId;
try {
playerId = Via.getManager().getProviders().get(EntityIdProvider.class).getEntityId(userConnection);
- } catch (Exception ex) {
- return; // Ignored
+ } catch (Exception ignored) {
+ return;
}
for (EntityTracker tracker : userConnection.getEntityTrackers()) {
@@ -156,18 +156,13 @@ public class BungeeServerHandler implements Listener {
// Clear auto-team
EntityTracker1_9 oldEntityTracker = user.getEntityTracker(Protocol1_9To1_8.class);
- if (oldEntityTracker != null) {
- if (oldEntityTracker.isAutoTeam() && oldEntityTracker.isTeamExists()) {
- oldEntityTracker.sendTeamPacket(false, true);
- }
+ if (oldEntityTracker != null && oldEntityTracker.isAutoTeam() && oldEntityTracker.isTeamExists()) {
+ oldEntityTracker.sendTeamPacket(false, true);
}
- String serverName = event.getServer().getInfo().getName();
-
+ String serverName = server.getInfo().getName();
storage.setCurrentServer(serverName);
-
int protocolId = Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName);
-
if (protocolId <= ProtocolVersion.v1_8.getVersion() && storage.getBossbar() != null) { // 1.8 doesn't have BossBar packet
// This ensures we can encode it properly as only the 1.9 protocol is currently implemented.
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaInjector.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaInjector.java
index e38d9408d..b13790ad3 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaInjector.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaInjector.java
@@ -76,7 +76,6 @@ public class BungeeViaInjector implements ViaInjector {
Via.getPlatform().getLogger().severe("ViaVersion cannot remove itself from Bungee without a reboot!");
}
- @SuppressWarnings("unchecked")
private void injectChannel(Channel channel) throws ReflectiveOperationException {
List names = channel.pipeline().names();
ChannelHandler bootstrapAcceptor = null;
diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeEntityIdProvider.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeEntityIdProvider.java
index 41c3f8c8b..c39f74752 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeEntityIdProvider.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeEntityIdProvider.java
@@ -24,13 +24,13 @@ import java.lang.reflect.Method;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class BungeeEntityIdProvider extends EntityIdProvider {
- private static Method getClientEntityId;
+ private static final Method GET_CLIENT_ENTITY_ID;
static {
try {
- getClientEntityId = Class.forName("net.md_5.bungee.UserConnection").getDeclaredMethod("getClientEntityId");
+ GET_CLIENT_ENTITY_ID = Class.forName("net.md_5.bungee.UserConnection").getDeclaredMethod("getClientEntityId");
} catch (NoSuchMethodException | ClassNotFoundException e) {
- e.printStackTrace();
+ throw new RuntimeException(e);
}
}
@@ -39,6 +39,6 @@ public class BungeeEntityIdProvider extends EntityIdProvider {
BungeeStorage storage = user.get(BungeeStorage.class);
ProxiedPlayer player = storage.getPlayer();
- return (int) getClientEntityId.invoke(player);
+ return (int) GET_CLIENT_ENTITY_ID.invoke(player);
}
}
diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeMainHandProvider.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeMainHandProvider.java
index 4f38d3872..a51475aa2 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeMainHandProvider.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeMainHandProvider.java
@@ -26,11 +26,11 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
/*
- This solves the wrong mainhand issue when you join with BungeeCord on a 1.8 server, and switch to a 1.9 or higher.
+ This solves the wrong main hand issue when you join with BungeeCord on a 1.8 server, and switch to a 1.9 or higher.
*/
public class BungeeMainHandProvider extends MainHandProvider {
- private static Method getSettings = null;
- private static Method setMainHand = null;
+ private static Method getSettings;
+ private static Method setMainHand;
static {
try {
diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeVersionProvider.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeVersionProvider.java
index 604695a44..730127749 100644
--- a/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeVersionProvider.java
+++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeVersionProvider.java
@@ -43,8 +43,10 @@ public class BungeeVersionProvider extends BaseVersionProvider {
@Override
public int getClosestServerProtocol(UserConnection user) throws Exception {
- if (ref == null)
+ if (ref == null) {
return super.getClosestServerProtocol(user);
+ }
+
// TODO Have one constant list forever until restart? (Might limit plugins if they change this)
List list = ReflectionUtil.getStatic(ref, "SUPPORTED_VERSION_IDS", List.class);
List sorted = new ArrayList<>(list);
diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java
index 6eaa13aed..329d8103a 100644
--- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java
+++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java
@@ -120,15 +120,12 @@ public class ParticleRewriter {
// Randomized because the previous one was a lot of different colors at once! :)
private static ParticleDataHandler reddustHandler() {
- return new ParticleDataHandler() {
- @Override
- public Particle handler(Particle particle, Integer[] data) {
- particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Red 0 - 1
- particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 0f)); // Green 0 - 1
- particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Blue 0 - 1
- particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1f));// Scale 0.01 - 4
- return particle;
- }
+ return (particle, data) -> {
+ particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Red 0 - 1
+ particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 0f)); // Green 0 - 1
+ particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Blue 0 - 1
+ particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1f));// Scale 0.01 - 4
+ return particle;
};
}
@@ -138,38 +135,33 @@ public class ParticleRewriter {
// Rewrite IconCrack items to new format :)
private static ParticleDataHandler iconcrackHandler() {
- return new ParticleDataHandler() {
- @Override
- public Particle handler(Particle particle, Integer[] data) {
- Item item;
- if (data.length == 1)
- item = new DataItem(data[0], (byte) 1, (short) 0, null);
- else if (data.length == 2)
- item = new DataItem(data[0], (byte) 1, data[1].shortValue(), null);
- else
- return particle;
-
- // Transform to new Item
- Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getItemRewriter().handleItemToClient(item);
-
- particle.getArguments().add(new Particle.ParticleData(Type.FLAT_ITEM, item)); // Item Slot The item that will be used.
+ return (particle, data) -> {
+ Item item;
+ if (data.length == 1) {
+ item = new DataItem(data[0], (byte) 1, (short) 0, null);
+ } else if (data.length == 2) {
+ item = new DataItem(data[0], (byte) 1, data[1].shortValue(), null);
+ } else {
return particle;
}
+
+ // Transform to new Item
+ Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getItemRewriter().handleItemToClient(item);
+
+ particle.getArguments().add(new Particle.ParticleData(Type.FLAT_ITEM, item)); // Item Slot The item that will be used.
+ return particle;
};
}
// Handle (id+(data<<12)) encoded blocks
private static ParticleDataHandler blockHandler() {
- return new ParticleDataHandler() {
- @Override
- public Particle handler(Particle particle, Integer[] data) {
- int value = data[0];
- int combined = (((value & 4095) << 4) | (value >> 12 & 15));
- int newId = WorldPackets.toNewId(combined);
+ return (particle, data) -> {
+ int value = data[0];
+ int combined = (((value & 4095) << 4) | (value >> 12 & 15));
+ int newId = WorldPackets.toNewId(combined);
- particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, newId)); // BlockState VarInt The ID of the block state.
- return particle;
- }
+ particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, newId)); // BlockState VarInt The ID of the block state.
+ return particle;
};
}
diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/BlockConnectionStorage.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/BlockConnectionStorage.java
index 1b445ef94..7b5a16326 100644
--- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/BlockConnectionStorage.java
+++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/BlockConnectionStorage.java
@@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.StorableObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/rewriter/EntityPacketRewriter1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/rewriter/EntityPacketRewriter1_20_2.java
index 8d76a221e..ca1da992f 100644
--- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/rewriter/EntityPacketRewriter1_20_2.java
+++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/rewriter/EntityPacketRewriter1_20_2.java
@@ -173,7 +173,7 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter meta.setMetaType(Types1_20_2.META_TYPES.byId(meta.metaType().typeId())));
- registerMetaTypeHandler(null, Types1_20_2.META_TYPES.blockStateType, Types1_20_2.META_TYPES.optionalBlockStateType, Types1_20_2.META_TYPES.particleType);
+ registerMetaTypeHandler(Types1_20_2.META_TYPES.itemType, Types1_20_2.META_TYPES.blockStateType, Types1_20_2.META_TYPES.optionalBlockStateType, Types1_20_2.META_TYPES.particleType);
filter().filterFamily(Entity1_19_4Types.DISPLAY).addIndex(10);
diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java
index 095c8e91d..22e951359 100644
--- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java
+++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java
@@ -245,13 +245,10 @@ public class InventoryPackets {
boolean throwItem = (slot == 45);
if (throwItem) {
// Send a packet wiping the slot
- wrapper.create(ClientboundPackets1_9.SET_SLOT, new PacketHandler() {
- @Override
- public void handle(PacketWrapper wrapper) throws Exception {
- wrapper.write(Type.UNSIGNED_BYTE, (short) 0);
- wrapper.write(Type.SHORT, slot);
- wrapper.write(Type.ITEM, null);
- }
+ wrapper.create(ClientboundPackets1_9.SET_SLOT, w -> {
+ w.write(Type.UNSIGNED_BYTE, (short) 0);
+ w.write(Type.SHORT, slot);
+ w.write(Type.ITEM, null);
}).send(Protocol1_9To1_8.class);
// Finally reset to simulate throwing item
wrapper.set(Type.SHORT, 0, (short) -999); // Set slot to -999
@@ -303,13 +300,10 @@ public class InventoryPackets {
if (throwItem) {
// Send a packet wiping the slot
- wrapper.create(ClientboundPackets1_9.SET_SLOT, new PacketHandler() {
- @Override
- public void handle(PacketWrapper wrapper) throws Exception {
- wrapper.write(Type.UNSIGNED_BYTE, (short) windowID);
- wrapper.write(Type.SHORT, slot);
- wrapper.write(Type.ITEM, null);
- }
+ wrapper.create(ClientboundPackets1_9.SET_SLOT, w -> {
+ w.write(Type.UNSIGNED_BYTE, windowID);
+ w.write(Type.SHORT, slot);
+ w.write(Type.ITEM, null);
}).scheduleSend(Protocol1_9To1_8.class);
// Finally reset to simulate throwing item
wrapper.set(Type.BYTE, 0, (byte) 0); // Set button to 0
diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/providers/CommandBlockProvider.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/providers/CommandBlockProvider.java
index 176032944..23996cb19 100644
--- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/providers/CommandBlockProvider.java
+++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/providers/CommandBlockProvider.java
@@ -33,21 +33,17 @@ public class CommandBlockProvider implements Provider {
public void addOrUpdateBlock(UserConnection user, Position position, CompoundTag tag) throws Exception {
checkPermission(user);
- if (isEnabled())
- getStorage(user).addOrUpdateBlock(position, tag);
+ getStorage(user).addOrUpdateBlock(position, tag);
}
public Optional get(UserConnection user, Position position) throws Exception {
checkPermission(user);
- if (isEnabled())
- return getStorage(user).getCommandBlock(position);
- return Optional.empty();
+ return getStorage(user).getCommandBlock(position);
}
public void unloadChunk(UserConnection user, int x, int z) throws Exception {
checkPermission(user);
- if (isEnabled())
- getStorage(user).unloadChunk(x, z);
+ getStorage(user).unloadChunk(x, z);
}
private CommandBlockStorage getStorage(UserConnection connection) {
@@ -55,8 +51,6 @@ public class CommandBlockProvider implements Provider {
}
public void sendPermission(UserConnection user) throws Exception {
- if (!isEnabled())
- return;
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.ENTITY_STATUS, null, user); // Entity status
EntityTracker1_9 tracker = user.getEntityTracker(Protocol1_9To1_8.class);
@@ -70,20 +64,13 @@ public class CommandBlockProvider implements Provider {
// Fix for Bungee since the join game is not sent after the first one
private void checkPermission(UserConnection user) throws Exception {
- if (!isEnabled())
- return;
CommandBlockStorage storage = getStorage(user);
if (!storage.isPermissions()) {
sendPermission(user);
}
}
- public boolean isEnabled() {
- return true;
- }
-
public void unloadChunks(UserConnection userConnection) {
- if (isEnabled())
- getStorage(userConnection).unloadChunks();
+ getStorage(userConnection).unloadChunks();
}
}
diff --git a/common/src/test/java/com/viaversion/viaversion/common/dummy/TestPlatform.java b/common/src/test/java/com/viaversion/viaversion/common/dummy/TestPlatform.java
index 383341a54..b84e7cec3 100644
--- a/common/src/test/java/com/viaversion/viaversion/common/dummy/TestPlatform.java
+++ b/common/src/test/java/com/viaversion/viaversion/common/dummy/TestPlatform.java
@@ -131,11 +131,6 @@ public final class TestPlatform implements ViaPlatform {
return null;
}
- @Override
- public boolean isOldClientsAllowed() {
- return false;
- }
-
@Override
public boolean hasPlugin(final String name) {
return false;
diff --git a/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java b/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java
index 1ee2fbede..9dfbb916e 100644
--- a/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java
+++ b/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java
@@ -222,11 +222,6 @@ public class SpongePlugin implements ViaPlatform {
return platformSpecific;
}
- @Override
- public boolean isOldClientsAllowed() {
- return true;
- }
-
@Override
public boolean hasPlugin(final String name) {
return game.pluginManager().plugin(name).isPresent();
diff --git a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java
index 868728a75..510c72ecc 100644
--- a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java
+++ b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java
@@ -230,11 +230,6 @@ public class VelocityPlugin implements ViaServerProxyPlatform {
return extra;
}
- @Override
- public boolean isOldClientsAllowed() {
- return true;
- }
-
@Override
public boolean hasPlugin(final String name) {
return proxy.getPluginManager().getPlugin(name).isPresent();