From 02494f5be77f8400d81f4d615a2f51506964bf1b Mon Sep 17 00:00:00 2001 From: willies952002 Date: Tue, 26 Apr 2016 23:00:23 -0400 Subject: [PATCH] Reimplement PlayerEditBookEvent --- ...tyRegainHealthEvent-isFastRegen-API.patch} | 4 +- ...-Vehicle-Event-Cancellation-Changes.patch} | 4 +- ...patch => 0146-Arrow-pickup-rule-API.patch} | 4 +- ...t-additions-and-mark-entities-remov.patch} | 4 +- ...dispenser-dropper-furnace-placement.patch} | 4 +- ...0149-Reimplement-PlayerEditBookEvent.patch | 89 +++++++++++++++++++ 6 files changed, 99 insertions(+), 10 deletions(-) rename Spigot-API-Patches/{0037-EntityRegainHealthEvent-isFastRegen-API.patch => 0038-EntityRegainHealthEvent-isFastRegen-API.patch} (96%) rename Spigot-Server-Patches/{0144-Vehicle-Event-Cancellation-Changes.patch => 0145-Vehicle-Event-Cancellation-Changes.patch} (98%) rename Spigot-Server-Patches/{0145-Arrow-pickup-rule-API.patch => 0146-Arrow-pickup-rule-API.patch} (96%) rename Spigot-Server-Patches/{0145-Check-entity-count-additions-and-mark-entities-remov.patch => 0147-Check-entity-count-additions-and-mark-entities-remov.patch} (97%) rename Spigot-Server-Patches/{0146-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch => 0148-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch} (97%) create mode 100644 Spigot-Server-Patches/0149-Reimplement-PlayerEditBookEvent.patch diff --git a/Spigot-API-Patches/0037-EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-API-Patches/0038-EntityRegainHealthEvent-isFastRegen-API.patch similarity index 96% rename from Spigot-API-Patches/0037-EntityRegainHealthEvent-isFastRegen-API.patch rename to Spigot-API-Patches/0038-EntityRegainHealthEvent-isFastRegen-API.patch index 26d3b74f5d..e4af6a4599 100644 --- a/Spigot-API-Patches/0037-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-API-Patches/0038-EntityRegainHealthEvent-isFastRegen-API.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0144-Vehicle-Event-Cancellation-Changes.patch b/Spigot-Server-Patches/0145-Vehicle-Event-Cancellation-Changes.patch similarity index 98% rename from Spigot-Server-Patches/0144-Vehicle-Event-Cancellation-Changes.patch rename to Spigot-Server-Patches/0145-Vehicle-Event-Cancellation-Changes.patch index 85d53bb58f..4883394e97 100644 --- a/Spigot-Server-Patches/0144-Vehicle-Event-Cancellation-Changes.patch +++ b/Spigot-Server-Patches/0145-Vehicle-Event-Cancellation-Changes.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0145-Arrow-pickup-rule-API.patch b/Spigot-Server-Patches/0146-Arrow-pickup-rule-API.patch similarity index 96% rename from Spigot-Server-Patches/0145-Arrow-pickup-rule-API.patch rename to Spigot-Server-Patches/0146-Arrow-pickup-rule-API.patch index 991bfb6371..179e1adb67 100644 --- a/Spigot-Server-Patches/0145-Arrow-pickup-rule-API.patch +++ b/Spigot-Server-Patches/0146-Arrow-pickup-rule-API.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0145-Check-entity-count-additions-and-mark-entities-remov.patch b/Spigot-Server-Patches/0147-Check-entity-count-additions-and-mark-entities-remov.patch similarity index 97% rename from Spigot-Server-Patches/0145-Check-entity-count-additions-and-mark-entities-remov.patch rename to Spigot-Server-Patches/0147-Check-entity-count-additions-and-mark-entities-remov.patch index 83353540c8..4478722b03 100644 --- a/Spigot-Server-Patches/0145-Check-entity-count-additions-and-mark-entities-remov.patch +++ b/Spigot-Server-Patches/0147-Check-entity-count-additions-and-mark-entities-remov.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0146-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch b/Spigot-Server-Patches/0148-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch similarity index 97% rename from Spigot-Server-Patches/0146-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch rename to Spigot-Server-Patches/0148-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch index 6ca6498aa8..2433764756 100644 --- a/Spigot-Server-Patches/0146-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch +++ b/Spigot-Server-Patches/0148-SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0149-Reimplement-PlayerEditBookEvent.patch b/Spigot-Server-Patches/0149-Reimplement-PlayerEditBookEvent.patch new file mode 100644 index 0000000000..95973d4e76 --- /dev/null +++ b/Spigot-Server-Patches/0149-Reimplement-PlayerEditBookEvent.patch @@ -0,0 +1,89 @@ +From 28dc0e6616aa92018560ce197d7b71f68170402c Mon Sep 17 00:00:00 2001 +From: willies952002 +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 +