|
93 | 93 | import net.minecraft.world.level.GameRules; |
94 | 94 | import net.minecraft.world.level.GameType; |
95 | 95 | import net.minecraft.world.level.Level; |
96 | | -@@ -180,17 +_,56 @@ |
| 96 | +@@ -180,17 +_,57 @@ |
97 | 97 | import net.minecraft.world.level.block.state.BlockState; |
98 | 98 | import net.minecraft.world.phys.AABB; |
99 | 99 | import net.minecraft.world.phys.BlockHitResult; |
|
104 | 104 | import net.minecraft.world.phys.shapes.VoxelShape; |
105 | 105 | +import org.bukkit.Location; |
106 | 106 | +import org.bukkit.craftbukkit.entity.CraftEntity; |
| 107 | ++import org.bukkit.craftbukkit.entity.CraftPlayer; |
107 | 108 | +import org.bukkit.craftbukkit.event.CraftEventFactory; |
108 | 109 | +import org.bukkit.craftbukkit.inventory.CraftItemStack; |
109 | 110 | +import org.bukkit.craftbukkit.util.CraftChatMessage; |
|
1573 | 1574 | for (int i = 0; i < p_215215_.length(); i++) { |
1574 | 1575 | if (!StringUtil.isAllowedChatCharacter(p_215215_.charAt(i))) { |
1575 | 1576 | return true; |
1576 | | -@@ -1381,46 +_,232 @@ |
| 1577 | +@@ -1381,46 +_,239 @@ |
1577 | 1578 | return false; |
1578 | 1579 | } |
1579 | 1580 |
|
|
1664 | 1665 | + } |
1665 | 1666 | + } |
1666 | 1667 | + |
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; |
1672 | 1688 | + } |
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 |
1681 | 1689 | + } |
1682 | 1690 | + // CraftBukkit end |
1683 | 1691 | + |
|
2638 | 2646 | ); |
2639 | 2647 | } |
2640 | 2648 | } |
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)) |
2645 | 2660 | - ); |
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 | ++ ); |
2649 | 2673 | } |
2650 | 2674 |
|
2651 | 2675 | @Override |
|
0 commit comments