mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 19:07:44 +01:00
Fix vanilla command permission handler
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
From 38cff44a61c275df29b12f24fca866fde6d98285 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 25 Aug 2019 00:09:52 -0500
|
||||
Subject: [PATCH] Dispenser curse of binding protection
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityInsentient.java | 7 +++++++
|
||||
src/main/java/net/minecraft/server/ItemArmor.java | 3 ++-
|
||||
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
|
||||
3 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 3ef4f8db46..742745cb47 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -920,6 +920,13 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public static EnumItemSlot getSlotForDispenser(ItemStack itemstack) {
|
||||
+ return EnchantmentManager.getEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? EnumItemSlot.MAINHAND : getSlotForItemStack(itemstack);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
+ public static EnumItemSlot getSlotForItemStack(ItemStack itemstack) { return h(itemstack); } // Purpur - OBFHELPER
|
||||
public static EnumItemSlot h(ItemStack itemstack) {
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemArmor.java b/src/main/java/net/minecraft/server/ItemArmor.java
|
||||
index df8c42bfbd..a4b3d0c298 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemArmor.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemArmor.java
|
||||
@@ -31,7 +31,7 @@ public class ItemArmor extends Item {
|
||||
return false;
|
||||
} else {
|
||||
EntityLiving entityliving = (EntityLiving) list.get(0);
|
||||
- EnumItemSlot enumitemslot = EntityInsentient.h(itemstack);
|
||||
+ EnumItemSlot enumitemslot = isourceblock.getWorld().purpurConfig.dispenserApplyCursedArmor ? EntityInsentient.getSlotForItemStack(itemstack) : EntityInsentient.getSlotForDispenser(itemstack); // Purpur
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.getWorld();
|
||||
@@ -79,6 +79,7 @@ public class ItemArmor extends Item {
|
||||
BlockDispenser.a((IMaterial) this, ItemArmor.a);
|
||||
}
|
||||
|
||||
+ public EnumItemSlot getEquipmentSlot() { return b(); } // Purpur - OBFHELPER
|
||||
public EnumItemSlot b() {
|
||||
return this.b;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 9914bb004a..87cd40aec2 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -106,6 +106,11 @@ public class PurpurWorldConfig {
|
||||
campfireFallWithGravity = getBoolean("blocks.campfire.fall-with-gravity", campfireFallWithGravity);
|
||||
}
|
||||
|
||||
+ public boolean dispenserApplyCursedArmor = true;
|
||||
+ private void dispenserSettings() {
|
||||
+ dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||
+ }
|
||||
+
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
private void farmlandSettings() {
|
||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
--
|
||||
2.24.0
|
||||
|
||||
Reference in New Issue
Block a user