Skip to content

Commit

Permalink
chore: cleanup last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
derklaro committed Oct 18, 2023
1 parent 17ef844 commit 266d3c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ final class MojangProfileResolver implements ProfileResolver {

private static final int DEFAULT_TIMEOUT = (int) TimeUnit.SECONDS.toMillis(10);

private static final Type PROFILE_PROPERTIES_TYPE = TypeFactory.parameterizedClass(Set.class, ProfileProperty.class);
private static final Gson GSON = new GsonBuilder()
.disableHtmlEscaping()
.registerTypeAdapter(ProfileProperty.class, new ProfilePropertyTypeAdapter())
.create();
private static final Type PROFILE_PROPERTIES_TYPE = TypeFactory.parameterizedClass(Set.class, ProfileProperty.class);

private static final Pattern UUID_NO_DASH_PATTERN = Pattern.compile("-", Pattern.LITERAL);
private static final Pattern UUID_DASHER_PATTERN = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ final class PacketEventsPacketAdapter implements PlatformPacketAdapter<World, Pl
@Override
public @NotNull OutboundPacket<World, Player, ItemStack, Plugin> createEntitySpawnPacket() {
return (player, npc) -> {
// SpawnPlayer (https://wiki.vg/Protocol#Spawn_Player)
Location location = npcLocation(npc);

PacketWrapper<?> wrapper;
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
// SpawnEntity (https://wiki.vg/Protocol#Spawn_Entity)
wrapper = new WrapperPlayServerSpawnEntity(
npc.entityId(),
Optional.of(npc.profile().uniqueId()),
Expand All @@ -167,6 +167,7 @@ final class PacketEventsPacketAdapter implements PlatformPacketAdapter<World, Pl
0,
Optional.empty());
} else {
// SpawnPlayer (https://wiki.vg/Protocol#Spawn_Player)
wrapper = new WrapperPlayServerSpawnPlayer(npc.entityId(), npc.profile().uniqueId(), location);
}

Expand Down Expand Up @@ -300,7 +301,6 @@ final class PacketEventsPacketAdapter implements PlatformPacketAdapter<World, Pl
) {
return (player, npc) -> {
// CustomPayload (https://wiki.vg/Protocol#Custom_Payload)

PacketWrapper<?> wrapper = new WrapperPlayServerPluginMessage(channelId, payload);
this.packetPlayerManager.sendPacketSilently(player, wrapper);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,11 @@ final class ProtocolLibPacketAdapter implements PlatformPacketAdapter<World, Pla
MinecraftKey key = parts.length == 1 ? new MinecraftKey(channelId) : new MinecraftKey(parts[0], parts[1]);

if (MinecraftVersion.CONFIG_PHASE_PROTOCOL_UPDATE.atOrAbove()) {
// mc 1.20.2:
// mc 1.20.2: custom payload info is in a wrapper object
CustomPacketPayloadWrapper payloadWrapper = new CustomPacketPayloadWrapper(payload, key);
container.getCustomPacketPayloads().write(0, payloadWrapper);
} else {
// pre 1.20.2: payload key is a plain field
container.getMinecraftKeys().write(0, key);
}
} else {
Expand All @@ -490,7 +491,7 @@ final class ProtocolLibPacketAdapter implements PlatformPacketAdapter<World, Pla
}

if (!MinecraftVersion.CONFIG_PHASE_PROTOCOL_UPDATE.atOrAbove()) {
// payload
// pre 1.20.2: payload data is a ByteBuf field
ByteBuf buffer = Unpooled.copiedBuffer(payload);
Object wrappedSerializableBuffer = MinecraftReflection.getPacketDataSerializer(buffer);
container.getModifier().withType(ByteBuf.class).write(0, wrappedSerializableBuffer);
Expand Down
1 change: 0 additions & 1 deletion minestom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ tasks.withType<JavaCompile> {

tasks.withType<ShadowJar> {
dependsOn(":npc-lib-common:shadowJar")

relocate("io.leangen.geantyref", "com.github.juliarn.npclib.relocate.geantyref")
}

0 comments on commit 266d3c9

Please sign in to comment.