13
0
geforkt von Mirrors/Paper

Update PaperSpigot to Minecraft 1.8

Dieser Commit ist enthalten in:
Zach Brown 2014-11-27 17:17:45 -08:00
Ursprung 0dc6acba77
Commit a52eb21fd8
256 geänderte Dateien mit 5529 neuen und 15301 gelöschten Zeilen

2
.gitignore vendored
Datei anzeigen

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

6
.gitmodules vendored
Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <artifactId>bukkit</artifactId>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-api</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<version>1.8-R0.1-SNAPSHOT</version>
- <name>Bukkit</name>
- <url>http://www.bukkit.org</url>
+ <name>Spigot-API</name>
@ -25,40 +25,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</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>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-parent</artifactId>
+ <version>dev-SNAPSHOT</version>
+ <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>
--

Datei anzeigen

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
* @return The current vehicle.
* @return if the custom name is displayed
*/
public Entity getVehicle();
public boolean isCustomNameVisible();
+
+ // Spigot Start
+ public class Spigot

Datei anzeigen

@ -21,5 +21,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
--
1.8.4.2

Datei anzeigen

@ -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!" );
+ 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");

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot</artifactId>
<packaging>jar</packaging>
<version>1.7.10-R0.1-SNAPSHOT</version>
<version>1.8-R0.1-SNAPSHOT</version>
- <name>CraftBukkit</name>
- <url>http://www.bukkit.org</url>
+ <name>Spigot</name>
@ -30,33 +30,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<buildtag.suffix></buildtag.suffix>
</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>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-parent</artifactId>
+ <version>dev-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
<repositories>
<repository>
<id>repobo-snap</id>
@@ -0,0 +0,0 @@
<dependencies>
@ -68,50 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<version>${project.version}</version>
<type>jar</type>
<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 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@ -140,19 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<executions>
<execution>
<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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
return getHandle().vehicle.getBukkitEntity();
public boolean isCustomNameVisible() {
return getHandle().getCustomNameVisible();
}
+
+ // Spigot start
@ -81,6 +81,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ 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
}
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
@@ -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
@ -122,6 +142,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ 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
}
--

Datei anzeigen

@ -9,17 +9,17 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
+ public ServerConnection getServerConnection()
+ {
+ return this.p;
+ return this.q;
+ }
+ // Spigot End
public ServerConnection ai() {
return this.p;
public ServerConnection ao() {
return this.q;
}
--

Datei anzeigen

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

Datei anzeigen

@ -10,20 +10,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public
public boolean isStatic;
// CraftBukkit start - public, longhashset
public Scoreboard scoreboard = new Scoreboard();
public final boolean isStatic;
// CraftBukkit - longhashset
- protected LongHashSet chunkTickList = new LongHashSet();
+ // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot
private int K;
public boolean allowMonsters;
public boolean allowAnimals;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private boolean M;
int[] I;
public long ticksPerMonsterSpawns;
public boolean populating;
private int tickPosition;
+
+ // 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 modifiedOdds = 100;
+ private final byte chunkTickRadius;
@ -46,16 +47,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot end
+
public BiomeBase getBiome(int i, int j) {
if (this.isLoaded(i, 0, j)) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public CraftWorld getWorld() {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
+ // Spigot start
+ 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 );
+ // Spigot end
@ -84,11 +85,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entityhuman = (EntityHuman) this.players.get(i);
j = MathHelper.floor(entityhuman.locX / 16.0D);
k = MathHelper.floor(entityhuman.locZ / 16.0D);
l = this.p();
l = this.q();
- for (int i1 = -l; i1 <= l; ++i1) {
- 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
+ long key = chunkToKey( j, k );
+ int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1
@ -100,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
+ int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
+ 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
}
@ -113,41 +114,53 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
// CraftBukkit start
// Iterator iterator = this.chunkTickList.iterator();
- for (long chunkCoord : this.chunkTickList.popAll()) {
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
protected void h() {
super.h();
if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
- Iterator iterator = this.chunkTickList.iterator();
+ // Spigot start
+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) {
+ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator();
while (iterator.hasNext()) {
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
+ iterator.advance();
+ long chunkCoord = iterator.key();
- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false);
+ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false);
+ // Spigot end
}
} 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.advance();
+ long chunkCoord = iter.key();
+ int chunkX = World.keyToX( chunkCoord );
+ int chunkZ = World.keyToZ( chunkCoord );
+ // If unloaded, or in procedd of being unloaded, drop it
+ if ( ( !this.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
+ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
+ {
+ iter.remove();
+ continue;
+ }
+ // Spigot end
// ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
- int chunkX = LongHash.msw(chunkCoord);
- int chunkZ = LongHash.lsw(chunkCoord);
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
int k = chunkX * 16;
int l = chunkZ * 16;
@@ -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 implements IAsyncTaskHandler {
}
}
@@ -0,0 +0,0 @@ public class WorldServer extends World {
this.methodProfiler.b();
}
+ // Spigot Start
+ if ( spigotConfig.clearChunksOnTick )
@ -157,7 +170,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

Datei anzeigen

@ -31,91 +31,90 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
if (l < 3) {
int i1 = world.getData(i, j, k);
if (i < 3) {
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
if (l < 7) {
float f = this.n(world, i, j, k);
if (i < 7) {
float f = a((Block) this, world, blockposition);
- if (random.nextInt((int) (25.0F / f) + 1) == 0) {
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot
++l;
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
- // CraftBukkit start
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
}
// CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
- for (int l = 0; l < 4; ++l) {
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot
+ for (int l = 0; l < numGrowth; ++l) { // Spigot
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
Block block = world.getType(blockposition1.up()).getBlock();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit
- if (random.nextInt(25) == 0) {
+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot
byte b0 = 4;
int l = 5;
+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5;
int i = 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
}
// CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
- for (int l = 0; l < 4; ++l) {
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot
+ for (int l = 0; l < numGrowth; ++l) { // Spigot
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
IBlockData iblockdata1 = world.getType(blockposition1);
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
if (l < 3) {
int i1 = world.getData(i, j, k);
if (i < 3) {
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
- if (i1 == 15) {
+ if (i1 >= (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
world.setData(i, j, k, 0, 4);
} else {
- if (j == 15) {
+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
// CraftBukkit start
// world.setTypeUpdate(blockposition.up(), this.getBlockData());
// 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
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) {
super.a(world, i, j, k, random);
- if (world.getLightLevel(i, j + 1, k) >= 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
super.b(world, blockposition, iblockdata, random);
- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
+ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) {
// CraftBukkit start
world.captureTreeGeneration = true;
// CraftBukkit end
@ -124,14 +123,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
if (world.getLightLevel(i, j + 1, k) >= 9) {
float f = this.n(world, i, j, k);
if (world.getLightLevel(blockposition.up()) >= 9) {
float f = BlockCrops.a((Block) this, world, blockposition);
- 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
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

Datei anzeigen

@ -10,13 +10,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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;
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 List b = new ArrayList();
private Set c = new HashSet();
- private List b = Lists.newArrayList();
- 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 {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
@ -71,11 +77,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) {
+ return;
}
-
- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- this.c.add(chunkcoordintpair);
+ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ // this.c.add(chunkcoordintpair);
+ // Spigot end
FileIOThread.a.a(this);
FileIOThread.a().a(this);
}
}
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {

Datei anzeigen

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
}
private void k() {
- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
private void w() {
- Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator();
+ // Spigot start
+ 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
while (iterator.hasNext()) {
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ EntityExperienceOrb xp = (EntityExperienceOrb) entity;
+ double radius = spigotConfig.expMerge;
+ 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) {
+ if (e instanceof EntityExperienceOrb) {
+ EntityExperienceOrb loopItem = (EntityExperienceOrb) e;

Datei anzeigen

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

Datei anzeigen

@ -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 ) );
+ }
+}
--

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public PlayerChunkMap(WorldServer worldserver) {
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
this.world = worldserver;
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
- this.a(worldserver.getMinecraftServer().getPlayerList().t());
+ 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
--- a/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
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
- this.manager = new PlayerChunkMap(this);
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
this.worldProvider.a(this);
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

Datei anzeigen

@ -14,23 +14,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
+ world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i, j);
}
boolean flag = ichunkprovider.isChunkLoaded(i, j - 1);
boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j);
boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1);
@@ -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
}
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
boolean newChunk = false;
// CraftBukkit end
if (chunk == null) {
+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot
@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (chunk == null) {
if (this.chunkProvider == null) {
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
}
// CraftBukkit end
chunk.loadNearby(this, this, i, j);
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
}
@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return chunk;
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk != null) {
chunk.lastSaved = this.world.getTime();
chunk.setLastSaved(this.world.getTime());
if (this.chunkProvider != null) {
+ world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
this.chunkProvider.recreateStructures(i, j);
this.chunkProvider.recreateStructures(chunk, i, j);
+ world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
}
}
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - Add async variant, provide compatibility
public Chunk a(World world, int i, int j) {
+ world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot
Object[] data = this.loadChunk(world, i, j);
Object[] data = loadChunk(world, i, j);
+ world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot
if (data != null) {
Chunk chunk = (Chunk) data[0];
@ -119,19 +119,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void aB() {
public void aM() {
+ SpigotTimings.serverCommandTimer.startTiming(); // Spigot
while (!this.j.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.j.remove(0);
while (!this.k.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.k.remove(0);
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.server.dispatchServerCommand(this.console, servercommand);
// CraftBukkit end
}
+ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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.hanging.HangingBreakByEntityEvent;
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 org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
@ -153,22 +153,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getId() {
return this.id;
}
@@ -0,0 +0,0 @@ public abstract class Entity {
return;
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
}
// CraftBukkit end
public void move(double d0, double d1, double d2) {
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
if (this.X) {
this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
@@ -0,0 +0,0 @@ public abstract class Entity {
+
if (this.T) {
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b();
}
+ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
@ -181,21 +182,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
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 {
}
public void h() {
public void s_() {
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
super.h();
super.s_();
if (!this.world.isStatic) {
int i = this.aZ();
int i = this.bu();
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
}
+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
this.e();
this.m();
+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
@ -203,39 +204,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.aX += f2;
this.aR += f2;
+ 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 {
}
this.world.methodProfiler.a("ai");
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.bh()) {
this.bc = false;
this.bd = 0.0F;
if (this.bC()) {
this.aW = false;
this.aX = 0.0F;
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.aO = this.yaw;
}
this.doTick();
this.world.methodProfiler.b();
}
+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.bd *= 0.98F;
this.be *= 0.98F;
this.bf *= 0.9F;
this.aX *= 0.98F;
this.aY *= 0.98F;
this.aZ *= 0.9F;
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
this.e(this.bd, this.be);
this.g(this.aX, this.aY);
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.bo();
this.bK();
+ 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
--- a/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;
import joptsimple.OptionSet;
@@ -0,0 +0,0 @@ import joptsimple.OptionSet;
import org.bukkit.craftbukkit.Main;
import org.bukkit.World.Environment;
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
protected void t() {}
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
protected void x() {}
protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws
protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ SpigotTimings.serverTickTimer.startTiming(); // Spigot
long i = System.nanoTime();
++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
this.methodProfiler.a("save");
this.u.savePlayers();
this.v.savePlayers();
this.saveChunks(true);
this.methodProfiler.b();
+ SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
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();
@ -281,8 +282,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot
}
public void v() {
this.methodProfiler.a("levels");
public void z() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.c("levels");
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
// 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.
if (this.ticks % 20 == 0) {
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
}
}
@ -312,27 +315,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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;
try {
+ worldserver.timings.doTick.startTiming(); // Spigot
worldserver.doTick();
+ worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Exception ticking world");
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Exception ticking world");
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 {
+ worldserver.timings.tickEntities.startTiming(); // Spigot
worldserver.tickEntities();
+ worldserver.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Exception ticking world entities");
} catch (Throwable throwable2) {
crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
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.a("tracker");
@ -342,22 +345,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.b();
this.methodProfiler.b();
// } // 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");
+ SpigotTimings.connectionTimer.startTiming(); // Spigot
this.ai().c();
this.ao().c();
+ SpigotTimings.connectionTimer.stopTiming(); // Spigot
this.methodProfiler.c("players");
+ SpigotTimings.playerListTimer.startTiming(); // Spigot
this.u.tick();
this.v.tick();
+ SpigotTimings.playerListTimer.stopTiming(); // Spigot
this.methodProfiler.c("tickables");
+ SpigotTimings.tickablesTimer.startTiming(); // Spigot
for (i = 0; i < this.n.size(); ++i) {
((IUpdatePlayerListBox) this.n.get(i)).a();
for (i = 0; i < this.o.size(); ++i) {
((IUpdatePlayerListBox) this.o.get(i)).c();
}
+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot
@ -367,7 +370,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
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 {
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit end
private void handleCommand(String s) {
@ -376,7 +379,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - whole method
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);
if (event.isCancelled()) {
@ -410,12 +413,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.spigotmc.CustomTimingsHandler; // Spigot
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public class TileEntity {
public abstract class TileEntity {
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
private static final Logger a = LogManager.getLogger();
private static Map i = new HashMap();
private static Map j = new HashMap();
private static Map f = Maps.newHashMap();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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.CraftWorld;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public ChunkGenerator generator;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot
@ -438,15 +441,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.world;
}
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.M = worldprovider.getWorldBorder();
this.worldProvider.a(this);
this.chunkProvider = this.j();
this.getServer().addWorld(this.world); // CraftBukkit
+ 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 {
this.f.clear();
this.g.clear();
this.methodProfiler.c("regular");
+ timings.entityTick.startTiming(); // Spigot
@ -458,7 +461,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!entity.dead) {
try {
+ SpigotTimings.tickEntityTimer.startTiming(); // Spigot
this.playerJoinedWorld(entity);
this.g(entity);
+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Ticking entity");
@ -470,28 +473,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.entityTick.stopTiming(); // Spigot
this.methodProfiler.c("blockEntities");
+ timings.tileEntityTick.startTiming(); // Spigot
this.M = true;
this.L = true;
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.b.isEmpty()) {
@@ -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 {
+ tileentity.tickTimer.startTiming(); // Spigot
tileentity.h();
+ tileentity.tickTimer.stopTiming(); // Spigot
((IUpdatePlayerListBox) tileentity).c();
} catch (Throwable throwable2) {
+ tileentity.tickTimer.stopTiming(); // Spigot
crashreport = CrashReport.a(throwable2, "Ticking block entity");
crashreportsystemdetails = crashreport.a("Block entity being ticked");
tileentity.a(crashreportsystemdetails);
CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
tileentity.a(crashreportsystemdetails1);
throw new ReportedException(crashreport1);
}
+ // Spigot start
+ finally {
+ tileentity.tickTimer.stopTiming();
+ }
+ // Spigot end
}
}
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
}
+ timings.tileEntityTick.stopTiming(); // Spigot
+ timings.tileEntityPending.startTiming(); // Spigot
this.M = false;
this.L = false;
/* CraftBukkit start - Moved up
if (!this.b.isEmpty()) {
@@ -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 {
// CraftBukkit start - Use neighbor cache instead of looking up
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
// CraftBukkit end
entity.S = entity.locX;
entity.T = entity.locY;
entity.P = entity.locX;
entity.Q = entity.locY;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
entity.passenger = null;
}
}
+ 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
--- a/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
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
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
// CraftBukkit end
}
@ -537,7 +548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.c("chunkSource");
this.chunkProvider.unloadChunks();
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);
}
@ -548,7 +559,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.doTickPending.stopTiming(); // Spigot
this.methodProfiler.c("tickBlocks");
+ timings.doTickTiles.startTiming(); // Spigot
this.g();
this.h();
+ timings.doTickTiles.stopTiming(); // Spigot
this.methodProfiler.c("chunkMap");
+ timings.doChunkMap.startTiming(); // Spigot
@ -565,15 +576,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.doPortalForcer.stopTiming(); // Spigot
this.methodProfiler.b();
+ timings.doSounds.startTiming(); // Spigot
this.Z();
+ timings.doSounds.stopTiming(); // Spigot
this.ak();
+ timings.doChunkGC.startTiming(); // Spigot
this.getWorld().processChunkGC(); // CraftBukkit
+ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@ -791,7 +800,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (queuedChunk.provider.chunkProvider != null) {
+ 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
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -12,16 +12,16 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
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 {
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public int ticksLived;
public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public
public int fireTicks;
- protected boolean inWater;
+ public boolean inWater; // Spigot - protected -> public
public int noDamageTicks;
private boolean justCreated;
protected boolean justCreated;
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 org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
@ -35,10 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getId() {
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);
if (world != null) {
this.dimension = world.worldProvider.dimension;
this.dimension = world.worldProvider.getDimension();
+ // Spigot start
+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig);
+ } else {
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
private float bq;
private float bl;
public boolean ageLocked = false; // CraftBukkit
+ // Spigot start
@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Entity shooter;
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
private double damage = 2.0D;
public int knockbackStrength; // CraftBukkit - private -> public
public int knockbackStrength;
+ // Spigot Start
+ @Override
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ if ( this.inGround )
+ {
+ this.at += 19; // Despawn counter. First int after shooter
+ this.ap += 19; // Despawn counter. First int after shooter
+ }
+ super.inactiveTick();
+ }
@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
private int ticksFlown;
public int expectedLifespan; // CraftBukkit - private -> public
public int expectedLifespan;
+ // Spigot Start
+ @Override
@ -148,18 +148,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void inactiveTick()
+ {
+ super.inactiveTick();
+ ++this.aU; // Above all the floats
+ ++this.aT; // Above all the floats
+ }
+ // Spigot end
public EntityLiving(World world) {
super(world);
public void G() {
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
this.f.clear();
this.g.clear();
this.methodProfiler.c("regular");
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
@ -172,7 +172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // CraftBukkit start - Use neighbor cache instead of looking up
- 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
+ if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
+ entity.ticksLived++;
@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else {
entity.tickTimer.startTiming(); // Spigot
// 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
@ -205,6 +205,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import net.minecraft.server.AxisAlignedBB;
+import net.minecraft.server.Chunk;
+import net.minecraft.server.Entity;
@ -222,6 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.server.EntityMonster;
+import net.minecraft.server.EntityProjectile;
+import net.minecraft.server.EntitySheep;
+import net.minecraft.server.EntitySlice;
+import net.minecraft.server.EntitySlime;
+import net.minecraft.server.EntityTNTPrimed;
+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
+ * active if in range.
+ *
@ -331,10 +313,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+
+ player.activatedTick = MinecraftServer.currentTick;
+ growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
+ growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
+ growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
+ growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );
+ maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
+ miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
+ animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
+ monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
+
+ int i = MathHelper.floor( maxBB.a / 16.0D );
+ int j = MathHelper.floor( maxBB.d / 16.0D );
@ -362,9 +344,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ 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 )
+ {
@ -376,20 +358,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ switch ( entity.activationType )
+ {
+ case 1:
+ if ( monsterBB.b( entity.boundingBox ) )
+ if ( monsterBB.b( entity.getBoundingBox() ) )
+ {
+ entity.activatedTick = MinecraftServer.currentTick;
+ }
+ break;
+ case 2:
+ if ( animalBB.b( entity.boundingBox ) )
+ if ( animalBB.b( entity.getBoundingBox() ) )
+ {
+ entity.activatedTick = MinecraftServer.currentTick;
+ }
+ break;
+ case 3:
+ default:
+ if ( miscBB.b( entity.boundingBox ) )
+ if ( miscBB.b( entity.getBoundingBox() ) )
+ {
+ entity.activatedTick = MinecraftServer.currentTick;
+ }
@ -428,15 +410,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ( entity instanceof EntityLiving )
+ {
+ 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;
+ }
+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null )
+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null )
+ {
+ 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;
+ }

Datei anzeigen

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

Datei anzeigen

@ -20,15 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot end
lines = new String[sign.lines.length];
System.arraycopy(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();
System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
}
--

Datei anzeigen

@ -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);
--

Datei anzeigen

@ -12,28 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class RegionFileCache {
- private static final Map a = new HashMap();
+ public static final Map a = new HashMap(); // CraftBukkit - private -> public
- private static final Map a = Maps.newHashMap();
+ public static final Map a = Maps.newHashMap(); // Spigot - private -> public
public static synchronized RegionFile a(File file1, int i, int j) {
File file2 = new File(file1, "region");
public static synchronized RegionFile a(File file, int i, int j) {
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
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 @@ 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 {
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle));
+
+ File parentFolder = world.getWorldFolder().getAbsoluteFile();
+
+ // Synchronized because access to RegionFileCache.a is guarded by this lock.

Datei anzeigen

@ -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;
--

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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.List;
@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
entity.f(nbttagcompound);
if (entity.world != null) {
if (entity.world != null && flag) {
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // 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()) {
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ }
@ -41,22 +41,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity2.f(nbttagcompound2);
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
+ // 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()) {
+ continue;
+ }
if (entity.world != null) {
if (entity.world != null && flag) {
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
}
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
}
} else if (entity instanceof EntityLiving && entity.world != null) {
((EntityInsentient) entity).prepare((GroupDataEntity) null);
- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
} else if (entity instanceof EntityLiving && entity.world != null && flag) {
((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // 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()) {
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ }
+ // Spigot end
}
@ -96,5 +96,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
* 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) {
--

Datei anzeigen

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

Datei anzeigen

@ -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
}
}
--

Datei anzeigen

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

Datei anzeigen

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class Chunk {
}
this.m = true;
this.p = true;
- 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
this.p();
}
this.n();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot Start
+ 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 )
+ {
@ -26,16 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot End
this.world.a(tileentity);
this.world.b(tileentity);
}
@@ -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()) {
Entity entity = (Entity) iter.next();
Entity entity = iter.next();
+ // Spigot Start
+ 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 )
+ {
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
public void b(int i) {
public void c(int i) {
+ // Spigot Start
+ for ( HumanEntity human : new java.util.ArrayList<HumanEntity>( transaction ) )
+ {
@ -62,6 +62,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot End
this.b = false;
super.b(i);
super.c(i);
}
--

Datei anzeigen

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

Datei anzeigen

@ -8,20 +8,20 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
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 {
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
+ pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null;
@@ -0,0 +0,0 @@ public abstract class Entity {
}
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
+ // 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() );
+ pluginManager.callEvent( event );
@ -31,19 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ // Spigot End
+
if (this.vehicle != 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.
}
--

Datei anzeigen

@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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 {
Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
Player respawnPlayer = cserver.getPlayer(entityplayer1);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
this.cserver.getPluginManager().callEvent(respawnEvent);
cserver.getPluginManager().callEvent(respawnEvent);
+ // Spigot Start
+ if (entityplayer.playerConnection.isDisconnected()) {
+ return entityplayer;

Datei anzeigen

@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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
public class BlockRedstoneTorch extends BlockTorch {
private boolean isOn;
- private static Map b = new HashMap();
- private static Map b = Maps.newHashMap();
+ 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) {
if (!b.containsKey(world)) {
private boolean a(World world, BlockPosition blockposition, boolean flag) {
--

Datei anzeigen

@ -8,25 +8,32 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/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
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
List list = this.world.getEntities(this, axisalignedbb);
- if (list != null) {
+ if (list != null && this.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving)
+ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving)
for (int i = 0; i < list.size(); ++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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
protected void bo() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
protected void bK() {
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- 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) {
Entity entity = (Entity) list.get(i);
@ -42,15 +49,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean collidesWithEntities = true;
+
+ @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
+ 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

Datei anzeigen

@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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.methodProfiler.b();
this.methodProfiler.a("snooper");
- if (!this.l.d() && this.ticks > 100) {
+ if (getSnooperEnabled() && !this.l.d() && this.ticks > 100) { // Spigot
this.l.a();
- if (!this.m.d() && this.ticks > 100) {
+ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot
this.m.a();
}
- if (this.ticks % 6000 == 0) {
+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
this.l.b();
this.m.b();
}
--

Datei anzeigen

@ -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
--

Datei anzeigen

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

Datei anzeigen

@ -8,10 +8,10 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/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
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
// Update client
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
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();

Datei anzeigen

@ -9,25 +9,16 @@ diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/ne
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
EntityArrow entityarrow = (EntityArrow) entity;
if (entityarrow.isBurning()) {
+ // 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;
+ }
+ // CraftBukkit end
this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
world.setAir(i, j, k);
this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
world.setAir(blockposition);
}
--

Datei anzeigen

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

Datei anzeigen

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
}
// Craftbukkit end */
// ++this.age; // CraftBukkit - Moved up
this.W();
- if (!this.world.isStatic && this.age >= 6000) {
+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
// CraftBukkit start - fire ItemDespawnEvent

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
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 {
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
private float lastPitch = Float.MAX_VALUE;
private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false;
@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// For the PacketPlayOutBlockPlace hack :(
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
Player player = this.getPlayer();
+ // 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 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();
// Skip the first time we do this

Datei anzeigen

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

Datei anzeigen

@ -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) {
--

Datei anzeigen

@ -4,11 +4,24 @@ Date: Tue, 5 Aug 2014 17:20:19 +0100
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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);
} finally {
try {
@ -16,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.stop();
this.isStopped = true;
} 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();

Datei anzeigen

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

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public boolean isReady() {
- return this.m && this.done && this.lit;
- return this.p && this.done && this.lit;
+ // 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.
@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot End
}
public ChunkCoordIntPair l() {
public ChunkCoordIntPair j() {
--

Datei anzeigen

@ -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 );
}
}
}
--

Datei anzeigen

@ -8,17 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
+ 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() );
+ public void handle(final PacketListener packetlistener)
+ @Override
+ public void a(final PacketListener packetlistener)
+ {
+ if ( a() )
+ if ( !a.startsWith("/") )
+ {
+ executors.submit( new Runnable()
+ {
@ -26,13 +27,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public void run()
+ {
+ PacketPlayInChat.this.a( (PacketPlayInListener) packetlistener );
+ PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener );
+ }
+ } );
+ return;
+ }
+ // Spigot End
this.a((PacketPlayInListener) packetlistener);
this.a((PacketListenerPlayIn) packetlistener);
}
}
--

Datei anzeigen

@ -9,127 +9,111 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
}
this.world.setAir(i, j, k);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
}
if (this.onGround) {
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(blockposition);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
} else if (!this.world.isStatic) {
this.die();
return;
@@ -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
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
if (this.id instanceof BlockFalling) {
((BlockFalling) this.id).a(this.world, i, j, k, this.data);
if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
j = chunkposition.y;
k = chunkposition.z;
block = this.world.getType(i, j, k);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
blockposition = (BlockPosition) iterator.next();
Block block = this.world.getType(blockposition).getBlock();
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
if (flag) {
double d0 = (double) ((float) i + this.world.random.nextFloat());
double d1 = (double) ((float) j + this.world.random.nextFloat());
double d0 = (double) ((float) blockposition.getX() + 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
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 {
@@ -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;
this.c = chunkmap.b;
+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot
try {
this.f = chunkmap.a;
public void a(PacketDataSerializer packetdataserializer) {
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 {
}
};
// CraftBukkit end
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
private int[] b;
private ChunkMap[] c;
private boolean d;
+ private World world; // Spigot
public PacketPlayOutMapChunkBulk() {}
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet {
Chunk chunk = (Chunk) list.get(k);
ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff');
+ // Spigot start
+ world = chunk.world;
+ /*
if (buildBuffer.length < j + chunkmap.a.length) {
byte[] abyte = new byte[j + chunkmap.a.length];
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
this.b[j] = chunk.locZ;
this.c[j] = chunkmap;
}
System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length);
+ */
+ // Spigot end
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
+ world = ((Chunk) list.get(0)).getWorld(); // Spigot
}
public void a(PacketDataSerializer packetdataserializer) {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
}
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
packetdataserializer.writeBytes(this.c[i].a);
}
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
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
+ 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
- if (captureTreeGeneration) {
+ if (captureTreeGeneration && useCaptured) {
@ -137,14 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Iterator<BlockState> it = capturedBlockStates.iterator();
while (it.hasNext()) {
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
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -153,9 +129,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package org.spigotmc;
+
+import net.minecraft.util.gnu.trove.set.TByteSet;
+import net.minecraft.util.gnu.trove.set.hash.TByteHashSet;
+import gnu.trove.set.TByteSet;
+import gnu.trove.set.hash.TByteHashSet;
+import net.minecraft.server.Block;
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.World;
+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
+ * 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 )
+ {
+ 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();
+ }
+ }
@ -249,7 +226,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK);
+ break;
+ case THE_END:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.WHITESTONE);
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE);
+ break;
+ default:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE);
@ -277,24 +254,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Grab the block ID in the buffer.
+ // 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
+ if ( obfuscateBlocks[blockId] )
+ {
+ // 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++;
+ continue;
+ }
+ // 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 )
+ {
+ case 1:
+ // Replace with replacement material
+ buffer[index] = replaceWithTypeId;
+ newId = replaceWithTypeId & 0xFF;
+ break;
+ case 2:
+ // Replace with random ore.
@ -302,9 +282,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ randomOre = 0;
+ }
+ buffer[index] = replacementOres[randomOre++];
+ newId = replacementOres[randomOre++] & 0xFF;
+ 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 ( world.isLoaded( x, y, z ) )
+ if ( world.isLoaded( position ) )
+ {
+ // Get block id
+ Block block = world.getType(x, y, z);
+ Block block = world.getType(position).getBlock();
+
+ // See if it needs update
+ if ( updateSelf && obfuscateBlocks[Block.getId( block )] )
+ {
+ // Send the update
+ world.notify( x, y, z );
+ world.notify( position );
+ }
+
+ // Check other blocks for updates
+ if ( radius > 0 )
+ {
+ updateNearbyBlocks( world, x + 1, y, z, radius - 1, true );
+ updateNearbyBlocks( world, x - 1, y, z, radius - 1, true );
+ updateNearbyBlocks( world, x, y + 1, z, radius - 1, true );
+ updateNearbyBlocks( world, x, y - 1, z, radius - 1, true );
+ updateNearbyBlocks( world, x, y, z + 1, radius - 1, true );
+ updateNearbyBlocks( world, x, y, z - 1, radius - 1, true );
+ updateNearbyBlocks( world, position.east(), radius - 1, true );
+ updateNearbyBlocks( world, position.west(), radius - 1, true );
+ updateNearbyBlocks( world, position.up(), radius - 1, true );
+ updateNearbyBlocks( world, position.down(), radius - 1, true );
+ updateNearbyBlocks( world, position.south(), 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 ||
+ ( isLoaded( world, x + 1, y, z, radius - 1 )
+ && isLoaded( world, x - 1, y, z, radius - 1 )
+ && isLoaded( world, x, y + 1, z, radius - 1 )
+ && isLoaded( world, x, y - 1, z, radius - 1 )
+ && isLoaded( world, x, y, z + 1, radius - 1 )
+ && isLoaded( world, x, y, z - 1, radius - 1 ) ) );
+ ( isLoaded( world, position.east(), radius - 1 )
+ && isLoaded( world, position.west(), radius - 1 )
+ && isLoaded( world, position.up(), radius - 1 )
+ && isLoaded( world, position.down(), radius - 1 )
+ && isLoaded( world, position.south(), 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
+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) );
+ && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, position.west(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, position.up(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, position.down(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, position.south(), radius - 1 )
+ || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) );
+ }
+
+ private static boolean isSolidBlock(Block block) {
@ -375,7 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // rendering they can be seen through therefor we special
+ // case them so that the antixray doesn't show the fake
+ // 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

Datei anzeigen

@ -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) {
--

Datei anzeigen

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

Datei anzeigen

@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot end
+
public void c() {
public void b() {
+ // Spigot start - Moved to initUUID
+ /*
if (!this.i.isComplete()) {
@ -31,45 +31,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot end
// CraftBukkit start - fire PlayerLoginEvent
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, this.hostname);
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
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 {
- this.g = EnumProtocolState.READY_TO_ACCEPT;
+ (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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
GameProfile gameprofile = LoginListener.a(this.a);
GameProfile gameprofile = LoginListener.b(this.a);
try {
+ // Spigot Start
+ if ( !LoginListener.c( this.a ).getOnlineMode() )
+ if ( !LoginListener.a( this.a ).getOnlineMode() )
+ {
+ a.initUUID();
+ fireLoginEvents();
+ return;
+ }
+ // 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));
if (LoginListener.a(this.a) != null) {
LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s));
if (LoginListener.b(this.a) != null) {
- // CraftBukkit start - fire PlayerPreLoginEvent
- if (!this.a.networkManager.isConnected()) {
- if (!this.a.networkManager.g()) {
- 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.util.UUID uniqueId = LoginListener.a(this.a).getId();
- final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server;
- java.util.UUID uniqueId = LoginListener.b(this.a).getId();
- final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
-
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
- server.getPluginManager().callEvent(asyncEvent);
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- return event.getResult();
- }};
-
- LoginListener.c(this.a).processQueue.add(waitable);
- LoginListener.a(this.a).processQueue.add(waitable);
- if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.a.disconnect(event.getKickMessage());
- return;
@ -99,28 +99,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- // 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);
+ 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.a(this.a, this.a.a(gameprofile));
@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread {
// CraftBukkit end
}
}
+
+ private void fireLoginEvents() throws Exception
+ {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!this.a.networkManager.isConnected()) {
+ if (!this.a.networkManager.g()) {
+ 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.util.UUID uniqueId = LoginListener.a(this.a).getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server;
+ java.util.UUID uniqueId = LoginListener.b(this.a).getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
+
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
+ server.getPluginManager().callEvent(asyncEvent);
@ -137,7 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return event.getResult();
+ }};
+
+ LoginListener.c(this.a).processQueue.add(waitable);
+ LoginListener.a(this.a).processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(event.getKickMessage());
+ return;
@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // 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);
+ }
}

Datei anzeigen

@ -9,20 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@
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;
@@ -0,0 +0,0 @@ import java.util.HashMap;
// CraftBukkit end
public class HandshakeListener implements PacketHandshakingInListener {
-
+
+ private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot
// CraftBukkit start - add fields
private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
@ -36,18 +28,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ String[] split = packethandshakinginsetprotocol.b.split("\00");
+ if ( split.length == 3 || split.length == 4 ) {
+ packethandshakinginsetprotocol.b = split[0];
+ b.n = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.spoofedUUID = UUIDTypeAdapter.fromString( split[2] );
+ b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
+ } else
+ {
+ 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);
+ return;
+ }
+ 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
@ -58,15 +50,7 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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;
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 {
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
// Spigot start
public void initUUID()
{
@ -84,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ 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 );
+ }
@ -96,36 +80,28 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
private final Queue k = Queues.newConcurrentLinkedQueue();
private final Queue l = Queues.newConcurrentLinkedQueue();
private Channel m;
- private SocketAddress n;
private final EnumProtocolDirection g;
private final Queue h = Queues.newConcurrentLinkedQueue();
private Channel i;
- private SocketAddress j;
+ // Spigot Start
+ public SocketAddress n;
+ public SocketAddress j;
+ public java.util.UUID spoofedUUID;
+ public Property[] spoofedProfile;
+ public com.mojang.authlib.properties.Property[] spoofedProfile;
+ // Spigot End
private PacketListener o;
private EnumProtocol p;
private IChatBaseComponent q;
private PacketListener k;
private IChatBaseComponent l;
private boolean m;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
static Channel a(NetworkManager networkmanager) {
return networkmanager.m;
return networkmanager.i;
}
+
+ // Spigot Start
+ public SocketAddress getRawAddress()
+ {
+ return this.m.remoteAddress();
+ return this.i.remoteAddress();
+ }
+ // Spigot End
}
@ -133,14 +109,14 @@ diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
this.a = packetdataserializer.a();
public void a(PacketDataSerializer packetdataserializer) {
this.a = packetdataserializer.e();
- this.b = packetdataserializer.c(255);
+ this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -148,13 +124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -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();
- 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());
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

Datei anzeigen

@ -10,21 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
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));
+ 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));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); // Spigot
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(7, new PathfinderGoalRandomStroll(this, 1.0D));
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, 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);
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java

Datei anzeigen

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

Datei anzeigen

@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
private void a(World world) {
if (this.e == null) {
if (this.d == null) {
// Spigot Start
- if ( world.spigotConfig.saveStructureInfo )
+ 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
--

Datei anzeigen

@ -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;
--

Datei anzeigen

@ -8,14 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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) {
i.error("Encountered an unexpected exception", throwable);
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
+ // Spigot Start
+ 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
CrashReport crashreport = null;

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -14,14 +14,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- for (int k1 = i; k1 < j; ++k1) {
- 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) {
- 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) {
- block = this.getType(k1, i2, l1);
- } else {
- block = Blocks.STONE;
- if (flag && flag1) {
- entity.h(false);
- } else if (!flag && !flag1) {
- entity.h(true);
- }
+ // Spigot start
+ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 );
+ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ )
@ -29,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int cx = chunkx << 4;
+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
+ {
+ if ( !this.isChunkLoaded( chunkx, chunkz ) )
+ if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
+ {
+ continue;
+ }
@ -47,14 +50,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ 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 )
+ {
+ 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);
}
}
}

Datei anzeigen

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

Datei anzeigen

@ -11,14 +11,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
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) {
try {
this.ai().a(inetaddress, this.L());
this.ao().a(inetaddress, this.Q());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
@@ -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;
}
+ }
@ -31,17 +31,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (org.spigotmc.SpigotConfig.lateBind) {
+ try {
+ this.ai().a(inetaddress, this.L());
+ this.ao().a(inetaddress, this.Q());
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
+ i.warn("**** FAILED TO BIND TO PORT!");
+ i.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ i.warn("Perhaps a server is already running on that port?");
+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
+ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java

Datei anzeigen

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
public ServerStatisticManager(MinecraftServer minecraftserver, File file1) {
public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
this.c = minecraftserver;
this.d = file1;
this.d = file;
+ // Spigot start
+ for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() )
+ {
@ -39,6 +39,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int j = statistic.d() ? this.getStatisticValue(statistic) : 0;
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
@ -47,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.List;
import java.util.Map;
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 org.bukkit.Bukkit;
import org.bukkit.ChatColor;

Datei anzeigen

@ -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
}
--

Datei anzeigen

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

Datei anzeigen

@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) {
} catch (Throwable throwable1) {
+ // Spigot Start
+ try {
crashreport = CrashReport.a(throwable, "Exception ticking world");
crashreport = CrashReport.a(throwable1, "Exception ticking world");
+ } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t);
+ }
@ -22,13 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
worldserver.a(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.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable1) {
} catch (Throwable throwable2) {
+ // Spigot Start
+ try {
crashreport = CrashReport.a(throwable1, "Exception ticking world entities");
crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
+ } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t);
+ }

Datei anzeigen

@ -9,10 +9,10 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
this.methodProfiler.a("save");
this.u.savePlayers();
this.v.savePlayers();
- this.saveChunks(true);
+ // Spigot Start
+ // We replace this with saving each individual world as this.saveChunks(...) is broken,

Datei anzeigen

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

Datei anzeigen

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -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();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -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();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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;
}
--

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen