Skip to content

Commit

Permalink
[Bukkit] Update Paper submodule to 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Dec 7, 2024
1 parent 673542d commit a83f985
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bukkit/paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots")
}

val version = "1.21.3-R0.1-SNAPSHOT"
val version = "1.21.4-R0.1-SNAPSHOT"

dependencies {
implementation(projects.bukkit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.*;

/**
* TabList implementation using direct mojang-mapped code for versions 1.21.2+.
* TabList implementation using direct mojang-mapped code for versions 1.21.4+.
*/
@SuppressWarnings("unused") // Used via reflection
public class PaperPacketTabList extends TabListBase<Component> {
Expand All @@ -34,6 +34,7 @@ public class PaperPacketTabList extends TabListBase<Component> {
private static final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> updateGameMode = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE);
private static final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> updateListed = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED);
private static final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> updateListOrder = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LIST_ORDER);
private static final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> updateHat = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT);
private static final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> addPlayer = EnumSet.allOf(ClientboundPlayerInfoUpdatePacket.Action.class);

private static final Field entries;
Expand Down Expand Up @@ -64,50 +65,51 @@ public void removeEntry(@NonNull UUID entry) {
@Override
public void updateDisplayName(@NonNull UUID entry, @Nullable Component displayName) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateDisplayName, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, false, 0, null, displayName, 0, null
entry, null, false, 0, null, displayName, false, 0, null
)));
}

@Override
public void updateLatency(@NonNull UUID entry, int latency) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateLatency, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, false, latency, null, null, 0, null
entry, null, false, latency, null, null, false, 0, null
)));
}

@Override
public void updateGameMode(@NonNull UUID entry, int gameMode) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateGameMode, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, false, 0, GameType.byId(gameMode), null, 0, null
entry, null, false, 0, GameType.byId(gameMode), null, false, 0, null
)));
}

@Override
public void updateListed(@NonNull UUID entry, boolean listed) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateListed, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, listed, 0, null, null, 0, null
entry, null, listed, 0, null, null, false, 0, null
)));
}

@Override
public void updateListOrder(@NonNull UUID entry, int listOrder) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateListOrder, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, false, 0, null, null, listOrder, null
entry, null, false, 0, null, null, false, listOrder, null
)));
}

@Override
public void updateHat(@NonNull UUID entry, boolean showHat) {
// TODO update module to 1.21.4 when it comes out
sendPacket(new ClientboundPlayerInfoUpdatePacket(updateHat, new ClientboundPlayerInfoUpdatePacket.Entry(
entry, null, false, 0, null, null, showHat, 0, null
)));
}

@Override
public void addEntry(@NonNull UUID id, @NonNull String name, @Nullable Skin skin, boolean listed, int latency,
int gameMode, @Nullable Component displayName, int listOrder, boolean showHat) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(addPlayer, new ClientboundPlayerInfoUpdatePacket.Entry(
id, createProfile(id, name, skin), listed, latency, GameType.byId(gameMode), displayName, listOrder, null
id, createProfile(id, name, skin), listed, latency, GameType.byId(gameMode), displayName, showHat, listOrder, null
)));
// TODO update module to 1.21.4 when it comes out
}

@Override
Expand Down Expand Up @@ -144,7 +146,8 @@ public void onPacketSend(@NonNull Object packet) {
TAB.getInstance().getFeatureManager().onEntryAdd(player, nmsData.profileId(), nmsData.profile().getName());
}
updatedList.add(rewriteEntry ? new ClientboundPlayerInfoUpdatePacket.Entry(
nmsData.profileId(), nmsData.profile(), nmsData.listed(), latency, nmsData.gameMode(), displayName, nmsData.listOrder(), nmsData.chatSession()
nmsData.profileId(), nmsData.profile(), nmsData.listed(), latency, nmsData.gameMode(), displayName,
nmsData.showHat(), nmsData.listOrder(), nmsData.chatSession()
) : nmsData);
}
if (rewritePacket) entries.set(info, updatedList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class BukkitPipelineInjector extends NettyPipelineInjector {
ProtocolVersion.V1_21,
ProtocolVersion.V1_21_1,
ProtocolVersion.V1_21_2,
ProtocolVersion.V1_21_3
ProtocolVersion.V1_21_3,
ProtocolVersion.V1_21_4
);

/** Function for getting player's channel */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public abstract class ComponentConverter {
ProtocolVersion.V1_21,
ProtocolVersion.V1_21_1,
ProtocolVersion.V1_21_2,
ProtocolVersion.V1_21_3
ProtocolVersion.V1_21_3,
ProtocolVersion.V1_21_4
);

/** Instance of this class */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class ScoreboardLoader {
ProtocolVersion.V1_21,
ProtocolVersion.V1_21_1,
ProtocolVersion.V1_21_2,
ProtocolVersion.V1_21_3
ProtocolVersion.V1_21_3,
ProtocolVersion.V1_21_4
);

/** Instance function */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public abstract class TabListBase<C> extends TrackedTabList<BukkitTabPlayer, C>

/** Versions supported by paper module that uses direct mojang-mapped NMS for latest MC version */
private static final EnumSet<ProtocolVersion> paperNativeVersions = EnumSet.of(
ProtocolVersion.V1_21_2,
ProtocolVersion.V1_21_3
ProtocolVersion.V1_21_4
);

/** Instance function */
Expand Down

0 comments on commit a83f985

Please sign in to comment.