Skip to content

Commit 26cc1e9

Browse files
committed
fix:fix missing patches
1 parent 1f102f6 commit 26cc1e9

2 files changed

Lines changed: 46 additions & 30 deletions

File tree

patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
import net.minecraft.world.level.GameRules;
9494
import net.minecraft.world.level.GameType;
9595
import net.minecraft.world.level.Level;
96-
@@ -180,17 +_,56 @@
96+
@@ -180,17 +_,57 @@
9797
import net.minecraft.world.level.block.state.BlockState;
9898
import net.minecraft.world.phys.AABB;
9999
import net.minecraft.world.phys.BlockHitResult;
@@ -104,6 +104,7 @@
104104
import net.minecraft.world.phys.shapes.VoxelShape;
105105
+import org.bukkit.Location;
106106
+import org.bukkit.craftbukkit.entity.CraftEntity;
107+
+import org.bukkit.craftbukkit.entity.CraftPlayer;
107108
+import org.bukkit.craftbukkit.event.CraftEventFactory;
108109
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
109110
+import org.bukkit.craftbukkit.util.CraftChatMessage;
@@ -1573,7 +1574,7 @@
15731574
for (int i = 0; i < p_215215_.length(); i++) {
15741575
if (!StringUtil.isAllowedChatCharacter(p_215215_.charAt(i))) {
15751576
return true;
1576-
@@ -1381,46 +_,232 @@
1577+
@@ -1381,46 +_,239 @@
15771578
return false;
15781579
}
15791580

@@ -1664,20 +1665,27 @@
16641665
+ }
16651666
+ }
16661667
+
1667-
+ @Deprecated // Paper
1668-
+ public void handleCommand(String s) { // Paper - private -> public
1669-
+ // Paper start - Remove all this old duplicated logic
1670-
+ if (s.startsWith("/")) {
1671-
+ s = s.substring(1);
1668+
+ public void handleCommand(String s) {
1669+
+ LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
1670+
+
1671+
+ CraftPlayer player = this.getCraftPlayer();
1672+
+
1673+
+ PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet(server));
1674+
+ this.cserver.getPluginManager().callEvent(event);
1675+
+
1676+
+ if (event.isCancelled()) {
1677+
+ return;
1678+
+ }
1679+
+
1680+
+ try {
1681+
+ if (this.cserver.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
1682+
+ return;
1683+
+ }
1684+
+ } catch (org.bukkit.command.CommandException ex) {
1685+
+ player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
1686+
+ java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
1687+
+ return;
16721688
+ }
1673-
+ /*
1674-
+ It should be noted that this represents the "legacy" command execution path.
1675-
+ Api can call commands even if there is no additional context provided.
1676-
+ This method should ONLY be used if you need to execute a command WITHOUT
1677-
+ an actual player's input.
1678-
+ */
1679-
+ this.performUnsignedChatCommand(s);
1680-
+ // Paper end
16811689
+ }
16821690
+ // CraftBukkit end
16831691
+
@@ -2638,14 +2646,30 @@
26382646
);
26392647
}
26402648
}
2641-
@@ -1840,13 +_,14 @@
2642-
.getPlayerList()
2643-
.broadcastAll(
2644-
new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player))
2649+
@@ -1833,20 +_,21 @@
2650+
this.chatSession = p_253823_;
2651+
this.signedMessageDecoder = p_253823_.createMessageDecoder(this.player.getUUID());
2652+
this.chatMessageChain
2653+
- .append(
2654+
- () -> {
2655+
- this.player.setChatSession(p_253823_);
2656+
- this.server
2657+
- .getPlayerList()
2658+
- .broadcastAll(
2659+
- new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player))
26452660
- );
2646-
+ , this.player); // Paper - Use single player info update packet on join
2647-
}
2648-
);
2661+
- }
2662+
- );
2663+
+ .append(
2664+
+ () -> {
2665+
+ this.player.setChatSession(p_253823_);
2666+
+ this.server
2667+
+ .getPlayerList()
2668+
+ .broadcastAll(
2669+
+ new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player))
2670+
+ );
2671+
+ }
2672+
+ );
26492673
}
26502674

26512675
@Override

src/main/java/org/bukkit/craftbukkit/CraftServer.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,6 @@ public String getBukkitVersion() {
596596

597597
@Override
598598
public List<CraftPlayer> getOnlinePlayers() {
599-
// NeoTenet start - refresh online players
600-
this.playerView = Collections.unmodifiableList(Lists.transform(playerList.players, new Function<ServerPlayer, CraftPlayer>() {
601-
@Override
602-
public CraftPlayer apply(ServerPlayer player) {
603-
return player.getBukkitEntity();
604-
}
605-
}));
606-
// NeoTenet end
607599
return this.playerView;
608600
}
609601

0 commit comments

Comments
 (0)