Merge pull request #232 from willies952002/implement/BookEditEvent

Reimplement PlayerEditBookEvent
This commit is contained in:
Daniel Ennis 2016-04-26 23:06:54 -04:00
commit 7365506fc7
6 changed files with 99 additions and 10 deletions

View File

@ -1,4 +1,4 @@
From e99524d7eec1240e136ac933dccd3f8ac9e72902 Mon Sep 17 00:00:00 2001
From 986cb0451c93c28f6428f4f3f64e23fe5d5be998 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
@ -46,5 +46,5 @@ index a7b3517..703520f 100644
/**
* Gets the amount of regained health
--
2.8.0
2.5.0

View File

@ -1,4 +1,4 @@
From 14face7ab0d9775b7c28764800c4616124b796c8 Mon Sep 17 00:00:00 2001
From 585ab1295463023ffa92fd3f3dd128634f1d7a5c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes
@ -90,5 +90,5 @@ index a00baa6..804b345 100644
return this.bu().size() < 1;
}
--
2.8.0
2.5.0

View File

@ -1,4 +1,4 @@
From 938a57611c9161b6d96210b64980c239fb22c0f7 Mon Sep 17 00:00:00 2001
From 3a910e832faa6f75cf179075ab1b884aeb9dd744 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 4 Mar 2016 03:16:11 -0500
Subject: [PATCH] Arrow pickup rule API
@ -54,5 +54,5 @@ index 2a3482c..fbf289f 100644
private final Arrow.Spigot spigot = new Arrow.Spigot()
{
--
2.7.4
2.5.0

View File

@ -1,4 +1,4 @@
From 7f8a586e9507e91b1697b01cd5e4b7d9e8664fb8 Mon Sep 17 00:00:00 2001
From 9ca006490279df3289be6f59ef4e8ba0ed5eb89e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 20:34:21 -0500
Subject: [PATCH] Check entity count additions and mark entities removed
@ -67,5 +67,5 @@ index b860c91..a8ea92c 100644
if (!entity.aa || entity.ab != k || entity.ac != l || entity.ad != i1) {
--
2.8.1
2.5.0

View File

@ -1,4 +1,4 @@
From 410613b55879caeb4473028be6a2446a399c73a1 Mon Sep 17 00:00:00 2001
From ccd5b8d392bc85425d9b65037a038314c7c5ad19 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 24 Apr 2016 19:49:33 -0500
Subject: [PATCH] SPIGOT-1401: Fix dispenser, dropper, furnace placement
@ -51,5 +51,5 @@ index 7a95974..6bc9aa8 100644
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
if (world.isClientSide) {
--
2.8.0
2.5.0

View File

@ -0,0 +1,89 @@
From 28dc0e6616aa92018560ce197d7b71f68170402c Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Sat, 23 Apr 2016 19:51:19 -0400
Subject: [PATCH] Reimplement PlayerEditBookEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d2aec29..c2dfe72 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2209,6 +2209,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
ItemStack itemstack;
ItemStack itemstack1;
+ try { // Paper - Reimplement BookEditEvent
if ("MC|BEdit".equals(s)) {
packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.b()));
@@ -2226,12 +2227,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
+ CraftEventFactory.handleEditBookEvent(player, itemstack1); // Paper
}
return;
}
} catch (Exception exception) {
PlayerConnection.LOGGER.error("Couldn\'t handle book info", exception);
+ this.disconnect("Invalid Book Data!"); // Paper
return;
} finally {
packetdataserializer.release();
@@ -2271,12 +2274,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
itemstack1.a("pages", (NBTBase) nbttaglist);
itemstack1.setItem(Items.WRITTEN_BOOK);
+ CraftEventFactory.handleEditBookEvent(player, itemstack1); // Paper
}
return;
}
} catch (Exception exception1) {
PlayerConnection.LOGGER.error("Couldn\'t sign book", exception1);
+ this.disconnect("Invalid Book Data!"); // Paper
return;
} finally {
packetdataserializer.release();
@@ -2342,6 +2347,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
} catch (Exception exception3) {
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3);
+ this.disconnect("Invalid Command Block Data!"); // Paper
} finally {
packetdataserializer.release();
}
@@ -2411,6 +2417,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
} catch (Exception exception4) {
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4);
+ this.disconnect("Invalid Command Block Data!"); // Paper
} finally {
packetdataserializer.release();
}
@@ -2436,6 +2443,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
} catch (Exception exception5) {
PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5);
+ this.disconnect("Invalid Beacon Data!"); // Paper
}
}
} else if ("MC|ItemName".equals(s)) {
@@ -2538,6 +2546,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
}
+ // Paper start
+ } finally {
+ if (packetplayincustompayload.b().refCnt() > 0) {
+ packetplayincustompayload.b().release();
+ }
+ }
+ // Paper end
}
--
2.5.0