3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Greatly reduce the number of (anonymous) inner classes

Reduces code complexity, and much more importantly, reduces the number of classes loaded at runtime by *hundreds*
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-02-12 11:44:25 +01:00
Ursprung de5b7bf828
Commit cb2165eb93
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
328 geänderte Dateien mit 3735 neuen und 4939 gelöschten Zeilen

Datei anzeigen

@ -23,13 +23,12 @@
package us.myles.ViaVersion.api;
import io.netty.buffer.ByteBuf;
import java.util.SortedSet;
import java.util.UUID;
import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossStyle;
import java.util.SortedSet;
import java.util.UUID;
/**
* @deprecated may be removed at some point, use {@link com.viaversion.viaversion.api.Via}
*/

Datei anzeigen

@ -24,13 +24,12 @@ package us.myles.ViaVersion.api;
import com.viaversion.viaversion.api.Via;
import io.netty.buffer.ByteBuf;
import java.util.SortedSet;
import java.util.UUID;
import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossStyle;
import java.util.SortedSet;
import java.util.UUID;
/**
* @deprecated may be removed at some point, use {@link Via#getAPI()}
*/

Datei anzeigen

@ -26,14 +26,13 @@ import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.version.VersionRange;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* @deprecated will no longer be updated and may be removed at some point, use {@link com.viaversion.viaversion.api.protocol.version.ProtocolVersion}

Datei anzeigen

@ -29,10 +29,9 @@ import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.api.protocol.ProtocolManager;
import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.SortedSet;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* General api point. For more specialized api methods, see {@link Via#getManager()}.

Datei anzeigen

@ -30,7 +30,6 @@ import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
import com.viaversion.viaversion.api.protocol.ProtocolManager;
import java.util.Set;
public interface ViaManager {

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.command;
import com.viaversion.viaversion.util.ChatColorUtil;
import java.util.Collections;
import java.util.List;

Datei anzeigen

@ -22,9 +22,8 @@
*/
package com.viaversion.viaversion.api.command;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface ViaVersionCommand {
/**

Datei anzeigen

@ -22,11 +22,10 @@
*/
package com.viaversion.viaversion.api.connection;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Handles injected UserConnections

Datei anzeigen

@ -24,9 +24,8 @@ package com.viaversion.viaversion.api.connection;
import com.viaversion.viaversion.api.protocol.ProtocolPipeline;
import com.viaversion.viaversion.api.protocol.packet.State;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface ProtocolInfo {

Datei anzeigen

@ -32,12 +32,11 @@ import com.viaversion.viaversion.exception.InformativeException;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.UUID;
import java.util.function.Function;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface UserConnection {

Datei anzeigen

@ -24,9 +24,8 @@ package com.viaversion.viaversion.api.data;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Arrays;
import org.checkerframework.checker.nullness.qual.Nullable;
public class IntArrayMappings implements Mappings {
private final int[] oldToNew;

Datei anzeigen

@ -25,9 +25,8 @@ package com.viaversion.viaversion.api.data;
import com.viaversion.viaversion.api.minecraft.RegistryType;
import com.viaversion.viaversion.api.minecraft.TagData;
import com.viaversion.viaversion.util.Int2IntBiMap;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface MappingData {

Datei anzeigen

@ -31,13 +31,12 @@ import com.viaversion.viaversion.api.minecraft.TagData;
import com.viaversion.viaversion.util.Int2IntBiHashMap;
import com.viaversion.viaversion.util.Int2IntBiMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.qual.Nullable;
public class MappingDataBase implements MappingData {
protected final String oldVersion;

Datei anzeigen

@ -32,8 +32,6 @@ import com.viaversion.viaversion.util.GsonUtil;
import com.viaversion.viaversion.util.Int2IntBiMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
@ -41,6 +39,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.checkerframework.checker.nullness.qual.Nullable;
public class MappingDataLoader {

Datei anzeigen

@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.data;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Arrays;
public interface Mappings {

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.legacy.bossbar;
import com.viaversion.viaversion.api.connection.UserConnection;
import java.util.Set;
import java.util.UUID;

Datei anzeigen

@ -22,10 +22,9 @@
*/
package com.viaversion.viaversion.api.minecraft;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.HashMap;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum RegistryType {

Datei anzeigen

@ -24,10 +24,9 @@ package com.viaversion.viaversion.api.minecraft.chunks;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.BitSet;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
//TODO Move methods from distinctly different versions to different objects/interfaces
public class BaseChunk implements Chunk {

Datei anzeigen

@ -24,10 +24,9 @@ package com.viaversion.viaversion.api.minecraft.chunks;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.BitSet;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
// TODO specialized sub interfaces
public interface Chunk {

Datei anzeigen

@ -24,10 +24,9 @@ package com.viaversion.viaversion.api.minecraft.chunks;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.BitSet;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public class Chunk1_18 implements Chunk {
protected final int x;

Datei anzeigen

@ -22,9 +22,8 @@
*/
package com.viaversion.viaversion.api.minecraft.chunks;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.EnumMap;
import org.checkerframework.checker.nullness.qual.Nullable;
public class ChunkSectionImpl implements ChunkSection {

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.minecraft.entities;
import com.viaversion.viaversion.api.Via;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.minecraft.entities;
import com.viaversion.viaversion.api.Via;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

Datei anzeigen

@ -24,7 +24,6 @@
package com.viaversion.viaversion.api.minecraft.entities;
import com.viaversion.viaversion.api.Via;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.minecraft.entities;
import com.viaversion.viaversion.api.Via;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

Datei anzeigen

@ -25,9 +25,8 @@ package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum Entity1_19Types implements EntityType {

Datei anzeigen

@ -25,9 +25,8 @@ package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum Entity1_19_3Types implements EntityType {

Datei anzeigen

@ -24,9 +24,8 @@ package com.viaversion.viaversion.api.minecraft.item;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.google.gson.annotations.SerializedName;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
public class DataItem implements Item {
@SerializedName(value = "identifier", alternate = "id")

Datei anzeigen

@ -23,9 +23,8 @@
package com.viaversion.viaversion.api.minecraft.metadata;
import com.google.common.base.Preconditions;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class Metadata {
private int id;

Datei anzeigen

@ -24,8 +24,6 @@
package com.viaversion.viaversion.api.minecraft.nbt;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
@ -38,11 +36,13 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.checkerframework.checker.nullness.qual.NonNull;
// Specific Via changes:
// - Use OpenNBT tags
// - Added readString/writeString methods from TagStringIO
// - Has not been updated for the sake of keeping the class simple
/**
* Serialization operations for binary tags.
*/

Datei anzeigen

@ -39,7 +39,6 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

Datei anzeigen

@ -37,7 +37,6 @@ import com.github.steveice10.opennbt.tag.builtin.NumberTag;
import com.github.steveice10.opennbt.tag.builtin.ShortTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
@ -45,6 +44,7 @@ import java.util.Map;
// Specific Via changes:
// - Use OpenNBT tags
// - Has not been updated to support pretty printing and legacy writing since that is not needed
/**
* An emitter for the SNBT format.
*

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
import com.viaversion.viaversion.api.connection.UserConnection;
import java.io.File;
import java.util.Collection;
import java.util.Collections;

Datei anzeigen

@ -22,12 +22,11 @@
*/
package com.viaversion.viaversion.api.platform.providers;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.Nullable;
public class ViaProviders {
private final Map<Class<? extends Provider>, Provider> providers = new HashMap<>();

Datei anzeigen

@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.exception.CancelException;
import com.viaversion.viaversion.exception.InformativeException;
import java.util.Arrays;
@ -168,12 +167,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
@Override
public void cancelServerbound(State state, int unmappedPacketId, int mappedPacketId) {
registerServerbound(state, unmappedPacketId, mappedPacketId, new PacketHandlers() {
@Override
public void register() {
handler(PacketWrapper::cancel);
}
});
registerServerbound(state, unmappedPacketId, mappedPacketId, PacketWrapper::cancel);
}
@Override
@ -183,12 +177,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
@Override
public void cancelClientbound(State state, int unmappedPacketId, int mappedPacketId) {
registerClientbound(state, unmappedPacketId, mappedPacketId, new PacketHandlers() {
@Override
public void register() {
handler(PacketWrapper::cancel);
}
});
registerClientbound(state, unmappedPacketId, mappedPacketId, PacketWrapper::cancel);
}
@Override
@ -227,12 +216,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
@Override
public void cancelClientbound(C1 packetType) {
registerClientbound(packetType, null, new PacketHandlers() {
@Override
public void register() {
handler(PacketWrapper::cancel);
}
});
registerClientbound(packetType, null, PacketWrapper::cancel);
}
@Override
@ -254,12 +238,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
@Override
public void cancelServerbound(S2 packetType) {
registerServerbound(packetType, null, new PacketHandlers() {
@Override
public void register() {
handler(PacketWrapper::cancel);
}
});
registerServerbound(packetType, null, PacketWrapper::cancel);
}
private void register(Map<Packet, ProtocolPacket> packetMap, PacketType packetType, @Nullable PacketType mappedPacketType,
@ -513,5 +492,25 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
public PacketHandler getRemapper() {
return handler;
}
@Override
public String toString() {
return "ProtocolPacket{" +
"state=" + state +
", oldId=" + oldId +
", newId=" + newId +
", unmappedPacketType=" + unmappedPacketType +
", mappedPacketType=" + mappedPacketType +
", handler=" + handler +
'}';
}
}
public Map<Packet, ProtocolPacket> getClientbound() {
return clientbound;
}
public Map<Packet, ProtocolPacket> getServerbound() {
return serverbound;
}
}

Datei anzeigen

@ -348,51 +348,51 @@ public interface Protocol<C1 extends ClientboundPacketType, C2 extends Clientbou
@Deprecated/*(forRemoval = true)*/
default void registerClientbound(State state, int unmappedPacketId, int mappedPacketId, PacketRemapper packetRemapper) {
registerClientbound(state, unmappedPacketId, mappedPacketId, (PacketHandler) packetRemapper, false);
registerClientbound(state, unmappedPacketId, mappedPacketId, packetRemapper.asPacketHandler(), false);
}
@Deprecated/*(forRemoval = true)*/
default void registerClientbound(State state, int unmappedPacketId, int mappedPacketId, PacketRemapper packetRemapper, boolean override) {
registerClientbound(state, unmappedPacketId, mappedPacketId, (PacketHandler) packetRemapper, override);
registerClientbound(state, unmappedPacketId, mappedPacketId, packetRemapper.asPacketHandler(), override);
}
@Deprecated/*(forRemoval = true)*/
default void registerClientbound(C1 packetType, @Nullable PacketRemapper packetRemapper) {
registerClientbound(packetType, (PacketHandler) packetRemapper);
registerClientbound(packetType, packetRemapper.asPacketHandler());
}
@Deprecated/*(forRemoval = true)*/
default void registerClientbound(C1 packetType, @Nullable C2 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
registerClientbound(packetType, mappedPacketType, (PacketHandler) packetRemapper, false);
registerClientbound(packetType, mappedPacketType, packetRemapper.asPacketHandler(), false);
}
@Deprecated/*(forRemoval = true)*/
default void registerClientbound(C1 packetType, @Nullable C2 mappedPacketType, @Nullable PacketRemapper packetRemapper, boolean override) {
registerClientbound(packetType, mappedPacketType, (PacketHandler) packetRemapper, override);
registerClientbound(packetType, mappedPacketType, packetRemapper.asPacketHandler(), override);
}
@Deprecated/*(forRemoval = true)*/
default void registerServerbound(State state, int unmappedPacketId, int mappedPacketId, PacketRemapper packetRemapper) {
registerServerbound(state, unmappedPacketId, mappedPacketId, (PacketHandler) packetRemapper, false);
registerServerbound(state, unmappedPacketId, mappedPacketId, packetRemapper.asPacketHandler(), false);
}
@Deprecated/*(forRemoval = true)*/
default void registerServerbound(State state, int unmappedPacketId, int mappedPacketId, PacketRemapper packetRemapper, boolean override) {
registerServerbound(state, unmappedPacketId, mappedPacketId, (PacketHandler) packetRemapper, override);
registerServerbound(state, unmappedPacketId, mappedPacketId, packetRemapper.asPacketHandler(), override);
}
@Deprecated/*(forRemoval = true)*/
default void registerServerbound(S2 packetType, @Nullable PacketRemapper packetRemapper) {
registerServerbound(packetType, (PacketHandler) packetRemapper);
registerServerbound(packetType, packetRemapper.asPacketHandler());
}
@Deprecated/*(forRemoval = true)*/
default void registerServerbound(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
registerServerbound(packetType, mappedPacketType, (PacketHandler) packetRemapper, false);
registerServerbound(packetType, mappedPacketType, packetRemapper.asPacketHandler(), false);
}
@Deprecated/*(forRemoval = true)*/
default void registerServerbound(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper, boolean override) {
registerServerbound(packetType, mappedPacketType, (PacketHandler) packetRemapper, override);
registerServerbound(packetType, mappedPacketType, packetRemapper.asPacketHandler(), override);
}
}

Datei anzeigen

@ -32,11 +32,11 @@ import com.viaversion.viaversion.api.protocol.packet.VersionedPacketTransformer;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
import java.util.concurrent.CompletableFuture;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface ProtocolManager {
@ -96,12 +96,16 @@ public interface ProtocolManager {
Protocol getBaseProtocol(int serverVersion);
/**
* Returns whether the given protocol is a base protocol.
* Returns an immutable collection of registered protocols.
*
* @param protocol protocol
* @return whether the protocol is a base protocol
* @see Protocol#isBaseProtocol()
* @return immutable collection of registered protocols
*/
Collection<Protocol<?, ?, ?, ?>> getProtocols();
/**
* @deprecated use Protocol#isBaseProtocol()
*/
@Deprecated/*(forRemoval = true)*/
default boolean isBaseProtocol(Protocol protocol) {
return protocol.isBaseProtocol();
}

Datei anzeigen

@ -23,10 +23,9 @@
package com.viaversion.viaversion.api.protocol;
import com.viaversion.viaversion.api.connection.UserConnection;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface ProtocolPipeline extends SimpleProtocol {

Datei anzeigen

@ -30,9 +30,8 @@ import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.exception.InformativeException;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface PacketWrapper {

Datei anzeigen

@ -24,9 +24,8 @@ package com.viaversion.viaversion.api.protocol.packet;
import com.viaversion.viaversion.api.connection.ProtocolInfo;
import com.viaversion.viaversion.api.connection.UserConnection;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.function.Consumer;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Utility to send packets from a given base version to or from any client version supported by Via.

Datei anzeigen

@ -158,4 +158,8 @@ public abstract class PacketHandlers implements PacketHandler {
handler.handle(wrapper);
}
}
public int handlersSize() {
return packetHandlers.size();
}
}

Datei anzeigen

@ -30,7 +30,7 @@ public interface ValueWriter<T> {
/**
* Write a value to a packet
*
* @param wrapper The packet wrapper to write to
* @param wrapper The packet wrapper to write to
* @param inputValue The value to write
* @throws Exception Throws exception if it fails to write
*/

Datei anzeigen

@ -25,14 +25,13 @@ package com.viaversion.viaversion.api.protocol.version;
import com.google.common.base.Preconditions;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public class ProtocolVersion {
private static final Int2ObjectMap<ProtocolVersion> VERSIONS = new Int2ObjectOpenHashMap<>();

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.Protocol;
import java.util.List;
public interface EntityRewriter<T extends Protocol> extends Rewriter<T> {

Datei anzeigen

@ -78,7 +78,6 @@ import com.viaversion.viaversion.api.type.types.minecraft.VarLongBlockChangeReco
import com.viaversion.viaversion.api.type.types.minecraft.Vector3fType;
import com.viaversion.viaversion.api.type.types.minecraft.VectorType;
import com.viaversion.viaversion.api.type.types.minecraft.VillagerDataType;
import java.util.UUID;
/**

Datei anzeigen

@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.lang.reflect.Array;
public class ArrayType<T> extends Type<T[]> {

Datei anzeigen

@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.type.types;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.util.Arrays;
import java.util.BitSet;

Datei anzeigen

@ -23,7 +23,6 @@
package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.type.Type;
import java.util.ArrayList;
import java.util.List;

Datei anzeigen

@ -26,7 +26,6 @@ import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.nio.charset.StandardCharsets;
public class StringType extends Type<String> {

Datei anzeigen

@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.util.UUID;
public class UUIDIntArrayType extends Type<UUID> {

Datei anzeigen

@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.util.UUID;
public class UUIDType extends Type<UUID> {

Datei anzeigen

@ -26,7 +26,6 @@ import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;

Datei anzeigen

@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.type.types.minecraft;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.Type;
import java.util.List;
public abstract class MetaListTypeTemplate extends Type<List<Metadata>> {

Datei anzeigen

@ -29,7 +29,6 @@ import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import java.io.DataInput;
import java.io.DataOutput;

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
import java.nio.ByteOrder;
public class ChunkSectionType1_8 extends Type<ChunkSection> {

Datei anzeigen

@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.type.types.version;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import java.util.List;
public class Types1_12 {

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_13;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_13 {

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_13_2;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_13_2 {

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_14 {

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_16 {

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_17 {

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_18 {

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_19 {

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_3;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_19_3 {

Datei anzeigen

@ -23,11 +23,9 @@
package com.viaversion.viaversion.api.type.types.version;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_3;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_4;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
import java.util.List;
public final class Types1_19_4 {

Datei anzeigen

@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import java.util.List;
public class Types1_8 {

Datei anzeigen

@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
import java.util.List;
public class Types1_9 {

Datei anzeigen

@ -24,7 +24,6 @@ package com.viaversion.viaversion.util;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
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

Datei anzeigen

@ -26,7 +26,6 @@ import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.protocol.Protocol;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

Datei anzeigen

@ -23,9 +23,8 @@
package com.viaversion.viaversion.util;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Simple wrapper class for two {@link Int2IntMap}s.

Datei anzeigen

@ -22,9 +22,8 @@
*/
package com.viaversion.viaversion.util;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
public class Pair<X, Y> {
private final X key;

Datei anzeigen

@ -28,12 +28,11 @@ import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.codec.MessageToMessageDecoder;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class PipelineUtil {
private static final Method DECODE_METHOD;

Datei anzeigen

@ -22,9 +22,8 @@
*/
package com.viaversion.viaversion.util;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
public class Triple<A, B, C> {
private final A first;

Datei anzeigen

@ -1,6 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.named
plugins {
id("via.base-conventions")

Datei anzeigen

@ -17,12 +17,12 @@
*/
package com.viaversion.viaversion.bukkit.listeners;
import com.viaversion.viaversion.ViaListener;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.Protocol;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import com.viaversion.viaversion.ViaListener;
import com.viaversion.viaversion.api.connection.UserConnection;
public class ViaBukkitListener extends ViaListener implements Listener {
private final Plugin plugin;

Datei anzeigen

@ -17,7 +17,14 @@
*/
package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
@ -33,14 +40,6 @@ import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import java.util.UUID;
public class ArmorListener extends ViaBukkitListener {

Datei anzeigen

@ -17,19 +17,19 @@
*/
package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.Plugin;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
public class DeathListener extends ViaBukkitListener {

Datei anzeigen

@ -18,17 +18,16 @@
package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import com.viaversion.viaversion.api.minecraft.item.Item;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
public class HandItemCache extends BukkitRunnable {

Datei anzeigen

@ -17,6 +17,8 @@
*/
package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -25,8 +27,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.Plugin;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
public class PaperPatch extends ViaBukkitListener {

Datei anzeigen

@ -19,14 +19,13 @@ package com.viaversion.viaversion.bukkit.providers;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import java.util.UUID;
public class BukkitBlockConnectionProvider extends BlockConnectionProvider {
private Chunk lastChunk;

Datei anzeigen

@ -37,17 +37,16 @@ import com.viaversion.viaversion.dump.PluginInfo;
import com.viaversion.viaversion.unsupported.UnsupportedPlugin;
import com.viaversion.viaversion.unsupported.UnsupportedServerSoftware;
import com.viaversion.viaversion.util.GsonUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player> {
private static ViaVersionPlugin instance;

Datei anzeigen

@ -18,13 +18,12 @@
package com.viaversion.viaversion.bukkit.commands;
import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import java.util.List;
public class BukkitCommandHandler extends ViaCommandHandler implements CommandExecutor, TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

Datei anzeigen

@ -18,11 +18,10 @@
package com.viaversion.viaversion.bukkit.commands;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import java.util.UUID;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import java.util.UUID;
public class BukkitCommandSender implements ViaCommandSender {
private final CommandSender sender;

Datei anzeigen

@ -20,13 +20,12 @@ package com.viaversion.viaversion.bukkit.compat;
import com.viaversion.viaversion.ViaVersionPlugin;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.bukkit.util.NMSUtil;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import java.util.logging.Level;
public final class ProtocolSupportCompat {
public static void registerPSConnectListener(ViaVersionPlugin plugin) {

Datei anzeigen

@ -19,9 +19,8 @@ package com.viaversion.viaversion.bukkit.compat;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.bukkit.util.NMSUtil;
import protocolsupport.api.Connection;
import java.lang.reflect.Method;
import protocolsupport.api.Connection;
final class ProtocolSupportConnectionListener extends Connection.PacketListener {

Datei anzeigen

@ -25,9 +25,8 @@ import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.lang.reflect.Method;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class BukkitChannelInitializer extends ChannelInitializer<Channel> implements WrappedChannelInitializer {

Datei anzeigen

@ -28,7 +28,6 @@ import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.MessageToMessageDecoder;
import java.util.List;
@ChannelHandler.Sharable

Datei anzeigen

@ -30,7 +30,6 @@ import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.codec.MessageToMessageEncoder;
import java.util.List;
@ChannelHandler.Sharable

Datei anzeigen

@ -23,6 +23,9 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.bukkit.handlers.BukkitEncodeHandler;
import com.viaversion.viaversion.bukkit.util.NMSUtil;
import io.netty.channel.Channel;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -30,10 +33,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
public class JoinListener implements Listener {
private static final Method GET_HANDLE;
@ -79,7 +78,7 @@ public class JoinListener implements Listener {
Channel channel;
try {
channel = getChannel(player);
channel = getChannel(player);
} catch (Exception ex) {
Via.getPlatform().getLogger().log(Level.WARNING, ex,
() -> "Could not find Channel for logging-in player " + player.getUniqueId());

Datei anzeigen

@ -23,13 +23,6 @@ import com.viaversion.viaversion.api.connection.ProtocolInfo;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashSet;
@ -37,6 +30,12 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
public class PlayerSneakListener extends ViaBukkitListener {
private static final float STANDING_HEIGHT = 1.8F;

Datei anzeigen

@ -25,14 +25,13 @@ import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
import java.util.Arrays;
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 java.util.Arrays;
public class EntityToggleGlideListener extends ViaBukkitListener {
private boolean swimmingMethodExists;

Datei anzeigen

@ -23,11 +23,10 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.bukkit.util.ProtocolSupportUtil;
import io.netty.buffer.ByteBuf;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.UUID;
public class BukkitViaAPI extends ViaAPIBase<Player> {
private final ViaVersionPlugin plugin;

Datei anzeigen

@ -19,12 +19,11 @@ package com.viaversion.viaversion.bukkit.platform;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.configuration.AbstractViaConfig;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.bukkit.plugin.Plugin;
public class BukkitViaConfig extends AbstractViaConfig {
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");

Datei anzeigen

@ -26,13 +26,12 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginDescriptionFile;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginDescriptionFile;
import org.checkerframework.checker.nullness.qual.Nullable;
public class BukkitViaInjector extends LegacyViaInjector {

Datei anzeigen

@ -45,17 +45,16 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.provider.AckSequenceProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.scheduler.BukkitTask;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class BukkitViaLoader implements ViaPlatformLoader {
private final ViaVersionPlugin plugin;

Datei anzeigen

@ -19,10 +19,9 @@ package com.viaversion.viaversion.bukkit.platform;
import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer;
import io.netty.channel.Channel;
import net.kyori.adventure.key.Key;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import net.kyori.adventure.key.Key;
public final class PaperViaInjector {
public static final boolean PAPER_INJECTION_METHOD = hasPaperInjectionMethod();

Datei anzeigen

@ -26,12 +26,6 @@ import com.viaversion.viaversion.bukkit.util.NMSUtil;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
import com.viaversion.viaversion.util.ReflectionUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -39,6 +33,11 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider {

Datei anzeigen

@ -22,12 +22,11 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.bukkit.util.NMSUtil;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.MovementTracker;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class BukkitViaMovementTransmitter extends MovementTransmitterProvider {
private static boolean USE_NMS = true;

Datei anzeigen

@ -19,13 +19,12 @@ package com.viaversion.viaversion.bukkit.tasks.protocol1_12to1_11_1;
import com.viaversion.viaversion.bukkit.providers.BukkitInventoryQuickMoveProvider;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class BukkitInventoryUpdateTask implements Runnable {

Datei anzeigen

@ -17,10 +17,9 @@
*/
package com.viaversion.viaversion.bukkit.util;
import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.bukkit.entity.Player;
public final class ProtocolSupportUtil {
private static final Method PROTOCOL_VERSION_METHOD;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen