Update from upstream SpigotMC

Add unbreakable API to item meta SpigotMC/Spigot@b1af008222
Configure how often EntityHangings calculate if they should die. SpigotMC/Spigot@ac6e1fc32d
Copy ItemStacks in DataWatcher to prevent ConcurrentModificationExcep… SpigotMC/Spigot@2af28ffbd1
Add the spigot.yml into the timings paste SpigotMC/Spigot@d61f38bd58

Note: This commit moves the entity-hanging tick into Spigot's spigot.yml and out of our paper.yml
This commit is contained in:
Zach Brown 2014-08-25 16:30:52 -05:00
parent a4e202676e
commit 3327198680
9 changed files with 324 additions and 17 deletions

View File

@ -19,6 +19,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
/** /**
@@ -0,0 +0,0 @@ public final class Bukkit {
public static UnsafeValues getUnsafe() {
return server.getUnsafe();
}
+
+ public static Server.Spigot spigot()
+ {
+ return server.spigot();
+ }
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
*/
@Deprecated
UnsafeValues getUnsafe();
+
+ public class Spigot
+ {
+
+ public org.bukkit.configuration.file.YamlConfiguration getConfig()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+ }
+
+ Spigot spigot();
}
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
@ -142,6 +172,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ CustomTimingsHandler.printTimings(fileTimings); + CustomTimingsHandler.printTimings(fileTimings);
+ fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); + fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" );
+ +
+ fileTimings.println( "<spigotConfig>" );
+ fileTimings.println( Bukkit.spigot().getConfig().saveToString() );
+ fileTimings.println( "</spigotConfig>" );
+
+ if ( paste ) + if ( paste )
+ { + {
+ new PasteThread( sender, bout ).start(); + new PasteThread( sender, bout ).start();

View File

@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:31:04 -0400
Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
*/
boolean hasConflictingEnchant(Enchantment ench);
+ // Spigot start
+ public class Spigot
+ {
+
+ /**
+ * Sets the unbreakable tag
+ *
+ * @param unbreakable true if set unbreakable
+ */
+ public void setUnbreakable(boolean unbreakable)
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ /**
+ * Return if the unbreakable tag is true
+ *
+ * @return true if the unbreakable tag is true
+ */
+ public boolean isUnbreakable()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+ }
+
+ Spigot spigot();
+ // Spigot end
+
@SuppressWarnings("javadoc")
ItemMeta clone();
}
--

View File

@ -5,6 +5,25 @@ Subject: [PATCH] Skeleton API Implementations
This contains the basic, empty implementations for some Spigot-API extensions. They are included early in the patching progress so that compilation will still succeed midway despite the APIs only being provided by subsequent patches. This contains the basic, empty implementations for some Spigot-API extensions. They are included early in the patching progress so that compilation will still succeed midway despite the APIs only being provided by subsequent patches.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
public UnsafeValues getUnsafe() {
return CraftMagicNumbers.INSTANCE;
}
+
+ private final Spigot spigot = new Spigot()
+ {
+
+ };
+
+ public Spigot spigot()
+ {
+ return spigot;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@ -82,6 +101,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ return spigot; + return spigot;
+ } + }
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
public final String toString() {
return SerializableMeta.classMap.get(getClass()) + "_META:" + serialize(); // TODO: cry
}
+
+ // Spigot start
+ private final Spigot spigot = new Spigot()
+ {
+ };
+
+ @Override
+ public Spigot spigot()
+ {
+ return spigot;
+ }
+ // Spigot end + // Spigot end
} }
-- --

View File

@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ + "IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )\n" + + "IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )\n"
+ + "Forums: http://www.spigotmc.org/\n"; + + "Forums: http://www.spigotmc.org/\n";
+ /*========================================================================*/ + /*========================================================================*/
+ static YamlConfiguration config; + public static YamlConfiguration config;
+ static int version; + static int version;
+ static Map<String, Command> commands; + static Map<String, Command> commands;
+ /*========================================================================*/ + /*========================================================================*/
@ -158,8 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ commands = new HashMap<String, Command>(); + commands = new HashMap<String, Command>();
+ +
+ version = getInt( "config-version", 6 ); + version = getInt( "config-version", 7 );
+ set( "config-version", 6 ); + set( "config-version", 7 );
+ readConfig( SpigotConfig.class, null ); + readConfig( SpigotConfig.class, null );
+ } + }
+ +

View File

@ -574,6 +574,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
private final Spigot spigot = new Spigot()
{
+ @Override
+ public YamlConfiguration getConfig()
+ {
+ return org.spigotmc.SpigotConfig.config;
+ }
};
public Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java

View File

@ -4,6 +4,50 @@ Date: Wed, 2 Jul 2014 23:35:51 +0100
Subject: [PATCH] Better item validation Subject: [PATCH] Better item validation
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DataWatcher.java
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
@@ -0,0 +0,0 @@ public class DataWatcher {
arraylist = new ArrayList();
}
+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
+ if ( watchableobject.b() instanceof ItemStack )
+ {
+ watchableobject = new WatchableObject(
+ watchableobject.c(),
+ watchableobject.a(),
+ ( (ItemStack) watchableobject.b() ).cloneItemStack()
+ );
+ }
+ // Spigot end
+
arraylist.add(watchableobject);
}
}
@@ -0,0 +0,0 @@ public class DataWatcher {
this.f.readLock().lock();
arraylist.addAll(this.dataValues.valueCollection()); // Spigot
+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
+ for ( int i = 0; i < arraylist.size(); i++ )
+ {
+ WatchableObject watchableobject = (WatchableObject) arraylist.get( i );
+ if ( watchableobject.b() instanceof ItemStack )
+ {
+ watchableobject = new WatchableObject(
+ watchableobject.c(),
+ watchableobject.a(),
+ ( (ItemStack) watchableobject.b() ).cloneItemStack()
+ );
+ arraylist.set( i, watchableobject );
+ }
+ }
+ // Spigot end
this.f.readLock().unlock();
return arraylist;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java

View File

@ -0,0 +1,128 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:35:16 -0400
Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
static final ItemMetaKey ATTRIBUTES_UUID_HIGH = new ItemMetaKey("UUIDMost");
@Specific(Specific.To.NBT)
static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast");
+ static final ItemMetaKey UNBREAKABLE = new ItemMetaKey("Unbreakable"); // Spigot
private String displayName;
private List<String> lore;
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.repairCost = meta.repairCost;
this.attributes = meta.attributes;
+ spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot
}
CraftMetaItem(NBTTagCompound tag) {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
} else {
attributes = null;
}
+ // Spigot start
+ if ( tag.hasKey( UNBREAKABLE.NBT ) )
+ {
+ spigot.setUnbreakable( tag.getBoolean( UNBREAKABLE.NBT ) );
+ }
+ // Spigot end
}
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
attributes = null;
+ // Spigot start
+ Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true );
+ if ( unbreakable != null )
+ {
+ spigot.setUnbreakable( unbreakable );
+ }
+ // Spigot end
}
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
+ // Spigot start
+ if ( spigot.isUnbreakable() )
+ {
+ itemTag.setBoolean( UNBREAKABLE.NBT, true );
+ }
+ // Spigot end
+
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden
boolean isEmpty() {
- return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost());
+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || spigot.isUnbreakable()); // Spigot
}
public String getDisplayName() {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
&& (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
- && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost());
+ && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) && this.spigot.isUnbreakable() == that.spigot.isUnbreakable(); // Spigot
}
/**
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
hash = 61 * hash + (hasEnchants() ? this.enchantments.hashCode() : 0);
hash = 61 * hash + (hasAttributes() ? this.attributes.hashCode() : 0);
hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0);
+ hash = 61 * hash + (spigot.isUnbreakable() ? 1231 : 1237); // Spigot
return hash;
}
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
builder.put(REPAIR.BUKKIT, repairCost);
}
+ // Spigot start
+ if ( spigot.isUnbreakable() )
+ {
+ builder.put( UNBREAKABLE.BUKKIT, true );
+ }
+ // Spigot end
+
return builder;
}
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
// Spigot start
private final Spigot spigot = new Spigot()
{
+ private boolean unbreakable;
+
+ @Override
+ public void setUnbreakable(boolean setUnbreakable)
+ {
+ unbreakable = setUnbreakable;
+ }
+
+ @Override
+ public boolean isUnbreakable()
+ {
+ return unbreakable;
+ }
};
@Override
--

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu> From: drXor <mcyoung@mit.edu>
Date: Sat, 9 Aug 2014 17:24:20 -0500 Date: Sat, 9 Aug 2014 13:56:51 -0400
Subject: [PATCH] Configurable hanging tick Subject: [PATCH] Configurable Hanging Tick
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
@ -13,24 +13,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
- if (this.e++ == 100 && !this.world.isStatic) { - if (this.e++ == 100 && !this.world.isStatic) {
+ if (this.e++ == this.world.paperSpigotConfig.hangingTickFrequency && !this.world.isStatic) { // PaperSpigot - 100 -> this.world.paperSpigotConfig.hangingTickFrequency + if (this.e++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency
this.e = 0; this.e = 0;
if (!this.dead && !this.survives()) { if (!this.dead && !this.survives()) {
// CraftBukkit start - fire break events // CraftBukkit start - fire break events
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig @@ -0,0 +0,0 @@ public class SpigotWorldConfig
waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); maxTntTicksPerTick = getInt( "max-tnt-per-tick", 100 );
log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); log( "Max TNT Explosions: " + maxTntTicksPerTick );
} }
+ +
+ public int hangingTickFrequency; + public int hangingTickFrequency;
+ private void hangingTickSpeed() + private void hangingTickFrequency()
+ { + {
+ hangingTickFrequency = getInt( "hanging-tick-frequency", 100); + hangingTickFrequency = getInt( "hanging-tick-frequency", 100 );
+ log( "Hanging entities tick frequency: " + hangingTickFrequency);
+ } + }
} }
-- --

View File

@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig @@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
hangingTickFrequency = getInt( "hanging-tick-frequency", 100); waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
log( "Hanging entities tick frequency: " + hangingTickFrequency); log( "Water over lava flow speed: " + waterOverLavaFlowSpeed);
} }
+ +
+ public boolean removeInvalidMobSpawnerTEs; + public boolean removeInvalidMobSpawnerTEs;