13
0
geforkt von Mirrors/Paper

Update upstream B/CB/S

Dieser Commit ist enthalten in:
Zach Brown 2016-07-12 23:22:58 -05:00
Ursprung b9926dcb47
Commit aff7563c30
5 geänderte Dateien mit 4 neuen und 125 gelöschten Zeilen

Datei anzeigen

@ -1,120 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 9 Jul 2016 20:00:28 -0500
Subject: [PATCH] Block sketchy heads
Checks for, and blocks, sketchy creative mode spawned, heads.
Currently only checks for new data, could be added to check all data if needed.
This is an NMS-port of the work done here: https://github.com/MylesIsCool/SkullExploitPatch by MylesIsCool (_MylesC)
diff --git a/src/main/java/com/destroystokyo/paper/ItemFilter.java b/src/main/java/com/destroystokyo/paper/ItemFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ItemFilter.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper;
+
+import net.minecraft.server.*;
+
+import javax.annotation.Nullable;
+
+public class ItemFilter {
+
+ /**
+ * Checks if the ItemStack passed could be a sketchy head item or block
+ * @param itemStackIn the ItemStack to check
+ * @return whether the item is safe or sketchy
+ */
+ public static boolean isHeadSketchy(@Nullable ItemStack itemStackIn) {
+ if (itemStackIn != null && itemStackIn.getTag() != null) {
+ NBTTagCompound itemTag = itemStackIn.getTag();
+ if (Item.getId(itemStackIn.getItem()) == Item.getId(Items.SKULL) && itemStackIn.getData() == 3) {
+ return isHeadItemSketchy(itemTag);
+ } else if (Item.getId(itemStackIn.getItem()) == Block.getId(Blocks.SKULL)) {
+ return isHeadBlockSketchy(itemTag);
+ }
+
+ // If we can't figure out which is which just run it through both
+ return isHeadItemSketchy(itemTag) || isHeadBlockSketchy(itemTag);
+ }
+ return false;
+ }
+
+ /**
+ * Checks the NBTTagCompound for sketchy data, from the perspective of an Item
+ * @param nbtTagCompound NBTTagCompound from an Item
+ * @return whether the data is safe or sketchy
+ */
+ private static boolean isHeadItemSketchy(NBTTagCompound nbtTagCompound) {
+ if (nbtTagCompound.hasKey("SkullOwner")) {
+ NBTTagCompound skullOwner = nbtTagCompound.getCompound("SkullOwner");
+ if (skullOwner.hasKey("Properties")) {
+ return isHeadNBTSketchy(skullOwner.getCompound("Properties"));
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks the NBTTagCompound for sketchy data, from the perspective of a Block
+ * @param nbtTagCompound NBTTagCompound from a Block
+ * @return whether the data is safe or sketchy
+ */
+ private static boolean isHeadBlockSketchy(NBTTagCompound nbtTagCompound) {
+ if (nbtTagCompound.hasKey("Owner")) {
+ NBTTagCompound skullOwner = nbtTagCompound.getCompound("Owner");
+ if (skullOwner.hasKey("Properties")) {
+ return isHeadNBTSketchy(skullOwner.getCompound("Properties"));
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Generified checker for use in both Items and Blocks after some semantics
+ * are done above in the calling methods.
+ * @param properties The generified properties compound from a parent-compound
+ * @return whether the data is safe or sketchy
+ */
+ private static boolean isHeadNBTSketchy(NBTTagCompound properties) {
+ if (properties.hasKey("textures")) {
+ NBTTagList textures = properties.getList("textures", 10);
+ for (NBTBase texture : textures.list) {
+ if (texture instanceof NBTTagCompound) {
+ if (!((NBTTagCompound) texture).hasKey("Signature")) {
+ // Check
+ if (((NBTTagCompound) texture).hasKey("Value")) {
+ if (((NBTTagCompound) texture).getString("Value").trim().length() > 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
+ // Paper start - Block sketchy heads
+ if (itemstack != null && (Item.getId(itemstack.getItem()) == Item.getId(Items.SKULL) && itemstack.getData() == 3 || Item.getId(itemstack.getItem()) == Block.getId(Blocks.SKULL))) {
+ if (com.destroystokyo.paper.ItemFilter.isHeadSketchy(itemstack)) {
+ this.disconnect("Bad creative item!");
+ return;
+ }
+ }
+ // Paper end
+
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45;
// CraftBukkit - Add invalidItems check
boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot
--

Datei anzeigen

@ -3,7 +3,6 @@ From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue
This provides option to queue lighting updates to ensure they do not cause the server lag
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -89,9 +88,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
if (event.isCancelled()) {
return false;
}
save = event.isSaveChunk();
+ chunk.lightingQueue.processUnload(); // Paper
// Update neighbor counts

@ -1 +1 @@
Subproject commit a1760b6baec0db18f0eeda14e371a75fa6fc3d3b
Subproject commit 19b3d5ef4cd3cc4cef246dd9dba02199e19f5daf

@ -1 +1 @@
Subproject commit 02d704b55af439337a63becf23d8a1e05780ef01
Subproject commit 301db84d3d85f5218f3ec590224071c04140bbe2

@ -1 +1 @@
Subproject commit 7745d45de92679ec54435905ec56cec46f5ce709
Subproject commit 9797151286c045686e3d09389353431efcc6034a