geforkt von Mirrors/Paper
Disallow Interaction With Self
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
1904e973f2
Commit
b934e29ae6
@ -127,14 +127,14 @@
|
||||
- this.chatMessageChain = new FutureChain(server);
|
||||
+ this.chatMessageChain = new FutureChain(server.chatExecutor); // CraftBukkit - async chat
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ private int lastTick = MinecraftServer.currentTick;
|
||||
+ private int allowedPlayerTicks = 1;
|
||||
+ private int lastDropTick = MinecraftServer.currentTick;
|
||||
+ private int lastBookTick = MinecraftServer.currentTick;
|
||||
+ private int dropCount = 0;
|
||||
|
||||
+
|
||||
+ private boolean hasMoved = false;
|
||||
+ private double lastPosX = Double.MAX_VALUE;
|
||||
+ private double lastPosY = Double.MAX_VALUE;
|
||||
@ -959,10 +959,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1566,6 +2068,121 @@
|
||||
return false;
|
||||
}
|
||||
@@ -1564,8 +2066,123 @@
|
||||
}
|
||||
|
||||
return false;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - add method
|
||||
+ public void chat(String s, PlayerChatMessage original, boolean async) {
|
||||
+ if (s.isEmpty() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) {
|
||||
@ -1047,8 +1049,8 @@
|
||||
+ this.server.console.sendMessage(s);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ private void handleCommand(String s) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
|
||||
+ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
||||
@ -1195,7 +1197,7 @@
|
||||
this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params));
|
||||
this.addPendingMessage(message);
|
||||
}
|
||||
@@ -1718,6 +2410,7 @@
|
||||
@@ -1718,9 +2410,17 @@
|
||||
@Override
|
||||
public void handleInteract(ServerboundInteractPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@ -1203,7 +1205,17 @@
|
||||
if (this.player.hasClientLoaded()) {
|
||||
final ServerLevel worldserver = this.player.serverLevel();
|
||||
final Entity entity = packet.getTarget(worldserver);
|
||||
@@ -1733,20 +2426,58 @@
|
||||
+ // Spigot Start
|
||||
+ if ( entity == this.player && !this.player.isSpectator() )
|
||||
+ {
|
||||
+ this.disconnect( Component.literal( "Cannot interact with self!" ) );
|
||||
+ return;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
|
||||
@@ -1733,20 +2433,58 @@
|
||||
|
||||
if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) {
|
||||
packet.dispatch(new ServerboundInteractPacket.Handler() {
|
||||
@ -1266,7 +1278,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1755,19 +2486,20 @@
|
||||
@@ -1755,19 +2493,20 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(InteractionHand hand) {
|
||||
@ -1290,7 +1302,7 @@
|
||||
label23:
|
||||
{
|
||||
if (entity instanceof AbstractArrow) {
|
||||
@@ -1785,6 +2517,11 @@
|
||||
@@ -1785,6 +2524,11 @@
|
||||
}
|
||||
|
||||
ServerGamePacketListenerImpl.this.player.attack(entity);
|
||||
@ -1302,7 +1314,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1809,7 +2546,7 @@
|
||||
@@ -1809,7 +2553,7 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
@ -1311,7 +1323,7 @@
|
||||
this.resetPosition();
|
||||
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
|
||||
} else {
|
||||
@@ -1817,11 +2554,11 @@
|
||||
@@ -1817,11 +2561,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1325,7 +1337,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1834,15 +2571,21 @@
|
||||
@@ -1834,15 +2578,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(ServerboundContainerClosePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@ -1349,7 +1361,7 @@
|
||||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1855,7 +2598,284 @@
|
||||
@@ -1855,7 +2605,284 @@
|
||||
boolean flag = packet.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
@ -1635,7 +1647,7 @@
|
||||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packet.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1901,8 +2921,22 @@
|
||||
@@ -1901,8 +2928,22 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1659,7 +1671,7 @@
|
||||
if (containerrecipebook_a == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) {
|
||||
this.player.connection.send(new ClientboundPlaceGhostRecipePacket(this.player.containerMenu.containerId, craftingmanager_d.display().display()));
|
||||
}
|
||||
@@ -1917,6 +2951,7 @@
|
||||
@@ -1917,6 +2958,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(ServerboundContainerButtonClickPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@ -1667,7 +1679,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1945,7 +2980,44 @@
|
||||
@@ -1945,7 +2987,44 @@
|
||||
|
||||
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
||||
@ -1712,7 +1724,7 @@
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemstack);
|
||||
this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemstack);
|
||||
@@ -1972,6 +3044,7 @@
|
||||
@@ -1972,6 +3051,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(ServerboundSignUpdatePacket packet, List<FilteredText> signText) {
|
||||
@ -1720,7 +1732,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
ServerLevel worldserver = this.player.serverLevel();
|
||||
BlockPos blockposition = packet.getPos();
|
||||
@@ -1993,7 +3066,17 @@
|
||||
@@ -1993,7 +3073,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@ -1739,7 +1751,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2058,7 +3141,7 @@
|
||||
@@ -2058,7 +3148,7 @@
|
||||
if (!this.waitingForSwitchToConfig) {
|
||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||
} else {
|
||||
@ -1748,7 +1760,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2083,8 +3166,10 @@
|
||||
@@ -2083,8 +3173,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren