Paper/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch
2016-03-14 00:58:34 -05:00

38 lines
2.0 KiB
Diff

From 45f4fa5d08d2d7709d73c12d3a6a89ab82e6ce04 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Wed, 12 Feb 2014 18:18:01 +1100
Subject: [PATCH] Allow Disabling Creative Item Filter
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a107029..2515ee7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1952,7 +1952,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
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()));
+ boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
// CraftBukkit start - Call click event
if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.a()).getItem(), packetplayinsetcreativeslot.getItemStack()))) { // Insist on valid slot
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 039777a..686b8bd 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -296,4 +296,10 @@ public class SpigotConfig
{
silentCommandBlocks = getBoolean( "commands.silent-commandblock-console", false );
}
+
+ public static boolean filterCreativeItems;
+ private static void filterCreativeItems()
+ {
+ filterCreativeItems = getBoolean( "settings.filter-creative-items", true );
+ }
}
--
2.5.0