Update with latest patches from upstream SpigotMC

This commit is contained in:
Byteflux 2014-09-21 22:05:59 -05:00 committed by Zach Brown
parent 39893976b4
commit 1a6b7c9d79
15 changed files with 1406 additions and 72 deletions

View file

@ -0,0 +1,99 @@
From 303ad6c8effffcf49b5c3e47f6e67de52288598e Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 11 Sep 2014 01:06:54 -0700
Subject: [PATCH] Spigot Update - 20140909a
diff --git a/pom.xml b/pom.xml
index 0c9f243..ec56492 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,13 @@
<relativePath>../pom.xml</relativePath>
</parent>
+ <repositories>
+ <repository>
+ <id>sonatype-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/public</url>
+ </repository>
+ </repositories>
+
<build>
<plugins>
<plugin>
@@ -74,6 +81,13 @@
</build>
<dependencies>
<dependency>
+ <groupId>net.md-5</groupId>
+ <artifactId>bungeecord-chat</artifactId>
+ <version>1.8-SNAPSHOT</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.12</version>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f861214..c560493 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -12,6 +12,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.logging.Logger;
+import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Warning.WarningState;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
@@ -915,6 +916,16 @@ public interface Server extends PluginMessageRecipient {
{
throw new UnsupportedOperationException( "Not supported yet." );
}
+
+ public void broadcast(BaseComponent component)
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void broadcast(BaseComponent... components)
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
}
Spigot spigot();
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b2ad5b7..2940b21 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2,6 +2,7 @@ package org.bukkit.entity;
import java.net.InetSocketAddress;
+import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@@ -1102,6 +1103,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
{
throw new UnsupportedOperationException( "Not supported yet." );
}
+
+ public void sendMessage(BaseComponent component)
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void sendMessage(BaseComponent... components)
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
}
Spigot spigot();
--
1.9.4.msysgit.0

View file

@ -0,0 +1,25 @@
From ef1b2e6c084a19cbb01701d87b4ef6468ea48c01 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 12 Sep 2014 17:16:11 -0700
Subject: [PATCH] Spigot Update - 20140909b
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 0b53084..b3002e8 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -138,11 +138,6 @@ public final class SimplePluginManager implements PluginManager {
server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" );
continue;
}
- if ( name.equalsIgnoreCase( "EchoPet" ) )
- {
- server.getLogger().log( Level.WARNING, "Skipping loading of EchoPet as it does not work with Spigot 1.8 builds!" );
- continue;
- }
// Spigot End
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
--
1.9.4.msysgit.0

View file

@ -0,0 +1,30 @@
From 2697b81bd9a9a950ee06d717150e9dbe3d3339fb Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 12 Sep 2014 18:20:53 -0700
Subject: [PATCH] Spigot Update - 20140911a
diff --git a/pom.xml b/pom.xml
index ec56492..4bfca82 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,6 +86,16 @@
<version>1.8-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.sf.trove4j</groupId>
+ <artifactId>trove4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
--
1.9.4.msysgit.0

View file

@ -0,0 +1,40 @@
From a473134c498e6ffbfe6a89288f9510b99718fed2 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 11 Sep 2014 01:07:52 -0700
Subject: [PATCH] Spigot Update - 20140909a
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0c4976d..a993b1d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -48,26 +48,6 @@ public class Main {
+ "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
+ "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
- Enumeration<URL> resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" );
- while ( resources.hasMoreElements() )
- {
- Manifest manifest = new Manifest( resources.nextElement().openStream() );
- String ts = manifest.getMainAttributes().getValue( "Timestamp" );
- if ( ts != null )
- {
- Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts );
-
- Calendar cal = Calendar.getInstance();
- cal.add( Calendar.DAY_OF_YEAR, -2 );
- if ( buildDate.before(cal.getTime() ) )
- {
- System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" );
- System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" );
- System.err.println( "The server will start in 10 seconds!" );
- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
- }
- }
- }
// Spigot End
// Todo: Installation script
OptionParser parser = new OptionParser() {
--
1.9.4.msysgit.0

View file

@ -0,0 +1,192 @@
From 8d77dcd164e3f844c3bda9310b37aa857f50a72a Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 12 Sep 2014 17:16:43 -0700
Subject: [PATCH] Spigot Update - 20140909b
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
index fdbdcc6..416a349 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
@@ -1,10 +1,14 @@
package net.minecraft.server;
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.chat.ComponentSerializer;
+
import java.io.IOException;
public class PacketPlayOutChat extends Packet {
private IChatBaseComponent a;
+ public BaseComponent[] components; // Spigot - Update 20140909b
private boolean b;
public PacketPlayOutChat() {
@@ -26,7 +30,16 @@ public class PacketPlayOutChat extends Packet {
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
- packetdataserializer.a(ChatSerializer.a(this.a));
+ // Spigot start - Update 20140909b
+ if (components != null)
+ {
+ packetdataserializer.a( ComponentSerializer.toString(components) );
+ }
+ else {
+ packetdataserializer.a( ChatSerializer.a(a) );
+ }
+ // Spigot end
+
// Spigot start - protocol patch
if ( packetdataserializer.version >= 16 )
{
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5b6aa3f..3964ba0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -23,6 +23,7 @@ import java.util.regex.Pattern;
import javax.imageio.ImageIO;
+import net.md_5.bungee.api.chat.BaseComponent;
import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.CommandAchievement;
import net.minecraft.server.CommandBan;
@@ -1837,6 +1838,24 @@ public final class CraftServer implements Server {
{
return org.spigotmc.SpigotConfig.config;
}
+
+ @Override
+ public void broadcast( BaseComponent component )
+ {
+ for ( Player player : getOnlinePlayers() )
+ {
+ player.spigot().sendMessage( component );
+ }
+ }
+
+ @Override
+ public void broadcast( BaseComponent... components )
+ {
+ for ( Player player : getOnlinePlayers() )
+ {
+ player.spigot().sendMessage( components );
+ }
+ }
};
public Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a993b1d..ba744b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -22,33 +22,6 @@ public class Main {
public static boolean useConsole = true;
public static void main(String[] args) throws Exception {
- // Spigot Start
- File lock = new File( ".update-lock" );
- if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null )
- {
- System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." );
- System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" );
- System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" );
- System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" );
- System.err.println( "Please type yes to continue starting the server. You have been warned :)" );
- System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" );
- System.err.println( "=================================================================================" );
- System.err.println( "Starting server in 10 seconds" );
- lock.createNewFile();
- try
- {
- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
- } catch ( InterruptedException ex )
- {
- }
- }
-
- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
- + "*** It is imperative that backups be taken before running this build on your server! ***\n"
- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
- + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
-
- // Spigot End
// Todo: Installation script
OptionParser parser = new OptionParser() {
{
@@ -166,6 +139,34 @@ public class Main {
} else if (options.has("v")) {
System.out.println(CraftServer.class.getPackage().getImplementationVersion());
} else {
+ // Spigot start - Update 20140909b
+ File lock = new File( ".update-lock" );
+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null )
+ {
+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." );
+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" );
+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" );
+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" );
+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" );
+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" );
+ System.err.println( "=================================================================================" );
+ System.err.println( "Starting server in 10 seconds" );
+ lock.createNewFile();
+ try
+ {
+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
+ } catch ( InterruptedException ex )
+ {
+ }
+ }
+
+ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
+ + "*** It is imperative that backups be taken before running this build on your server! ***\n"
+ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
+ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
+
+ // Spigot end
+
try {
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'});
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 35f2bfa..ca1d027 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -17,6 +17,7 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
+import net.md_5.bungee.api.chat.BaseComponent;
import net.minecraft.server.*;
import net.minecraft.util.com.mojang.authlib.GameProfile;
@@ -1402,6 +1403,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return java.util.Collections.unmodifiableSet( ret );
}
+
+ @Override
+ public void sendMessage( BaseComponent component )
+ {
+ sendMessage( new BaseComponent[] { component } );
+ }
+
+ @Override
+ public void sendMessage( BaseComponent... components )
+ {
+ if ( getHandle().playerConnection != null )
+ {
+ PacketPlayOutChat packet = new PacketPlayOutChat();
+ packet.components = components;
+ getHandle().playerConnection.sendPacket( packet );
+ }
+ }
};
public Player.Spigot spigot()
--
1.9.4.msysgit.0

View file

@ -1,32 +1,31 @@
From 086f11f8a45ecfd90d16709d4fe20739df317cc5 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 8 Sep 2014 23:25:48 -0500
Subject: [PATCH] Add SportBukkit fix for certain visually offset entities
From 0c60a2d1e7ae744f963071a20be7f6039df1444d Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 21 Sep 2014 12:57:40 -0700
Subject: [PATCH] Spigot Update - 20140916a
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 46c4fb8..0c7b6f8 100644
index 46c4fb8..8dad7ca 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -147,7 +147,8 @@ public class EntityTrackerEntry {
@@ -147,7 +147,7 @@ public class EntityTrackerEntry {
this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
}
// CraftBukkit end
- object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch
+ // PaperSpigot - Fix visual offset of falling block entities in proto patch
+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround, tracker instanceof EntityFallingBlock || tracker instanceof EntityTNTPrimed); // Spigot - protocol patch
+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround, tracker instanceof EntityFallingBlock || tracker instanceof EntityTNTPrimed); // Spigot - protocol patch // Spigot Update - 20140916a
}
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
index 87260d5..1906e38 100644
index 87260d5..b637d25 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
@@ -9,6 +9,7 @@ public class PacketPlayOutEntityTeleport extends Packet {
private byte e;
private byte f;
private boolean onGround; // Spigot - protocol patch
+ private boolean heightCorrection; // PaperSpigot - Fix visual offset of falling block entities in proto patch
+ private boolean heightCorrection; // Spigot Update - 20140916a
public PacketPlayOutEntityTeleport() {}
@ -35,7 +34,7 @@ index 87260d5..1906e38 100644
}
- public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround, boolean heightCorrection) { // Spigot - protocol patch
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround, boolean heightCorrection) { // Spigot - protocol patch // Spigot Update - 20140916a
this.a = i;
this.b = j;
this.c = k;
@ -43,36 +42,36 @@ index 87260d5..1906e38 100644
this.e = b0;
this.f = b1;
this.onGround = onGround; // Spigot - protocol patch
+ this.heightCorrection = heightCorrection; // PaperSpigot - Fix visual offset of falling block entities in proto patch
+ this.heightCorrection = heightCorrection; // Spigot Update - 20140916a
}
public void a(PacketDataSerializer packetdataserializer) {
@@ -51,7 +53,8 @@ public class PacketPlayOutEntityTeleport extends Packet {
@@ -51,7 +53,7 @@ public class PacketPlayOutEntityTeleport extends Packet {
}
// Spigot end
packetdataserializer.writeInt(this.b);
- packetdataserializer.writeInt(this.c);
+ // PaperSpigot - Fix visual offset of falling block entities in proto patch
+ packetdataserializer.writeInt(packetdataserializer.version >= 16 && this.heightCorrection ? this.c - 16 : this.c); // Spigot - protocol patch
+ packetdataserializer.writeInt((packetdataserializer.version >= 16 && heightCorrection) ? (this.c - 16) : this.c); // Spigot Update - 20140916a
packetdataserializer.writeInt(this.d);
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
index dcf1204..a137db4 100644
index dcf1204..eef9de2 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
@@ -116,6 +116,11 @@ public class PacketPlayOutSpawnEntity extends Packet {
@@ -116,6 +116,12 @@ public class PacketPlayOutSpawnEntity extends Packet {
int data = k >> 16;
k = id | ( data << 12 );
}
+ // PaperSpigot start - Fix visual offset of falling block entities on proto patch
+ if ((j == 50 || j == 70 || j == 74) && packetdataserializer.version >= 16) { // TNTPrimed, FallingSand, DragonEgg
+ this.c -= 16;
+
+ if ( ( j == 50 || j == 70 || j == 74 ) && packetdataserializer.version >= 16 ) // Spigot Update - 20140916a
+ {
+ c -= 16;
+ }
+ // PaperSpigot end
+
// Spigot end
packetdataserializer.writeInt(this.b);
packetdataserializer.writeInt(this.c);
--
1.9.1
1.9.4.msysgit.0

View file

@ -0,0 +1,973 @@
From dd9186f3ff7054b05e2b5379badb7204718bc50d Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 21 Sep 2014 18:11:43 -0700
Subject: [PATCH] Spigot Update - 20140921a
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
new file mode 100644
index 0000000..deda472
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
@@ -0,0 +1,364 @@
+package net.minecraft.server;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+public class EnchantmentManager {
+
+ private static final Random random = new Random();
+ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null);
+ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null);
+ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null);
+ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null);
+
+ public static int getEnchantmentLevel(int i, ItemStack itemstack) {
+ if (itemstack == null) {
+ return 0;
+ } else {
+ NBTTagList nbttaglist = itemstack.getEnchantments();
+
+ if (nbttaglist == null) {
+ return 0;
+ } else {
+ for (int j = 0; j < nbttaglist.size(); ++j) {
+ short short1 = nbttaglist.get(j).getShort("id");
+ short short2 = nbttaglist.get(j).getShort("lvl");
+
+ if (short1 == i) {
+ return short2;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
+
+ public static Map a(ItemStack itemstack) {
+ LinkedHashMap linkedhashmap = new LinkedHashMap();
+ NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.g(itemstack) : itemstack.getEnchantments();
+
+ if (nbttaglist != null) {
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ short short1 = nbttaglist.get(i).getShort("id");
+ short short2 = nbttaglist.get(i).getShort("lvl");
+
+ linkedhashmap.put(Integer.valueOf(short1), Integer.valueOf(short2));
+ }
+ }
+
+ return linkedhashmap;
+ }
+
+ public static void a(Map map, ItemStack itemstack) {
+ NBTTagList nbttaglist = new NBTTagList();
+ Iterator iterator = map.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ int i = ((Integer) iterator.next()).intValue();
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ nbttagcompound.setShort("id", (short) i);
+ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue());
+ nbttaglist.add(nbttagcompound);
+ if (itemstack.getItem() == Items.ENCHANTED_BOOK) {
+ Items.ENCHANTED_BOOK.a(itemstack, new EnchantmentInstance(i, ((Integer) map.get(Integer.valueOf(i))).intValue()));
+ }
+ }
+
+ if (nbttaglist.size() > 0) {
+ if (itemstack.getItem() != Items.ENCHANTED_BOOK) {
+ itemstack.a("ench", (NBTBase) nbttaglist);
+ }
+ } else if (itemstack.hasTag()) {
+ itemstack.getTag().remove("ench");
+ }
+ }
+
+ public static int getEnchantmentLevel(int i, ItemStack[] aitemstack) {
+ if (aitemstack == null) {
+ return 0;
+ } else {
+ int j = 0;
+ ItemStack[] aitemstack1 = aitemstack;
+ int k = aitemstack.length;
+
+ for (int l = 0; l < k; ++l) {
+ ItemStack itemstack = aitemstack1[l];
+ int i1 = getEnchantmentLevel(i, itemstack);
+
+ if (i1 > j) {
+ j = i1;
+ }
+ }
+
+ return j;
+ }
+ }
+
+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) {
+ if (itemstack != null) {
+ NBTTagList nbttaglist = itemstack.getEnchantments();
+
+ if (nbttaglist != null) {
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ short short1 = nbttaglist.get(i).getShort("id");
+ short short2 = nbttaglist.get(i).getShort("lvl");
+
+ if (Enchantment.byId[short1] != null) {
+ enchantmentmodifier.a(Enchantment.byId[short1], short2);
+ }
+ }
+ }
+ }
+ }
+
+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) {
+ ItemStack[] aitemstack1 = aitemstack;
+ int i = aitemstack.length;
+
+ for (int j = 0; j < i; ++j) {
+ ItemStack itemstack = aitemstack1[j];
+
+ a(enchantmentmodifier, itemstack);
+ }
+ }
+
+ public static int a(ItemStack[] aitemstack, DamageSource damagesource) {
+ b.a = 0;
+ b.b = damagesource;
+ a((EnchantmentModifier) b, aitemstack);
+ if (b.a > 25) {
+ b.a = 25;
+ }
+
+ return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1);
+ }
+
+ public static float a(EntityLiving entityliving, EntityLiving entityliving1) {
+ return a(entityliving.be(), entityliving1.getMonsterType());
+ }
+
+ public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) {
+ c.a = 0.0F;
+ c.b = enummonstertype;
+ a((EnchantmentModifier) c, itemstack);
+ return c.a;
+ }
+
+ public static void a(EntityLiving entityliving, Entity entity) {
+ d.b = entity;
+ d.a = entityliving;
+ a((EnchantmentModifier) d, entityliving.getEquipment());
+ if (entity instanceof EntityHuman) {
+ a((EnchantmentModifier) d, entityliving.be());
+ }
+ d.b = null;
+ d.a = null;
+ }
+
+ public static void b(EntityLiving entityliving, Entity entity) {
+ e.a = entityliving;
+ e.b = entity;
+ a((EnchantmentModifier) e, entityliving.getEquipment());
+ if (entityliving instanceof EntityHuman) {
+ a((EnchantmentModifier) e, entityliving.be());
+ }
+ e.a = null;
+ e.b = null;
+ }
+
+ public static int getKnockbackEnchantmentLevel(EntityLiving entityliving, EntityLiving entityliving1) {
+ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.be());
+ }
+
+ public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.be());
+ }
+
+ public static int getOxygenEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.OXYGEN.id, entityliving.getEquipment());
+ }
+
+ public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.be());
+ }
+
+ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.be()) > 0;
+ }
+
+ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.be());
+ }
+
+ public static int getLuckEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.be());
+ }
+
+ public static int getLureEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.be());
+ }
+
+ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.be());
+ }
+
+ public static boolean hasWaterWorkerEnchantment(EntityLiving entityliving) {
+ return getEnchantmentLevel(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0;
+ }
+
+ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) {
+ ItemStack[] aitemstack = entityliving.getEquipment();
+ int i = aitemstack.length;
+
+ for (int j = 0; j < i; ++j) {
+ ItemStack itemstack = aitemstack[j];
+
+ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) {
+ return itemstack;
+ }
+ }
+
+ return null;
+ }
+
+ public static int a(Random random, int i, int j, ItemStack itemstack) {
+ Item item = itemstack.getItem();
+ int k = item.c();
+
+ if (k <= 0) {
+ return 0;
+ } else {
+ if (j > 15) {
+ j = 15;
+ }
+
+ int l = random.nextInt(8) + 1 + (j >> 1) + random.nextInt(j + 1);
+
+ return i == 0 ? Math.max(l / 3, 1) : (i == 1 ? l * 2 / 3 + 1 : Math.max(l, j * 2));
+ }
+ }
+
+ public static ItemStack a(Random random, ItemStack itemstack, int i) {
+ List list = b(random, itemstack, i);
+ boolean flag = itemstack.getItem() == Items.BOOK;
+
+ if (flag) {
+ itemstack.setItem(Items.ENCHANTED_BOOK);
+ }
+
+ if (list != null) {
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) iterator.next();
+
+ if (flag) {
+ Items.ENCHANTED_BOOK.a(itemstack, enchantmentinstance);
+ } else {
+ itemstack.addEnchantment(enchantmentinstance.enchantment, enchantmentinstance.level);
+ }
+ }
+ }
+
+ return itemstack;
+ }
+
+ public static List b(Random random, ItemStack itemstack, int i) {
+ Item item = itemstack.getItem();
+ int j = item.c();
+
+ if (j <= 0) {
+ return null;
+ } else {
+ j /= 2;
+ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1);
+ int k = j + i;
+ float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F;
+ int l = (int) ((float) k * (1.0F + f) + 0.5F);
+
+ if (l < 1) {
+ l = 1;
+ }
+
+ ArrayList arraylist = null;
+ Map map = b(l, itemstack);
+
+ if (map != null && !map.isEmpty()) {
+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) WeightedRandom.a(random, map.values());
+
+ if (enchantmentinstance != null) {
+ arraylist = new ArrayList();
+ arraylist.add(enchantmentinstance);
+
+ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) {
+ Iterator iterator = map.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ Integer integer = (Integer) iterator.next();
+ boolean flag = true;
+ Iterator iterator1 = arraylist.iterator();
+
+ while (true) {
+ if (iterator1.hasNext()) {
+ EnchantmentInstance enchantmentinstance1 = (EnchantmentInstance) iterator1.next();
+
+ if (enchantmentinstance1.enchantment.a(Enchantment.byId[integer.intValue()])) {
+ continue;
+ }
+
+ flag = false;
+ }
+
+ if (!flag) {
+ iterator.remove();
+ }
+ break;
+ }
+ }
+
+ if (!map.isEmpty()) {
+ EnchantmentInstance enchantmentinstance2 = (EnchantmentInstance) WeightedRandom.a(random, map.values());
+
+ arraylist.add(enchantmentinstance2);
+ }
+ }
+ }
+ }
+
+ return arraylist;
+ }
+ }
+
+ public static Map b(int i, ItemStack itemstack) {
+ Item item = itemstack.getItem();
+ HashMap hashmap = null;
+ boolean flag = itemstack.getItem() == Items.BOOK;
+ Enchantment[] aenchantment = Enchantment.byId;
+ int j = aenchantment.length;
+
+ for (int k = 0; k < j; ++k) {
+ Enchantment enchantment = aenchantment[k];
+
+ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) {
+ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) {
+ if (i >= enchantment.a(l) && i <= enchantment.b(l)) {
+ if (hashmap == null) {
+ hashmap = new HashMap();
+ }
+
+ hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l));
+ }
+ }
+ }
+ }
+
+ return hashmap;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java
new file mode 100644
index 0000000..c8e11db
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java
@@ -0,0 +1,17 @@
+package net.minecraft.server;
+
+final class EnchantmentModifierArthropods implements EnchantmentModifier {
+
+ public EntityLiving a;
+ public Entity b;
+
+ private EnchantmentModifierArthropods() {}
+
+ public void a(Enchantment enchantment, int i) {
+ enchantment.a(this.a, this.b, i);
+ }
+
+ EnchantmentModifierArthropods(EmptyClass emptyclass) {
+ this();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java
new file mode 100644
index 0000000..8610c7a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java
@@ -0,0 +1,17 @@
+package net.minecraft.server;
+
+final class EnchantmentModifierDamage implements EnchantmentModifier {
+
+ public float a;
+ public EnumMonsterType b;
+
+ private EnchantmentModifierDamage() {}
+
+ public void a(Enchantment enchantment, int i) {
+ this.a += enchantment.a(i, this.b);
+ }
+
+ EnchantmentModifierDamage(EmptyClass emptyclass) {
+ this();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java
new file mode 100644
index 0000000..8c03320
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java
@@ -0,0 +1,17 @@
+package net.minecraft.server;
+
+final class EnchantmentModifierProtection implements EnchantmentModifier {
+
+ public int a;
+ public DamageSource b;
+
+ private EnchantmentModifierProtection() {}
+
+ public void a(Enchantment enchantment, int i) {
+ this.a += enchantment.a(i, this.b);
+ }
+
+ EnchantmentModifierProtection(EmptyClass emptyclass) {
+ this();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java
new file mode 100644
index 0000000..41993e0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java
@@ -0,0 +1,17 @@
+package net.minecraft.server;
+
+final class EnchantmentModifierThorns implements EnchantmentModifier {
+
+ public EntityLiving a;
+ public Entity b;
+
+ private EnchantmentModifierThorns() {}
+
+ public void a(Enchantment enchantment, int i) {
+ enchantment.b(this.a, this.b, i);
+ }
+
+ EnchantmentModifierThorns(EmptyClass emptyclass) {
+ this();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EnchantmentThorns.java b/src/main/java/net/minecraft/server/EnchantmentThorns.java
new file mode 100644
index 0000000..6841259
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EnchantmentThorns.java
@@ -0,0 +1,54 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class EnchantmentThorns extends Enchantment {
+
+ public EnchantmentThorns(int i, int j) {
+ super(i, j, EnchantmentSlotType.ARMOR_TORSO);
+ this.b("thorns");
+ }
+
+ public int a(int n) {
+ return 10 + 20 * (n - 1);
+ }
+
+ public int b(int i) {
+ return super.a(i) + 50;
+ }
+
+ public int getMaxLevel() {
+ return 3;
+ }
+
+ public boolean canEnchant(ItemStack itemstack) {
+ return itemstack.getItem() instanceof ItemArmor ? true : super.canEnchant(itemstack);
+ }
+
+ public void b(EntityLiving entityliving, Entity entity, int n) {
+ Random ai = entityliving.aI();
+ ItemStack a = EnchantmentManager.a(Enchantment.THORNS, entityliving);
+
+ if (a(n, ai)) {
+ entity.damageEntity(DamageSource.a(entityliving), b(n, ai));
+ entity.makeSound("damage.thorns", 0.5F, 1.0F);
+ if (a != null) {
+ a.damage(3, entityliving);
+ }
+ } else if (a != null) {
+ a.damage(1, entityliving);
+ }
+ }
+
+ public static boolean a(int n, Random random) {
+ return n > 0 && random.nextFloat() < 0.15f * n;
+ }
+
+ public static int b(int n, Random random) {
+ if (n > 10) {
+ return n - 10;
+ }
+
+ return 1 + random.nextInt(4);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 617f7d4..cf0c38f 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@@ -21,7 +22,7 @@ public abstract class EntityInsentient extends EntityLiving {
private Navigation navigation;
protected final PathfinderGoalSelector goalSelector;
protected final PathfinderGoalSelector targetSelector;
- private EntityLiving goalTarget;
+ private WeakReference<EntityLiving> goalTarget = new WeakReference<EntityLiving>(null); // Spigot Update - 20140921a
private EntitySenses bq;
private ItemStack[] equipment = new ItemStack[5];
public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
@@ -76,11 +77,11 @@ public abstract class EntityInsentient extends EntityLiving {
}
public EntityLiving getGoalTarget() {
- return this.goalTarget;
+ return this.goalTarget.get();
}
public void setGoalTarget(EntityLiving entityliving) {
- this.goalTarget = entityliving;
+ this.goalTarget = new WeakReference<EntityLiving>(entityliving);
}
public boolean a(Class oclass) {
diff --git a/src/main/java/net/minecraft/server/ItemEnchantedBook.java b/src/main/java/net/minecraft/server/ItemEnchantedBook.java
new file mode 100644
index 0000000..0829e4c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemEnchantedBook.java
@@ -0,0 +1,72 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class ItemEnchantedBook extends Item {
+
+ public ItemEnchantedBook() {}
+
+ public boolean e_(ItemStack itemStack) {
+ return false;
+ }
+
+ public EnumItemRarity f(ItemStack itemstack) {
+ if (this.g(itemstack).size() > 0) {
+ return EnumItemRarity.UNCOMMON;
+ }
+ return super.f(itemstack);
+ }
+
+ public NBTTagList g(ItemStack itemStack) {
+ if (itemStack.tag == null || !itemStack.tag.hasKeyOfType("StoredEnchantments", 9)) {
+ return new NBTTagList();
+ }
+ return (NBTTagList)itemStack.tag.get("StoredEnchantments");
+ }
+
+ public void a(ItemStack itemStack, EnchantmentInstance enchantmentInstance) {
+ NBTTagList g = this.g(itemStack);
+ boolean b = true;
+ for (int i = 0; i < g.size(); ++i) {
+ NBTTagCompound value = g.get(i);
+ if (value.getShort("id") == enchantmentInstance.enchantment.id) {
+ if (value.getShort("lvl") < enchantmentInstance.level) {
+ value.setShort("lvl", (short)enchantmentInstance.level);
+ }
+
+ b = false;
+ break;
+ }
+ }
+
+ if (b) {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ nbtTagCompound.setShort("id", (short)enchantmentInstance.enchantment.id);
+ nbtTagCompound.setShort("lvl", (short)enchantmentInstance.level);
+ g.add(nbtTagCompound);
+ }
+
+ if (!itemStack.hasTag()) {
+ itemStack.setTag(new NBTTagCompound());
+ }
+
+ itemStack.getTag().set("StoredEnchantments", g);
+ }
+
+ public ItemStack a(EnchantmentInstance enchantmentInstance) {
+ ItemStack itemStack = new ItemStack(this);
+ this.a(itemStack, enchantmentInstance);
+ return itemStack;
+ }
+
+ public StructurePieceTreasure b(Random random) {
+ return this.a(random, 1, 1, 1);
+ }
+
+ public StructurePieceTreasure a(final Random random, final int n, final int n2, final int n3) {
+ ItemStack itemstack = new ItemStack(Items.BOOK, 1, 0);
+
+ EnchantmentManager.a(random, itemstack, 30);
+ return new StructurePieceTreasure(itemstack, n, n2, n3);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 0cae021..76a5403 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -199,6 +199,8 @@ public class NetworkManager extends SimpleChannelInboundHandler {
public void close(IChatBaseComponent ichatbasecomponent) {
// Spigot Start
this.preparing = false;
+ this.k.clear(); // Spigot Update - 20140921a
+ this.l.clear(); // Spigot Update - 20140921a
// Spigot End
if (this.m.isOpen()) {
this.m.close();
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
new file mode 100644
index 0000000..30a05c6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
@@ -0,0 +1,54 @@
+package net.minecraft.server;
+
+import java.lang.ref.WeakReference;
+import java.util.Collections;
+import java.util.List;
+
+public class PathfinderGoalNearestAttackableTarget extends PathfinderGoalTarget {
+
+ private final Class a;
+ private final int b;
+ private final DistanceComparator e;
+ private final IEntitySelector f;
+ private WeakReference<EntityLiving> g; // Spigot Update - 20140921a
+
+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag) {
+ this(entitycreature, oclass, i, flag, false);
+ }
+
+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1) {
+ this(entitycreature, oclass, i, flag, flag1, (IEntitySelector) null);
+ }
+
+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1, IEntitySelector ientityselector) {
+ super(entitycreature, flag, flag1);
+ this.g = new WeakReference<EntityLiving>(null);
+ this.a = oclass;
+ this.b = i;
+ this.e = new DistanceComparator(entitycreature);
+ this.a(1);
+ this.f = new EntitySelectorNearestAttackableTarget(this, ientityselector);
+ }
+
+ public boolean a() {
+ if (this.b > 0 && this.c.aI().nextInt(this.b) != 0) {
+ return false;
+ } else {
+ double d0 = this.f();
+ List list = this.c.world.a(this.a, this.c.boundingBox.grow(d0, 4.0D, d0), this.f);
+
+ Collections.sort(list, this.e);
+ if (list.isEmpty()) {
+ return false;
+ } else {
+ this.g = new WeakReference<EntityLiving>((EntityLiving) list.get(0));
+ return true;
+ }
+ }
+ }
+
+ public void c() {
+ this.c.setGoalTarget(this.g.get());
+ super.c();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
new file mode 100644
index 0000000..9a31d82
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
@@ -0,0 +1,36 @@
+package net.minecraft.server;
+
+public class PathfinderGoalSwell extends PathfinderGoal {
+
+ EntityCreeper a;
+
+ public PathfinderGoalSwell(EntityCreeper entitycreeper) {
+ this.a = entitycreeper;
+ this.a(1);
+ }
+
+ public boolean a() {
+ EntityLiving entityliving = this.a.getGoalTarget();
+
+ return this.a.cb() > 0 || entityliving != null && this.a.f(entityliving) < 9.0D;
+ }
+
+ public void c() {
+ this.a.getNavigation().h();
+ }
+
+ public void d() {}
+
+ public void e() {
+ EntityLiving b = this.a.getGoalTarget(); // Spigot Update - 20140921a
+ if (b == null) {
+ this.a.a(-1);
+ } else if (this.a.f(b) > 49.0D) {
+ this.a.a(-1);
+ } else if (!this.a.getEntitySenses().canSee(b)) {
+ this.a.a(-1);
+ } else {
+ this.a.a(1);
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
index 9d54472..1765c79 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
@@ -10,6 +10,6 @@ public class LongHash {
}
public static int lsw(long l) {
- return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant &
+ return (int) (l & -1L) + Integer.MIN_VALUE; // Spigot - remove redundant & // Spigot Update - 20140921a
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
index 7f659b7..22c96c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
@@ -31,7 +31,6 @@ public class LongHashSet {
private int elements;
private long[] values;
private int modCount;
- private org.spigotmc.FlatMap<Boolean> flat = new org.spigotmc.FlatMap<Boolean>(); // Spigot
public LongHashSet() {
this(INITIAL_SIZE);
@@ -57,30 +56,10 @@ public class LongHashSet {
}
public boolean contains(int msw, int lsw) {
- // Spigot start
- if ( elements == 0 )
- {
- return false;
- }
- if ( flat.contains( msw, lsw ) )
- {
- return true;
- }
- // Spigot end
return contains(LongHash.toLong(msw, lsw));
}
public boolean contains(long value) {
- // Spigot start
- if ( elements == 0 )
- {
- return false;
- }
- if ( flat.contains( value ) )
- {
- return true;
- }
- // Spigot end
int hash = hash(value);
int index = (hash & 0x7FFFFFFF) % values.length;
int offset = 1;
@@ -103,7 +82,6 @@ public class LongHashSet {
}
public boolean add(long value) {
- flat.put( value, Boolean.TRUE ); // Spigot
int hash = hash(value);
int index = (hash & 0x7FFFFFFF) % values.length;
int offset = 1;
@@ -147,18 +125,10 @@ public class LongHashSet {
}
public void remove(int msw, int lsw) {
- // Spigot start
- flat.remove(msw, lsw);
- remove0(LongHash.toLong(msw, lsw));
+ remove(LongHash.toLong(msw, lsw));
}
public boolean remove(long value) {
- flat.remove(value);
- return remove0(value);
- }
-
- private boolean remove0(long value) {
- // Spigot end
int hash = hash(value);
int index = (hash & 0x7FFFFFFF) % values.length;
int offset = 1;
@@ -191,7 +161,6 @@ public class LongHashSet {
freeEntries = values.length;
modCount++;
- flat = new org.spigotmc.FlatMap<Boolean>();
}
public long[] toArray() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
index 2e5b436..01861cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
@@ -28,7 +28,6 @@ public class LongObjectHashMap<V> implements Cloneable, Serializable {
private transient V[][] values;
private transient int modCount;
private transient int size;
- private transient org.spigotmc.FlatMap<V> flat = new org.spigotmc.FlatMap<V>(); // Spigot
public LongObjectHashMap() {
initialize();
@@ -62,17 +61,6 @@ public class LongObjectHashMap<V> implements Cloneable, Serializable {
}
public V get(long key) {
- // Spigot start
- if ( size == 0 )
- {
- return null;
- }
- V val = flat.get( key );
- if ( val != null )
- {
- return val;
- }
- // Spigot end
int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1));
long[] inner = keys[index];
if (inner == null) return null;
@@ -90,7 +78,6 @@ public class LongObjectHashMap<V> implements Cloneable, Serializable {
}
public V put(long key, V value) {
- flat.put(key, value); // Spigot
int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1));
long[] innerKeys = keys[index];
V[] innerValues = values[index];
@@ -137,7 +124,6 @@ public class LongObjectHashMap<V> implements Cloneable, Serializable {
}
public V remove(long key) {
- flat.remove(key); // Spigot
int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1));
long[] inner = keys[index];
if (inner == null) {
@@ -188,7 +174,6 @@ public class LongObjectHashMap<V> implements Cloneable, Serializable {
size = 0;
Arrays.fill(keys, null);
Arrays.fill(values, null);
- flat = new org.spigotmc.FlatMap<V>();
}
public Set<Long> keySet() {
diff --git a/src/main/java/org/spigotmc/FlatMap.java b/src/main/java/org/spigotmc/FlatMap.java
deleted file mode 100644
index 9416f6e..0000000
--- a/src/main/java/org/spigotmc/FlatMap.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.spigotmc;
-
-import org.bukkit.craftbukkit.util.LongHash;
-
-public class FlatMap<V>
-{
-
- private static final int FLAT_LOOKUP_SIZE = 512;
- private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ];
-
- public void put(long msw, long lsw, V value)
- {
- long acx = Math.abs( msw );
- long acz = Math.abs( lsw );
- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE )
- {
- flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value;
- }
- }
-
- public void put(long key, V value)
- {
- put( LongHash.msw( key ), LongHash.lsw( key ), value );
-
- }
-
- public void remove(long key)
- {
- put( key, null );
- }
-
- public void remove(long msw, long lsw)
- {
- put( msw, lsw, null );
- }
-
- public boolean contains(long msw, long lsw)
- {
- return get( msw, lsw ) != null;
- }
-
- public boolean contains(long key)
- {
- return get( key ) != null;
- }
-
- public V get(long msw, long lsw)
- {
- long acx = Math.abs( msw );
- long acz = Math.abs( lsw );
- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE )
- {
- return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )];
- } else
- {
- return null;
- }
- }
-
- public V get(long key)
- {
- return get( LongHash.msw( key ), LongHash.lsw( key ) );
- }
-}
--
1.9.4.msysgit.0

View file

@ -1,4 +1,4 @@
From 4580551f3e716c0f35e3667c6a1634c0994b3cf3 Mon Sep 17 00:00:00 2001
From da7e53caceb34fb4e99f9363c281696e8e668625 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sat, 12 Jul 2014 19:32:01 -0500
Subject: [PATCH] PaperSpigot config files
@ -20,7 +20,7 @@ index 9cc0526..e9a1a67 100644
i.info("Generating keypair");
this.a(MinecraftEncryption.b());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6100297..744d942 100644
index 7a547da..a6ef3b6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -197,6 +197,7 @@ public abstract class World implements IBlockAccess {
@ -40,10 +40,10 @@ index 6100297..744d942 100644
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2c3a140..93f2726 100644
index 10621b3..1548042 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -813,6 +813,7 @@ public final class CraftServer implements Server {
@@ -814,6 +814,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init(); // Spigot
@ -51,7 +51,7 @@ index 2c3a140..93f2726 100644
for (WorldServer world : console.worlds) {
world.difficulty = difficulty;
world.setSpawnFlags(monsters, animals);
@@ -828,12 +829,14 @@ public final class CraftServer implements Server {
@@ -829,12 +830,14 @@ public final class CraftServer implements Server {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
world.spigotConfig.init(); // Spigot

View file

@ -1,4 +1,4 @@
From a53609af81b9c93f55ae5cf419f392c92f9f0333 Mon Sep 17 00:00:00 2001
From 2e1e4619fd49a668fca9eabecbbc7f21d29b9af1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 May 2014 02:12:39 -0500
Subject: [PATCH] Teleport passenger/vehicle with player
@ -43,10 +43,10 @@ index dea5e19..5dc7e95 100644
if (j == 1 && i == 1) {
ChunkCoordinates chunkcoordinates = worldserver1.getSpawn();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 35f2bfa..7026f83 100644
index 173166f..2c8d0a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -491,6 +491,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -492,6 +492,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// If this player is riding another entity, we must dismount before teleporting.
entity.mount(null);
@ -73,7 +73,7 @@ index 35f2bfa..7026f83 100644
// Update the From Location
from = event.getFrom();
// Grab the new To Location dependent on whether the event was cancelled.
@@ -510,6 +530,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -511,6 +531,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} else {
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
}

View file

@ -1,14 +1,14 @@
From 0bc7b3848e091aca58db8afe01c02943ca3bd8c0 Mon Sep 17 00:00:00 2001
From 8ba29cb16f8d0f9bcbcafbd398f66aaf72326b23 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 29 Jun 2014 13:32:36 -0500
Subject: [PATCH] Allow nerfed mobs to jump
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 617f7d4..963b6e9 100644
index cf0c38f..deb04b5 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -407,6 +407,12 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -408,6 +408,12 @@ public abstract class EntityInsentient extends EntityLiving {
// Spigot Start
if ( this.fromMobSpawner )
{

View file

@ -1,14 +1,14 @@
From e9a962e921cbf95753c1e4297a8b40dc53557a6b Mon Sep 17 00:00:00 2001
From e624fffa541916f7aca5bda6885d8f02b5a7c597 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Mon, 7 Jul 2014 04:11:34 +0100
Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 963b6e9..ab2c4c8 100644
index deb04b5..2d35a8d 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -386,13 +386,13 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -387,13 +387,13 @@ public abstract class EntityInsentient extends EntityLiving {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;

View file

@ -1,6 +1,6 @@
From 94cf09556e71988186d6621fbc206075452d59b7 Mon Sep 17 00:00:00 2001
From f77b76bf2e137e47c1c4527cfbfaedb708720557 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 8 Aug 2014 22:51:26 -0500
Date: Sun, 21 Sep 2014 22:02:02 -0500
Subject: [PATCH] Player affects spawning API
@ -17,10 +17,10 @@ index 35b5cfb..114f406 100644
@Override
public CraftHumanEntity getBukkitEntity() {
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index ab2c4c8..f133a24 100644
index 2d35a8d..cbef9b6 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -378,7 +378,7 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -379,7 +379,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (this.persistent) {
this.aU = 0;
} else {
@ -106,12 +106,12 @@ index 717be3b..33c228b 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7026f83..873f3be 100644
index 2c8d0a0..c3e411b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1432,6 +1432,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return java.util.Collections.unmodifiableSet( ret );
@@ -1450,6 +1450,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().playerConnection.sendPacket( packet );
}
}
+
+ // PaperSpigot start - Add affects spawning API
@ -123,6 +123,7 @@ index 7026f83..873f3be 100644
+ return getHandle().affectsSpawning;
+ }
+ // PaperSpigot end
+
};
public Player.Spigot spigot()

View file

@ -1,25 +0,0 @@
From 8c17e7dde8ae985ee00aac0a2a39ecb1261215e7 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 1 Sep 2014 14:41:31 -0500
Subject: [PATCH] Show paperspigot in protocol warning
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0c4976d..57aecea 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -43,9 +43,9 @@ public class Main {
}
}
- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
+ System.err.println( "This PaperSpigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
+ "*** It is imperative that backups be taken before running this build on your server! ***\n"
- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
+ + "Please report any such issues to the PaperSpigot project, stating your client, server, and if applicable BungeeCord versions.\n"
+ "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
Enumeration<URL> resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" );
--
1.9.1

View file

@ -1,4 +1,4 @@
From d1696997a26b8ce4731b0e51b369ebf75bace45a Mon Sep 17 00:00:00 2001
From 2f0886ffb64bbfdcc07654623d6706aed64add98 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sat, 6 Sep 2014 22:05:09 -0500
Subject: [PATCH] mc-dev imports for 1.8 things

View file

@ -1,4 +1,4 @@
From 88655672db04b2b56e0c1f8ee8e378be5400d7bc Mon Sep 17 00:00:00 2001
From 64dd434f6aec4c748a55a854fe0b3055659dd2c0 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 7 Sep 2014 15:45:58 -0500
Subject: [PATCH] Implement a few 1.8 features