mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
Cleanup imports
This commit is contained in:
parent
a59099f160
commit
3506f30041
16 changed files with 6 additions and 30 deletions
|
@ -99,10 +99,11 @@ public class ServerListener extends SessionAdapter {
|
|||
if (packet instanceof ClientIntentionPacket intentionPacket) {
|
||||
switch (intentionPacket.getIntent()) {
|
||||
case STATUS -> protocol.setState(ProtocolState.STATUS);
|
||||
case TRANSFER:
|
||||
case TRANSFER -> {
|
||||
if (!session.getFlag(MinecraftConstants.ACCEPT_TRANSFERS_KEY, false)) {
|
||||
session.disconnect("Server does not accept transfers.");
|
||||
}
|
||||
}
|
||||
case LOGIN -> {
|
||||
protocol.setState(ProtocolState.LOGIN);
|
||||
if (intentionPacket.getProtocolVersion() > protocol.getCodec().getProtocolVersion()) {
|
||||
|
@ -111,8 +112,7 @@ public class ServerListener extends SessionAdapter {
|
|||
session.disconnect("Outdated client! Please use " + protocol.getCodec().getMinecraftVersion() + ".");
|
||||
}
|
||||
}
|
||||
default ->
|
||||
throw new UnsupportedOperationException("Invalid client intent: " + intentionPacket.getIntent());
|
||||
default -> throw new UnsupportedOperationException("Invalid client intent: " + intentionPacket.getIntent());
|
||||
}
|
||||
}
|
||||
} else if (protocol.getState() == ProtocolState.LOGIN) {
|
||||
|
@ -136,7 +136,7 @@ public class ServerListener extends SessionAdapter {
|
|||
session.enableEncryption(protocol.enableEncryption(key));
|
||||
new Thread(new UserAuthTask(session, key)).start();
|
||||
} else if (packet instanceof ServerboundLoginAcknowledgedPacket) {
|
||||
((MinecraftProtocol) session.getPacketProtocol()).setState(ProtocolState.CONFIGURATION);
|
||||
protocol.setState(ProtocolState.CONFIGURATION);
|
||||
|
||||
// Credit ViaVersion: https://github.com/ViaVersion/ViaVersion/blob/dev/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java
|
||||
for (Map.Entry<String, Tag> entry : networkCodec.getValue().entrySet()) {
|
||||
|
|
|
@ -3,8 +3,6 @@ package org.geysermc.mcprotocollib.protocol.data.game.item.component;
|
|||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.type.BooleanDataComponent;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BooleanComponentType extends DataComponentType<Boolean> {
|
||||
protected final BooleanReader primitiveReader;
|
||||
protected final BooleanWriter primitiveWriter;
|
||||
|
|
|
@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
|
|
|
@ -14,7 +14,6 @@ import io.netty.buffer.ByteBuf;
|
|||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package org.geysermc.mcprotocollib.protocol.data.game.item.component;
|
|||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.type.IntDataComponent;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntComponentType extends DataComponentType<Integer> {
|
||||
protected final IntReader primitiveReader;
|
||||
protected final IntWriter primitiveWriter;
|
||||
|
|
|
@ -16,7 +16,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
|||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -33,8 +32,7 @@ public class ItemCodecHelper extends MinecraftCodecHelper {
|
|||
super(Int2ObjectMaps.emptyMap(), Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
public <T, E extends Throwable> Filterable<T> readFilterable(ByteBuf buf, Function<ByteBuf, T> reader) {
|
||||
public <T> Filterable<T> readFilterable(ByteBuf buf, Function<ByteBuf, T> reader) {
|
||||
T raw = reader.apply(buf);
|
||||
T filtered = null;
|
||||
if (buf.readBoolean()) {
|
||||
|
|
|
@ -6,8 +6,6 @@ import org.geysermc.mcprotocollib.protocol.data.game.item.component.ItemCodecHel
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BooleanDataComponent extends DataComponent<Boolean, BooleanComponentType> {
|
||||
private final Boolean value;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.geysermc.mcprotocollib.protocol.data.game.item.component.ItemCodecHel
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntDataComponent extends DataComponent<Integer, IntComponentType> {
|
||||
private final Integer value;
|
||||
|
|
|
@ -7,8 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -7,8 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -7,8 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -8,8 +8,6 @@ import lombok.Data;
|
|||
import lombok.With;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -8,7 +8,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -8,8 +8,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -8,8 +8,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
|
|
Loading…
Reference in a new issue