diff --git a/CraftBukkit-Patches/0167-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0167-Allow-Attribute-Capping.patch index 24850dedf..bf30400a8 100644 --- a/CraftBukkit-Patches/0167-Allow-Attribute-Capping.patch +++ b/CraftBukkit-Patches/0167-Allow-Attribute-Capping.patch @@ -1,4 +1,4 @@ -From 80090075fd17a339df12915499af1da9f5b5060e Mon Sep 17 00:00:00 2001 +From 1c0463570cae7693d88da1b2953bcbb19e417df1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 28 Jul 2014 16:55:51 +1000 Subject: [PATCH] Allow Attribute Capping. @@ -19,7 +19,7 @@ index d424f04..cd613d2 100644 public AttributeRanged(String s, double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java -index 6202bba..70b60ac 100644 +index 6202bba..7ad88f5 100644 --- a/src/main/java/net/minecraft/server/GenericAttributes.java +++ b/src/main/java/net/minecraft/server/GenericAttributes.java @@ -10,11 +10,13 @@ import org.apache.logging.log4j.Logger; @@ -28,7 +28,7 @@ index 6202bba..70b60ac 100644 private static final Logger f = LogManager.getLogger(); - public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); + // Spigot Start -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); ++ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); // Spigot public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); - public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); diff --git a/CraftBukkit-Patches/0169-Add-an-option-for-a-global-cache-for-any-request-on-.patch b/CraftBukkit-Patches/0168-Add-an-option-for-a-global-cache-for-any-request-on-.patch similarity index 99% rename from CraftBukkit-Patches/0169-Add-an-option-for-a-global-cache-for-any-request-on-.patch rename to CraftBukkit-Patches/0168-Add-an-option-for-a-global-cache-for-any-request-on-.patch index 679dc5716..e8b76ea17 100644 --- a/CraftBukkit-Patches/0169-Add-an-option-for-a-global-cache-for-any-request-on-.patch +++ b/CraftBukkit-Patches/0168-Add-an-option-for-a-global-cache-for-any-request-on-.patch @@ -1,4 +1,4 @@ -From 5a6573e4250ecd9d87caa204cc86601eeb900670 Mon Sep 17 00:00:00 2001 +From 821b62358576bd2c097cfb3edca4785114afa570 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Mon, 28 Jul 2014 11:42:11 +0100 Subject: [PATCH] Add an option for a global cache for any request on Mojang's diff --git a/CraftBukkit-Patches/0168-Set-the-minimum-max-health-attribute-value-to-0.1.patch b/CraftBukkit-Patches/0168-Set-the-minimum-max-health-attribute-value-to-0.1.patch deleted file mode 100644 index 5fe7b73a7..000000000 --- a/CraftBukkit-Patches/0168-Set-the-minimum-max-health-attribute-value-to-0.1.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 9a9f8e410bb21895d12df0598d4842983e7cc5a8 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 28 Jul 2014 23:15:00 +0100 -Subject: [PATCH] Set the minimum max health attribute value to 0.1 - - -diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java -index 70b60ac..7ad88f5 100644 ---- a/src/main/java/net/minecraft/server/GenericAttributes.java -+++ b/src/main/java/net/minecraft/server/GenericAttributes.java -@@ -11,7 +11,7 @@ public class GenericAttributes { - - private static final Logger f = LogManager.getLogger(); - // Spigot Start -- public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); // Spigot - public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); - public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); - public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); --- -1.9.1 - diff --git a/CraftBukkit-Patches/0170-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0169-Only-fetch-an-online-UUID-in-online-mode.patch similarity index 96% rename from CraftBukkit-Patches/0170-Only-fetch-an-online-UUID-in-online-mode.patch rename to CraftBukkit-Patches/0169-Only-fetch-an-online-UUID-in-online-mode.patch index 998b9534c..d7a047efc 100644 --- a/CraftBukkit-Patches/0170-Only-fetch-an-online-UUID-in-online-mode.patch +++ b/CraftBukkit-Patches/0169-Only-fetch-an-online-UUID-in-online-mode.patch @@ -1,4 +1,4 @@ -From db76316cbb4f5749d66b616f879d7707983a5b0c Mon Sep 17 00:00:00 2001 +From 1382634a0c67d1be66fa280d949b1d071878ecd7 Mon Sep 17 00:00:00 2001 From: Maxim Van de Wynckel Date: Wed, 30 Jul 2014 01:19:51 +0200 Subject: [PATCH] Only fetch an online UUID in online mode @@ -16,7 +16,7 @@ index 79d4d99..2c3a140 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1396,8 +1396,14 @@ public final class CraftServer implements Server { - + OfflinePlayer result = getPlayerExact(name); if (result == null) { - // This is potentially blocking :( @@ -32,5 +32,6 @@ index 79d4d99..2c3a140 100644 if (profile == null) { // Make an OfflinePlayer using an offline mode UUID since the name has no profile result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name)); --- +-- 1.9.1 + diff --git a/CraftBukkit-Patches/0170-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0170-Filter-attribute-modifiers-which-cause-the-attribute.patch new file mode 100644 index 000000000..6341f4618 --- /dev/null +++ b/CraftBukkit-Patches/0170-Filter-attribute-modifiers-which-cause-the-attribute.patch @@ -0,0 +1,147 @@ +From b29947e0d00b8a2b937724dc8bd675969626039c Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Thu, 31 Jul 2014 17:48:20 +0100 +Subject: [PATCH] Filter attribute modifiers which cause the attribute to go + out of its range + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +index ec37524..bcde85c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +@@ -38,6 +38,8 @@ import com.google.common.collect.ImmutableMap; + + // Spigot start + import static org.spigotmc.ValidateUtils.*; ++import net.minecraft.server.GenericAttributes; ++import net.minecraft.server.IAttribute; + // Spigot end + + /** +@@ -256,6 +258,123 @@ class CraftMetaItem implements ItemMeta, Repairable { + NBTTagList save = null; + NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10); + ++ // Spigot start ++ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); ++ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); ++ Map attributesByName = new HashMap(); ++ attributeTracker.put( "generic.maxHealth", 20.0 ); ++ attributesByName.put( "generic.maxHealth", GenericAttributes.maxHealth ); ++ attributeTracker.put( "generic.followRange", 32.0 ); ++ attributesByName.put( "generic.followRange", GenericAttributes.b ); ++ attributeTracker.put( "generic.knockbackResistance", 0.0 ); ++ attributesByName.put( "generic.knockbackResistance", GenericAttributes.c ); ++ attributeTracker.put( "generic.movementSpeed", 0.7 ); ++ attributesByName.put( "generic.movementSpeed", GenericAttributes.d ); ++ attributeTracker.put( "generic.attackDamage", 1.0 ); ++ attributesByName.put( "generic.attackDamage", GenericAttributes.e ); ++ NBTTagList oldList = nbttaglist; ++ nbttaglist = new NBTTagList(); ++ ++ List op0 = new ArrayList(); ++ List op1 = new ArrayList(); ++ List op2 = new ArrayList(); ++ ++ for ( int i = 0; i < oldList.size(); ++i ) ++ { ++ NBTTagCompound nbttagcompound = oldList.get( i ); ++ if ( nbttagcompound == null ) continue; ++ ++ if ( !( nbttagcompound.get( ATTRIBUTES_UUID_HIGH.NBT ) instanceof NBTTagLong ) ) ++ { ++ continue; ++ } ++ if ( !( nbttagcompound.get( ATTRIBUTES_UUID_LOW.NBT ) instanceof NBTTagLong ) ) ++ { ++ continue; ++ } ++ if ( !( nbttagcompound.get( ATTRIBUTES_IDENTIFIER.NBT ) instanceof NBTTagString ) || !CraftItemFactory.KNOWN_NBT_ATTRIBUTE_NAMES.contains( nbttagcompound.getString( ATTRIBUTES_IDENTIFIER.NBT ) ) ) ++ { ++ continue; ++ } ++ if ( !( nbttagcompound.get( ATTRIBUTES_NAME.NBT ) instanceof NBTTagString ) || nbttagcompound.getString( ATTRIBUTES_NAME.NBT ).isEmpty() ) ++ { ++ continue; ++ } ++ if ( !( nbttagcompound.get( ATTRIBUTES_VALUE.NBT ) instanceof NBTTagDouble ) ) ++ { ++ continue; ++ } ++ if ( !( nbttagcompound.get( ATTRIBUTES_TYPE.NBT ) instanceof NBTTagInt ) || nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) < 0 || nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) > 2 ) ++ { ++ continue; ++ } ++ ++ switch ( nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) ) ++ { ++ case 0: ++ op0.add( nbttagcompound ); ++ break; ++ case 1: ++ op1.add( nbttagcompound ); ++ break; ++ case 2: ++ op2.add( nbttagcompound ); ++ break; ++ } ++ } ++ for ( NBTTagCompound nbtTagCompound : op0 ) ++ { ++ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); ++ if ( attributeTracker.containsKey( name ) ) ++ { ++ double val = attributeTracker.get( name ); ++ val += nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); ++ if ( val != attributesByName.get( name ).a( val ) ) ++ { ++ continue; ++ } ++ attributeTracker.put( name, val ); ++ } ++ nbttaglist.add( nbtTagCompound ); ++ } ++ for ( String name : attributeTracker.keySet() ) ++ { ++ attributeTrackerX.put( name, attributeTracker.get( name ) ); ++ } ++ for ( NBTTagCompound nbtTagCompound : op1 ) ++ { ++ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); ++ if ( attributeTracker.containsKey( name ) ) ++ { ++ double val = attributeTracker.get( name ); ++ double valX = attributeTrackerX.get( name ); ++ val += valX * nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); ++ if ( val != attributesByName.get( name ).a( val ) ) ++ { ++ continue; ++ } ++ attributeTracker.put( name, val ); ++ } ++ nbttaglist.add( nbtTagCompound ); ++ } ++ for ( NBTTagCompound nbtTagCompound : op2 ) ++ { ++ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); ++ if ( attributeTracker.containsKey( name ) ) ++ { ++ double val = attributeTracker.get( name ); ++ val += val * nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); ++ if ( val != attributesByName.get( name ).a( val ) ) ++ { ++ continue; ++ } ++ attributeTracker.put( name, val ); ++ } ++ nbttaglist.add( nbtTagCompound ); ++ } ++ ++ // Spigot end ++ + for (int i = 0; i < nbttaglist.size(); ++i) { + if (!(nbttaglist.get(i) instanceof NBTTagCompound)) { + continue; +-- +1.9.1 +