PaperSpigot-Parent/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch

38 lines
2.0 KiB
Diff
Raw Normal View History

2015-04-09 05:41:04 +02:00
From 34048df211127ea6f6f8d9e6e55ac1d39bcfde87 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
2015-04-05 17:09:21 +02:00
index 2e191a2..7812c76 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2015-04-05 17:09:21 +02:00
@@ -1703,7 +1703,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
2014-11-28 02:17:45 +01:00
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize();
// 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;
2015-02-28 12:36:22 +01:00
// 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
2014-11-28 02:17:45 +01:00
index f58208e..86c45c6 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -295,4 +295,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 );
+ }
}
--
2014-11-28 02:17:45 +01:00
2.1.0