13
0
geforkt von Mirrors/Paper

Allow using signs inside spawn protection

Dieser Commit ist enthalten in:
Anton Lindroth 2020-04-15 01:54:02 +02:00
Ursprung 53ea19c9bd
Commit a032df8427

Datei anzeigen

@ -1050,10 +1050,12 @@
if (this.player.hasClientLoaded()) {
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
ServerLevel worldserver = this.player.serverLevel();
@@ -1244,6 +1828,7 @@
@@ -1243,7 +1827,8 @@
int i = this.player.level().getMaxY();
if (blockposition.getY() <= i) {
if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
- if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - Allow using signs inside spawn protection
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
@ -1076,12 +1078,10 @@
if (this.player.hasClientLoaded()) {
this.ackBlockChangesUpTo(packet.getSequence());
ServerLevel worldserver = this.player.serverLevel();
@@ -1294,8 +1881,49 @@
if (f1 != this.player.getXRot() || f != this.player.getYRot()) {
@@ -1296,6 +1883,47 @@
this.player.absRotateTo(f, f1);
+ }
+
}
+ // CraftBukkit start
+ // Raytrace to look for 'rogue armswings'
+ double d0 = this.player.getX();
@ -1112,8 +1112,8 @@
+ cancelled = event.useItemInHand() == Event.Result.DENY;
+ }
+ this.player.gameMode.firedInteract = false;
}
+ }
+
+ if (cancelled) {
+ this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
+ return;
@ -2177,7 +2177,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1945,7 +3273,44 @@
@@ -1945,6 +3273,43 @@
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
@ -2185,7 +2185,7 @@
+ // CraftBukkit start - Call click event
+ InventoryView inventory = this.player.inventoryMenu.getBukkitView();
+ org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packet.itemStack());
+
+ SlotType type = SlotType.QUICKBAR;
+ if (flag) {
+ type = SlotType.OUTSIDE;
@ -2218,10 +2218,9 @@
+ }
+ }
+ // CraftBukkit end
+
if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemstack);
this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemstack);
@@ -1964,7 +3329,19 @@
@Override