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.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
|
||||
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;
|
||||
@ -1125,21 +1125,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
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;
|
||||
case DROP_ALL_ITEMS:
|
||||
if (!this.player.isSpectator()) {
|
||||
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;
|
||||
case RELEASE_USE_ITEM:
|
||||
- this.player.releaseUsingItem();
|
||||
+ 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;
|
||||
case START_DESTROY_BLOCK:
|
||||
case ABORT_DESTROY_BLOCK:
|
||||
@ -1172,7 +1172,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // 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;
|
||||
default:
|
||||
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.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 {
|
||||
LOGGER.warn(
|
||||
"Rejecting UseItemOnPacket from {}: Location {} too far away from hit block {}.",
|
||||
@ -1397,7 +1397,7 @@
|
||||
|
||||
this.player.getInventory().selected = packet.getSlot();
|
||||
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 {
|
||||
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
|
||||
@ -2004,7 +2004,7 @@
|
||||
+ });
|
||||
+ }
|
||||
+ // 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 {
|
||||
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) {
|
||||
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.setRemoteSlot(packet.slotNum(), itemStack);
|
||||
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) {
|
||||
if (this.dropSpamThrottler.isUnderThreshold()) {
|
||||
this.dropSpamThrottler.increment();
|
||||
|
||||
@ -184,6 +184,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public boolean skipVanillaDamageTickWhenShieldBlocked = false;
|
||||
@Comment("This setting controls what compression format is used for region files.")
|
||||
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 {
|
||||
GZIP,
|
||||
|
||||
Reference in New Issue
Block a user