Update PaperSpigot to Minecraft 1.8

This commit is contained in:
Zach Brown 2014-11-27 17:17:45 -08:00
parent 0dc6acba77
commit a52eb21fd8
256 changed files with 5529 additions and 15301 deletions

2
.gitignore vendored
View file

@ -40,3 +40,5 @@ Spigot-API
Spigot-Server Spigot-Server
PaperSpigot-Server PaperSpigot-Server
PaperSpigot-API PaperSpigot-API
Bukkit
CraftBukkit

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[submodule "Bukkit"]
path = Bukkit
url = https://github.com/Bukkit/Bukkit.git
[submodule "CraftBukkit"]
path = CraftBukkit
url = https://github.com/Zbob750/CraftBukkit.git

View file

@ -1,11 +0,0 @@
language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
notifications:
email: false
before_install:
- git config --global user.email "admin@ecocitycraft.com"
- git config --global user.name "EcoCityCraft"
- ./applyPatches.sh

1
Bukkit

@ -1 +0,0 @@
Subproject commit f210234e59275330f83b994e199c76f6abd41ee7

View file

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <artifactId>bukkit</artifactId> - <artifactId>bukkit</artifactId>
+ <groupId>org.spigotmc</groupId> + <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-api</artifactId> + <artifactId>spigot-api</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version> <version>1.8-R0.1-SNAPSHOT</version>
- <name>Bukkit</name> - <name>Bukkit</name>
- <url>http://www.bukkit.org</url> - <url>http://www.bukkit.org</url>
+ <name>Spigot-API</name> + <name>Spigot-API</name>
@ -25,40 +25,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
- <scm>
- <developerConnection>scm:git:git@github.com:Bukkit/Bukkit.git</developerConnection>
- <connection>scm:git:git://github.com/Bukkit/Bukkit.git</connection>
- <url>https://github.com/Bukkit/Bukkit/tree/master/</url>
- </scm>
-
- <ciManagement>
- <system>jenkins</system>
- <url>http://ci.bukkit.org</url>
- </ciManagement>
-
- <distributionManagement>
- <site>
- <id>jd.bukkit.org</id>
- <url>file:///home/javadocs/public_html/</url>
- </site>
- <repository>
- <id>repobo-rel</id>
- <name>repo.bukkit.org Releases</name>
- <url>http://repo.bukkit.org/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>repobo-snap</id>
- <name>repo.bukkit.org Snapshots</name>
- <url>http://repo.bukkit.org/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
+ <parent> + <parent>
+ <groupId>org.spigotmc</groupId> + <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-parent</artifactId> + <artifactId>spigot-parent</artifactId>
+ <version>dev-SNAPSHOT</version> + <version>dev-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath> + <relativePath>../pom.xml</relativePath>
+ </parent> + </parent>
+
+ <repositories>
+ <repository>
+ <id>sonatype-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/public</url>
+ </repository>
+ </repositories>
+
<build> <build>
<plugins> <plugins>
<plugin>
-- --

View file

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable { @@ -0,0 +0,0 @@ public interface Entity extends Metadatable {
* @return The current vehicle. * @return if the custom name is displayed
*/ */
public Entity getVehicle(); public boolean isCustomNameVisible();
+ +
+ // Spigot Start + // Spigot Start
+ public class Spigot + public class Spigot

View file

@ -20,6 +20,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void updateInventory(); public void updateInventory();
/** /**
-- --
1.8.4.2

View file

@ -19,11 +19,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); + server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" );
+ continue; + 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 + // Spigot End
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { 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"); server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");

View file

@ -1,99 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
<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>
@@ -0,0 +0,0 @@
</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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -0,0 +0,0 @@ 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

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
<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

@ -1 +0,0 @@
Subproject commit 07d4558b48d0717cb7f9e07015c76599b9fe9697

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ <groupId>org.spigotmc</groupId> + <groupId>org.spigotmc</groupId>
+ <artifactId>spigot</artifactId> + <artifactId>spigot</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.7.10-R0.1-SNAPSHOT</version> <version>1.8-R0.1-SNAPSHOT</version>
- <name>CraftBukkit</name> - <name>CraftBukkit</name>
- <url>http://www.bukkit.org</url> - <url>http://www.bukkit.org</url>
+ <name>Spigot</name> + <name>Spigot</name>
@ -30,33 +30,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<buildtag.suffix></buildtag.suffix> <buildtag.suffix></buildtag.suffix>
</properties> </properties>
- <scm>
- <connection>scm:git:git://github.com/Bukkit/CraftBukkit.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/Bukkit/CraftBukkit.git</developerConnection>
- <url>https://github.com/Bukkit/CraftBukkit</url>
- </scm>
-
- <distributionManagement>
- <repository>
- <id>repobo-rel</id>
- <name>repo.bukkit.org Releases</name>
- <url>http://repo.bukkit.org/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>repobo-snap</id>
- <name>repo.bukkit.org Snapshots</name>
- <url>http://repo.bukkit.org/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
+ <parent> + <parent>
+ <groupId>org.spigotmc</groupId> + <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-parent</artifactId> + <artifactId>spigot-parent</artifactId>
+ <version>dev-SNAPSHOT</version> + <version>dev-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath> + <relativePath>../pom.xml</relativePath>
+ </parent> + </parent>
+
<repositories> <repositories>
<repository> <repository>
<id>repobo-snap</id>
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<dependencies> <dependencies>
@ -68,50 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.bukkit</groupId>
+ <groupId>org.spigotmc</groupId>
<artifactId>minecraft-server</artifactId>
- <version>${minecraft.version}</version>
+ <version>${minecraft.version}-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -0,0 +0,0 @@
<artifactId>gson</artifactId>
<version>2.1</version>
</dependency>
- <dependency>
- <groupId>org.avaje</groupId>
- <artifactId>ebean</artifactId>
- <version>2.7.3</version>
- <type>jar</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.9</version>
- <type>jar</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>10.0</version>
- <type>jar</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.3</version>
- <scope>provided</scope>
- </dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside --> <!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@ -140,19 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
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 {
loadIcon();
updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel"));
- updater.setEnabled(configuration.getBoolean("auto-updater.enabled"));
+ updater.setEnabled(false); // Spigot
updater.setSuggestChannels(configuration.getBoolean("auto-updater.suggest-channels"));
updater.getOnBroken().addAll(configuration.getStringList("auto-updater.on-broken"));
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update"));
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

File diff suppressed because it is too large Load diff

View file

@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isCustomNameVisible() {
return getHandle().vehicle.getBukkitEntity(); return getHandle().getCustomNameVisible();
} }
+ +
+ // Spigot start + // Spigot start
@ -81,6 +81,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ return spigot; + return spigot;
+ } + }
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
@@ -0,0 +0,0 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
public EntityType getType() {
return EntityType.LIGHTNING;
}
+
+ // Spigot start
+ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() {
+
+ };
+
+ @Override
+ public LightningStrike.Spigot spigot() {
+ return spigot;
+ }
+ // Spigot end + // Spigot end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@ -89,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
} }
+ +
+ // Spigot start + // Spigot start
@ -122,6 +142,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ return spigot; + return spigot;
+ } + }
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
@@ -0,0 +0,0 @@ final class CraftScore implements Score {
public CraftScoreboard getScoreboard() {
return objective.getScoreboard();
}
+
+ // Spigot start
+ @Override
+ public boolean isScoreSet() throws IllegalStateException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
scoreboard.teams.remove(team.getName());
setUnregistered();
}
+
+ // Spigot start
+ @Override
+ public Set<String> getEntries() throws IllegalStateException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Spigot end + // Spigot end
} }
-- --

View file

@ -9,17 +9,17 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
}
} }
+ // Spigot Start + // Spigot Start
+ public ServerConnection getServerConnection() + public ServerConnection getServerConnection()
+ { + {
+ return this.p; + return this.q;
+ } + }
+ // Spigot End + // Spigot End
public ServerConnection ai() { public ServerConnection ao() {
return this.p; return this.q;
} }
-- --

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
if (this.L() < 0) { if (this.Q() < 0) {
this.setPort(this.propertyManager.getInt("server-port", 25565)); this.setPort(this.propertyManager.getInt("server-port", 25565));
} }
+ // Spigot start + // Spigot start
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.SpigotConfig.registerCommands(); + org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end + // Spigot end
i.info("Generating keypair"); DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b()); this.a(MinecraftEncryption.b());
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false; return false;
@ -33,24 +33,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot End + // Spigot End
if (!this.getOnlineMode()) { if (!this.getOnlineMode()) {
i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public boolean pvpMode; public long ticksPerMonsterSpawns;
public boolean keepSpawnInMemory = true; public boolean populating;
public ChunkGenerator generator; private int tickPosition;
+ public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public CraftWorld getWorld() { public CraftWorld getWorld() {
return this.world; return this.world;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
// Changed signature - added gen and env protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot
this.generator = gen; this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env); this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@ -59,8 +59,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold");
updater.check(serverVersion); loadIcon();
- loadPlugins(); - loadPlugins();
- enablePlugins(PluginLoadOrder.STARTUP); - enablePlugins(PluginLoadOrder.STARTUP);
@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.SpigotConfig.init(); // Spigot + org.spigotmc.SpigotConfig.init(); // Spigot
for (WorldServer world : console.worlds) { for (WorldServer world : console.worlds) {
world.difficulty = difficulty; world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals); world.setSpawnFlags(monsters, animals);
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
} else { } else {
@ -158,8 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ commands = new HashMap<String, Command>(); + commands = new HashMap<String, Command>();
+ +
+ version = getInt( "config-version", 7 ); + version = getInt( "config-version", 8 );
+ set( "config-version", 7 ); + set( "config-version", 8 );
+ readConfig( SpigotConfig.class, null ); + readConfig( SpigotConfig.class, null );
+ } + }
+ +

View file

@ -10,20 +10,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public public Scoreboard scoreboard = new Scoreboard();
public boolean isStatic; public final boolean isStatic;
// CraftBukkit start - public, longhashset // CraftBukkit - longhashset
- protected LongHashSet chunkTickList = new LongHashSet(); - protected LongHashSet chunkTickList = new LongHashSet();
+ // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot + // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot
private int K; private int K;
public boolean allowMonsters; public boolean allowMonsters;
public boolean allowAnimals; public boolean allowAnimals;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private boolean M; public long ticksPerMonsterSpawns;
int[] I; public boolean populating;
private int tickPosition;
+
+ // Spigot start + // Spigot start
+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
+ protected float growthOdds = 100; + protected float growthOdds = 100;
+ protected float modifiedOdds = 100; + protected float modifiedOdds = 100;
+ private final byte chunkTickRadius; + private final byte chunkTickRadius;
@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static long chunkToKey(int x, int z) + public static long chunkToKey(int x, int z)
+ { + {
+ long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 ); + long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 );
+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); + k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 );
+ return k; + return k;
+ } + }
+ +
@ -46,16 +47,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot end + // Spigot end
+ +
public BiomeBase getBiome(int i, int j) { public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
if (this.isLoaded(i, 0, j)) {
Chunk chunk = this.getChunkAtWorldCoords(i, j); public CraftWorld getWorld() {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end // CraftBukkit end
+ // Spigot start + // Spigot start
+ this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); + this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
+ this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
+ this.chunkTickList.setAutoCompactionFactor( 0 ); + this.chunkTickList.setAutoCompactionFactor( 0 );
+ // Spigot end + // Spigot end
@ -84,15 +85,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entityhuman = (EntityHuman) this.players.get(i); entityhuman = (EntityHuman) this.players.get(i);
j = MathHelper.floor(entityhuman.locX / 16.0D); j = MathHelper.floor(entityhuman.locX / 16.0D);
k = MathHelper.floor(entityhuman.locZ / 16.0D); k = MathHelper.floor(entityhuman.locZ / 16.0D);
l = this.p(); l = this.q();
- for (int i1 = -l; i1 <= l; ++i1) { - for (int i1 = -l; i1 <= l; ++i1) {
- for (int j1 = -l; j1 <= l; ++j1) { - for (int j1 = -l; j1 <= l; ++j1) {
- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); // CraftBukkit - this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k));
+ // Spigot start - Always update the chunk the player is on + // Spigot start - Always update the chunk the player is on
+ long key = chunkToKey( j, k ); + long key = chunkToKey( j, k );
+ int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1 + int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1
+ chunkTickList.put(key, (short) (existingPlayers + 1)); + chunkTickList.put( key, (short) ( existingPlayers + 1 ) );
+ +
+ // Check and see if we update the chunks surrounding the player this tick + // Check and see if we update the chunks surrounding the player this tick
+ for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ ) + for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ )
@ -100,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
+ int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
+ long hash = chunkToKey( dx + j, dz + k ); + long hash = chunkToKey( dx + j, dz + k );
+ if ( !chunkTickList.contains( hash ) && this.isChunkLoaded( dx + j, dz + k ) ) + if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) )
+ { + {
+ chunkTickList.put( hash, (short) -1 ); // no players + chunkTickList.put( hash, (short) -1 ); // no players
} }
@ -113,41 +114,53 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
// CraftBukkit start protected void h() {
// Iterator iterator = this.chunkTickList.iterator(); super.h();
if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
- Iterator iterator = this.chunkTickList.iterator();
+ // Spigot start
+ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator();
- for (long chunkCoord : this.chunkTickList.popAll()) { while (iterator.hasNext()) {
+ // Spigot start - ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) { + iterator.advance();
+ iter.advance(); + long chunkCoord = iterator.key();
+ long chunkCoord = iter.key();
+ int chunkX = World.keyToX(chunkCoord); - this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false);
+ int chunkZ = World.keyToZ(chunkCoord); + this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false);
+ // If unloaded, or in procedd of being unloaded, drop it + // Spigot end
+ if ( ( !this.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) }
} else {
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
// ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next();
// int k = chunkcoordintpair1.x * 16;
// int l = chunkcoordintpair1.z * 16;
- for (long chunkCoord : chunkTickList.popAll()) {
- int chunkX = LongHash.msw(chunkCoord);
- int chunkZ = LongHash.lsw(chunkCoord);
+ // Spigot start
+ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext(); )
+ { + {
+ iter.remove(); + iter.advance();
+ continue; + long chunkCoord = iter.key();
+ } + int chunkX = World.keyToX( chunkCoord );
+ // Spigot end + int chunkZ = World.keyToZ( chunkCoord );
// ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); + // If unloaded, or in procedd of being unloaded, drop it
- int chunkX = LongHash.msw(chunkCoord); + if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
- int chunkZ = LongHash.lsw(chunkCoord); + {
int k = chunkX * 16; + iter.remove();
int l = chunkZ * 16; + continue;
+ }
+ // Spigot end
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
int k = chunkX * 16;
int l = chunkZ * 16;
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}
@@ -0,0 +0,0 @@ public class WorldServer extends World {
if (block.isTicking()) {
++i;
+ this.growthOdds = (iter.value() < 1) ? this.modifiedOdds : 100; // Spigot - grow fast if no players are in this chunk (value = player count)
block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
}
}
@@ -0,0 +0,0 @@ public class WorldServer extends World {
this.methodProfiler.b();
} }
+ // Spigot Start + // Spigot Start
+ if ( spigotConfig.clearChunksOnTick ) + if ( spigotConfig.clearChunksOnTick )
@ -157,7 +170,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot End + // Spigot End
} }
public boolean a(int i, int j, int k, Block block) { protected BlockPosition a(BlockPosition blockposition) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -31,91 +31,90 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockCactus.java --- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -0,0 +0,0 @@ public class BlockCactus extends Block { @@ -0,0 +0,0 @@ public class BlockCactus extends Block {
if (l < 3) { if (i < 3) {
int i1 = world.getData(i, j, k); int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
- if (j == 15) {
+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
world.setTypeUpdate(blockposition1, this.getBlockData());
IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0));
- if (i1 == 15) {
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
world.setData(i, j, k, 0, 4);
this.doPhysics(world, i, j + 1, k, this);
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java --- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement @@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
if (l < 7) { if (i < 7) {
float f = this.n(world, i, j, k); float f = a((Block) this, world, blockposition);
- if (random.nextInt((int) (25.0F / f) + 1) == 0) { - if (random.nextInt((int) (25.0F / f) + 1) == 0) {
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot - // CraftBukkit start
++l; + if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1));
} CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java --- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java +++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { @@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement {
}
// CraftBukkit end // CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) { } else {
- for (int l = 0; l < 4; ++l) { if (world.getLightLevel(blockposition.up()) >= 9) {
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot - for (int i = 0; i < 4; ++i) {
+ for (int l = 0; l < numGrowth; ++l) { // Spigot + for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
int i1 = i + random.nextInt(3) - 1; BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
int j1 = j + random.nextInt(5) - 3; Block block = world.getType(blockposition1.up()).getBlock();
int k1 = k + random.nextInt(3) - 1; IBlockData iblockdata1 = world.getType(blockposition1);
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java --- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -0,0 +0,0 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme @@ -0,0 +0,0 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme
public void a(World world, int i, int j, int k, Random random) { public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit
- if (random.nextInt(25) == 0) { - if (random.nextInt(25) == 0) {
+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot + if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5;
byte b0 = 4; int i = 5;
int l = 5; boolean flag = true;
Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator();
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockMycel.java --- a/src/main/java/net/minecraft/server/BlockMycel.java
+++ b/src/main/java/net/minecraft/server/BlockMycel.java +++ b/src/main/java/net/minecraft/server/BlockMycel.java
@@ -0,0 +0,0 @@ public class BlockMycel extends Block { @@ -0,0 +0,0 @@ public class BlockMycel extends Block {
}
// CraftBukkit end // CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) { } else {
- for (int l = 0; l < 4; ++l) { if (world.getLightLevel(blockposition.up()) >= 9) {
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot - for (int i = 0; i < 4; ++i) {
+ for (int l = 0; l < numGrowth; ++l) { // Spigot + for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
int i1 = i + random.nextInt(3) - 1; BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
int j1 = j + random.nextInt(5) - 3; IBlockData iblockdata1 = world.getType(blockposition1);
int k1 = k + random.nextInt(3) - 1; Block block = world.getType(blockposition1.up()).getBlock();
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java --- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -0,0 +0,0 @@ public class BlockReed extends Block { @@ -0,0 +0,0 @@ public class BlockReed extends Block {
if (l < 3) { if (i < 3) {
int i1 = world.getData(i, j, k); int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
- if (i1 == 15) { - if (j == 15) {
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit // CraftBukkit start
world.setData(i, j, k, 0, 4); // world.setTypeUpdate(blockposition.up(), this.getBlockData());
} else { // world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(0)), 4);
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java --- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen @@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen
public void a(World world, int i, int j, int k, Random random) { public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isStatic) { if (!world.isStatic) {
super.a(world, i, j, k, random); super.b(world, blockposition, iblockdata, random);
- if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) { - if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot + if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) {
// CraftBukkit start // CraftBukkit start
world.captureTreeGeneration = true; world.captureTreeGeneration = true;
// CraftBukkit end // CraftBukkit end
@ -124,14 +123,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockStem.java --- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -0,0 +0,0 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { @@ -0,0 +0,0 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
if (world.getLightLevel(i, j + 1, k) >= 9) { if (world.getLightLevel(blockposition.up()) >= 9) {
float f = this.n(world, i, j, k); float f = BlockCrops.a((Block) this, world, blockposition);
- if (random.nextInt((int) (25.0F / f) + 1) == 0) { - if (random.nextInt((int) (25.0F / f) + 1) == 0) {
+ if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot + if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
int l = world.getData(i, j, k); int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue();
if (l < 7) { if (i < 7) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -10,13 +10,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
+ private java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave> pendingSaves = new java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave>(); // Spigot
private static final Logger a = LogManager.getLogger(); private static final Logger a = LogManager.getLogger();
private List b = new ArrayList(); - private List b = Lists.newArrayList();
private Set c = new HashSet(); - private Set c = Sets.newHashSet();
+ // Spigot start
+ private java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave> pendingSaves = new java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave>();
+ // private List b = Lists.newArrayList();
+ // private Set c = Sets.newHashSet();
+ // Spigot end
private Object d = new Object();
private final File e;
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
@ -71,11 +77,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) { + if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) {
+ return; + return;
} }
-
- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- this.c.add(chunkcoordintpair); - this.c.add(chunkcoordintpair);
+ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ // this.c.add(chunkcoordintpair);
+ // Spigot end + // Spigot end
FileIOThread.a.a(this); FileIOThread.a().a(this);
} }
} }
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {

View file

@ -12,34 +12,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityItem extends Entity { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
} }
private void k() { private void w() {
- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator(); - Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator();
+ // Spigot start + // Spigot start
+ double radius = world.spigotConfig.itemMerge; + double radius = world.spigotConfig.itemMerge;
+ Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(radius, radius, radius)).iterator(); + Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator();
+ // Spigot end + // Spigot end
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityItem entityitem = (EntityItem) iterator.next(); EntityItem entityitem = (EntityItem) iterator.next();
@@ -0,0 +0,0 @@ public class EntityItem extends Entity { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
return false; return false;
} else { } else {
- itemstack1.count += itemstack.count; - itemstack1.count += itemstack.count;
- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); - entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
- entityitem.age = Math.min(entityitem.age, this.age); - entityitem.age = Math.min(entityitem.age, this.age);
- entityitem.setItemStack(itemstack1); - entityitem.setItemStack(itemstack1);
- this.die(); - this.die();
+ // Spigot start + // Spigot start
+ itemstack.count += itemstack1.count; + itemstack.count += itemstack1.count;
+ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); + this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
+ this.age = Math.min(entityitem.age, this.age); + this.age = Math.min(entityitem.age, this.age);
+ this.setItemStack(itemstack); + this.setItemStack(itemstack);
+ entityitem.die(); + entityitem.die();
+ // Spigot end + // Spigot end
return true; return true;
} }
} else { } else {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ EntityExperienceOrb xp = (EntityExperienceOrb) entity; + EntityExperienceOrb xp = (EntityExperienceOrb) entity;
+ double radius = spigotConfig.expMerge; + double radius = spigotConfig.expMerge;
+ if (radius > 0) { + if (radius > 0) {
+ List<Entity> entities = this.getEntities(entity, entity.boundingBox.grow(radius, radius, radius)); + List<Entity> entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius));
+ for (Entity e : entities) { + for (Entity e : entities) {
+ if (e instanceof EntityExperienceOrb) { + if (e instanceof EntityExperienceOrb) {
+ EntityExperienceOrb loopItem = (EntityExperienceOrb) e; + EntityExperienceOrb loopItem = (EntityExperienceOrb) e;

View file

@ -13,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return 10; return 10;
} }
- public void onPlace(World world, int i, int j, int k) {} - public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {}
+ public void onPlace(World world, int i, int j, int k) { + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot + org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot
+ } + }
- public void remove(World world, int i, int j, int k, Block block, int l) {} - public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {}
+ public void remove(World world, int i, int j, int k, Block block, int l) { + public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot + org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot
+ } + }
@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void updatePlayer(EntityPlayer entityplayer) { public void updatePlayer(EntityPlayer entityplayer) {
+ org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot + org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot
if (entityplayer != this.tracker) { if (entityplayer != this.tracker) {
double d0 = entityplayer.locX - (double) (this.xLoc / 32); if (this.c(entityplayer)) {
double d1 = entityplayer.locZ - (double) (this.zLoc / 32); if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
@@ -0,0 +0,0 @@ public class EntityTrackerEntry { @@ -0,0 +0,0 @@ public class EntityTrackerEntry {
} }
@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot + org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
if (entity == null) return false; if (entity == null) return false;
// CraftBukkit end // CraftBukkit end
int i = MathHelper.floor(entity.locX / 16.0D);
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} }
@ -88,11 +88,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} }
public void a(List list) { public void b(Collection collection) {
+ org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot
// CraftBukkit start // CraftBukkit start
// this.entityList.addAll(list); // this.entityList.addAll(collection);
Entity entity = null; Iterator iterator = collection.iterator();
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

@ -1,223 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:13:47 +1000
Subject: [PATCH] LongHash Tweaks
Tweaks the LongHash algorithm and provides a large array based map to look up values centered around the origin, ie the access normally seen on a Minecraft server.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
@@ -0,0 +0,0 @@ public class LongHash {
}
public static int lsw(long l) {
- return (int) (l & 0xFFFFFFFF) + Integer.MIN_VALUE;
+ return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant &
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public class LongHashSet {
}
public void remove(int msw, int lsw) {
- remove(LongHash.toLong(msw, lsw));
+ // Spigot start
+ flat.remove(msw, lsw);
+ remove0(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;
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
@@ -0,0 +0,0 @@ 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();
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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];
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/spigotmc/FlatMap.java
@@ -0,0 +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 ) );
+ }
+}
--

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public PlayerChunkMap(WorldServer worldserver) { - public PlayerChunkMap(WorldServer worldserver) {
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { + public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
this.world = worldserver; this.world = worldserver;
- this.a(worldserver.getMinecraftServer().getPlayerList().s()); - this.a(worldserver.getMinecraftServer().getPlayerList().t());
+ this.a(viewDistance); // Spigot + this.a(viewDistance); // Spigot
} }
@ -25,15 +25,15 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
// CraftBukkit end // CraftBukkit end
this.server = minecraftserver; this.server = minecraftserver;
this.tracker = new EntityTracker(this); this.tracker = new EntityTracker(this);
- this.manager = new PlayerChunkMap(this); - this.manager = new PlayerChunkMap(this);
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
if (this.entitiesById == null) { this.worldProvider.a(this);
this.entitiesById = new IntHashMap(); this.chunkProvider = this.k();
} this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -14,23 +14,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
+ world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot + world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { boolean flag = ichunkprovider.isChunkLoaded(i, j - 1);
ichunkprovider.getChunkAt(ichunkprovider1, i, j); boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j);
} boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1);
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) { }
ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1);
} }
+ world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot + world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot
} }
public int d(int i, int j) { public BlockPosition h(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
boolean newChunk = false; // CraftBukkit end
if (chunk == null) { if (chunk == null) {
+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot + world.timings.syncChunkLoadTimer.startTiming(); // Spigot
@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (chunk == null) { if (chunk == null) {
if (this.chunkProvider == null) { if (this.chunkProvider == null) {
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
}
// CraftBukkit end // CraftBukkit end
chunk.loadNearby(this, this, i, j); chunk.loadNearby(this, this, i, j);
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
} }
@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return chunk; return chunk;
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk != null) { if (chunk != null) {
chunk.lastSaved = this.world.getTime(); chunk.setLastSaved(this.world.getTime());
if (this.chunkProvider != null) { if (this.chunkProvider != null) {
+ world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot + world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
this.chunkProvider.recreateStructures(i, j); this.chunkProvider.recreateStructures(chunk, i, j);
+ world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot + world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
} }
} }
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - Add async variant, provide compatibility // CraftBukkit start - Add async variant, provide compatibility
public Chunk a(World world, int i, int j) { public Chunk a(World world, int i, int j) {
+ world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot + world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot
Object[] data = this.loadChunk(world, i, j); Object[] data = loadChunk(world, i, j);
+ world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot + world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot
if (data != null) { if (data != null) {
Chunk chunk = (Chunk) data[0]; Chunk chunk = (Chunk) data[0];
@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot + world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot
// return chunk; // CraftBukkit // return chunk; // CraftBukkit
} }
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -119,19 +119,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
} }
public void aB() { public void aM() {
+ SpigotTimings.serverCommandTimer.startTiming(); // Spigot + SpigotTimings.serverCommandTimer.startTiming(); // Spigot
while (!this.j.isEmpty()) { while (!this.k.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.j.remove(0); ServerCommand servercommand = (ServerCommand) this.k.remove(0);
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.server.dispatchServerCommand(this.console, servercommand);
// CraftBukkit end // CraftBukkit end
} }
+ SpigotTimings.serverCommandTimer.stopTiming(); // Spigot + SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
} }
public boolean X() { public boolean ad() {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.painting.PaintingBreakByEntityEvent; import org.bukkit.event.painting.PaintingBreakByEntityEvent;
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public boolean valid; // CraftBukkit public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
@ -153,22 +153,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getId() { public int getId() {
return this.id; return this.id;
} }
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
return; }
}
// CraftBukkit end public void move(double d0, double d1, double d2) {
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
if (this.X) { +
this.boundingBox.d(d0, d1, d2); if (this.T) {
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.a(this.getBoundingBox().c(d0, d1, d2));
@@ -0,0 +0,0 @@ public abstract class Entity { this.recalcPosition();
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
} }
protected String H() { private void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
@ -181,21 +182,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
public abstract class EntityLiving extends Entity { public abstract class EntityLiving extends Entity {
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
} }
public void h() { public void s_() {
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot + SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
super.h(); super.s_();
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = this.aZ(); int i = this.bu();
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
} }
} }
+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
this.e(); this.m();
+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
double d0 = this.locX - this.lastX; double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
@ -203,39 +204,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.aX += f2; this.aR += f2;
+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot + SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
} }
protected float f(float f, float f1) { protected float h(float f, float f1) {
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
} }
this.world.methodProfiler.a("ai"); this.world.methodProfiler.a("ai");
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot + SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.bh()) { if (this.bC()) {
this.bc = false; this.aW = false;
this.bd = 0.0F; this.aX = 0.0F;
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.aO = this.yaw; this.doTick();
} this.world.methodProfiler.b();
} }
+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot + SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("jump"); this.world.methodProfiler.a("jump");
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.bd *= 0.98F; this.aX *= 0.98F;
this.be *= 0.98F; this.aY *= 0.98F;
this.bf *= 0.9F; this.aZ *= 0.9F;
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot + SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
this.e(this.bd, this.be); this.g(this.aX, this.aY);
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("push"); this.world.methodProfiler.a("push");
if (!this.world.isStatic) { if (!this.world.isStatic) {
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot + SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.bo(); this.bK();
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot + SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
} }
@ -244,36 +245,36 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import jline.console.ConsoleReader; @@ -0,0 +0,0 @@ import joptsimple.OptionSet;
import joptsimple.OptionSet;
import org.bukkit.craftbukkit.Main;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent; import org.bukkit.event.world.WorldSaveEvent;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
protected void t() {} protected void x() {}
protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ SpigotTimings.serverTickTimer.startTiming(); // Spigot + SpigotTimings.serverTickTimer.startTiming(); // Spigot
long i = System.nanoTime(); long i = System.nanoTime();
++this.ticks; ++this.ticks;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
} }
if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
+ SpigotTimings.worldSaveTimer.startTiming(); // Spigot + SpigotTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save"); this.methodProfiler.a("save");
this.u.savePlayers(); this.v.savePlayers();
this.saveChunks(true); this.saveChunks(true);
this.methodProfiler.b(); this.methodProfiler.b();
+ SpigotTimings.worldSaveTimer.stopTiming(); // Spigot + SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
} }
this.methodProfiler.a("tallying"); this.methodProfiler.a("tallying");
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
@ -281,8 +282,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot + org.spigotmc.CustomTimingsHandler.tick(); // Spigot
} }
public void v() { public void z() {
this.methodProfiler.a("levels"); @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.c("levels");
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot + SpigotTimings.schedulerTimer.startTiming(); // Spigot
// CraftBukkit start // CraftBukkit start
@ -304,7 +307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) { if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
} }
} }
@ -312,27 +315,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i; int i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
CrashReport crashreport; CrashReport crashreport;
try { try {
+ worldserver.timings.doTick.startTiming(); // Spigot + worldserver.timings.doTick.startTiming(); // Spigot
worldserver.doTick(); worldserver.doTick();
+ worldserver.timings.doTick.stopTiming(); // Spigot + worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) { } catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable, "Exception ticking world"); crashreport = CrashReport.a(throwable1, "Exception ticking world");
worldserver.a(crashreport); worldserver.a(crashreport);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
} }
try { try {
+ worldserver.timings.tickEntities.startTiming(); // Spigot + worldserver.timings.tickEntities.startTiming(); // Spigot
worldserver.tickEntities(); worldserver.tickEntities();
+ worldserver.timings.tickEntities.stopTiming(); // Spigot + worldserver.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable1) { } catch (Throwable throwable2) {
crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
worldserver.a(crashreport); worldserver.a(crashreport);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.a("tracker"); this.methodProfiler.a("tracker");
@ -342,22 +345,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
// } // CraftBukkit // } // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
} }
this.methodProfiler.c("connection"); this.methodProfiler.c("connection");
+ SpigotTimings.connectionTimer.startTiming(); // Spigot + SpigotTimings.connectionTimer.startTiming(); // Spigot
this.ai().c(); this.ao().c();
+ SpigotTimings.connectionTimer.stopTiming(); // Spigot + SpigotTimings.connectionTimer.stopTiming(); // Spigot
this.methodProfiler.c("players"); this.methodProfiler.c("players");
+ SpigotTimings.playerListTimer.startTiming(); // Spigot + SpigotTimings.playerListTimer.startTiming(); // Spigot
this.u.tick(); this.v.tick();
+ SpigotTimings.playerListTimer.stopTiming(); // Spigot + SpigotTimings.playerListTimer.stopTiming(); // Spigot
this.methodProfiler.c("tickables"); this.methodProfiler.c("tickables");
+ SpigotTimings.tickablesTimer.startTiming(); // Spigot + SpigotTimings.tickablesTimer.startTiming(); // Spigot
for (i = 0; i < this.n.size(); ++i) { for (i = 0; i < this.o.size(); ++i) {
((IUpdatePlayerListBox) this.n.get(i)).a(); ((IUpdatePlayerListBox) this.o.get(i)).c();
} }
+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot + SpigotTimings.tickablesTimer.stopTiming(); // Spigot
@ -367,16 +370,16 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit end // CraftBukkit end
private void handleCommand(String s) { private void handleCommand(String s) {
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
+ +
// CraftBukkit start - whole method // CraftBukkit start - whole method
this.c.info(this.player.getName() + " issued server command: " + s); this.c.info(this.player.getName() + " issued server command: " + s);
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -396,7 +399,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
//this.minecraftServer.getCommandHandler().a(this.player, s); // this.minecraftServer.getCommandHandler().a(this.player, s);
// CraftBukkit end // CraftBukkit end
} }
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
@ -410,12 +413,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.spigotmc.CustomTimingsHandler; // Spigot +import org.spigotmc.CustomTimingsHandler; // Spigot
import org.bukkit.inventory.InventoryHolder; // CraftBukkit import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public class TileEntity { public abstract class TileEntity {
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
private static final Logger a = LogManager.getLogger(); private static final Logger a = LogManager.getLogger();
private static Map i = new HashMap(); private static Map f = Maps.newHashMap();
private static Map j = new HashMap(); private static Map g = Maps.newHashMap();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
@ -429,7 +432,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public ChunkGenerator generator;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot + public final SpigotTimings.WorldTimingsHandler timings; // Spigot
@ -438,15 +441,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.world; return this.world;
} }
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.M = worldprovider.getWorldBorder();
this.worldProvider.a(this); this.getServer().addWorld(this.world); // CraftBukkit
this.chunkProvider = this.j();
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
if (!this.worldData.isInitialized()) { }
try {
this.a(worldsettings); public World b() {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.f.clear(); this.g.clear();
this.methodProfiler.c("regular"); this.methodProfiler.c("regular");
+ timings.entityTick.startTiming(); // Spigot + timings.entityTick.startTiming(); // Spigot
@ -458,7 +461,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!entity.dead) { if (!entity.dead) {
try { try {
+ SpigotTimings.tickEntityTimer.startTiming(); // Spigot + SpigotTimings.tickEntityTimer.startTiming(); // Spigot
this.playerJoinedWorld(entity); this.g(entity);
+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Ticking entity"); crashreport = CrashReport.a(throwable1, "Ticking entity");
@ -470,28 +473,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.entityTick.stopTiming(); // Spigot + timings.entityTick.stopTiming(); // Spigot
this.methodProfiler.c("blockEntities"); this.methodProfiler.c("blockEntities");
+ timings.tileEntityTick.startTiming(); // Spigot + timings.tileEntityTick.startTiming(); // Spigot
this.M = true; this.L = true;
// CraftBukkit start - From below, clean up tile entities before ticking them // CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.b.isEmpty()) { if (!this.b.isEmpty()) {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { if (this.isLoaded(blockposition) && this.M.a(blockposition)) {
try { try {
+ tileentity.tickTimer.startTiming(); // Spigot + tileentity.tickTimer.startTiming(); // Spigot
tileentity.h(); ((IUpdatePlayerListBox) tileentity).c();
+ tileentity.tickTimer.stopTiming(); // Spigot } catch (Throwable throwable2) {
} catch (Throwable throwable2) { CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
+ tileentity.tickTimer.stopTiming(); // Spigot @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
crashreport = CrashReport.a(throwable2, "Ticking block entity"); tileentity.a(crashreportsystemdetails1);
crashreportsystemdetails = crashreport.a("Block entity being ticked"); throw new ReportedException(crashreport1);
tileentity.a(crashreportsystemdetails); }
+ // Spigot start
+ finally {
+ tileentity.tickTimer.stopTiming();
+ }
+ // Spigot end
}
}
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} }
} }
+ timings.tileEntityTick.stopTiming(); // Spigot + timings.tileEntityTick.stopTiming(); // Spigot
+ timings.tileEntityPending.startTiming(); // Spigot + timings.tileEntityPending.startTiming(); // Spigot
this.M = false; this.L = false;
/* CraftBukkit start - Moved up /* CraftBukkit start - Moved up
if (!this.b.isEmpty()) { if (!this.b.isEmpty()) {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
@ -505,15 +516,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// CraftBukkit start - Use neighbor cache instead of looking up // CraftBukkit start - Use neighbor cache instead of looking up
Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4);
if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) {
+ entity.tickTimer.startTiming(); // Spigot + entity.tickTimer.startTiming(); // Spigot
// CraftBukkit end // CraftBukkit end
entity.S = entity.locX; entity.P = entity.locX;
entity.T = entity.locY; entity.Q = entity.locY;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
entity.passenger = null;
} }
} }
+ entity.tickTimer.stopTiming(); // Spigot + entity.tickTimer.stopTiming(); // Spigot
} }
} }
@ -522,12 +533,12 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
long time = this.worldData.getTime(); long time = this.worldData.getTime();
if (this.getGameRules().getBoolean("doMobSpawning") && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
+ timings.mobSpawn.startTiming(); // Spigot + timings.mobSpawn.startTiming(); // Spigot
this.R.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); this.R.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
+ timings.mobSpawn.stopTiming(); // Spigot + timings.mobSpawn.stopTiming(); // Spigot
// CraftBukkit end // CraftBukkit end
} }
@ -537,7 +548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.c("chunkSource"); this.methodProfiler.c("chunkSource");
this.chunkProvider.unloadChunks(); this.chunkProvider.unloadChunks();
int j = this.a(1.0F); int j = this.a(1.0F);
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.worldData.setDayTime(this.worldData.getDayTime() + 1L); this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
} }
@ -548,7 +559,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.doTickPending.stopTiming(); // Spigot + timings.doTickPending.stopTiming(); // Spigot
this.methodProfiler.c("tickBlocks"); this.methodProfiler.c("tickBlocks");
+ timings.doTickTiles.startTiming(); // Spigot + timings.doTickTiles.startTiming(); // Spigot
this.g(); this.h();
+ timings.doTickTiles.stopTiming(); // Spigot + timings.doTickTiles.stopTiming(); // Spigot
this.methodProfiler.c("chunkMap"); this.methodProfiler.c("chunkMap");
+ timings.doChunkMap.startTiming(); // Spigot + timings.doChunkMap.startTiming(); // Spigot
@ -565,15 +576,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.doPortalForcer.stopTiming(); // Spigot + timings.doPortalForcer.stopTiming(); // Spigot
this.methodProfiler.b(); this.methodProfiler.b();
+ timings.doSounds.startTiming(); // Spigot + timings.doSounds.startTiming(); // Spigot
this.Z(); this.ak();
+ timings.doSounds.stopTiming(); // Spigot
+ timings.doChunkGC.startTiming(); // Spigot
this.getWorld().processChunkGC(); // CraftBukkit this.getWorld().processChunkGC(); // CraftBukkit
+ timings.doChunkGC.stopTiming(); // Spigot + timings.doChunkGC.stopTiming(); // Spigot
} }
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@ -791,7 +800,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (queuedChunk.provider.chunkProvider != null) { if (queuedChunk.provider.chunkProvider != null) {
+ queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot + queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
queuedChunk.provider.chunkProvider.recreateStructures(queuedChunk.x, queuedChunk.z); queuedChunk.provider.chunkProvider.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
+ queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot + queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
} }

View file

@ -12,16 +12,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
public int r; private long u;
public long s; private int v;
private int x; private ConcurrentLinkedQueue w;
+ protected net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot + protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
private int neighbors = 0x1 << 12; private int neighbors = 0x1 << 12;
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
entity.ai = k; entity.af = k;
entity.aj = this.locZ; entity.ag = this.locZ;
this.entitySlices[k].add(entity); this.entitySlices[k].add(entity);
+ // Spigot start - increment creature type count + // Spigot start - increment creature type count
+ // Keep this synced up with World.a(Class) + // Keep this synced up with World.a(Class)
@ -64,24 +64,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot end + // Spigot end
} }
public boolean d(int i, int j, int k) { public boolean d(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java --- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
return new ChunkPosition(k, i1, l);
} public SpawnerCreature() {}
+ // Spigot start - get entity count only from chunks being processed in b + // Spigot start - get entity count only from chunks being processed in b
+ private int getEntityCount(WorldServer server, Class oClass) + private int getEntityCount(WorldServer server, Class oClass)
+ { + {
+ int i = 0; + int i = 0;
+ for ( Long coord : this.a.keySet() ) + Iterator<Long> it = this.b.iterator();
+ while ( it.hasNext() )
+ { + {
+ Long coord = it.next();
+ int x = LongHash.msw( coord ); + int x = LongHash.msw( coord );
+ int z = LongHash.lsw( coord ); + int z = LongHash.lsw( coord );
+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z ) ) + if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
+ { + {
+ i += server.getChunkAt( x, z ).entityCount.get( oClass ); + i += server.getChunkAt( x, z ).entityCount.get( oClass );
+ } + }
@ -90,53 +92,57 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot end + // Spigot end
+ +
public int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) {
if (!flag && !flag1) { if (!flag && !flag1) {
return 0; return 0;
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
j = MathHelper.floor(entityhuman.locZ / 16.0D); j = MathHelper.floor(entityhuman.locZ / 16.0D);
byte b0 = 8; byte b0 = 8;
+ // Spigot Start + // Spigot Start
+ b0 = worldserver.spigotConfig.mobSpawnRange; + b0 = worldserver.spigotConfig.mobSpawnRange;
+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; + b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0;
+ b0 = ( b0 > 8 ) ? 8 : b0; + b0 = ( b0 > 8 ) ? 8 : b0;
+ // Spigot End + // Spigot End
for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) { for (int i1 = -b0; i1 <= b0; ++i1) {
for (k = -b0; k <= b0; ++k) {
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
if (limit == 0) { if (limit == 0) {
continue; continue;
} }
+ int mobcnt = 0; + int mobcnt = 0; // Spigot
// CraftBukkit end // CraftBukkit end
- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * this.a.size() / 256) { // CraftBukkit - use per-world limits if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) {
+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * this.a.size() / 256) { // Spigot - use per-world limits and use all loaded chunks k = worldserver.a(enumcreaturetype.a());
Iterator iterator = this.a.keySet().iterator(); int l1 = limit * i / a; // CraftBukkit - use per-world limits
+ int moblimit = (limit * this.a.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit - if (k <= l1) {
label110: + if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) {
- while (iterator.hasNext()) { Iterator iterator1 = this.b.iterator();
+ while (iterator.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
// CraftBukkit start = use LongHash and LongObjectHashMap
long key = ((Long) iterator.next()).longValue();
+ int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit
label115:
- while (iterator1.hasNext()) {
+ while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
// CraftBukkit start = use LongHash and LongObjectHashMap
long key = ((Long) iterator1.next()).longValue();
BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key));
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
groupdataentity = entityinsentient.prepare(groupdataentity); worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); }
// CraftBukkit end
+ // Spigot start + // Spigot start
+ if ( --moblimit <= 0 ) + if ( --moblimit <= 0 )
+ { + {
+ // If we're past limit, stop spawn + // If we're past limit, stop spawn
+ continue label110; + continue label115;
+ } + }
+ // Spigot end + // Spigot end
if (j2 >= entityinsentient.bB()) { if (l2 >= entityinsentient.bU()) {
continue label110; continue label115;
} }
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -20,6 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot end + // Spigot end
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { if (!tileentity.x() && tileentity.t()) {
try { BlockPosition blockposition = tileentity.getPosition();
-- --

View file

@ -12,16 +12,16 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public public int fireTicks;
- protected boolean inWater; - protected boolean inWater;
+ public boolean inWater; // Spigot - protected -> public + public boolean inWater; // Spigot - protected -> public
public int noDamageTicks; public int noDamageTicks;
private boolean justCreated; protected boolean justCreated;
protected boolean fireProof; protected boolean fireProof;
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public boolean valid; // CraftBukkit public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
@ -35,10 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getId() { public int getId() {
return this.id; return this.id;
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.setPosition(0.0D, 0.0D, 0.0D); this.setPosition(0.0D, 0.0D, 0.0D);
if (world != null) { if (world != null) {
this.dimension = world.worldProvider.dimension; this.dimension = world.worldProvider.getDimension();
+ // Spigot start + // Spigot start
+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig); + this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig);
+ } else { + } else {
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityAgeable.java --- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature { @@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature {
private float bq; private float bl;
public boolean ageLocked = false; // CraftBukkit public boolean ageLocked = false; // CraftBukkit
+ // Spigot start + // Spigot start
@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Entity shooter; public Entity shooter;
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
private double damage = 2.0D; private double damage = 2.0D;
public int knockbackStrength; // CraftBukkit - private -> public public int knockbackStrength;
+ // Spigot Start + // Spigot Start
+ @Override + @Override
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ if ( this.inGround ) + if ( this.inGround )
+ { + {
+ this.at += 19; // Despawn counter. First int after shooter + this.ap += 19; // Despawn counter. First int after shooter
+ } + }
+ super.inactiveTick(); + super.inactiveTick();
+ } + }
@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
private int ticksFlown; private int ticksFlown;
public int expectedLifespan; // CraftBukkit - private -> public public int expectedLifespan;
+ // Spigot Start + // Spigot Start
+ @Override + @Override
@ -148,18 +148,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void inactiveTick() + public void inactiveTick()
+ { + {
+ super.inactiveTick(); + super.inactiveTick();
+ ++this.aU; // Above all the floats + ++this.aT; // Above all the floats
+ } + }
+ // Spigot end + // Spigot end
public EntityLiving(World world) { public void G() {
super(world); this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.f.clear(); this.g.clear();
this.methodProfiler.c("regular"); this.methodProfiler.c("regular");
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot + org.spigotmc.ActivationRange.activateEntities(this); // Spigot
@ -172,7 +172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // CraftBukkit start - Use neighbor cache instead of looking up - // CraftBukkit start - Use neighbor cache instead of looking up
- Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); - Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4);
- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { - if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) {
+ // Spigot start + // Spigot start
+ if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { + if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
+ entity.ticksLived++; + entity.ticksLived++;
@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else { + } else {
entity.tickTimer.startTiming(); // Spigot entity.tickTimer.startTiming(); // Spigot
// CraftBukkit end // CraftBukkit end
entity.S = entity.locX; entity.P = entity.locX;
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
@ -205,6 +205,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+import java.util.ArrayList; +import java.util.ArrayList;
+import java.util.List; +import java.util.List;
+import java.util.Set;
+import net.minecraft.server.AxisAlignedBB; +import net.minecraft.server.AxisAlignedBB;
+import net.minecraft.server.Chunk; +import net.minecraft.server.Chunk;
+import net.minecraft.server.Entity; +import net.minecraft.server.Entity;
@ -222,6 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.server.EntityMonster; +import net.minecraft.server.EntityMonster;
+import net.minecraft.server.EntityProjectile; +import net.minecraft.server.EntityProjectile;
+import net.minecraft.server.EntitySheep; +import net.minecraft.server.EntitySheep;
+import net.minecraft.server.EntitySlice;
+import net.minecraft.server.EntitySlime; +import net.minecraft.server.EntitySlime;
+import net.minecraft.server.EntityTNTPrimed; +import net.minecraft.server.EntityTNTPrimed;
+import net.minecraft.server.EntityVillager; +import net.minecraft.server.EntityVillager;
@ -291,26 +293,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ /** + /**
+ * Utility method to grow an AABB without creating a new AABB or touching
+ * the pool, so we can re-use ones we have.
+ *
+ * @param target
+ * @param source
+ * @param x
+ * @param y
+ * @param z
+ */
+ public static void growBB(AxisAlignedBB target, AxisAlignedBB source, int x, int y, int z)
+ {
+ target.a = source.a - x;
+ target.b = source.b - y;
+ target.c = source.c - z;
+ target.d = source.d + x;
+ target.e = source.e + y;
+ target.f = source.f + z;
+ }
+
+ /**
+ * Find what entities are in range of the players in the world and set + * Find what entities are in range of the players in the world and set
+ * active if in range. + * active if in range.
+ * + *
@ -331,10 +313,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ +
+ player.activatedTick = MinecraftServer.currentTick; + player.activatedTick = MinecraftServer.currentTick;
+ growBB( maxBB, player.boundingBox, maxRange, 256, maxRange ); + maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
+ growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange ); + miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
+ growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange ); + animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
+ growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange ); + monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
+ +
+ int i = MathHelper.floor( maxBB.a / 16.0D ); + int i = MathHelper.floor( maxBB.a / 16.0D );
+ int j = MathHelper.floor( maxBB.d / 16.0D ); + int j = MathHelper.floor( maxBB.d / 16.0D );
@ -362,9 +344,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ private static void activateChunkEntities(Chunk chunk) + private static void activateChunkEntities(Chunk chunk)
+ { + {
+ for ( List<Entity> slice : chunk.entitySlices ) + for ( EntitySlice slice : chunk.entitySlices )
+ { + {
+ for ( Entity entity : slice ) + for ( Entity entity : (Set<Entity>) slice )
+ { + {
+ if ( MinecraftServer.currentTick > entity.activatedTick ) + if ( MinecraftServer.currentTick > entity.activatedTick )
+ { + {
@ -376,20 +358,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ switch ( entity.activationType ) + switch ( entity.activationType )
+ { + {
+ case 1: + case 1:
+ if ( monsterBB.b( entity.boundingBox ) ) + if ( monsterBB.b( entity.getBoundingBox() ) )
+ { + {
+ entity.activatedTick = MinecraftServer.currentTick; + entity.activatedTick = MinecraftServer.currentTick;
+ } + }
+ break; + break;
+ case 2: + case 2:
+ if ( animalBB.b( entity.boundingBox ) ) + if ( animalBB.b( entity.getBoundingBox() ) )
+ { + {
+ entity.activatedTick = MinecraftServer.currentTick; + entity.activatedTick = MinecraftServer.currentTick;
+ } + }
+ break; + break;
+ case 3: + case 3:
+ default: + default:
+ if ( miscBB.b( entity.boundingBox ) ) + if ( miscBB.b( entity.getBoundingBox() ) )
+ { + {
+ entity.activatedTick = MinecraftServer.currentTick; + entity.activatedTick = MinecraftServer.currentTick;
+ } + }
@ -428,15 +410,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ( entity instanceof EntityLiving ) + if ( entity instanceof EntityLiving )
+ { + {
+ EntityLiving living = (EntityLiving) entity; + EntityLiving living = (EntityLiving) entity;
+ if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) + if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 )
+ { + {
+ return true; + return true;
+ } + }
+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null ) + if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null )
+ { + {
+ return true; + return true;
+ } + }
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bY() /* Getter for first boolean */ ) + if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ )
+ { + {
+ return true; + return true;
+ } + }

View file

@ -9,17 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
return this.item.getMaxDurability();
} }
+ // Spigot start
public boolean isDamaged(int i, Random random) { public boolean isDamaged(int i, Random random) {
+ return isDamaged(i, random, null); + return isDamaged(i, random, null);
+ } + }
+ +
+ public boolean isDamaged(int i, Random random, EntityLiving entityliving) { + public boolean isDamaged(int i, Random random, EntityLiving entityliving) {
+ // Spigot end + // Spigot end
if (!this.g()) { if (!this.e()) {
return false; return false;
} else { } else {
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
@ -43,10 +41,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) { public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) { if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) { if (this.e()) {
- if (this.isDamaged(i, entityliving.aI())) { - if (this.isDamaged(i, entityliving.bb())) {
+ if (this.isDamaged(i, entityliving.aI(), entityliving)) { // Spigot + if (this.isDamaged(i, entityliving.bb(), entityliving)) { // Spigot
entityliving.a(this); entityliving.b(this);
--this.count; --this.count;
if (entityliving instanceof EntityHuman) { if (entityliving instanceof EntityHuman) {
-- --

View file

@ -20,15 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot end + // Spigot end
lines = new String[sign.lines.length]; lines = new String[sign.lines.length];
System.arraycopy(sign.lines, 0, lines, 0, lines.length); System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
} }
@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockState implements Sign {
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
- if (result) {
+ if (result && sign != null) { // Spigot, add null check
sign.lines = sanitizeLines(lines);
sign.update();
}
-- --

View file

@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 17 Mar 2013 19:02:50 +1100
Subject: [PATCH] Faster UUID for entities
It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity {
this.random = new Random();
this.maxFireTicks = 1;
this.justCreated = true;
- this.uniqueID = UUID.randomUUID();
+ this.uniqueID = new UUID(random.nextLong(), random.nextLong()); // Spigot
this.as = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
--

View file

@ -12,28 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class RegionFileCache { public class RegionFileCache {
- private static final Map a = new HashMap(); - private static final Map a = Maps.newHashMap();
+ public static final Map a = new HashMap(); // CraftBukkit - private -> public + public static final Map a = Maps.newHashMap(); // Spigot - private -> public
public static synchronized RegionFile a(File file1, int i, int j) { public static synchronized RegionFile a(File file, int i, int j) {
File file2 = new File(file1, "region"); File file1 = new File(file, "region");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.MobEffectList;
import net.minecraft.server.PropertyManager;
import net.minecraft.server.ServerCommand;
+import net.minecraft.server.RegionFile;
+import net.minecraft.server.RegionFileCache;
import net.minecraft.server.ServerNBTManager;
import net.minecraft.server.WorldLoaderServer;
import net.minecraft.server.WorldManager;
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
worlds.remove(world.getName().toLowerCase()); worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle)); console.worlds.remove(console.worlds.indexOf(handle));
+
+ File parentFolder = world.getWorldFolder().getAbsoluteFile(); + File parentFolder = world.getWorldFolder().getAbsoluteFile();
+ +
+ // Synchronized because access to RegionFileCache.a is guarded by this lock. + // Synchronized because access to RegionFileCache.a is guarded by this lock.

View file

@ -1,72 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 19:08:41 +1100
Subject: [PATCH] Limit Custom Map Rendering
The default CraftBukkit render sequence for maps is ridiculously slow. By only using it when a custom renderer has been added (rarely in most cases), we can fallback to the Vanilla renderer for general usage. This leads to a much higher effiency overall, especially if no plugins are rendering such maps.
diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
@@ -0,0 +0,0 @@ public class WorldMapHumanTracker {
int i;
int j;
- org.bukkit.craftbukkit.map.RenderData render = this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()); // CraftBukkit
+ // Spigot start
+ boolean custom = this.worldMap.mapView.renderers.size() > 1 || !(this.worldMap.mapView.renderers.get(0) instanceof org.bukkit.craftbukkit.map.CraftMapRenderer);
+ org.bukkit.craftbukkit.map.RenderData render = (custom) ? this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()) : null; // CraftBukkit
if (--this.g < 0) {
this.g = 4;
- abyte = new byte[render.cursors.size() * 3 + 1]; // CraftBukkit
+ abyte = new byte[((custom) ? render.cursors.size() : this.worldMap.decorations.size()) * 3 + 1]; // CraftBukkit
abyte[0] = 1;
i = 0;
// CraftBukkit start
- for (i = 0; i < render.cursors.size(); ++i) {
- org.bukkit.map.MapCursor cursor = render.cursors.get(i);
- if (!cursor.isVisible()) continue;
- abyte[i * 3 + 1] = (byte) (cursor.getRawType() << 4 | cursor.getDirection() & 15);
- abyte[i * 3 + 2] = (byte) cursor.getX();
- abyte[i * 3 + 3] = (byte) cursor.getY();
+ // Spigot start
+ for (Iterator iterator = ((custom) ? render.cursors.iterator() : this.worldMap.decorations.values().iterator()); iterator.hasNext(); ++i) {
+ org.bukkit.map.MapCursor cursor = (custom) ? (org.bukkit.map.MapCursor) iterator.next() : null;
+ if (cursor != null && !cursor.isVisible()) continue;
+ WorldMapDecoration deco = (custom) ? null : (WorldMapDecoration) iterator.next();
+
+ abyte[i * 3 + 1] = (byte) (((custom) ? cursor.getRawType() : deco.type) << 4 | ((custom) ? cursor.getDirection() : deco.rotation) & 15);
+ abyte[i * 3 + 2] = (byte) ((custom) ? cursor.getX() : deco.locX);
+ abyte[i * 3 + 3] = (byte) ((custom) ? cursor.getY() : deco.locY);
}
+ // Spigot end
// CraftBukkit end
boolean flag = !itemstack.A();
@@ -0,0 +0,0 @@ public class WorldMapHumanTracker {
abyte1[2] = (byte) j;
for (int i1 = 0; i1 < abyte1.length - 3; ++i1) {
- abyte1[i1 + 3] = render.buffer[(i1 + j) * 128 + i]; // CraftBukkit
+ abyte1[i1 + 3] = ((custom) ? render.buffer : this.worldMap.colors)[(i1 + j) * 128 + i];
}
this.c[i] = -1;
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
@@ -0,0 +0,0 @@ import org.bukkit.map.MapView;
public final class CraftMapView implements MapView {
private final Map<CraftPlayer, RenderData> renderCache = new HashMap<CraftPlayer, RenderData>();
- private final List<MapRenderer> renderers = new ArrayList<MapRenderer>();
+ public final List<MapRenderer> renderers = new ArrayList<MapRenderer>(); // Spigot
private final Map<MapRenderer, Map<CraftPlayer, CraftMapCanvas>> canvases = new HashMap<MapRenderer, Map<CraftPlayer, CraftMapCanvas>>();
protected final WorldMap worldMap;
--

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/IRecipe.java --- a/src/main/java/net/minecraft/server/IRecipe.java
+++ b/src/main/java/net/minecraft/server/IRecipe.java +++ b/src/main/java/net/minecraft/server/IRecipe.java
@@ -0,0 +0,0 @@ public interface IRecipe { @@ -0,0 +0,0 @@ public interface IRecipe {
ItemStack b(); ItemStack[] b(InventoryCrafting inventorycrafting);
org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
+ +
+ java.util.List<ItemStack> getIngredients(); // Spigot + java.util.List<ItemStack> getIngredients(); // Spigot
@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java --- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java +++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -0,0 +0,0 @@ public class ShapedRecipes implements IRecipe { @@ -0,0 +0,0 @@ public class ShapedRecipes implements IRecipe {
private int width; private final int width;
private int height; private final int height;
private ItemStack[] items; private final ItemStack[] items;
- private ItemStack result; - private final ItemStack result;
+ public ItemStack result; // Spigot + public ItemStack result; // Spigot
private boolean e; private boolean e;

View file

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public double getDamage() + public double getDamage()
+ { + {
+ return getHandle().e(); + return getHandle().j();
+ } + }
+ +
+ @Override + @Override

View file

@ -9,73 +9,71 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java --- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
} }
if (flag) { if (flag) {
- this.c(8); - this.d(8);
+ this.c(world.spigotConfig.hopperTransfer); // Spigot + this.d(world.spigotConfig.hopperTransfer); // Spigot
this.update(); this.update();
return true; return true;
} }
} }
+ // Spigot start + // Spigot start
+ if ( !this.j() ) + if ( !this.n() )
+ { + {
+ this.c( world.spigotConfig.hopperCheck ); + this.d( world.spigotConfig.hopperCheck );
+ } + }
+ // Spigot end + // Spigot end
return false; return false;
} else { } else {
return false; return false;
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
if (this.getItem(j) != null) { // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection);
ItemStack itemstack = this.getItem(j).cloneItemStack();
// CraftBukkit start - Call event when pushing items into other inventories // CraftBukkit start - Call event when pushing items into other inventories
- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, 1)); - CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1));
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, world.spigotConfig.hopperAmount)); // Spigot + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot
Inventory destinationInventory; Inventory destinationInventory;
// Have to special case large chests as they work oddly // Have to special case large chests as they work oddly
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
this.getWorld().getServer().getPluginManager().callEvent(event); this.getWorld().getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
this.setItem(j, itemstack); this.setItem(i, itemstack);
- this.c(8); // Delay hopper checks - this.d(8); // Delay hopper checks
+ this.c(world.spigotConfig.hopperTransfer); // Spigot + this.d(world.spigotConfig.hopperTransfer); // Spigot
return false; return false;
} }
+ int origCount = event.getItem().getAmount(); // Spigot + int origCount = event.getItem().getAmount(); // Spigot
ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), i); ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
-
if (itemstack1 == null || itemstack1.count == 0) { if (itemstack1 == null || itemstack1.count == 0) {
if (event.getItem().equals(oitemstack)) { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
iinventory.update();
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper {
// CraftBukkit end // CraftBukkit end
return true; return true;
} }
- -
+ itemstack.count -= origCount - itemstack1.count; // Spigot + itemstack.count -= origCount - itemstack1.count; // Spigot
this.setItem(j, itemstack); this.setItem(i, itemstack);
} }
} }
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) {
ItemStack itemstack1 = itemstack.cloneItemStack(); ItemStack itemstack1 = itemstack.cloneItemStack();
// ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null);
// CraftBukkit start - Call event on collection of items from inventories into the hopper // CraftBukkit start - Call event on collection of items from inventories into the hopper
- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); - CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1));
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, ihopper.getWorld().spigotConfig.hopperAmount)); // Spigot + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, ihopper.getWorld().spigotConfig.hopperAmount)); // Spigot
Inventory sourceInventory; Inventory sourceInventory;
// Have to special case large chests as they work oddly // Have to special case large chests as they work oddly
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
iinventory.setItem(i, itemstack1); iinventory.setItem(i, itemstack1);
if (ihopper instanceof TileEntityHopper) { if (ihopper instanceof TileEntityHopper) {
- ((TileEntityHopper) ihopper).c(8); // Delay hopper checks - ((TileEntityHopper) ihopper).d(8); // Delay hopper checks
+ ((TileEntityHopper) ihopper).c(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot + ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot
} else if (ihopper instanceof EntityMinecartHopper) { } else if (ihopper instanceof EntityMinecartHopper) {
- ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks - ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks
+ ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot + ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot
@ -84,26 +82,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false; return false;
} }
+ int origCount = event.getItem().getAmount(); // Spigot + int origCount = event.getItem().getAmount(); // Spigot
ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), -1); ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
if (itemstack2 == null || itemstack2.count == 0) { if (itemstack2 == null || itemstack2.count == 0) {
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
// CraftBukkit end
return true; return true;
} }
+ itemstack1.count -= origCount - itemstack2.count; // Spigot + itemstack1.count -= origCount - itemstack2.count; // Spigot
iinventory.setItem(i, itemstack1); iinventory.setItem(i, itemstack1);
} }
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory;
if (tileentityhopper.o()) {
- tileentityhopper.d(8);
+ tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot
}
if (flag) {
if (iinventory instanceof TileEntityHopper) {
- ((TileEntityHopper) iinventory).c(8);
+ ((TileEntityHopper) iinventory).c(((TileEntityHopper) iinventory).world.spigotConfig.hopperTransfer); // Spigot
iinventory.update(); iinventory.update();
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ import java.util.Collection; @@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
entity.f(nbttagcompound); entity.f(nbttagcompound);
if (entity.world != null) { if (entity.world != null && flag) {
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled + // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
+ if (!event.isCancelled()) { + if (!event.isCancelled()) {
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ } + }
@ -41,22 +41,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity2.f(nbttagcompound2); entity2.f(nbttagcompound2);
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
+ // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled + // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b(), this.c(), this.d()); + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b().getX(), this.b().getY(), this.b().getZ());
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ continue; + continue;
+ } + }
if (entity.world != null) { if (entity.world != null && flag) {
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
} }
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
} }
} else if (entity instanceof EntityLiving && entity.world != null) { } else if (entity instanceof EntityLiving && entity.world != null && flag) {
((EntityInsentient) entity).prepare((GroupDataEntity) null); ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot start - call SpawnerSpawnEvent, abort if cancelled + // Spigot start - call SpawnerSpawnEvent, abort if cancelled
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
+ if (!event.isCancelled()) { + if (!event.isCancelled()) {
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ } + }
+ // Spigot end + // Spigot end
} }
@ -96,5 +96,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /** + /**
* Bucket methods * Bucket methods
*/ */
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) { public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemInHand) {
-- --

View file

@ -8,15 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
// CraftBukkit start - whole method // CraftBukkit start - whole method
- this.c.info(this.player.getName() + " issued server command: " + s); + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
+ if ( org.spigotmc.SpigotConfig.logCommands ) this.c.info(this.player.getName() + " issued server command: " + s); this.c.info(this.player.getName() + " issued server command: " + s);
CraftPlayer player = this.getPlayer(); CraftPlayer player = this.getPlayer();
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 11:54:32 +1000
Subject: [PATCH] Prevent Shutdown Hang
Prevents server hanging if players disconnect during the shutdown sequence.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
public void u() {
- for (int i = 0; i < this.players.size(); ++i) {
- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
+ while (!this.players.isEmpty()) {
+ // Spigot start
+ EntityPlayer p = (EntityPlayer) this.players.get( 0 );
+ p.playerConnection.disconnect( this.server.server.getShutdownMessage() );
+ if ( ( !this.players.isEmpty() ) && ( this.players.get( 0 ) == p ) )
+ {
+ this.players.remove( 0 ); // Prevent shutdown hang if already disconnected
+ }
+ // Spigot end
}
}
--

View file

@ -11,15 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
// CraftBukkit end // CraftBukkit end
if (packethandshakinginsetprotocol.d() > 5) { if (packethandshakinginsetprotocol.b() > 47) {
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.10"); - chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8");
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot + chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext); this.b.close(chatcomponenttext);
} else if (packethandshakinginsetprotocol.d() < 5) { } else if (packethandshakinginsetprotocol.b() < 47) {
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.10"); - chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8");
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot + chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext); this.b.close(chatcomponenttext);
} else { } else {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
@ -32,14 +32,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// return "You are not white-listed on this server!"; // return "You are not white-listed on this server!";
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
} else if (this.k.isBanned(socketaddress) && !this.k.get(gameprofile).hasExpired()) { } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.k.get(socketaddress); IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} else { } else {
// return this.players.size() >= this.maxPlayers ? "The server is full!" : null; // return this.players.size() >= this.maxPlayers ? "The server is full!" : null;
if (this.players.size() >= this.maxPlayers) { if (this.players.size() >= this.maxPlayers) {
- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); - event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
} }
} }
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static String whitelistMessage; + public static String whitelistMessage;
+ public static String unknownCommandMessage; + public static String unknownCommandMessage;
+ public static String serverFullMessage; + public static String serverFullMessage;
+ public static String outdatedClientMessage = "Outdated client! Please use {}"; + public static String outdatedClientMessage = "Outdated client! Please use {0}";
+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}"; + public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
+ private static String transform(String s) + private static String transform(String s)
+ { + {
@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ private static void messages() + private static void messages()
+ { + {
+ if (version < 4) + if (version < 8)
+ { + {
+ set( "messages.outdated-client", outdatedClientMessage ); + set( "messages.outdated-client", outdatedClientMessage );
+ set( "messages.outdated-server", outdatedServerMessage ); + set( "messages.outdated-server", outdatedServerMessage );

View file

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
} }
this.m = true; this.p = true;
- if (!this.lit && this.done) { - if (!this.lit && this.done) {
+ if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight + if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight
this.p(); this.n();
} }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot Start + // Spigot Start
+ if ( tileentity instanceof IInventory ) + if ( tileentity instanceof IInventory )
+ { + {
+ for ( org.bukkit.entity.HumanEntity h : new ArrayList<org.bukkit.entity.HumanEntity>( (List) ( (IInventory) tileentity ).getViewers() ) ) + for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList((List<org.bukkit.entity.HumanEntity>) ( (IInventory) tileentity ).getViewers() ) )
+ { + {
+ if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
+ { + {
@ -26,16 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot End + // Spigot End
this.world.a(tileentity); this.world.b(tileentity);
} }
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
java.util.Iterator<Object> iter = this.entitySlices[i].iterator(); java.util.Iterator<Entity> iter = newList.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Entity entity = (Entity) iter.next(); Entity entity = iter.next();
+ // Spigot Start + // Spigot Start
+ if ( entity instanceof IInventory ) + if ( entity instanceof IInventory )
+ { + {
+ for ( org.bukkit.entity.HumanEntity h : new ArrayList<org.bukkit.entity.HumanEntity>( (List) ( (IInventory) entity ).getViewers() ) ) + for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList( (List<org.bukkit.entity.HumanEntity>) ( (IInventory) entity ).getViewers() ) )
+ { + {
+ if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
+ { + {
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
} }
public void b(int i) { public void c(int i) {
+ // Spigot Start + // Spigot Start
+ for ( HumanEntity human : new java.util.ArrayList<HumanEntity>( transaction ) ) + for ( HumanEntity human : new java.util.ArrayList<HumanEntity>( transaction ) )
+ { + {
@ -62,6 +62,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot End + // Spigot End
this.b = false; this.b = false;
super.b(i); super.c(i);
} }
-- --

View file

@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
if (this.player.dead) return; // CraftBukkit PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver); Entity entity = packetplayinuseentity.a((World) worldserver);
+ // Spigot Start + // Spigot Start
+ if ( entity == player ) + if ( entity == player && !player.v() ) // RENAME
+ { + {
+ disconnect( "Cannot interact with self!" ); + disconnect( "Cannot interact with self!" );
+ return; + return;
+ } + }
+ // Spigot End + // Spigot End
this.player.v(); this.player.z();
if (entity != null) { if (entity != null) {
-- --

View file

@ -8,20 +8,20 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
} }
} }
// CraftBukkit end // CraftBukkit end
+ pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot + pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null; this.vehicle.passenger = null;
@@ -0,0 +0,0 @@ public abstract class Entity { }
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
} }
} }
// CraftBukkit end // CraftBukkit end
+ // Spigot Start + // Spigot Start
+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4 ) ) + if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) )
+ { + {
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ); + org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
+ pluginManager.callEvent( event ); + pluginManager.callEvent( event );
@ -31,19 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ // Spigot End + // Spigot End
+
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.passenger = null; this.vehicle.passenger = null;
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java }
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void setPassengerOf(Entity entity) {
// CraftBukkit end
if (this.vehicle != null && entity == null) {
+ world.getServer().getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
// CraftBukkit start - use parent method instead to correctly fire VehicleExitEvent
Entity originalVehicle = this.vehicle;
// First statement moved down, second statement handled in parent method.
-- --

View file

@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
Player respawnPlayer = this.cserver.getPlayer(entityplayer1); Player respawnPlayer = cserver.getPlayer(entityplayer1);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
this.cserver.getPluginManager().callEvent(respawnEvent); cserver.getPluginManager().callEvent(respawnEvent);
+ // Spigot Start + // Spigot Start
+ if (entityplayer.playerConnection.isDisconnected()) { + if (entityplayer.playerConnection.isDisconnected()) {
+ return entityplayer; + return entityplayer;

View file

@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit @@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneTorch extends BlockTorch { public class BlockRedstoneTorch extends BlockTorch {
private boolean isOn; - private static Map b = Maps.newHashMap();
- private static Map b = new HashMap();
+ private static Map b = new java.util.WeakHashMap(); // Spigot + private static Map b = new java.util.WeakHashMap(); // Spigot
private final boolean isOn;
private boolean a(World world, int i, int j, int k, boolean flag) { private boolean a(World world, BlockPosition blockposition, boolean flag) {
if (!b.containsKey(world)) {
-- --

View file

@ -8,28 +8,35 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
List list = this.world.getEntities(this, axisalignedbb); List list = this.world.getEntities(this, axisalignedbb);
- if (list != null) { + if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving)
+ if (list != null && this.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving) for (int i = 0; i < list.size(); ++i) {
for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i);
Entity entity = (Entity) list.get(i);
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
this.d(entity);
}
}
+ } // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
protected void bo() { protected void bK() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && !list.isEmpty()) { - if (list != null && !list.isEmpty()) {
+ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition + if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
@ -42,15 +49,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean collidesWithEntities = true; + public boolean collidesWithEntities = true;
+ +
+ @Override + @Override
+ public boolean R() + public boolean ad()
+ { + {
+ return this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving) + return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
+ } + }
+ +
+ @Override + @Override
+ public boolean S() + public boolean ae()
+ { + {
+ return this.collidesWithEntities && super.S(); // (second !this.isDead near bottom of EntityLiving) + return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving)
+ } + }
+ // Spigot end + // Spigot end

View file

@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.g[this.ticks % 100] = System.nanoTime() - i; this.g[this.ticks % 100] = System.nanoTime() - i;
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.a("snooper"); this.methodProfiler.a("snooper");
- if (!this.l.d() && this.ticks > 100) { - if (!this.m.d() && this.ticks > 100) {
+ if (getSnooperEnabled() && !this.l.d() && this.ticks > 100) { // Spigot + if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot
this.l.a(); this.m.a();
} }
- if (this.ticks % 6000 == 0) { - if (this.ticks % 6000 == 0) {
+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
this.l.b(); this.m.b();
} }
-- --

View file

@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 09:07:54 +1000
Subject: [PATCH] Lower Chunk Compression
Use a chunk compression level of 4 - this provides an optimal balance between speed and compression.
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk extends Packet {
this.b = chunk.locZ;
this.g = flag;
ChunkMap chunkmap = a(chunk, flag, i);
- Deflater deflater = new Deflater(-1);
+ Deflater deflater = new Deflater(4); // Spigot
this.d = chunkmap.c;
this.c = chunkmap.b;
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet {
@Override
protected Deflater initialValue() {
// Don't use higher compression level, slows things down too much
- return new Deflater(6);
+ return new Deflater(4); // Spigot 6 -> 4
}
};
// CraftBukkit end
--

View file

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public boolean isInvulnerable() + public boolean isInvulnerable()
+ { + {
+ return getHandle().isInvulnerable(); + return getHandle().isInvulnerable(net.minecraft.server.DamageSource.GENERIC);
+ } + }
}; };

View file

@ -8,10 +8,10 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
// Update client // Update client
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.g));
+ // Spigot Start + // Spigot Start
+ ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); + ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();

View file

@ -9,25 +9,16 @@ diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/ne
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java --- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) {
- this.a(world, i, j, k, 1, entityhuman);
+ this.a(world, i, j, k, 1, (EntityLiving) entityhuman); // Spigot - Fix decompile error!
world.setAir(i, j, k);
entityhuman.bF().damage(1, entityhuman);
return true;
@@ -0,0 +0,0 @@ public class BlockTNT extends Block { @@ -0,0 +0,0 @@ public class BlockTNT extends Block {
EntityArrow entityarrow = (EntityArrow) entity; EntityArrow entityarrow = (EntityArrow) entity;
if (entityarrow.isBurning()) { if (entityarrow.isBurning()) {
+ // CraftBukkit start + // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, i, j, k, Blocks.AIR, 0).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
world.setAir(i, j, k); world.setAir(blockposition);
} }
-- --

View file

@ -11,19 +11,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
private void a(World world) { private void a(World world) {
if (this.e == null) { if (this.d == null) {
+ // Spigot Start + // Spigot Start
+ if ( world.spigotConfig.saveStructureInfo ) + if ( world.spigotConfig.saveStructureInfo )
+ { + {
this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a());
+ } else + } else
+ { + {
+ this.e = new PersistentStructure( this.a() ); + this.d = new PersistentStructure( this.a() );
+ } + }
+ // Spigot End + // Spigot End
if (this.e == null) { if (this.d == null) {
this.e = new PersistentStructure(this.a()); this.d = new PersistentStructure(this.a());
world.a(this.a(), (PersistentBase) this.e); world.a(this.a(), (PersistentBase) this.d);
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityItem.java --- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
} // Craftbukkit end */
// ++this.age; // CraftBukkit - Moved up this.W();
- if (!this.world.isStatic && this.age >= 6000) { - if (!this.world.isStatic && this.age >= 6000) {
+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot + if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
// CraftBukkit start - fire ItemDespawnEvent // CraftBukkit start - fire ItemDespawnEvent

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
private float lastPitch = Float.MAX_VALUE; private float lastPitch = Float.MAX_VALUE;
private float lastYaw = Float.MAX_VALUE; private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false; private boolean justTeleported = false;
@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// For the PacketPlayOutBlockPlace hack :( // For the PacketPlayOutBlockPlace hack :(
Long lastPacket; Long lastPacket;
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
}
// CraftBukkit start - fire PlayerMoveEvent // CraftBukkit start - fire PlayerMoveEvent
Player player = this.getPlayer(); Player player = this.getPlayer();
+ // Spigot Start + // Spigot Start
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
Location to = player.getLocation().clone(); // Start off the To location as the Players current location. Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
this.lastPitch = to.getPitch(); this.lastPitch = to.getPitch();
// Skip the first time we do this // Skip the first time we do this

View file

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
if (block == this.g && i == this.h) { if (block == this.g && i == this.h) {
++this.at; ++this.ap;
- if (this.at == 1200) { - if (this.ap >= 1200) {
+ if (this.at >= world.spigotConfig.arrowDespawnRate) { // First int after shooter + if (this.ap >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
this.die(); this.die();
} }
} else {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 17:52:14 +1100
Subject: [PATCH] Fix packed ice generation
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block = world.getType(blockposition.a(i1, k, j1)).getBlock();
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE);
+ world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
}
if (k != 0 && l > 1) {
block = world.getType(blockposition.a(i1, -k, j1)).getBlock();
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE);
+ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
}
}
}
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block1 = world.getType(blockposition1).getBlock();
if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
- this.a(world, blockposition1, Blocks.PACKED_ICE);
+ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot
blockposition1 = blockposition1.down();
--l1;
if (l1 <= 0) {
--

View file

@ -4,11 +4,24 @@ Date: Tue, 5 Aug 2014 17:20:19 +0100
Subject: [PATCH] Watchdog Thread. Subject: [PATCH] Watchdog Thread.
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
// CraftBukkit end
- if (this.aQ() > 0L) {
+ if (false && this.aQ() > 0L) { // Spigot - disable
Thread thread = new Thread(new ThreadWatchdog(this));
thread.setName("Server Watchdog");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.a(crashreport); this.a(crashreport);
} finally { } finally {
try { try {
@ -16,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.stop(); this.stop();
this.isStopped = true; this.isStopped = true;
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();

View file

@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java +++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java
@@ -0,0 +0,0 @@ public class BlockFlowerPot extends BlockContainer { @@ -0,0 +0,0 @@ public class BlockFlowerPot extends BlockContainer {
if (tileentityflowerpot != null && tileentityflowerpot.a() != null) { if (tileentityflowerpot != null && tileentityflowerpot.b() != null) {
this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b())); a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c()));
+ tileentityflowerpot.a( null, 0 ); // Spigot + tileentityflowerpot.a( null, 0 ); // Spigot
} }
super.remove(world, i, j, k, block, l); super.remove(world, blockposition, iblockdata);
-- --

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public boolean isReady() { public boolean isReady() {
- return this.m && this.done && this.lit; - return this.p && this.done && this.lit;
+ // Spigot Start + // Spigot Start
+ /* + /*
+ * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. + * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client.
@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot End + // Spigot End
} }
public ChunkCoordIntPair l() { public ChunkCoordIntPair j() {
-- --

View file

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Wed, 9 Oct 2013 18:20:05 +1100
Subject: [PATCH] Fix BrewingStands Removing NBT / Potions
diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockBrewingStand.java
+++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java
@@ -0,0 +0,0 @@ public class BlockBrewingStand extends BlockContainer {
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
- world.addEntity(entityitem);
+ // Spigot Start
+ if ( itemstack.hasTag() )
+ {
+ entityitem.getItemStack().setTag( (NBTTagCompound) itemstack.getTag().clone() );
+ }
+ // Spigot End
+ world.addEntity( entityitem );
}
}
}
--

View file

@ -8,17 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInChat.java --- a/src/main/java/net/minecraft/server/PacketPlayInChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java
@@ -0,0 +0,0 @@ public class PacketPlayInChat extends Packet { @@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet {
return this.a;
} }
// CraftBukkit end
- public void handle(PacketListener packetlistener) { - public void a(PacketListener packetlistener) {
+ // Spigot Start + // Spigot Start
+ private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( + private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() );
+ public void handle(final PacketListener packetlistener) + @Override
+ public void a(final PacketListener packetlistener)
+ { + {
+ if ( a() ) + if ( !a.startsWith("/") )
+ { + {
+ executors.submit( new Runnable() + executors.submit( new Runnable()
+ { + {
@ -26,13 +27,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public void run() + public void run()
+ { + {
+ PacketPlayInChat.this.a( (PacketPlayInListener) packetlistener ); + PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener );
+ } + }
+ } ); + } );
+ return; + return;
+ } + }
+ // Spigot End + // Spigot End
this.a((PacketPlayInListener) packetlistener); this.a((PacketListenerPlayIn) packetlistener);
} }
} }
-- --

View file

@ -9,127 +9,111 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
} blockposition = new BlockPosition(this);
if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
this.world.setAir(i, j, k); this.world.setAir(blockposition);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
} } else if (!this.world.isStatic) {
this.die();
if (this.onGround) { return;
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
return;
} }
this.world.setTypeAndData(i, j, k, this.id, this.data, 3); this.world.setTypeAndData(blockposition, this.block, 3);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
// CraftBukkit end // CraftBukkit end
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
if (this.id instanceof BlockFalling) {
((BlockFalling) this.id).a(this.world, i, j, k, this.data);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java --- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion { @@ -0,0 +0,0 @@ public class Explosion {
j = chunkposition.y; blockposition = (BlockPosition) iterator.next();
k = chunkposition.z; Block block = this.world.getType(blockposition).getBlock();
block = this.world.getType(i, j, k);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
if (flag) { if (flag) {
double d0 = (double) ((float) i + this.world.random.nextFloat()); double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat());
double d1 = (double) ((float) j + this.world.random.nextFloat()); double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat());
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk extends Packet { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet {
this.b = chunk.locZ;
this.d = flag;
this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i);
+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
}
this.d = chunkmap.c; public void a(PacketDataSerializer packetdataserializer) {
this.c = chunkmap.b;
+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot
try {
this.f = chunkmap.a;
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
} private int[] b;
}; private ChunkMap[] c;
// CraftBukkit end private boolean d;
+ private World world; // Spigot + private World world; // Spigot
public PacketPlayOutMapChunkBulk() {} public PacketPlayOutMapChunkBulk() {}
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
Chunk chunk = (Chunk) list.get(k); this.b[j] = chunk.locZ;
ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); this.c[j] = chunkmap;
}
+ // Spigot start -
+ world = chunk.world; +
+ /* + world = ((Chunk) list.get(0)).getWorld(); // Spigot
if (buildBuffer.length < j + chunkmap.a.length) { }
byte[] abyte = new byte[j + chunkmap.a.length];
public void a(PacketDataSerializer packetdataserializer) {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
} }
System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length); for (i = 0; i < this.a.length; ++i) {
+ */ + world.spigotConfig.antiXrayInstance.obfuscate(this.a[i], this.b[i], this.c[i].b, this.c[i].a, world); // Spigot
+ // Spigot end packetdataserializer.writeBytes(this.c[i].a);
j += chunkmap.a.length;
this.a[k] = chunk.locX;
this.b[k] = chunk.locZ;
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet {
if (this.buffer != null) {
return;
} }
+ // Spigot start
+ int finalBufferSize = 0;
+ // Obfuscate all sections
+ for (int i = 0; i < a.length; i++) {
+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world);
+ finalBufferSize += inflatedBuffers[i].length;
+ }
+
+ // Now it's time to efficiently copy the chunk to the build buffer
+ buildBuffer = new byte[finalBufferSize];
+ int bufferLocation = 0;
+ for (int i = 0; i < a.length; i++) {
+ System.arraycopy(inflatedBuffers[i], 0, buildBuffer, bufferLocation, inflatedBuffers[i].length);
+ bufferLocation += inflatedBuffers[i].length;
+ }
+ // Spigot end
Deflater deflater = localDeflater.get();
deflater.reset();
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -0,0 +0,0 @@ public class PlayerInteractManager { @@ -0,0 +0,0 @@ public class PlayerInteractManager {
this.o = i1;
}
} }
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
} }
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
} }
public void a(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
return this.getType(i, k, j); this.d(blockposition.up(), block);
this.d(blockposition.north(), block);
this.d(blockposition.south(), block);
+ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, blockposition); // Spigot
} }
- public Block getType(int i, int j, int k) { public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
return this.worldProvider.p()[this.getLightLevel(blockposition)];
}
- public IBlockData getType(BlockPosition blockposition) {
+ // Spigot start + // Spigot start
+ public Block getType(int i, int j, int k) + public IBlockData getType(BlockPosition blockposition)
+ { + {
+ return getType( i, j, k, true ); + return getType( blockposition, true );
+ } + }
+ +
+ public Block getType(int i, int j, int k, boolean useCaptured) { + public IBlockData getType(BlockPosition blockposition, boolean useCaptured) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
- if (captureTreeGeneration) { - if (captureTreeGeneration) {
+ if (captureTreeGeneration && useCaptured) { + if (captureTreeGeneration && useCaptured) {
@ -137,14 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Iterator<BlockState> it = capturedBlockStates.iterator(); Iterator<BlockState> it = capturedBlockStates.iterator();
while (it.hasNext()) { while (it.hasNext()) {
BlockState previous = it.next(); BlockState previous = it.next();
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.e(i, j + 1, k, block);
this.e(i, j, k - 1, block);
this.e(i, j, k + 1, block);
+ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, i, j, k); // Spigot
}
public void b(int i, int j, int k, Block block, int l) {
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -153,9 +129,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import net.minecraft.util.gnu.trove.set.TByteSet; +import gnu.trove.set.TByteSet;
+import net.minecraft.util.gnu.trove.set.hash.TByteHashSet; +import gnu.trove.set.hash.TByteHashSet;
+import net.minecraft.server.Block; +import net.minecraft.server.Block;
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.Blocks; +import net.minecraft.server.Blocks;
+import net.minecraft.server.World; +import net.minecraft.server.World;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.util.CraftMagicNumbers;
@ -199,12 +176,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Starts the timings handler, then updates all blocks within the set radius + * Starts the timings handler, then updates all blocks within the set radius
+ * of the given coordinate, revealing them if they are hidden ores. + * of the given coordinate, revealing them if they are hidden ores.
+ */ + */
+ public void updateNearbyBlocks(World world, int x, int y, int z) + public void updateNearbyBlocks(World world, BlockPosition position)
+ { + {
+ if ( world.spigotConfig.antiXray ) + if ( world.spigotConfig.antiXray )
+ { + {
+ update.startTiming(); + update.startTiming();
+ updateNearbyBlocks( world, x, y, z, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower + updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
+ update.stopTiming(); + update.stopTiming();
+ } + }
+ } + }
@ -249,7 +226,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK); + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK);
+ break; + break;
+ case THE_END: + case THE_END:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.WHITESTONE); + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE);
+ break; + break;
+ default: + default:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE); + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE);
@ -277,24 +254,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Grab the block ID in the buffer. + // Grab the block ID in the buffer.
+ // TODO: extended IDs are not yet supported + // TODO: extended IDs are not yet supported
+ int blockId = buffer[index] & 0xFF; + int blockId = (buffer[index << 1] & 0xFF)
+ | ((buffer[(index << 1) + 1] & 0xFF) << 8);
+ blockId >>>= 4;
+ // Check if the block should be obfuscated + // Check if the block should be obfuscated
+ if ( obfuscateBlocks[blockId] ) + if ( obfuscateBlocks[blockId] )
+ { + {
+ // The world isn't loaded, bail out + // The world isn't loaded, bail out
+ if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) + if ( !isLoaded( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) )
+ { + {
+ index++; + index++;
+ continue; + continue;
+ } + }
+ // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate + // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate
+ if ( !hasTransparentBlockAdjacent( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) + if ( !hasTransparentBlockAdjacent( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) )
+ { + {
+ int newId = blockId;
+ switch ( world.spigotConfig.engineMode ) + switch ( world.spigotConfig.engineMode )
+ { + {
+ case 1: + case 1:
+ // Replace with replacement material + // Replace with replacement material
+ buffer[index] = replaceWithTypeId; + newId = replaceWithTypeId & 0xFF;
+ break; + break;
+ case 2: + case 2:
+ // Replace with random ore. + // Replace with random ore.
@ -302,9 +282,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ randomOre = 0; + randomOre = 0;
+ } + }
+ buffer[index] = replacementOres[randomOre++]; + newId = replacementOres[randomOre++] & 0xFF;
+ break; + break;
+ } + }
+ newId <<= 4;
+ buffer[index << 1] = (byte) (newId & 0xFF);
+ buffer[(index << 1) + 1] = (byte) ((newId >> 8) & 0xFF);
+ } + }
+ } + }
+ +
@ -317,56 +300,56 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ +
+ private void updateNearbyBlocks(World world, int x, int y, int z, int radius, boolean updateSelf) + private void updateNearbyBlocks(World world, BlockPosition position, int radius, boolean updateSelf)
+ { + {
+ // If the block in question is loaded + // If the block in question is loaded
+ if ( world.isLoaded( x, y, z ) ) + if ( world.isLoaded( position ) )
+ { + {
+ // Get block id + // Get block id
+ Block block = world.getType(x, y, z); + Block block = world.getType(position).getBlock();
+ +
+ // See if it needs update + // See if it needs update
+ if ( updateSelf && obfuscateBlocks[Block.getId( block )] ) + if ( updateSelf && obfuscateBlocks[Block.getId( block )] )
+ { + {
+ // Send the update + // Send the update
+ world.notify( x, y, z ); + world.notify( position );
+ } + }
+ +
+ // Check other blocks for updates + // Check other blocks for updates
+ if ( radius > 0 ) + if ( radius > 0 )
+ { + {
+ updateNearbyBlocks( world, x + 1, y, z, radius - 1, true ); + updateNearbyBlocks( world, position.east(), radius - 1, true );
+ updateNearbyBlocks( world, x - 1, y, z, radius - 1, true ); + updateNearbyBlocks( world, position.west(), radius - 1, true );
+ updateNearbyBlocks( world, x, y + 1, z, radius - 1, true ); + updateNearbyBlocks( world, position.up(), radius - 1, true );
+ updateNearbyBlocks( world, x, y - 1, z, radius - 1, true ); + updateNearbyBlocks( world, position.down(), radius - 1, true );
+ updateNearbyBlocks( world, x, y, z + 1, radius - 1, true ); + updateNearbyBlocks( world, position.south(), radius - 1, true );
+ updateNearbyBlocks( world, x, y, z - 1, radius - 1, true ); + updateNearbyBlocks( world, position.north(), radius - 1, true );
+ } + }
+ } + }
+ } + }
+ +
+ private static boolean isLoaded(World world, int x, int y, int z, int radius) + private static boolean isLoaded(World world, BlockPosition position, int radius)
+ { + {
+ return world.isLoaded( x, y, z ) + return world.isLoaded( position )
+ && ( radius == 0 || + && ( radius == 0 ||
+ ( isLoaded( world, x + 1, y, z, radius - 1 ) + ( isLoaded( world, position.east(), radius - 1 )
+ && isLoaded( world, x - 1, y, z, radius - 1 ) + && isLoaded( world, position.west(), radius - 1 )
+ && isLoaded( world, x, y + 1, z, radius - 1 ) + && isLoaded( world, position.up(), radius - 1 )
+ && isLoaded( world, x, y - 1, z, radius - 1 ) + && isLoaded( world, position.down(), radius - 1 )
+ && isLoaded( world, x, y, z + 1, radius - 1 ) + && isLoaded( world, position.south(), radius - 1 )
+ && isLoaded( world, x, y, z - 1, radius - 1 ) ) ); + && isLoaded( world, position.north(), radius - 1 ) ) );
+ } + }
+ +
+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) + private static boolean hasTransparentBlockAdjacent(World world, BlockPosition position, int radius)
+ { + {
+ return !isSolidBlock(world.getType(x, y, z, false)) /* isSolidBlock */ + return !isSolidBlock(world.getType(position, false).getBlock()) /* isSolidBlock */
+ || ( radius > 0 + || ( radius > 0
+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) + && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, position.west(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, position.up(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, position.down(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 ) + || hasTransparentBlockAdjacent( world, position.south(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) ); + || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) );
+ } + }
+ +
+ private static boolean isSolidBlock(Block block) { + private static boolean isSolidBlock(Block block) {
@ -375,7 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // rendering they can be seen through therefor we special + // rendering they can be seen through therefor we special
+ // case them so that the antixray doesn't show the fake + // case them so that the antixray doesn't show the fake
+ // blocks around them. + // blocks around them.
+ return block.r() && block != Blocks.MOB_SPAWNER; + return block.isOccluding() && block != Blocks.MOB_SPAWNER;
+ } + }
+} +}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 17:52:14 +1100
Subject: [PATCH] Fix packed ice generation
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block = world.getType(i + l1, j + j1, k + i2);
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
- this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + l1, j + j1, k + i2, Blocks.PACKED_ICE); // Spigot
}
if (j1 != 0 && k1 > 1) {
block = world.getType(i + l1, j - j1, k + i2);
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
- this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + l1, j - j1, k + i2, Blocks.PACKED_ICE); // Spigot
}
}
}
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block1 = world.getType(i + j2, l1, k + k1);
if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
- this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + j2, l1, k + k1, Blocks.PACKED_ICE); // Spigot
--l1;
--k2;
if (k2 <= 0) {
--

View file

@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Entity a; private final Entity a;
private boolean b = true; private boolean b = true;
- private static final HashMap c = new HashMap(); - private static final Map c = Maps.newHashMap();
- private final Map d = new HashMap(); - private final Map d = Maps.newHashMap();
+ // Spigot Start + // Spigot Start
+ private static final net.minecraft.util.gnu.trove.map.TObjectIntMap classToId = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); + private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 );
+ private final net.minecraft.util.gnu.trove.map.TIntObjectMap dataValues = new net.minecraft.util.gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); + private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 );
+ // These exist as an attempt at backwards compatability for (broken) NMS plugins + // These exist as an attempt at backwards compatability for (broken) NMS plugins
+ private static final Map c = net.minecraft.util.gnu.trove.TDecorators.wrap( classToId ); + private static final Map c = gnu.trove.TDecorators.wrap( classToId );
+ private final Map d = net.minecraft.util.gnu.trove.TDecorators.wrap( dataValues ); + private final Map d = gnu.trove.TDecorators.wrap( dataValues );
+ // Spigot End + // Spigot End
private boolean e; private boolean e;
private ReadWriteLock f = new ReentrantReadWriteLock(); private ReadWriteLock f = new ReentrantReadWriteLock();
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public void a(int i, Object object) { public void a(int i, Object object) {
- Integer integer = (Integer) c.get(object.getClass()); - Integer integer = (Integer) DataWatcher.c.get(object.getClass());
+ int integer = classToId.get(object.getClass()); // Spigot + int integer = classToId.get(object.getClass()); // Spigot
- if (integer == null) { - if (integer == null) {
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.b = false; this.b = false;
} }
@@ -0,0 +0,0 @@ public class DataWatcher { @@ -0,0 +0,0 @@ public class DataWatcher {
WatchableObject watchableobject = new WatchableObject(j, i, null); WatchableObject watchableobject = new WatchableObject(j, i, (Object) null);
this.f.writeLock().lock(); this.f.writeLock().lock();
- this.d.put(Integer.valueOf(i), watchableobject); - this.d.put(Integer.valueOf(i), watchableobject);
@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public List c() { public List c() {
- ArrayList arraylist = null; - ArrayList arraylist = null;
+ ArrayList arraylist = new ArrayList(); // Spigot + ArrayList arraylist = Lists.newArrayList(); // Spigot
this.f.readLock().lock(); this.f.readLock().lock();
@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { - for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) {
- watchableobject = (WatchableObject) iterator.next(); - watchableobject = (WatchableObject) iterator.next();
- if (arraylist == null) { - if (arraylist == null) {
- arraylist = new ArrayList(); - arraylist = Lists.newArrayList();
- } - }
- } - }
+ arraylist.addAll(this.dataValues.valueCollection()); // Spigot + arraylist.addAll(this.dataValues.valueCollection()); // Spigot
@ -111,13 +111,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
static { static {
- c.put(Byte.class, Integer.valueOf(0)); - DataWatcher.c.put(Byte.class, Integer.valueOf(0));
- c.put(Short.class, Integer.valueOf(1)); - DataWatcher.c.put(Short.class, Integer.valueOf(1));
- c.put(Integer.class, Integer.valueOf(2)); - DataWatcher.c.put(Integer.class, Integer.valueOf(2));
- c.put(Float.class, Integer.valueOf(3)); - DataWatcher.c.put(Float.class, Integer.valueOf(3));
- c.put(String.class, Integer.valueOf(4)); - DataWatcher.c.put(String.class, Integer.valueOf(4));
- c.put(ItemStack.class, Integer.valueOf(5)); - DataWatcher.c.put(ItemStack.class, Integer.valueOf(5));
- c.put(ChunkCoordinates.class, Integer.valueOf(6)); - DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6));
- DataWatcher.c.put(Vector3f.class, Integer.valueOf(7));
+ // Spigot Start - remove valueOf + // Spigot Start - remove valueOf
+ classToId.put(Byte.class, 0); + classToId.put(Byte.class, 0);
+ classToId.put(Short.class, 1); + classToId.put(Short.class, 1);
@ -125,7 +126,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ classToId.put(Float.class, 3); + classToId.put(Float.class, 3);
+ classToId.put(String.class, 4); + classToId.put(String.class, 4);
+ classToId.put(ItemStack.class, 5); + classToId.put(ItemStack.class, 5);
+ classToId.put(ChunkCoordinates.class, 6); + classToId.put(BlockPosition.class, 6);
+ classToId.put(Vector3f.class, 7);
+ // Spigot End + // Spigot End
} }
} }

View file

@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
}
} }
+ // Spigot start + // Spigot start
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot end + // Spigot end
+ +
public void c() { public void b() {
+ // Spigot start - Moved to initUUID + // Spigot start - Moved to initUUID
+ /* + /*
if (!this.i.isComplete()) { if (!this.i.isComplete()) {
@ -31,45 +31,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot end + // Spigot end
// CraftBukkit start - fire PlayerLoginEvent // CraftBukkit start - fire PlayerLoginEvent
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, this.hostname); EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
this.g = EnumProtocolState.KEY; this.g = EnumProtocolState.KEY;
this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.K().getPublic(), this.e), new GenericFutureListener[0]); this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.P().getPublic(), this.e));
} else { } else {
- this.g = EnumProtocolState.READY_TO_ACCEPT; - this.g = EnumProtocolState.READY_TO_ACCEPT;
+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot + (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot
} }
}
}
diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java --- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java +++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { @@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread {
GameProfile gameprofile = LoginListener.a(this.a); GameProfile gameprofile = LoginListener.b(this.a);
try { try {
+ // Spigot Start + // Spigot Start
+ if ( !LoginListener.c( this.a ).getOnlineMode() ) + if ( !LoginListener.a( this.a ).getOnlineMode() )
+ { + {
+ a.initUUID(); + a.initUUID();
+ fireLoginEvents(); + fireLoginEvents();
+ return; + return;
+ } + }
+ // Spigot End + // Spigot End
String s = (new BigInteger(MinecraftEncryption.a(LoginListener.b(this.a), LoginListener.c(this.a).K().getPublic(), LoginListener.d(this.a)))).toString(16); String s = (new BigInteger(MinecraftEncryption.a(LoginListener.c(this.a), LoginListener.a(this.a).P().getPublic(), LoginListener.d(this.a)))).toString(16);
LoginListener.a(this.a, LoginListener.c(this.a).av().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s));
if (LoginListener.a(this.a) != null) { if (LoginListener.b(this.a) != null) {
- // CraftBukkit start - fire PlayerPreLoginEvent - // CraftBukkit start - fire PlayerPreLoginEvent
- if (!this.a.networkManager.isConnected()) { - if (!this.a.networkManager.g()) {
- return; - return;
- } - }
- -
- String playerName = LoginListener.a(this.a).getName(); - String playerName = LoginListener.b(this.a).getName();
- java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); - java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
- java.util.UUID uniqueId = LoginListener.a(this.a).getId(); - java.util.UUID uniqueId = LoginListener.b(this.a).getId();
- final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; - final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
- -
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
- server.getPluginManager().callEvent(asyncEvent); - server.getPluginManager().callEvent(asyncEvent);
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- return event.getResult(); - return event.getResult();
- }}; - }};
- -
- LoginListener.c(this.a).processQueue.add(waitable); - LoginListener.a(this.a).processQueue.add(waitable);
- if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { - if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.a.disconnect(event.getKickMessage()); - this.a.disconnect(event.getKickMessage());
- return; - return;
@ -98,29 +98,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- } - }
- } - }
- // CraftBukkit end - // CraftBukkit end
- -
- LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); - LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId());
- LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); - LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
+ fireLoginEvents(); // Spigot + fireLoginEvents(); // Spigot
} else if (LoginListener.c(this.a).N()) { } else if (LoginListener.a(this.a).S()) {
LoginListener.e().warn("Failed to verify username but will let them in anyway!"); LoginListener.e().warn("Failed to verify username but will let them in anyway!");
LoginListener.a(this.a, this.a.a(gameprofile)); LoginListener.a(this.a, this.a.a(gameprofile));
@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { @@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread {
// CraftBukkit end
} }
} }
+ +
+ private void fireLoginEvents() throws Exception + private void fireLoginEvents() throws Exception
+ { + {
+ // CraftBukkit start - fire PlayerPreLoginEvent + // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!this.a.networkManager.isConnected()) { + if (!this.a.networkManager.g()) {
+ return; + return;
+ } + }
+ +
+ String playerName = LoginListener.a(this.a).getName(); + String playerName = LoginListener.b(this.a).getName();
+ java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); + java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
+ java.util.UUID uniqueId = LoginListener.a(this.a).getId(); + java.util.UUID uniqueId = LoginListener.b(this.a).getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; + final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
+ +
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
+ server.getPluginManager().callEvent(asyncEvent); + server.getPluginManager().callEvent(asyncEvent);
@ -137,7 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return event.getResult(); + return event.getResult();
+ }}; + }};
+ +
+ LoginListener.c(this.a).processQueue.add(waitable); + LoginListener.a(this.a).processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(event.getKickMessage()); + this.a.disconnect(event.getKickMessage());
+ return; + return;
@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
+ LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); + LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId());
+ LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
+ } + }
} }

View file

@ -9,20 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java --- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@ import java.util.HashMap;
package net.minecraft.server;
+import net.minecraft.util.com.mojang.authlib.properties.Property; // Spigot
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
// CraftBukkit start
import java.net.InetAddress;
import java.util.HashMap;
+import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
// CraftBukkit end // CraftBukkit end
public class HandshakeListener implements PacketHandshakingInListener { public class HandshakeListener implements PacketHandshakingInListener {
-
+
+ private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot + private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot
// CraftBukkit start - add fields // CraftBukkit start - add fields
private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>(); private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
@ -36,18 +28,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ String[] split = packethandshakinginsetprotocol.b.split("\00"); + String[] split = packethandshakinginsetprotocol.b.split("\00");
+ if ( split.length == 3 || split.length == 4 ) { + if ( split.length == 3 || split.length == 4 ) {
+ packethandshakinginsetprotocol.b = split[0]; + packethandshakinginsetprotocol.b = split[0];
+ b.n = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); + b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.spoofedUUID = UUIDTypeAdapter.fromString( split[2] ); + b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
+ } else + } else
+ { + {
+ chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); + chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
+ this.b.close(chatcomponenttext); + this.b.close(chatcomponenttext);
+ return; + return;
+ } + }
+ if ( split.length == 4 ) + if ( split.length == 4 )
+ { + {
+ b.spoofedProfile = gson.fromJson(split[3], Property[].class); + b.spoofedProfile = gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
+ } + }
+ } + }
+ // Spigot End + // Spigot End
@ -58,15 +50,7 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ import javax.crypto.SecretKey; @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
import net.minecraft.util.com.google.common.base.Charsets;
import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.util.com.mojang.authlib.properties.Property;
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.util.org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
// Spigot start // Spigot start
public void initUUID() public void initUUID()
{ {
@ -84,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ if (networkManager.spoofedProfile != null) + if (networkManager.spoofedProfile != null)
+ { + {
+ for ( Property property : networkManager.spoofedProfile ) + for ( com.mojang.authlib.properties.Property property : networkManager.spoofedProfile )
+ { + {
+ this.i.getProperties().put( property.getName(), property ); + this.i.getProperties().put( property.getName(), property );
+ } + }
@ -96,36 +80,28 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ import javax.crypto.SecretKey;
import net.minecraft.util.com.google.common.collect.Queues;
import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
+import net.minecraft.util.com.mojang.authlib.properties.Property;
import net.minecraft.util.io.netty.channel.Channel;
import net.minecraft.util.io.netty.channel.ChannelFutureListener;
import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
private final Queue k = Queues.newConcurrentLinkedQueue(); private final EnumProtocolDirection g;
private final Queue l = Queues.newConcurrentLinkedQueue(); private final Queue h = Queues.newConcurrentLinkedQueue();
private Channel m; private Channel i;
- private SocketAddress n; - private SocketAddress j;
+ // Spigot Start + // Spigot Start
+ public SocketAddress n; + public SocketAddress j;
+ public java.util.UUID spoofedUUID; + public java.util.UUID spoofedUUID;
+ public Property[] spoofedProfile; + public com.mojang.authlib.properties.Property[] spoofedProfile;
+ // Spigot End + // Spigot End
private PacketListener o; private PacketListener k;
private EnumProtocol p; private IChatBaseComponent l;
private IChatBaseComponent q; private boolean m;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
static Channel a(NetworkManager networkmanager) { static Channel a(NetworkManager networkmanager) {
return networkmanager.m; return networkmanager.i;
} }
+ +
+ // Spigot Start + // Spigot Start
+ public SocketAddress getRawAddress() + public SocketAddress getRawAddress()
+ { + {
+ return this.m.remoteAddress(); + return this.i.remoteAddress();
+ } + }
+ // Spigot End + // Spigot End
} }
@ -133,14 +109,14 @@ diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol extends Packet { @@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet {
public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws public void a(PacketDataSerializer packetdataserializer) {
this.a = packetdataserializer.a(); this.a = packetdataserializer.e();
- this.b = packetdataserializer.c(255); - this.b = packetdataserializer.c(255);
+ this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot + this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot
this.c = packetdataserializer.readUnsignedShort(); this.c = packetdataserializer.readUnsignedShort();
this.d = EnumProtocol.a(packetdataserializer.a()); this.d = EnumProtocol.a(packetdataserializer.e());
} }
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -148,13 +124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, new PlayerInteractManager(this.server.getWorldServer(0))); EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), gameprofile, new PlayerInteractManager(server.getWorldServer(0)));
Player player = entity.getBukkitEntity(); Player player = entity.getBukkitEntity();
- PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress()); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); + PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());
String s; String s;
if (this.j.isBanned(gameprofile) && !this.j.get(gameprofile).hasExpired()) { if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -10,21 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityZombie.java --- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
this.getNavigation().b(true); }
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false)); protected void n() {
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); - this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); } // Spigot + if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); // Spigot
this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true));
this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false)); this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true)); + if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true)); this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false)); } // Spigot
this.a(0.6F, 1.8F);
} }
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -9,33 +9,33 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
private final List n = new ArrayList(); private final List o = Lists.newArrayList();
private final ICommandHandler o; private final ICommandHandler p;
public final MethodProfiler methodProfiler = new MethodProfiler(); public final MethodProfiler methodProfiler = new MethodProfiler();
- private final ServerConnection p; - private final ServerConnection q;
+ private ServerConnection p; // Spigot + private ServerConnection q; // Spigot
private final ServerPing q = new ServerPing(); private final ServerPing r = new ServerPing();
private final Random r = new Random(); private final Random s = new Random();
private String serverIp; private String serverIp;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
j = this;
this.d = proxy; this.d = proxy;
// this.universe = file1; // CraftBukkit MinecraftServer.k = this;
- this.p = new ServerConnection(this); // this.universe = file; // CraftBukkit
+ // this.p = new ServerConnection(this); // Spigot - this.q = new ServerConnection(this);
this.o = new CommandDispatcher(); + // this.q = new ServerConnection(this); // Spigot
// this.convertable = new WorldLoaderServer(file1); // CraftBukkit - moved to DedicatedServer.init this.Z = new UserCache(this, file1);
this.T = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); this.p = this.h();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
} }
// Spigot End // Spigot End
public ServerConnection ai() { public ServerConnection ao() {
- return this.p; - return this.q;
+ return ( this.p ) == null ? this.p = new ServerConnection( this ) : this.p; // Spigot + return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot
} }
public boolean ak() { public boolean aq() {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
private void a(World world) { private void a(World world) {
if (this.e == null) { if (this.d == null) {
// Spigot Start // Spigot Start
- if ( world.spigotConfig.saveStructureInfo ) - if ( world.spigotConfig.saveStructureInfo )
+ if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) ) + if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) )
{ {
this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a());
} else } else
-- --

View file

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 8 Dec 2013 16:52:42 +1100
Subject: [PATCH] Remove OS X Special Chars from Signs
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener {
for (j = 0; j < 4; ++j) {
boolean flag = true;
+ packetplayinupdatesign.f()[j] = packetplayinupdatesign.f()[j].replaceAll( "\uF700", "" ).replaceAll( "\uF701", "" ); // Spigot - Mac OSX sends weird chars
if (packetplayinupdatesign.f()[j].length() > 15) {
flag = false;
--

View file

@ -8,14 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
i.error("Encountered an unexpected exception", throwable); MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
+ // Spigot Start + // Spigot Start
+ if ( throwable.getCause() != null ) + if ( throwable.getCause() != null )
+ { + {
+ i.error( "\tCause of unexpected exception was", throwable.getCause() ); + MinecraftServer.LOGGER.error( "\tCause of unexpected exception was", throwable.getCause() );
+ } + }
+ // Spigot End + // Spigot End
CrashReport crashreport = null; CrashReport crashreport = null;

View file

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- Validate.notNull(effect, "Effect cannot be null"); - Validate.notNull(effect, "Effect cannot be null");
- Validate.notNull(location.getWorld(), "World cannot be null"); - Validate.notNull(location.getWorld(), "World cannot be null");
- int packetData = effect.getId(); - int packetData = effect.getId();
- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false); - PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), data, false);
- int distance; - int distance;
- radius *= radius; - radius *= radius;
- -
@ -73,20 +73,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ( effect.getType() != Effect.Type.PARTICLE ) + if ( effect.getType() != Effect.Type.PARTICLE )
+ { + {
+ int packetData = effect.getId(); + int packetData = effect.getId();
+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); + packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false );
+ } else + } else
+ { + {
+ StringBuilder particleFullName = new StringBuilder(); + net.minecraft.server.EnumParticle particle = null;
+ particleFullName.append( effect.getName() ); + int[] extra = null;
+ if ( effect.getData() != null && ( effect.getData().equals( org.bukkit.Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) + for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() )
+ { + {
+ particleFullName.append( '_' ).append( id ); + if ( effect.getName().startsWith( p.b().replace("_", "") ) )
+ {
+ particle = p;
+ if ( effect.getData() != null )
+ {
+ if ( effect.getData().equals( org.bukkit.Material.class ) )
+ {
+ extra = new int[]{ id };
+ } else
+ {
+ extra = new int[]{ (id << 4) | data };
+ }
+ }
+ break;
+ }
+ } + }
+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) + if ( extra == null )
+ { + {
+ particleFullName.append( '_' ).append( data ); + extra = new int[0];
+ } + }
+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); + packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra );
+ } + }
+ int distance; + int distance;
+ radius *= radius; + radius *= radius;
@ -135,20 +149,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ( effect.getType() != Effect.Type.PARTICLE ) + if ( effect.getType() != Effect.Type.PARTICLE )
+ { + {
+ int packetData = effect.getId(); + int packetData = effect.getId();
+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); + packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false );
+ } else + } else
+ { + {
+ StringBuilder particleFullName = new StringBuilder(); + net.minecraft.server.EnumParticle particle = null;
+ particleFullName.append( effect.getName() ); + int[] extra = null;
+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) + for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() )
+ { + {
+ particleFullName.append( '_' ).append( id ); + if ( effect.getName().startsWith( p.b().replace("_", "") ) )
+ {
+ particle = p;
+ if ( effect.getData() != null )
+ {
+ if ( effect.getData().equals( org.bukkit.Material.class ) )
+ {
+ extra = new int[]{ id };
+ } else
+ {
+ extra = new int[]{ (id << 4) | data };
+ }
+ }
+ break;
+ }
+ } + }
+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) + if ( extra == null )
+ { + {
+ particleFullName.append( '_' ).append( data ); + extra = new int[0];
+ } + }
+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); + packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra );
+ } + }
+ int distance; + int distance;
+ radius *= radius; + radius *= radius;

View file

@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
+ nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived); + nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived);
// CraftBukkit end // CraftBukkit end
this.b(nbttagcompound); if (this.getCustomName() != null && this.getCustomName().length() > 0) {
if (this.vehicle != null) { nbttagcompound.setString("CustomName", this.getCustomName());
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
EntityLiving entity = (EntityLiving) this; EntityLiving entity = (EntityLiving) this;

View file

@ -14,14 +14,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- for (int k1 = i; k1 < j; ++k1) { - for (int k1 = i; k1 < j; ++k1) {
- for (int l1 = i1; l1 < j1; ++l1) { - for (int l1 = i1; l1 < j1; ++l1) {
- if (this.isLoaded(k1, 64, l1)) { - if (this.isLoaded(new BlockPosition(k1, 64, l1))) {
- for (int i2 = k - 1; i2 < l; ++i2) { - for (int i2 = k - 1; i2 < l; ++i2) {
- Block block; - BlockPosition blockposition = new BlockPosition(k1, i2, l1);
- boolean flag = entity.aS();
- boolean flag1 = this.a(this.af(), entity);
- -
- if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { - if (flag && flag1) {
- block = this.getType(k1, i2, l1); - entity.h(false);
- } else { - } else if (!flag && !flag1) {
- block = Blocks.STONE; - entity.h(true);
- }
+ // Spigot start + // Spigot start
+ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 ); + int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 );
+ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ ) + for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ )
@ -29,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int cx = chunkx << 4; + int cx = chunkx << 4;
+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) + for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
+ { + {
+ if ( !this.isChunkLoaded( chunkx, chunkz ) ) + if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
+ { + {
+ continue; + continue;
+ } + }
@ -47,14 +50,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ { + {
+ for ( int y = ystart; y < l; y++ ) + for ( int y = ystart; y < l; y++ )
+ { + {
+ Block block = chunk.getType(x - cx, y, z - cz ); + BlockPosition blockposition = new BlockPosition( x, y, z );
+ boolean flag = entity.aS();
+ boolean flag1 = this.a(this.af(), entity);
+
+ if (flag && flag1) {
+ entity.h(false);
+ } else if (!flag && !flag1) {
+ entity.h(true);
+ }
- IBlockData iblockdata;
+ IBlockData iblockdata;
- if (!this.af().a(blockposition) && flag1) {
- iblockdata = Blocks.STONE.getBlockData();
- } else {
- iblockdata = this.getType(blockposition);
+ IBlockData block;
+ if (!this.af().a(blockposition) && flag1) {
+ block = Blocks.STONE.getBlockData();
+ } else
+ {
+ block = chunk.getBlockData( blockposition );
+ }
+ if ( block != null ) + if ( block != null )
+ { + {
+ block.a( this, x, y, z, axisalignedbb, this.L, entity ); + block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity);
+ } + }
} }
- -
- block.a(this, k1, i2, l1, axisalignedbb, this.L, entity); - iblockdata.getBlock().a(this, blockposition, iblockdata, axisalignedbb, arraylist, entity);
} }
} }
} }

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState; public final boolean defaultActivationState;
public long activatedTick = 0; public long activatedTick = 0;
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.a("checkDespawn"); this.world.methodProfiler.a("checkDespawn");
this.w(); this.D();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
+ // Spigot Start + // Spigot Start
+ if ( this.fromMobSpawner ) + if ( this.fromMobSpawner )
@ -31,14 +31,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Spigot End + // Spigot End
this.world.methodProfiler.a("sensing"); this.world.methodProfiler.a("sensing");
this.bq.a(); this.bi.a();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
if (!event.isCancelled()) { if (!event.isCancelled()) {
entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot Start + // Spigot Start
@ -51,9 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
} }
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot Start + // Spigot Start
+ if ( entity.world.spigotConfig.nerfSpawnerMobs ) + if ( entity.world.spigotConfig.nerfSpawnerMobs )
+ { + {

View file

@ -11,14 +11,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.a(MinecraftEncryption.b()); this.a(MinecraftEncryption.b());
i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L()); DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.Q());
+ if (!org.spigotmc.SpigotConfig.lateBind) { + if (!org.spigotmc.SpigotConfig.lateBind) {
try { try {
this.ai().a(inetaddress, this.L()); this.ao().a(inetaddress, this.Q());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
i.warn("Perhaps a server is already running on that port?"); DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
return false; return false;
} }
+ } + }
@ -31,17 +31,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (org.spigotmc.SpigotConfig.lateBind) { + if (org.spigotmc.SpigotConfig.lateBind) {
+ try { + try {
+ this.ai().a(inetaddress, this.L()); + this.ao().a(inetaddress, this.Q());
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable + } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
+ i.warn("**** FAILED TO BIND TO PORT!"); + DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
+ i.warn("The exception was: {}", new Object[] { ioexception.toString()}); + DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ i.warn("Perhaps a server is already running on that port?"); + DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
+ return false; + return false;
+ } + }
+ } + }
return true; +
} if (false && this.aQ() > 0L) { // Spigot - disable
} Thread thread = new Thread(new ThreadWatchdog(this));
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { @@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager {
public ServerStatisticManager(MinecraftServer minecraftserver, File file1) { public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
this.c = minecraftserver; this.c = minecraftserver;
this.d = file1; this.d = file;
+ // Spigot start + // Spigot start
+ for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() ) + for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() )
+ { + {
@ -39,6 +39,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int j = statistic.d() ? this.getStatisticValue(statistic) : 0; int j = statistic.d() ? this.getStatisticValue(statistic) : 0;
super.setStatistic(entityhuman, statistic, i); super.setStatistic(entityhuman, statistic, i);
@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager {
return this.g;
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
@ -47,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; +import gnu.trove.map.hash.TObjectIntHashMap;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View file

@ -1,109 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 5 Jan 2014 09:35:01 +1100
Subject: [PATCH] Fix Biome Decoration Crashes
We don't really know what affect this will have on the terrain generation, but its better than crashing and not having terrain generate at all!
diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BiomeDecorator.java
+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java
@@ -0,0 +0,0 @@ public class BiomeDecorator {
for (j = 0; j < this.z; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
WorldGenerator worldgenerator = biomebase.b(this.b);
worldgenerator.generate(this.a, this.b, k, i1, l);
@@ -0,0 +0,0 @@ public class BiomeDecorator {
for (j = 0; j < this.A; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
(new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l);
}
@@ -0,0 +0,0 @@ public class BiomeDecorator {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) {
+ for (i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { // Spigot
;
}
@@ -0,0 +0,0 @@ public class BiomeDecorator {
if (this.b.nextInt(8) == 0) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
this.r.generate(this.a, this.b, k, i1, l);
}
}
@@ -0,0 +0,0 @@ public class BiomeDecorator {
if (this.b.nextInt(4) == 0) {
j = this.c + this.b.nextInt(16) + 8;
k = this.d + this.b.nextInt(16) + 8;
- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2);
+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot
this.q.generate(this.a, this.b, j, l, k);
}
if (this.b.nextInt(8) == 0) {
j = this.c + this.b.nextInt(16) + 8;
k = this.d + this.b.nextInt(16) + 8;
- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2);
+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot
this.r.generate(this.a, this.b, j, l, k);
}
for (j = 0; j < this.C; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
this.t.generate(this.a, this.b, k, i1, l);
}
for (j = 0; j < 10; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
this.t.generate(this.a, this.b, k, i1, l);
}
if (this.b.nextInt(32) == 0) {
j = this.c + this.b.nextInt(16) + 8;
k = this.d + this.b.nextInt(16) + 8;
- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2);
+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot
(new WorldGenPumpkin()).generate(this.a, this.b, j, l, k);
}
for (j = 0; j < this.D; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
this.u.generate(this.a, this.b, k, i1, l);
}
@@ -0,0 +0,0 @@ public class BiomeDecorator {
this.a(1, this.n, 0, 16);
this.b(1, this.o, 16, 16);
}
+
+ // Spigot Start
+ private int getHighestBlockYAt(int x, int z)
+ {
+ return Math.max( 1, this.a.getHighestBlockYAt( x, z ) );
+ }
+ // Spigot End
}
--

View file

@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
} }
public boolean g() { public boolean e() {
- return this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable"); - return this.item == null ? false : (this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable"));
+ // Spigot Start + // Spigot Start
+ if ( this.item.getMaxDurability() <= 0 ) + if ( this.item.getMaxDurability() <= 0 )
+ { + {

View file

@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
worldserver.doTick(); worldserver.doTick();
worldserver.timings.doTick.stopTiming(); // Spigot worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) { } catch (Throwable throwable1) {
+ // Spigot Start + // Spigot Start
+ try { + try {
crashreport = CrashReport.a(throwable, "Exception ticking world"); crashreport = CrashReport.a(throwable1, "Exception ticking world");
+ } catch (Throwable t){ + } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t); + throw new RuntimeException("Error generating crash report", t);
+ } + }
@ -22,13 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
worldserver.a(crashreport); worldserver.a(crashreport);
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
worldserver.tickEntities(); worldserver.tickEntities();
worldserver.timings.tickEntities.stopTiming(); // Spigot worldserver.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable1) { } catch (Throwable throwable2) {
+ // Spigot Start + // Spigot Start
+ try { + try {
crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
+ } catch (Throwable t){ + } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t); + throw new RuntimeException("Error generating crash report", t);
+ } + }

View file

@ -9,10 +9,10 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
SpigotTimings.worldSaveTimer.startTiming(); // Spigot SpigotTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save"); this.methodProfiler.a("save");
this.u.savePlayers(); this.v.savePlayers();
- this.saveChunks(true); - this.saveChunks(true);
+ // Spigot Start + // Spigot Start
+ // We replace this with saving each individual world as this.saveChunks(...) is broken, + // We replace this with saving each individual world as this.saveChunks(...) is broken,

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static { static {
Builder<Character, EnumChatFormat> builder = ImmutableMap.builder(); Builder<Character, EnumChatFormat> builder = ImmutableMap.builder();
@@ -0,0 +0,0 @@ public final class CraftChatMessage { @@ -0,0 +0,0 @@ public final class CraftChatMessage {
currentChatComponent = null; }
break; break;
case 3: case 3:
+ if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) { + if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) {

View file

@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -0,0 +0,0 @@ public class NBTTagByteArray extends NBTBase { @@ -0,0 +0,0 @@ public class NBTTagByteArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException {
int j = datainput.readInt(); int j = datainput.readInt();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
nbtreadlimiter.a((long) (8 * j)); nbtreadlimiter.a((long) (8 * j));
this.data = new byte[j]; this.data = new byte[j];
@ -22,9 +22,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -0,0 +0,0 @@ public class NBTTagIntArray extends NBTBase { @@ -0,0 +0,0 @@ public class NBTTagIntArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException {
int j = datainput.readInt(); int j = datainput.readInt();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
nbtreadlimiter.a((long) (32 * j)); nbtreadlimiter.a((long) (32 * j));
this.data = new int[j]; this.data = new int[j];

View file

@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -0,0 +0,0 @@ public class BlockPortal extends BlockHalfTransparent { @@ -0,0 +0,0 @@ public class BlockPortal extends BlockHalfTransparent {
public void a(World world, int i, int j, int k, Random random) { public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
super.a(world, i, j, k, random); super.b(world, blockposition, iblockdata, random);
- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { - if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) {
+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { // Spigot + if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { // Spigot
int l; int i = blockposition.getY();
for (l = j; !World.a((IBlockAccess) world, i, l, k) && l > 0; --l) { BlockPosition blockposition1;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.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/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
// CraftBukkit end // CraftBukkit end
@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final double[] recentTps = new double[ 3 ]; + public final double[] recentTps = new double[ 3 ];
+ // Spigot end + // Spigot end
public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
this.X = new UserCache(this, a); this.d = proxy;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.isRunning = false; this.isRunning = false;
} }
@ -35,27 +35,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void run() { public void run() {
try { try {
if (this.init()) { if (this.init()) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.q.setServerInfo(new ServerPingServerData("1.7.10", 5)); this.r.setServerInfo(new ServerPingServerData("1.8", 47));
this.a(this.q); this.a(this.r);
+ // Spigot start + // Spigot start
+ Arrays.fill( recentTps, 20 ); + Arrays.fill( recentTps, 20 );
+ long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
while (this.isRunning) { while (this.isRunning) {
- long k = ar(); - long j = ax();
- long l = k - i; - long k = j - this.ab;
- -
- if (l > 2000L && i - this.P >= 15000L) { - if (k > 2000L && this.ab - this.R >= 15000L) {
- if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages - if (server.getWarnOnOverload()) // CraftBukkit
- MinecraftServer.i.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(l), Long.valueOf(l / 50L)}); - MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)});
- l = 2000L; - k = 2000L;
- this.P = i; - this.R = this.ab;
- } - }
- -
- if (l < 0L) { - if (k < 0L) {
- MinecraftServer.i.warn("Time ran backwards! Did the system time change?"); - MinecraftServer.LOGGER.warn("Time ran backwards! Did the system time change?");
- l = 0L; - k = 0L;
+ curTime = System.nanoTime(); + curTime = System.nanoTime();
+ wait = TICK_TIME - (curTime - lastTick) - catchupTime; + wait = TICK_TIME - (curTime - lastTick) - catchupTime;
+ if (wait > 0) { + if (wait > 0) {
@ -66,16 +66,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ catchupTime = Math.min(1000000000, Math.abs(wait)); + catchupTime = Math.min(1000000000, Math.abs(wait));
} }
- j += l; - i += k;
- i = k; - this.ab = j;
- if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit - if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
- this.u(); - this.y();
- j = 0L; - i = 0L;
- } else { - } else {
- while (j > 50L) { - while (i > 50L) {
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- j -= 50L; - i -= 50L;
- this.u(); - this.y();
- } - }
+ if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
+ { + {
@ -87,9 +87,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ lastTick = curTime; + lastTick = curTime;
- Thread.sleep(Math.max(1L, 50L - j)); - Thread.sleep(Math.max(1L, 50L - i));
+ this.u(); + this.y();
this.O = true; this.Q = true;
} }
+ // Spigot end + // Spigot end
} else { } else {
@ -119,7 +119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+import com.google.common.base.Joiner; +import com.google.common.base.Joiner;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.com.google.common.collect.Iterables; +import com.google.common.collect.Iterables;
+import org.bukkit.ChatColor; +import org.bukkit.ChatColor;
+import org.bukkit.command.Command; +import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;

View file

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Thu, 9 Jan 2014 14:19:12 +0000
Subject: [PATCH] Fix anvil collisions
diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockAnvil.java
+++ b/src/main/java/net/minecraft/server/BlockAnvil.java
@@ -0,0 +0,0 @@ public class BlockAnvil extends BlockFalling {
this.a(CreativeModeTab.c);
}
+ // Spigot start
+ @Override
+ public AxisAlignedBB a( World world, int i, int j, int k )
+ {
+ updateShape( world, i, j, k );
+ return super.a( world, i, j, k );
+ }
+ // Spigot end
+
public boolean d() {
return false;
}
--

Some files were not shown because too many files have changed in this diff Show more