Add config for updating equipment on player actions (#12275)
This commit is contained in:
@@ -577,7 +577,7 @@
|
|||||||
|
|
||||||
this.player.connection.send(new ClientboundSetHeldSlotPacket(inventory.selected));
|
this.player.connection.send(new ClientboundSetHeldSlotPacket(inventory.selected));
|
||||||
this.player.inventoryMenu.broadcastChanges();
|
this.player.inventoryMenu.broadcastChanges();
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1103,7 +1103,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.player.stopUsingItem();
|
this.player.stopUsingItem();
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1125,21 +1125,21 @@
|
|||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.player.drop(false);
|
this.player.drop(false);
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case DROP_ALL_ITEMS:
|
case DROP_ALL_ITEMS:
|
||||||
if (!this.player.isSpectator()) {
|
if (!this.player.isSpectator()) {
|
||||||
this.player.drop(true);
|
this.player.drop(true);
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case RELEASE_USE_ITEM:
|
case RELEASE_USE_ITEM:
|
||||||
- this.player.releaseUsingItem();
|
- this.player.releaseUsingItem();
|
||||||
+ if (this.player.getUseItem() == this.player.getItemInHand(this.player.getUsedItemHand())) this.player.releaseUsingItem(); // Paper - validate use item before processing release
|
+ if (this.player.getUseItem() == this.player.getItemInHand(this.player.getUsedItemHand())) this.player.releaseUsingItem(); // Paper - validate use item before processing release
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
return;
|
return;
|
||||||
case START_DESTROY_BLOCK:
|
case START_DESTROY_BLOCK:
|
||||||
case ABORT_DESTROY_BLOCK:
|
case ABORT_DESTROY_BLOCK:
|
||||||
@@ -1172,7 +1172,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Send block entities after destroy prediction
|
+ // Paper end - Send block entities after destroy prediction
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Invalid player action");
|
throw new IllegalArgumentException("Invalid player action");
|
||||||
@@ -1247,7 +1247,7 @@
|
|||||||
|
|
||||||
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos));
|
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos));
|
||||||
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos.relative(direction)));
|
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos.relative(direction)));
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"Rejecting UseItemOnPacket from {}: Location {} too far away from hit block {}.",
|
"Rejecting UseItemOnPacket from {}: Location {} too far away from hit block {}.",
|
||||||
@@ -1397,7 +1397,7 @@
|
|||||||
|
|
||||||
this.player.getInventory().selected = packet.getSlot();
|
this.player.getInventory().selected = packet.getSlot();
|
||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||||
+ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // CraftBukkit // Paper - kick event cause
|
+ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // CraftBukkit // Paper - kick event cause
|
||||||
@@ -2004,7 +2004,7 @@
|
|||||||
+ });
|
+ });
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - PlayerUseUnknownEntityEvent
|
+ // Paper end - PlayerUseUnknownEntityEvent
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2410,7 +2410,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.player.containerMenu.broadcastChanges();
|
this.player.containerMenu.broadcastChanges();
|
||||||
}
|
}
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2487,7 +2487,7 @@
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
this.player.containerMenu.broadcastChanges();
|
this.player.containerMenu.broadcastChanges();
|
||||||
}
|
}
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2536,7 +2536,7 @@
|
|||||||
this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemStack);
|
this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemStack);
|
||||||
this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemStack);
|
this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemStack);
|
||||||
this.player.inventoryMenu.broadcastChanges();
|
this.player.inventoryMenu.broadcastChanges();
|
||||||
+ this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
||||||
} else if (flag && flag2) {
|
} else if (flag && flag2) {
|
||||||
if (this.dropSpamThrottler.isUnderThreshold()) {
|
if (this.dropSpamThrottler.isUnderThreshold()) {
|
||||||
this.dropSpamThrottler.increment();
|
this.dropSpamThrottler.increment();
|
||||||
|
|||||||
@@ -184,6 +184,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|||||||
public boolean skipVanillaDamageTickWhenShieldBlocked = false;
|
public boolean skipVanillaDamageTickWhenShieldBlocked = false;
|
||||||
@Comment("This setting controls what compression format is used for region files.")
|
@Comment("This setting controls what compression format is used for region files.")
|
||||||
public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
|
public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
|
||||||
|
@Comment("This setting controls if equipment should be updated when handling certain player actions.")
|
||||||
|
public boolean updateEquipmentOnPlayerActions = true;
|
||||||
|
|
||||||
public enum CompressionFormat {
|
public enum CompressionFormat {
|
||||||
GZIP,
|
GZIP,
|
||||||
|
|||||||
Reference in New Issue
Block a user