PaperMC/CraftBukkit-Patches/0137-Add-quiet-option-to-hasKeyOfType.patch
2014-04-19 09:15:37 +10:00

37 lines
1.2 KiB
Diff

From 59a46b8a6c85a4c77499ee8fe98b140b87ec524b Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Thu, 17 Apr 2014 12:58:08 +0100
Subject: [PATCH] Add quiet option to hasKeyOfType
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 5b8842f..7931c4a 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -119,13 +119,21 @@ public class NBTTagCompound extends NBTBase {
return this.map.containsKey(s);
}
- public boolean hasKeyOfType(String s, int i) {
+ // Spigot start - Add quiet option
+ public boolean hasKeyOfType(String s, int i)
+ {
+ return hasKeyOfType( s, i, false );
+ }
+
+ public boolean hasKeyOfType(String s, int i, boolean quiet)
+ {
byte b0 = this.b(s);
if (b0 == i) {
return true;
} else if (i != 99) {
- if (b0 > 0) {
+ if (b0 > 0 && !quiet) {
+ // Spigot end
b.warn("NBT tag {} was of wrong type; expected {}, found {}", new Object[] { s, getTagName(i), getTagName(b0)});
}
--
1.9.1