Update PaperSpigot to Minecraft 1.8

This commit is contained in:
Zach Brown 2014-11-27 17:17:45 -08:00
parent 4100c7f703
commit de86706b70
300 changed files with 7042 additions and 16868 deletions

2
.gitignore vendored
View File

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

6
.gitmodules vendored
View File

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

View File

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

1
Bukkit

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

View File

@ -1,21 +1,21 @@
From 08428965ebbf972796dbd554ecca48eea639e852 Mon Sep 17 00:00:00 2001
From 20956e8769aa775aeac3d6d21dc3860575066443 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 10:36:24 +1000
Subject: [PATCH] POM Changes
diff --git a/pom.xml b/pom.xml
index 4c5937a..2e5420b 100644
index ed69653..87c0c58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,42 +1,21 @@
@@ -1,15 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.bukkit</groupId>
- <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,42 +25,23 @@ index 4c5937a..2e5420b 100644
<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>
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 96a0f82578677644e39e778482c983a41930140f Mon Sep 17 00:00:00 2001
From 441af32c70779242830099187105998737549c45 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 2 Jun 2013 10:42:57 +1000
Subject: [PATCH] Spigot Timings
@ -276,7 +276,7 @@ index d2fe422..1d51908 100644
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index b178c0d..fe723c9 100644
index fb0bfba..3e60a7b 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -39,6 +39,7 @@ import org.bukkit.plugin.PluginLoader;
@ -295,7 +295,7 @@ index b178c0d..fe723c9 100644
/**
* This class was not meant to be constructed explicitly
@@ -283,13 +285,19 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -284,13 +286,19 @@ public final class JavaPluginLoader implements PluginLoader {
}
}
@ -315,7 +315,7 @@ index b178c0d..fe723c9 100644
} catch (InvocationTargetException ex) {
throw new EventException(ex.getCause());
} catch (Throwable t) {
@@ -297,7 +305,7 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -298,7 +306,7 @@ public final class JavaPluginLoader implements PluginLoader {
}
}
};
@ -496,5 +496,5 @@ index 0000000..8d98297
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 4b9d141d1691760cbc77af472798d0100a9fb9ba Mon Sep 17 00:00:00 2001
From 0a83eb0476ad914249b85f2b55e76c6bdc41e253 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 4 Mar 2013 18:31:20 +1100
Subject: [PATCH] Add PlayerItemDamageEvent
@ -65,5 +65,5 @@ index 0000000..38a72ab
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 279155a45dcff6fe128cf4762d5cbe88022d4a3d Mon Sep 17 00:00:00 2001
From ef1350a00ce855de556998df6f44cc1510aae924 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:20:49 +1000
Subject: [PATCH] BungeeCord Support
@ -99,5 +99,5 @@ index b74b7b8..081e994 100644
* Gets the current result of the login, as an enum
*
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 19a3b2ec5ce16627a28abd11a49605b84b1e24c8 Mon Sep 17 00:00:00 2001
From 434fe0ecc9bed38528fa1985f0e7f69f463db736 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:08:24 +1000
Subject: [PATCH] Add Arrow API
@ -30,5 +30,5 @@ index e49eef0..e7a32f7 100644
+ Spigot spigot();
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 29f3f315387ef5c5b14f55f05819030fba87062e Mon Sep 17 00:00:00 2001
From 9df89a6e4e1111b34f0aa250d4ef06f7453c145a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:57:09 +1000
Subject: [PATCH] Add Particle API
@ -365,5 +365,5 @@ index 08aa71d..5217aec 100644
}
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 7af1ecdc02b2556a955289553118dfbabde4907c Mon Sep 17 00:00:00 2001
From eccd4ba94b9d646d2f59e678882ef616d7c07867 Mon Sep 17 00:00:00 2001
From: Andy Shulman <andy.shulman@hotmail.com>
Date: Mon, 15 Apr 2013 20:06:01 -0500
Subject: [PATCH] Define EntitySpawnEvent and SpawnerSpawnEvent
@ -216,5 +216,5 @@ index 0000000..1acb3c4
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From f04bd1caddf61581ced67d7fec409e25b6dec9b5 Mon Sep 17 00:00:00 2001
From 8a59d111c2a1e4028474c264c94d35fd42c9b0a7 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 20:32:53 +1000
Subject: [PATCH] Entity Mount and Dismount Events
@ -108,5 +108,5 @@ index 0000000..16aa2a7
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From dbf7e0b50e03150df774881195002269552f4236 Mon Sep 17 00:00:00 2001
From 6fb58d4e83fcb4fc453990d6367c61ae6f4222e8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 4 Jul 2013 20:05:19 +1000
Subject: [PATCH] Update Depends
@ -6,10 +6,10 @@ Subject: [PATCH] Update Depends
- All of these changes have been reviewed to be binary compatible and in general contract compatible with previous versions of the libraries.
diff --git a/pom.xml b/pom.xml
index 2e5420b..0c9f243 100644
index c5ce4b2..b5ad32f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,21 +76,21 @@
@@ -83,21 +83,21 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
@ -34,7 +34,7 @@ index 2e5420b..0c9f243 100644
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -104,7 +104,7 @@
@@ -112,7 +112,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
@ -44,5 +44,5 @@ index 2e5420b..0c9f243 100644
<!-- testing -->
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 5cf09dcfd541d0434f843de98f040ee8fa68a3e2 Mon Sep 17 00:00:00 2001
From 24bc955987cc5738a8df959a894418e70e42d964 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 7 Jul 2013 10:32:05 -0400
Subject: [PATCH] InventoryClickEvent getClickedInventory
@ -50,5 +50,5 @@ index 28198b8..3313d91 100644
*
* @return the slot type
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 7a2bd98d4764d254ecd97211e12a2d3e5ca8162f Mon Sep 17 00:00:00 2001
From e871dc1552f172369cd309b6ac9ed0af08f25280 Mon Sep 17 00:00:00 2001
From: Alex Bennett <alex.eugene.bennett@gmail.com>
Date: Thu, 11 Jul 2013 15:31:32 -0500
Subject: [PATCH] Added getAllSessionData() to the Conversation API.
@ -24,5 +24,5 @@ index 4f33ff4..7390a77 100644
* this as a way to pass data through each Prompt as the conversation
* develops.
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 3f83f75a73d1b8bb56a888fedcc12c26706481b8 Mon Sep 17 00:00:00 2001
From ed8a52ebe4d123ca8a03e1b34b463369d44a67d1 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 22 Jul 2013 19:09:43 +1000
Subject: [PATCH] Catch Conversation API Errors
@ -30,5 +30,5 @@ index d4c1f6d..46912c8 100644
/**
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 79529c856d312e3ccceedf58c339fe99bff3046b Mon Sep 17 00:00:00 2001
From 3eb055ccbeea11a57734515378a8c838e6ac764c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:20:50 +1000
Subject: [PATCH] Player Collision API
@ -37,5 +37,5 @@ index c6bb787..b879ecb 100644
Spigot spigot();
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From c473d3e1e26599df1e47fb9a6ac1517cafa50f66 Mon Sep 17 00:00:00 2001
From 453c8160b0223029c3c10d03999501bed6a031ba Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:42:16 +1000
Subject: [PATCH] Expand Boolean Prompt Values
@ -24,5 +24,5 @@ index 3f2c97f..81ef78c 100644
}
--
1.9.1
2.1.0

View File

@ -1,17 +1,17 @@
From 8cee5c5d553dc19fe218d3432a0c353989ce885b Mon Sep 17 00:00:00 2001
From dd4b8a4e0eaade34eea01efb407fa13d1cf4af4c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:49:36 +1000
Subject: [PATCH] Add Getter for Entity Invulnerability
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index a60172d..5a1e895 100644
index 39c35c0..d1189ef 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -295,4 +295,22 @@ public interface Entity extends Metadatable {
* @return The current vehicle.
@@ -340,4 +340,22 @@ public interface Entity extends Metadatable {
* @return if the custom name is displayed
*/
public Entity getVehicle();
public boolean isCustomNameVisible();
+
+ // Spigot Start
+ public class Spigot
@ -32,5 +32,5 @@ index a60172d..5a1e895 100644
+ // Spigot End
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 9e4a8d127f11485d052096dbd75d5fdd08c94c23 Mon Sep 17 00:00:00 2001
From d352e90012958d648c73e7dddce37ddf203b4e98 Mon Sep 17 00:00:00 2001
From: ninja- <xninja@openmailbox.org>
Date: Tue, 8 Oct 2013 14:35:58 +0200
Subject: [PATCH] Add respawn API.
@ -24,5 +24,5 @@ index b879ecb..6559243 100644
Spigot spigot();
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From acace924776c03b988c7fb27de01021d03d88c5e Mon Sep 17 00:00:00 2001
From e2827f8e0e31219b75692ad0c866d5f4bc8bb0f3 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 19 Oct 2013 12:59:42 +1100
Subject: [PATCH] Fix Plugin Message API Disconnects
@ -26,5 +26,5 @@ index a906f8d..4c171e8 100644
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 7c38108c86881c6904493f24d41a0434e10368c4 Mon Sep 17 00:00:00 2001
From 85cbff874a815bdd616d06c1131e94a3c6e404a1 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Tue, 24 Dec 2013 10:14:25 +1100
Subject: [PATCH] Fix Tab Completion for Some Commands
@ -81,5 +81,5 @@ index c9ac1ce..a687fef 100644
+ // Spigot End
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 537de94f93b6632771dd62f249f28c3ff34cddc7 Mon Sep 17 00:00:00 2001
From 7f9ceb022a4ff2257c94be5515fb4fdb5b887af4 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 23 Jan 2014 13:17:38 +1100
Subject: [PATCH] Add Spigot Links
@ -25,5 +25,5 @@ index a51766e..1905b8d 100644
Compilation
-----------
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 45c36f5748ba92a780e63663875835706017753e Mon Sep 17 00:00:00 2001
From 285e74b3c673699d5ccf9241dc89e6cd010a3c68 Mon Sep 17 00:00:00 2001
From: Smove <jan@lavasurvival.net>
Date: Sat, 1 Feb 2014 18:10:49 +1100
Subject: [PATCH] Implement Locale Getter for Players
@ -26,5 +26,5 @@ index 6559243..2cc19a7 100644
Spigot spigot();
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From f39dd83d89e165110316b184856f6f08752e3e71 Mon Sep 17 00:00:00 2001
From a3cdd140f2359b7a19b3adbf10c770207a337070 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Sun, 9 Feb 2014 14:02:11 -0500
Subject: [PATCH] Add support for fetching hidden players
@ -26,5 +26,5 @@ index 2cc19a7..37c8a58 100644
Spigot spigot();
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 08bae09498e4734f7e5e18a2f0c6099f221cfd87 Mon Sep 17 00:00:00 2001
From 3950fb168ff04d6e29577c9c4a08d7c2b7656b78 Mon Sep 17 00:00:00 2001
From: drXor <mcyoungsota@gmail.com>
Date: Sun, 23 Feb 2014 16:16:29 -0400
Subject: [PATCH] Silenceable Lightning API
@ -66,5 +66,5 @@ index c8b5154..1ed4ac9 100644
+ Spigot spigot();
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 350a5f4e14e622512b2a91e3f08f52ed4ef6802b Mon Sep 17 00:00:00 2001
From e3225adc7599d9748290a68334ec8635b803d6c1 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 30 Mar 2014 15:58:22 +1100
Subject: [PATCH] Remove deprecation on some player lookup methods
@ -6,7 +6,7 @@ Subject: [PATCH] Remove deprecation on some player lookup methods
Most of these methods still have plenty of use given that only one player with each name can exist at a time. Deprecating these methods renders even basic functionality such as /msg <name> impossible without causing compiler warnings. We will maintain this API and it should be considered safe and appropriate for most use cases.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7b25817..34f44af 100644
index cc071c6..b85a699 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -197,7 +197,6 @@ public final class Bukkit {
@ -34,7 +34,7 @@ index 7b25817..34f44af 100644
return server.getPlayerExact(name);
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e14e9f1..14c8a8a 100644
index 573b33b..f861214 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -308,23 +308,17 @@ public interface Server extends PluginMessageRecipient {
@ -75,5 +75,5 @@ index e14e9f1..14c8a8a 100644
/**
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 498e18aa6f38ee56b8d883e43d3734eb20669df8 Mon Sep 17 00:00:00 2001
From 96c041a8ac1d923260b223185fa51e9a9fdcf0d8 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 17 Apr 2014 19:22:26 +1000
Subject: [PATCH] Expand team API to allow arbitrary strings.
@ -71,5 +71,5 @@ index 50c6f76..b90b9c3 100644
+ // Spigot end
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From c83b72d7be864c3f36b98cea8eea17b647682116 Mon Sep 17 00:00:00 2001
From 61249f066edcdf474dd11f93aedfa621241d4a3e Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 17 Apr 2014 19:35:13 +1000
Subject: [PATCH] Add Score.isScoreSet()Z API.
@ -27,5 +27,5 @@ index 4c10346..2410cbd 100644
* Gets the scoreboard for the associated objective.
*
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 18efac72ae78fa2b9ae87f7b31d2d9d3a2348e93 Mon Sep 17 00:00:00 2001
From 5c06d1fef805814a36289acf6f6bacdbdc29187d Mon Sep 17 00:00:00 2001
From: ninja <xninja@openmailbox.org>
Date: Tue, 8 Apr 2014 14:01:32 +0200
Subject: [PATCH] Add PlayerSpawnLocationEvent.
@ -61,5 +61,5 @@ index 0000000..dd3f58c
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From eefb473aac1d8fa827fa6fb06ae9831ed260b88b Mon Sep 17 00:00:00 2001
From 1248aadefde8e330cf79289c4a87cdc47b16ebb4 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Wed, 16 Jul 2014 17:24:21 +1000
Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible
@ -6,7 +6,7 @@ Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible
When on Java 7 we can register the classloader as parallel capable to prevent deadlocks caused by certain scenarios. Due to the nature of PluginClassLoader this isn't completely safe, but we can make it safer by switching to concurrency focused collections. Either way this is far better than crashing the server.
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 6611342..a845e81 100644
index fe723c9..f8ef65b 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -48,7 +48,7 @@ import org.yaml.snakeyaml.error.YAMLException;
@ -63,5 +63,5 @@ index 13f8633..4cffa13 100644
super(new URL[] {file.toURI().toURL()}, parent);
Validate.notNull(loader, "Loader cannot be null");
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From e76f23f838d7d7287d4b9000273d819c8bf70c95 Mon Sep 17 00:00:00 2001
From c789d5147f42f303e3a504827abbadb3c4a72b87 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Tue, 22 Jul 2014 21:01:32 +1000
Subject: [PATCH] Fix slow tab complete for some commands.
@ -19,5 +19,5 @@ index b3fa4f8..6559b33 100644
if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) {
completions.add(name);
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 7ed4a5c6dde8f4a5cb4d1bf9f6b1d14c40aaf100 Mon Sep 17 00:00:00 2001
From 77013c32824c02e4395a7488b96be98859296a7a Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu>
Date: Wed, 23 Jul 2014 15:50:36 -0400
Subject: [PATCH] Undeprecate Player#updateInventory()V
@ -21,5 +21,5 @@ index 37c8a58..b2ad5b7 100644
/**
--
1.8.4.2
2.1.0

View File

@ -1,4 +1,4 @@
From a302400ed6abb7b3f54f0add03d8c6fb271962de Mon Sep 17 00:00:00 2001
From 5ba93a51ec3f858ec324be5cbeeda7d677c91526 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:31:04 -0400
Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta
@ -44,5 +44,5 @@ index 397ba11..9ae3e4c 100644
ItemMeta clone();
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 51cd0958df56ffd971da90b18d7010df99d02fa4 Mon Sep 17 00:00:00 2001
From 7b6992e7d0858c798faf863a56d8e376eb4a1e81 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 1 Sep 2014 19:36:20 +1000
Subject: [PATCH] Skip loading of plugins which are not 1.8 compatible.
@ -6,10 +6,10 @@ Subject: [PATCH] Skip loading of plugins which are not 1.8 compatible.
As they do not work with Spigot 1.8 builds!
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 1d51908..0b53084 100644
index 1d51908..b3002e8 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -132,6 +132,18 @@ public final class SimplePluginManager implements PluginManager {
@@ -132,6 +132,13 @@ public final class SimplePluginManager implements PluginManager {
try {
description = loader.getPluginDescription(file);
String name = description.getName();
@ -19,15 +19,10 @@ index 1d51908..0b53084 100644
+ 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");
continue;
--
1.9.1
2.1.0

View File

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

View File

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

View File

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

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

View File

@ -1,4 +1,4 @@
From 191d925c165b18ef460bb2956e4084602f676bf6 Mon Sep 17 00:00:00 2001
From 02a078677cd7891bda112d4df03b4ae357c5e58c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 13:07:39 +1000
Subject: [PATCH] POM Changes
@ -6,7 +6,7 @@ Subject: [PATCH] POM Changes
Basic changes to the build system which mark the artifact as Spigot, and the necessary code changes to ensure proper functionality. Also disables the auto updater provided by CraftBukkit as it is useless to us.
diff --git a/pom.xml b/pom.xml
index 8dc82eb..6aeffa8 100644
index e2d4c7d..64600fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,12 @@
@ -18,7 +18,7 @@ index 8dc82eb..6aeffa8 100644
+ <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>
@ -26,38 +26,21 @@ index 8dc82eb..6aeffa8 100644
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -18,24 +18,12 @@
@@ -18,6 +18,13 @@
<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>
@@ -53,16 +41,16 @@
<id>repobo-snap</id>
@@ -34,8 +41,8 @@
<dependencies>
<dependency>
@ -68,51 +51,7 @@ index 8dc82eb..6aeffa8 100644
<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>
@@ -107,33 +95,6 @@
<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>
@@ -151,15 +112,15 @@
@@ -132,15 +139,15 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
<build>
@ -131,7 +70,7 @@ index 8dc82eb..6aeffa8 100644
</configuration>
<executions>
<execution>
@@ -212,7 +173,7 @@
@@ -193,7 +200,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
@ -140,19 +79,6 @@ index 8dc82eb..6aeffa8 100644
<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 a666131..eb0b342 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -317,7 +317,7 @@ 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 f905d17..9304637 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@ -167,5 +93,5 @@ index f905d17..9304637 100644
if (stream != null) {
--
1.9.1
2.1.0

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
From c3f529b0c38959cca79017feac7bd3d312b647aa Mon Sep 17 00:00:00 2001
From f313b15b07c642bdd687eada899fa22f4d43d653 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:10:56 +1000
Subject: [PATCH] Skeleton API Implementations
@ -6,10 +6,10 @@ Subject: [PATCH] Skeleton API Implementations
This contains the basic, empty implementations for some Spigot-API extensions. They are included early in the patching progress so that compilation will still succeed midway despite the APIs only being provided by subsequent patches.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index eb0b342..1fb4eeb 100644
index f2a78c1..c20a2d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1768,4 +1768,14 @@ public final class CraftServer implements Server {
@@ -1620,4 +1620,14 @@ public final class CraftServer implements Server {
public UnsafeValues getUnsafe() {
return CraftMagicNumbers.INSTANCE;
}
@ -25,10 +25,10 @@ index eb0b342..1fb4eeb 100644
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f4dec5b..7112c77 100644
index 2f21f7a..4ab7c05 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1313,4 +1313,14 @@ public class CraftWorld implements World {
@@ -1323,4 +1323,14 @@ public class CraftWorld implements World {
cps.queueUnload(chunk.locX, chunk.locZ);
}
}
@ -44,7 +44,7 @@ index f4dec5b..7112c77 100644
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 4f8d47d..09e7223 100644
index dca8520..bf48e6e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -71,4 +71,15 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
@ -64,12 +64,12 @@ index 4f8d47d..09e7223 100644
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index b8a9a14..4198dae 100644
index b7e9d8f..4b26bb0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -402,4 +402,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().vehicle.getBukkitEntity();
@@ -436,4 +436,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isCustomNameVisible() {
return getHandle().getCustomNameVisible();
}
+
+ // Spigot start
@ -81,15 +81,35 @@ index b8a9a14..4198dae 100644
+ {
+ 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 64e346d..243e8e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
@@ -27,4 +27,15 @@ 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
index bbf310b..da0c78e 100644
index 286a58c..fb07b7d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1287,4 +1287,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1309,4 +1309,15 @@ 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,8 +142,55 @@ index c9738c4..32d4a67 100644
+ {
+ 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 7095f6d..c7d3657 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
@@ -58,4 +58,11 @@ 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 8a640d3..e38d109 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -142,4 +142,26 @@ 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
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From dfc4c44370852db4d3b5f17f54adabb1c4d1a45d Mon Sep 17 00:00:00 2001
From 0ec0c2a68e29d25a42c0c5c9d55d99b189df039f Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 14 Apr 2014 10:38:04 +1000
Subject: [PATCH] Obfuscation Helpers
@ -6,22 +6,22 @@ Subject: [PATCH] Obfuscation Helpers
Provides several friendly named methods which map to a obfuscated method. Obfuscated methods which are used frequently should be added to this file to ease with updates to new Minecraft versions.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e65cbfa..998de35 100644
index 4a39203..00e897b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1225,6 +1225,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
@@ -1298,6 +1298,12 @@ 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;
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 590b9e6daca8420d6d7f3baae9380f553408bb28 Mon Sep 17 00:00:00 2001
From 246253b92d92085145293e7c5d64a20fd836f083 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 7 Jul 2013 09:32:53 +1000
Subject: [PATCH] Spigot Configuration
@ -6,11 +6,11 @@ Subject: [PATCH] Spigot Configuration
Provides the basic infrastructure to load and save the Spigot configuration file, spigot.yml
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 83f2dad..c591de0 100644
index 29c0a34..424b71d 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -116,6 +116,11 @@ 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 83f2dad..c591de0 100644
+ org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end
i.info("Generating keypair");
DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b());
@@ -130,7 +135,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false;
@ -33,34 +33,34 @@ index 83f2dad..c591de0 100644
+ // 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 08c506c..12c613c 100644
index 0767445..94463a4 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -106,6 +106,7 @@ public abstract class World implements IBlockAccess {
public boolean pvpMode;
public boolean keepSpawnInMemory = true;
public ChunkGenerator generator;
@@ -85,6 +85,7 @@ public abstract class World implements IBlockAccess {
public long ticksPerMonsterSpawns;
public boolean populating;
private int tickPosition;
+ public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public CraftWorld getWorld() {
return this.world;
@@ -121,6 +122,7 @@ public abstract class World implements IBlockAccess {
@@ -99,6 +100,7 @@ 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
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1fb4eeb..9d45f34 100644
index c20a2d5..ff9efe9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -323,8 +323,10 @@ public final class CraftServer implements Server {
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update"));
updater.check(serverVersion);
@@ -245,8 +245,10 @@ public final class CraftServer implements Server {
chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold");
loadIcon();
- loadPlugins();
- enablePlugins(PluginLoadOrder.STARTUP);
@ -71,15 +71,15 @@ index 1fb4eeb..9d45f34 100644
}
public boolean getCommandBlockOverride(String command) {
@@ -789,6 +791,7 @@ public final class CraftServer implements Server {
@@ -672,6 +674,7 @@ public final class CraftServer implements Server {
logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage());
}
+ org.spigotmc.SpigotConfig.init(); // Spigot
for (WorldServer world : console.worlds) {
world.difficulty = difficulty;
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@@ -803,11 +806,14 @@ public final class CraftServer implements Server {
@@ -686,11 +689,14 @@ public final class CraftServer implements Server {
} else {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
@ -96,7 +96,7 @@ index 1fb4eeb..9d45f34 100644
int pollCount = 0;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
new file mode 100644
index 0000000..8ae9862
index 0000000..6837305
--- /dev/null
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -0,0 +1,138 @@
@ -158,8 +158,8 @@ index 0000000..8ae9862
+
+ 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 );
+ }
+
@ -316,5 +316,5 @@ index 0000000..961ddb4
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From cd02a08b0e6122b9061162abdf9ef24be9df1af9 Mon Sep 17 00:00:00 2001
From 0e407f08a361f677443120db69572f7c73268167 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:56:02 +1000
Subject: [PATCH] Better Chunk Tick Selection
@ -6,24 +6,25 @@ Subject: [PATCH] Better Chunk Tick Selection
An optimized chunk ticking algorithm which better selects chunks around players which are active on the server.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 12c613c..7ecd668 100644
index e8c86d2..4d630b1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -62,7 +62,7 @@ public abstract class World implements IBlockAccess {
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public
public boolean isStatic;
// CraftBukkit start - public, longhashset
@@ -64,7 +64,7 @@ public abstract class World implements IBlockAccess {
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;
@@ -79,6 +79,30 @@ public abstract class World implements IBlockAccess {
private boolean M;
int[] I;
@@ -85,6 +85,31 @@ public abstract class World implements IBlockAccess {
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,22 +47,22 @@ index 12c613c..7ecd668 100644
+ }
+ // Spigot end
+
public BiomeBase getBiome(int i, int j) {
if (this.isLoaded(i, 0, j)) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
@@ -128,6 +152,11 @@ public abstract class World implements IBlockAccess {
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public CraftWorld getWorld() {
@@ -106,6 +131,11 @@ 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
this.K = this.random.nextInt(12000);
this.allowMonsters = true;
@@ -1987,17 +2016,44 @@ public abstract class World implements IBlockAccess {
@@ -1884,17 +1914,44 @@ public abstract class World implements IBlockAccess {
int k;
int l;
@ -84,11 +85,11 @@ index 12c613c..7ecd668 100644
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 12c613c..7ecd668 100644
+ 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
}
@ -110,44 +111,56 @@ index 12c613c..7ecd668 100644
this.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ba7965d..71626fa 100644
index 1a6024f..93e5a14 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -307,10 +307,20 @@ public class WorldServer extends World {
// CraftBukkit start
// Iterator iterator = this.chunkTickList.iterator();
- for (long chunkCoord : this.chunkTickList.popAll()) {
@@ -344,12 +344,15 @@ 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 {
@@ -361,9 +364,21 @@ 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;
@@ -401,6 +411,7 @@ 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);
@@ -458,6 +473,12 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}
}
@@ -409,6 +420,12 @@ public class WorldServer extends World {
this.methodProfiler.b();
}
+ // Spigot Start
+ if ( spigotConfig.clearChunksOnTick )
@ -157,7 +170,7 @@ index ba7965d..71626fa 100644
+ // 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 961ddb4..90a227f 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -179,5 +192,5 @@ index 961ddb4..90a227f 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 4600e04f4209c804d64951143128240f3a68c3cf Mon Sep 17 00:00:00 2001
From bec392e5a87c0d036a931c482c6e13df404bbded Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:17:20 +1000
Subject: [PATCH] Crop Growth Rates
@ -6,10 +6,10 @@ Subject: [PATCH] Crop Growth Rates
Allows configuring the growth rates of crops as a percentage of their normal growth rate.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 9876ebf..c043b9a 100644
index 59d03ce..12e2b79 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -804,4 +804,16 @@ public class Block {
@@ -927,4 +927,16 @@ public class Block {
return 0;
}
// CraftBukkit end
@ -27,111 +27,110 @@ index 9876ebf..c043b9a 100644
+ // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index e920c6f..f55e531 100644
index 7046683..8569204 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -23,7 +23,7 @@ public class BlockCactus extends Block {
if (l < 3) {
int i1 = world.getData(i, j, k);
@@ -29,7 +29,7 @@ public class BlockCactus extends Block {
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 875181f..fd28d85 100644
index 2ce2e34..d61251f 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -29,7 +29,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
if (l < 7) {
float f = this.n(world, i, j, k);
@@ -32,8 +32,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
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 abd991b..7c00158 100644
index 7516e21..8357fee 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -39,7 +39,8 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement {
}
@@ -45,7 +45,7 @@ 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 6671a84..4daa273 100644
index f2944be..decefa9 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -19,7 +19,7 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme
@@ -20,7 +20,7 @@ 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 a01a6e6..2854bbc 100644
index 8f792e4..cb383a5 100644
--- a/src/main/java/net/minecraft/server/BlockMycel.java
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
@@ -33,7 +33,8 @@ public class BlockMycel extends Block {
}
@@ -44,7 +44,7 @@ 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 a1350f6..6c04ad2 100644
index ae7c617..11631da 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -24,7 +24,7 @@ public class BlockReed extends Block {
if (l < 3) {
int i1 = world.getData(i, j, k);
@@ -28,7 +28,7 @@ public class BlockReed extends Block {
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 89e60a8..8258395 100644
index ff4f576..39c0cba 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -27,7 +27,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen
public void a(World world, int i, int j, int k, Random random) {
@@ -28,7 +28,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen
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
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index 40ad1c6..b37b187 100644
index 23661a8..24e4d85 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
if (world.getLightLevel(i, j + 1, k) >= 9) {
float f = this.n(world, i, j, k);
@@ -47,7 +47,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
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 90a227f..7e79ba5 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -173,5 +172,5 @@ index 90a227f..7e79ba5 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 0744f8a9ee4ffbd0f160aac4f4b48898b4b8e124 Mon Sep 17 00:00:00 2001
From 0274f34174a47601b4fececf698e65325670b3bb Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:09:45 +1000
Subject: [PATCH] More Efficient Chunk Save Queue
@ -6,18 +6,24 @@ Subject: [PATCH] More Efficient Chunk Save Queue
Optimizes the data structures behind the chunk save queue into ones more suitable for the type of data and access which they are used for.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 9402f0f..ea45af2 100644
index a5175fd..9ab0b5e 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger;
@@ -15,8 +15,11 @@ 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();
@@ -30,13 +31,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
- 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;
@@ -29,13 +32,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
synchronized (this.d) {
@ -36,7 +42,7 @@ index 9402f0f..ea45af2 100644
}
return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
@@ -63,14 +62,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -62,14 +63,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
Object object = this.d;
synchronized (this.d) {
@ -56,7 +62,7 @@ index 9402f0f..ea45af2 100644
}
if (nbttagcompound == null) {
@@ -150,17 +147,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -150,17 +149,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
Object object = this.d;
synchronized (this.d) {
@ -71,14 +77,16 @@ index 9402f0f..ea45af2 100644
+ 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);
}
}
@@ -170,12 +161,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -170,12 +166,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
Object object = this.d;
synchronized (this.d) {
@ -97,5 +105,5 @@ index 9402f0f..ea45af2 100644
if (pendingchunktosave != null) {
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 97b423f6d3b88ae933e6005d8b00a32096a047f8 Mon Sep 17 00:00:00 2001
From 5fbdb53b2c7e4ed1a2eebbeaeb9f4b28d34f23a8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 09:46:33 +1100
Subject: [PATCH] Merge tweaks and configuration
@ -6,22 +6,22 @@ Subject: [PATCH] Merge tweaks and configuration
This allows the merging of Experience orbs, as well as the configuration of the merge radius of items. Additionally it refactors the merge algorithm to be a better experience for players.
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 394bfbf..c8c0d6a 100644
index e2c0712..7f16401 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -117,7 +117,10 @@ public class EntityItem extends Entity {
@@ -122,7 +122,10 @@ 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()) {
EntityItem entityitem = (EntityItem) iterator.next();
@@ -148,11 +151,13 @@ public class EntityItem extends Entity {
@@ -156,11 +159,13 @@ public class EntityItem extends Entity {
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
return false;
} else {
@ -41,10 +41,10 @@ index 394bfbf..c8c0d6a 100644
}
} else {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7ecd668..dcc87e8 100644
index 4d630b1..18f0311 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1010,6 +1010,23 @@ public abstract class World implements IBlockAccess {
@@ -908,6 +908,23 @@ public abstract class World implements IBlockAccess {
// Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
event = CraftEventFactory.callProjectileLaunchEvent(entity);
}
@ -53,7 +53,7 @@ index 7ecd668..dcc87e8 100644
+ 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;
@ -92,5 +92,5 @@ index 7e79ba5..1545a61 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 6ef33540f17b60e923a59626dc721ab79f68e4f3 Mon Sep 17 00:00:00 2001
From 3397d600dc9d5afeb67b5979f7490b5bfce721c1 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Tue, 25 Mar 2014 16:10:01 +1100
Subject: [PATCH] Async Operation Catching
@ -6,30 +6,30 @@ Subject: [PATCH] Async Operation Catching
Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index c043b9a..0893a6f 100644
index 12e2b79..9a19752 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -433,9 +433,13 @@ public class Block {
@@ -268,9 +268,13 @@ public class Block {
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
+ }
public int a(Random random) {
return 1;
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 1af0e67..70b0181 100644
index c9058db..350f2f7 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -91,6 +91,7 @@ public class EntityTracker {
@@ -94,6 +94,7 @@ public class EntityTracker {
}
public void addEntity(Entity entity, int i, int j, boolean flag) {
@ -37,7 +37,7 @@ index 1af0e67..70b0181 100644
if (i > this.e) {
i = this.e;
}
@@ -125,6 +126,7 @@ public class EntityTracker {
@@ -129,6 +130,7 @@ public class EntityTracker {
}
public void untrackEntity(Entity entity) {
@ -46,18 +46,18 @@ index 1af0e67..70b0181 100644
EntityPlayer entityplayer = (EntityPlayer) entity;
Iterator iterator = this.c.iterator();
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 0cf9ad5..f654d58 100644
index 7c58740..f5d518f 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -299,6 +299,7 @@ public class EntityTrackerEntry {
@@ -308,6 +308,7 @@ public class EntityTrackerEntry {
}
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);
@@ -515,6 +516,7 @@ public class EntityTrackerEntry {
if (this.c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
@@ -536,6 +537,7 @@ public class EntityTrackerEntry {
}
public void clear(EntityPlayer entityplayer) {
@ -66,18 +66,18 @@ index 0cf9ad5..f654d58 100644
this.trackedPlayers.remove(entityplayer);
entityplayer.d(this.tracker);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index dcc87e8..d12ef7a 100644
index 4cd59aa..a16be9b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -979,6 +979,7 @@ public abstract class World implements IBlockAccess {
@@ -878,6 +878,7 @@ public abstract class World implements IBlockAccess {
}
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
+ org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
if (entity == null) return false;
// CraftBukkit end
@@ -1086,6 +1087,7 @@ public abstract class World implements IBlockAccess {
int i = MathHelper.floor(entity.locX / 16.0D);
@@ -985,6 +986,7 @@ public abstract class World implements IBlockAccess {
}
public void removeEntity(Entity entity) {
@ -85,16 +85,16 @@ index dcc87e8..d12ef7a 100644
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@@ -2466,6 +2468,7 @@ public abstract class World implements IBlockAccess {
@@ -2410,6 +2412,7 @@ 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 7112c77..c76c3d3 100644
index 4ab7c05..b9032cd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -162,6 +162,7 @@ public class CraftWorld implements World {
@ -122,10 +122,10 @@ index 7112c77..c76c3d3 100644
if (generate) {
// Use the default variant of loadChunk when generate == true.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6493ce7..8b599f2 100644
index fb07b7d..01b1822 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -238,6 +238,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -214,6 +214,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kickPlayer(String message) {
@ -169,5 +169,5 @@ index 0000000..4b3aa85
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,225 +0,0 @@
From 0c3794fe2fabe95056ec884d1b83e4ac4560b699 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 691cafd..9d54472 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
@@ -10,6 +10,6 @@ public class LongHash {
}
public static int lsw(long l) {
- return (int) (l & 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 22c96c5..7f659b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
@@ -31,6 +31,7 @@ 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);
@@ -56,10 +57,30 @@ 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;
@@ -82,6 +103,7 @@ 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;
@@ -125,10 +147,18 @@ 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;
@@ -161,6 +191,7 @@ 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 01861cc..2e5b436 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java
@@ -28,6 +28,7 @@ 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();
@@ -61,6 +62,17 @@ 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;
@@ -78,6 +90,7 @@ 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];
@@ -124,6 +137,7 @@ 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) {
@@ -174,6 +188,7 @@ 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 0000000..9416f6e
--- /dev/null
+++ b/src/main/java/org/spigotmc/FlatMap.java
@@ -0,0 +1,64 @@
+package org.spigotmc;
+
+import org.bukkit.craftbukkit.util.LongHash;
+
+public class FlatMap<V>
+{
+
+ private static final int FLAT_LOOKUP_SIZE = 512;
+ private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ];
+
+ public void put(long msw, long lsw, V value)
+ {
+ long acx = Math.abs( msw );
+ long acz = Math.abs( lsw );
+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE )
+ {
+ flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value;
+ }
+ }
+
+ public void put(long key, V value)
+ {
+ put( LongHash.msw( key ), LongHash.lsw( key ), value );
+
+ }
+
+ public void remove(long key)
+ {
+ put( key, null );
+ }
+
+ public void remove(long msw, long lsw)
+ {
+ put( msw, lsw, null );
+ }
+
+ public boolean contains(long msw, long lsw)
+ {
+ return get( msw, lsw ) != null;
+ }
+
+ public boolean contains(long key)
+ {
+ return get( key ) != null;
+ }
+
+ public V get(long msw, long lsw)
+ {
+ long acx = Math.abs( msw );
+ long acz = Math.abs( lsw );
+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE )
+ {
+ return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )];
+ } else
+ {
+ return null;
+ }
+ }
+
+ public V get(long key)
+ {
+ return get( LongHash.msw( key ), LongHash.lsw( key ) );
+ }
+}
--
1.9.1

View File

@ -1,4 +1,4 @@
From 96c3f91f9741f81bce19d0b681a8adaf05eb234f Mon Sep 17 00:00:00 2001
From 84fd7cb51f698d601ac8d22e24e9baf6f04953b7 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 09:52:41 +1100
Subject: [PATCH] View Distance
@ -6,7 +6,7 @@ Subject: [PATCH] View Distance
This commit allows the user to select per world view distances, and view distances below 3. Be wary of the issues selecting a view distance of 1 or 2 may cause!
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index ae53635..cc1b095 100644
index 8ac9387..5ca5935 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -26,9 +26,9 @@ public class PlayerChunkMap {
@ -16,24 +16,24 @@ index ae53635..cc1b095 100644
- 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
}
public WorldServer a() {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 71626fa..8f25a15 100644
index 93e5a14..f34b76e 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -55,7 +55,7 @@ public class WorldServer extends World {
@@ -62,7 +62,7 @@ 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 1545a61..6cc3a91 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -51,5 +51,5 @@ index 1545a61..6cc3a91 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 6dc58e160c5b62dc3c5d6f1bb40678a44fcac26d Mon Sep 17 00:00:00 2001
From 0684c3cc896612daa522771c2faadafebd1c776a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 10 Jan 2013 00:18:11 -0500
Subject: [PATCH] Spigot Timings
@ -6,70 +6,70 @@ Subject: [PATCH] Spigot Timings
Overhauls the Timings System adding performance tracking all around the Minecraft Server
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3ac0ae4..9acfe12 100644
index 4ac212b..7519bfa 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -847,6 +847,7 @@ public class Chunk {
@@ -876,6 +876,7 @@ public class Chunk {
}
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);
@@ -922,6 +923,7 @@ public class Chunk {
}
@@ -862,6 +863,7 @@ 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 c88d5d4..22330c3 100644
index a363af7..9ee7e75 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -137,6 +137,7 @@ public class ChunkProviderServer implements IChunkProvider {
boolean newChunk = false;
@@ -130,6 +130,7 @@ public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit end
if (chunk == null) {
+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot
chunk = this.loadChunk(i, j);
if (chunk == null) {
if (this.chunkProvider == null) {
@@ -187,6 +188,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
@@ -181,6 +182,7 @@ public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit end
chunk.loadNearby(this, this, i, j);
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
}
return chunk;
@@ -219,7 +221,9 @@ public class ChunkProviderServer implements IChunkProvider {
@@ -215,7 +217,9 @@ 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
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index ea45af2..59fe8ac 100644
index 9ab0b5e..1eea51c 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -44,7 +44,9 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -45,7 +45,9 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
// 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];
NBTTagCompound nbttagcompound = (NBTTagCompound) data[1];
@@ -343,6 +345,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -381,6 +383,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) {
// CraftBukkit end
@ -77,7 +77,7 @@ index ea45af2..59fe8ac 100644
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
@@ -368,7 +371,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -406,7 +409,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
}
@ -87,7 +87,7 @@ index ea45af2..59fe8ac 100644
NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10);
if (nbttaglist2 != null) {
@@ -381,6 +385,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -419,6 +423,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
}
@ -96,7 +96,7 @@ index ea45af2..59fe8ac 100644
if (nbttagcompound.hasKeyOfType("TileTicks", 9)) {
NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10);
@@ -393,6 +399,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -438,6 +444,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
}
@ -105,7 +105,7 @@ index ea45af2..59fe8ac 100644
// return chunk; // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index c591de0..58e68da 100644
index 424b71d..390c6eb 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -18,6 +18,7 @@ import java.io.PrintStream;
@ -116,27 +116,27 @@ index c591de0..58e68da 100644
import org.bukkit.event.server.ServerCommandEvent;
// CraftBukkit end
@@ -291,6 +292,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -317,6 +318,7 @@ 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);
@@ -303,6 +305,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.server.dispatchServerCommand(this.console, servercommand);
@@ -330,6 +332,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// 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 09c9c8e..a7d9c11 100644
index 6e395b6..e2f3456 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -15,6 +15,7 @@ import org.bukkit.entity.Hanging;
@@ -16,6 +16,7 @@ import org.bukkit.entity.Hanging;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Vehicle;
@ -144,7 +144,7 @@ index 09c9c8e..a7d9c11 100644
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
@@ -113,6 +114,8 @@ public abstract class Entity {
@@ -112,6 +113,8 @@ public abstract class Entity implements ICommandListener {
public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
@ -153,27 +153,28 @@ index 09c9c8e..a7d9c11 100644
public int getId() {
return this.id;
}
@@ -416,6 +419,7 @@ public abstract class Entity {
return;
@@ -378,6 +381,8 @@ 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;
@@ -724,6 +728,7 @@ public abstract class Entity {
+
if (this.T) {
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
@@ -716,6 +721,7 @@ 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 0c63b2c..6a0bee6 100644
index 0aaee5f..803b5df 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -16,6 +16,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
@@ -17,6 +17,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.entity.EntityRegainHealthEvent;
// CraftBukkit end
@ -181,99 +182,99 @@ index 0c63b2c..6a0bee6 100644
+
public abstract class EntityLiving extends Entity {
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -1357,6 +1359,7 @@ public abstract class EntityLiving extends Entity {
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -1384,6 +1386,7 @@ 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();
@@ -1395,7 +1398,9 @@ public abstract class EntityLiving extends Entity {
int i = this.bu();
@@ -1422,7 +1425,9 @@ 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;
float f = (float) (d0 * d0 + d1 * d1);
@@ -1460,6 +1465,7 @@ public abstract class EntityLiving extends Entity {
@@ -1487,6 +1492,7 @@ 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) {
@@ -1524,6 +1530,7 @@ public abstract class EntityLiving extends Entity {
protected float h(float f, float f1) {
@@ -1551,6 +1557,7 @@ 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;
@@ -1541,6 +1548,7 @@ public abstract class EntityLiving extends Entity {
this.aO = this.yaw;
}
if (this.bC()) {
this.aW = false;
this.aX = 0.0F;
@@ -1561,6 +1568,7 @@ public abstract class EntityLiving extends Entity {
this.doTick();
this.world.methodProfiler.b();
}
+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
@@ -1562,11 +1570,15 @@ public abstract class EntityLiving extends Entity {
this.bd *= 0.98F;
this.be *= 0.98F;
this.bf *= 0.9F;
@@ -1582,11 +1590,15 @@ public abstract class EntityLiving extends Entity {
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
}
this.world.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 998de35..0a15416 100644
index 00e897b..1cb9d38 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -37,6 +37,7 @@ import jline.console.ConsoleReader;
import joptsimple.OptionSet;
@@ -45,6 +45,7 @@ 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;
@@ -545,6 +546,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
protected void t() {}
@@ -587,6 +588,7 @@ 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;
@@ -571,10 +573,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -613,10 +615,12 @@ 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");
@@ -591,21 +595,30 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -633,6 +637,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b();
this.methodProfiler.b();
@ -281,8 +282,10 @@ index 998de35..0a15416 100644
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot
}
public void v() {
this.methodProfiler.a("levels");
public void z() {
@@ -651,16 +657,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.c("levels");
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
// CraftBukkit start
@ -304,7 +307,7 @@ index 998de35..0a15416 100644
// 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) {
@@ -613,6 +626,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -668,6 +681,7 @@ 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 998de35..0a15416 100644
int i;
@@ -638,7 +652,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -691,7 +705,9 @@ 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);
@@ -646,7 +662,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -699,7 +715,9 @@ 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);
@@ -655,7 +673,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -708,7 +726,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b();
this.methodProfiler.a("tracker");
@ -342,32 +345,32 @@ index 998de35..0a15416 100644
this.methodProfiler.b();
this.methodProfiler.b();
// } // CraftBukkit
@@ -664,14 +684,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -717,14 +737,20 @@ 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
this.methodProfiler.b();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3a98439..69004ea 100644
index 9b71ffc..2a0cea5 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -941,6 +941,8 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -1031,6 +1031,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit end
private void handleCommand(String s) {
@ -376,7 +379,7 @@ index 3a98439..69004ea 100644
// CraftBukkit start - whole method
this.c.info(this.player.getName() + " issued server command: " + s);
@@ -950,18 +952,22 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -1040,18 +1042,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -400,27 +403,27 @@ index 3a98439..69004ea 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index b2de58b..befe9a9 100644
index ec76148..a93ad27 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -7,10 +7,12 @@ import java.util.concurrent.Callable;
@@ -6,10 +6,12 @@ import java.util.concurrent.Callable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+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 d12ef7a..a5843b0 100644
index a16be9b..5fc707f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -16,6 +16,7 @@ import org.bukkit.Bukkit;
@@ -18,6 +18,7 @@ import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.LongHashSet;
@ -428,8 +431,8 @@ index d12ef7a..a5843b0 100644
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@@ -132,6 +133,8 @@ public abstract class World implements IBlockAccess {
public ChunkGenerator generator;
@@ -112,6 +113,8 @@ public abstract class World implements IBlockAccess {
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot
@ -437,64 +440,72 @@ index d12ef7a..a5843b0 100644
public CraftWorld getWorld() {
return this.world;
}
@@ -183,6 +186,7 @@ public abstract class World implements IBlockAccess {
@@ -149,6 +152,7 @@ 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);
@@ -1313,6 +1317,7 @@ public abstract class World implements IBlockAccess {
this.f.clear();
}
public World b() {
@@ -1239,6 +1243,7 @@ public abstract class World implements IBlockAccess {
this.g.clear();
this.methodProfiler.c("regular");
+ timings.entityTick.startTiming(); // Spigot
// CraftBukkit start - Use field for loop variable
for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) {
entity = (Entity) this.entityList.get(this.tickPosition);
@@ -1328,7 +1333,9 @@ public abstract class World implements IBlockAccess {
@@ -1255,7 +1260,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("tick");
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");
crashreportsystemdetails = crashreport.a("Entity being ticked");
@@ -1353,7 +1360,9 @@ public abstract class World implements IBlockAccess {
@@ -1280,7 +1287,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
}
+ 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()) {
@@ -1369,8 +1378,11 @@ public abstract class World implements IBlockAccess {
@@ -1300,6 +1309,7 @@ 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);
@@ -1390,6 +1402,8 @@ public abstract class World implements IBlockAccess {
CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
@@ -1308,6 +1318,11 @@ public abstract class World implements IBlockAccess {
tileentity.a(crashreportsystemdetails1);
throw new ReportedException(crashreport1);
}
+ // Spigot start
+ finally {
+ tileentity.tickTimer.stopTiming();
+ }
+ // Spigot end
}
}
@@ -1320,6 +1335,8 @@ 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()) {
@@ -1430,6 +1444,7 @@ public abstract class World implements IBlockAccess {
@@ -1352,6 +1369,7 @@ public abstract class World implements IBlockAccess {
this.a.clear();
}
@ -502,32 +513,32 @@ index d12ef7a..a5843b0 100644
this.methodProfiler.b();
this.methodProfiler.b();
}
@@ -1454,6 +1469,7 @@ public abstract class World implements IBlockAccess {
@@ -1396,6 +1414,7 @@ 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;
@@ -1516,6 +1532,7 @@ public abstract class World implements IBlockAccess {
entity.passenger = null;
entity.P = entity.locX;
entity.Q = entity.locY;
@@ -1459,6 +1478,7 @@ public abstract class World implements IBlockAccess {
}
}
+ entity.tickTimer.stopTiming(); // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 8f25a15..d93eb8b 100644
index f34b76e..9012c9e 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -185,10 +185,13 @@ public class WorldServer extends World {
@@ -212,10 +212,13 @@ 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 8f25a15..d93eb8b 100644
this.methodProfiler.c("chunkSource");
this.chunkProvider.unloadChunks();
int j = this.a(1.0F);
@@ -202,21 +205,36 @@ public class WorldServer extends World {
@@ -229,21 +232,34 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
}
@ -548,7 +559,7 @@ index 8f25a15..d93eb8b 100644
+ 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,20 +576,18 @@ index 8f25a15..d93eb8b 100644
+ 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 9d45f34..01de2fd 100644
index ff9efe9..0d23ec1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1778,6 +1778,11 @@ public final class CraftServer implements Server {
@@ -1630,6 +1630,11 @@ public final class CraftServer implements Server {
private final Spigot spigot = new Spigot()
{
@ -591,7 +600,7 @@ index 9d45f34..01de2fd 100644
public Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c76c3d3..28aa997 100644
index b9032cd..84c52d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -252,9 +252,11 @@ public class CraftWorld implements World {
@ -783,7 +792,7 @@ index 0000000..558574f
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 9cf1b49..c249e77 100644
index c2d4c2e..f0db29f 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -40,7 +40,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
@ -791,7 +800,7 @@ index 9cf1b49..c249e77 100644
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
}
@ -880,5 +889,5 @@ index 55db3ff..220e39a 100644
+ // Spigot end
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 807522ab058396ece9c943ade1698f28fb476ed0 Mon Sep 17 00:00:00 2001
From 008dfe5d5d4c87964fc09c34e6ffd46f66d33f09 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:29:54 +1000
Subject: [PATCH] Fix Mob Spawning Relative to View Distance
@ -8,20 +8,20 @@ Changes the mob spawning algorithm to properly account for view distance and the
Needs better documentation.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9acfe12..b6f3761 100644
index 7519bfa..c3059b6 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -40,6 +40,7 @@ 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
@@ -42,6 +42,7 @@ public class Chunk {
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;
@@ -635,6 +636,22 @@ public class Chunk {
entity.ai = k;
entity.aj = this.locZ;
@@ -662,6 +663,22 @@ public class Chunk {
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)
@ -42,7 +42,7 @@ index 9acfe12..b6f3761 100644
}
public void b(Entity entity) {
@@ -651,6 +668,22 @@ public class Chunk {
@@ -678,6 +695,22 @@ public class Chunk {
}
this.entitySlices[i].remove(entity);
@ -64,24 +64,26 @@ index 9acfe12..b6f3761 100644
+ // 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 1dfc346..75427b5 100644
index 25988d4..43954b3 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -27,6 +27,23 @@ public final class SpawnerCreature {
return new ChunkPosition(k, i1, l);
}
@@ -19,6 +19,25 @@ public final class SpawnerCreature {
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,10 +92,10 @@ index 1dfc346..75427b5 100644
+ }
+ // 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;
@@ -42,6 +59,11 @@ public final class SpawnerCreature {
@@ -38,6 +57,11 @@ public final class SpawnerCreature {
j = MathHelper.floor(entityhuman.locZ / 16.0D);
byte b0 = 8;
@ -103,39 +105,43 @@ index 1dfc346..75427b5 100644
+ b0 = ( b0 > 8 ) ? 8 : b0;
+ // Spigot End
for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) {
@@ -89,13 +111,15 @@ public final class SpawnerCreature {
for (k = -b0; k <= b0; ++k) {
@@ -88,17 +112,19 @@ 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));
@@ -156,6 +182,13 @@ public final class SpawnerCreature {
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature
}
@@ -160,6 +184,13 @@ public final class SpawnerCreature {
groupdataentity = entityinsentient.prepare(groupdataentity);
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL);
// CraftBukkit end
+ // 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 6cc3a91..46249d7 100644
@ -154,5 +160,5 @@ index 6cc3a91..46249d7 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,14 +1,14 @@
From 259d75f8ba67a5b5b6f8dbebf9e517c749c00d24 Mon Sep 17 00:00:00 2001
From 81e9b691cfb2a3c0e0df11bf2e05f041e0d7438f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Feb 2013 09:20:19 +1100
Subject: [PATCH] Handle Null Tile Entities
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a5843b0..e03712a 100644
index 3802264..a3fc086 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1375,6 +1375,13 @@ public abstract class World implements IBlockAccess {
@@ -1303,6 +1303,13 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
@ -20,8 +20,8 @@ index a5843b0..e03712a 100644
+ }
+ // 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();
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 696c8e0e4980786ee03c711cf5681cdf11f491af Mon Sep 17 00:00:00 2001
From 160cff443e01980c29589470d51bc54fb447148e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500
Subject: [PATCH] Entity Activation Range
@ -9,19 +9,19 @@ This will drastically cut down on tick timings for entities that are not in rang
This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a7d9c11..33798d8 100644
index bb5e17d..ba1c2f2 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -90,7 +90,7 @@ public abstract class Entity {
@@ -89,7 +89,7 @@ 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;
@@ -114,7 +114,13 @@ public abstract class Entity {
@@ -113,7 +113,13 @@ 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 a7d9c11..33798d8 100644
public int getId() {
return this.id;
@@ -141,7 +147,12 @@ public abstract class Entity {
@@ -143,7 +149,12 @@ 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 {
@ -49,11 +49,11 @@ index a7d9c11..33798d8 100644
this.datawatcher = new DataWatcher(this);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index 36ed831..7ddca48 100644
index 3303d19..8ae38f7 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -6,6 +6,31 @@ public abstract class EntityAgeable extends EntityCreature {
private float bq;
@@ -9,6 +9,31 @@ public abstract class EntityAgeable extends EntityCreature {
private float bl;
public boolean ageLocked = false; // CraftBukkit
+ // Spigot start
@ -85,7 +85,7 @@ index 36ed831..7ddca48 100644
super(world);
}
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 88b0751..ac5d5d2 100644
index 3ba285a..ae00f60 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -15,7 +15,7 @@ public class EntityArrow extends Entity implements IProjectile {
@ -99,7 +99,7 @@ index 88b0751..ac5d5d2 100644
public Entity shooter;
@@ -24,6 +24,18 @@ 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 88b0751..ac5d5d2 100644
+ {
+ if ( this.inGround )
+ {
+ this.at += 19; // Despawn counter. First int after shooter
+ this.ap += 19; // Despawn counter. First int after shooter
+ }
+ super.inactiveTick();
+ }
@ -117,12 +117,12 @@ index 88b0751..ac5d5d2 100644
super(world);
this.j = 10.0D;
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 759d46c..b977cf7 100644
index 8357157..16400c3 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -5,6 +5,15 @@ public class EntityFireworks extends Entity {
private int ticksFlown;
public int expectedLifespan; // CraftBukkit - private -> public
public int expectedLifespan;
+ // Spigot Start
+ @Override
@ -137,10 +137,10 @@ index 759d46c..b977cf7 100644
super(world);
this.a(0.25F, 0.25F);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 6a0bee6..92ad5c7 100644
index 8da3ddd..c4e3e9d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -84,6 +84,13 @@ public abstract class EntityLiving extends Entity {
@@ -83,6 +83,13 @@ public abstract class EntityLiving extends Entity {
public int maxAirTicks = 300;
ArrayList<org.bukkit.inventory.ItemStack> drops = null;
// CraftBukkit end
@ -148,31 +148,31 @@ index 6a0bee6..92ad5c7 100644
+ 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 e03712a..e876b66 100644
index a3fc086..c006526 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1317,6 +1317,7 @@ public abstract class World implements IBlockAccess {
this.f.clear();
@@ -1243,6 +1243,7 @@ public abstract class World implements IBlockAccess {
this.g.clear();
this.methodProfiler.c("regular");
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
timings.entityTick.startTiming(); // Spigot
// CraftBukkit start - Use field for loop variable
for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) {
@@ -1473,9 +1474,11 @@ public abstract class World implements IBlockAccess {
@@ -1418,9 +1419,11 @@ public abstract class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- // 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 e03712a..e876b66 100644
+ } 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 558574f..41d2d87 100644
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
@ -197,14 +197,15 @@ index 558574f..41d2d87 100644
public static final HashMap<String, CustomTimingsHandler> pluginTaskTimingMap = new HashMap<String, CustomTimingsHandler>();
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
new file mode 100644
index 0000000..903172a
index 0000000..8ca6e20
--- /dev/null
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +1,296 @@
@@ -0,0 +1,278 @@
+package org.spigotmc;
+
+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 0000000..903172a
+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 0000000..903172a
+ }
+
+ /**
+ * 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 0000000..903172a
+ {
+
+ 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 0000000..903172a
+ */
+ 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 0000000..903172a
+ 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 0000000..903172a
+ 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;
+ }
@ -518,5 +500,5 @@ index 46249d7..ed2836a 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 726c32d9a80f49276d9596dc785664653cece467 Mon Sep 17 00:00:00 2001
From 73ed5ee29cb1766c1646967dffab9f104a63d1cb Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Feb 2013 08:58:35 +1100
Subject: [PATCH] Metrics
@ -657,7 +657,7 @@ index 0000000..d9c3b63
+}
\ 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 a4de4e9..dc4d4b3 100644
index 6837305..fdd4fe1 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -36,6 +36,7 @@ public class SpigotConfig
@ -688,5 +688,5 @@ index a4de4e9..dc4d4b3 100644
static void readConfig(Class<?> clazz, Object instance)
--
1.9.1
2.1.0

View File

@ -1,28 +1,26 @@
From e966fa6d6dc7ef524fb7285960bdcd8744e9d232 Mon Sep 17 00:00:00 2001
From cc4f72301e86bf997da5da7adf86ed658aed26c6 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 4 Mar 2013 18:45:52 +1100
Subject: [PATCH] PlayerItemDamageEvent
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index c9d74d3..a2ab06a 100644
index 0502bcb..204ae01 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -279,7 +279,13 @@ public final class ItemStack {
return this.item.getMaxDurability();
@@ -305,6 +305,11 @@ public final class ItemStack {
}
+ // 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 {
@@ -294,7 +300,16 @@ public final class ItemStack {
@@ -319,7 +324,16 @@ public final class ItemStack {
}
i -= k;
@ -40,15 +38,15 @@ index c9d74d3..a2ab06a 100644
return false;
}
}
@@ -307,7 +322,7 @@ public final class ItemStack {
@@ -332,7 +346,7 @@ 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) {
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 31decbb03eaed1acb57f79fc9a128dd806029373 Mon Sep 17 00:00:00 2001
From fab5ba1054b3144296518fdd3852e561218de1ad Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 18 Mar 2013 20:01:44 +1100
Subject: [PATCH] Prevent NPE in CraftSign
@ -6,10 +6,10 @@ Subject: [PATCH] Prevent NPE in CraftSign
This commit prevents the constructor of CraftSign throwing an NPE when it cannot get the sign tile entity. Instead it will fallback to a 4 empty lined sign, and not try to do anything to those lines on .update().
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 77717d5..1533dd4 100644
index 724dbd1..1b603b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -14,6 +14,12 @@ public class CraftSign extends CraftBlockState implements Sign {
@@ -17,6 +17,12 @@ public class CraftSign extends CraftBlockState implements Sign {
CraftWorld world = (CraftWorld) block.getWorld();
sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
@ -20,17 +20,8 @@ index 77717d5..1533dd4 100644
+ }
+ // Spigot end
lines = new String[sign.lines.length];
System.arraycopy(sign.lines, 0, lines, 0, lines.length);
}
@@ -34,7 +40,7 @@ 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);
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 2c59fc73e053f597d163844ba2b38e54168566bc Mon Sep 17 00:00:00 2001
From e24ea35293d323a1666931db31c059e2f8775fff Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Feb 2013 11:58:47 -0500
Subject: [PATCH] Entity Tracking Ranges
@ -12,10 +12,10 @@ This has multiple benefits:
4) Less client lag - Not trying to render distant item frames and paintings and entities will reduce entity count on the client, which is major for shop/town worlds which may use tons of item frames.
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 70b0181..c0766d6 100644
index 350f2f7..e3b2864 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -92,6 +92,7 @@ public class EntityTracker {
@@ -95,6 +95,7 @@ public class EntityTracker {
public void addEntity(Entity entity, int i, int j, boolean flag) {
org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
@ -105,5 +105,5 @@ index 0000000..4bf4d2a
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,23 +0,0 @@
From 4075f4f1be59696cbddd8df88b0f10f8fc5f41cc 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 33798d8..18e4d8d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -141,7 +141,7 @@ 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);
--
1.9.1

View File

@ -1,4 +1,4 @@
From 94171e10243a8feca65e35c70a9a4774e43c178a Mon Sep 17 00:00:00 2001
From 9c06e031213caf1c0463c736134f5bee4f91b1a9 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:50:27 +1000
Subject: [PATCH] Thread Naming and Tweaks
@ -19,5 +19,5 @@ index 8442ecb..93d8d42 100644
private CraftAsyncDebugger debugTail = debugHead;
private static final int RECENT_TICKS;
--
1.9.1
2.1.0

View File

@ -1,39 +1,31 @@
From 321030ab9c4665edec42a775e7366ae71c7cc535 Mon Sep 17 00:00:00 2001
From 6c17a534faf1cbea851c45f3b3ba2963c9554ba3 Mon Sep 17 00:00:00 2001
From: Antony Riley <antony@cyberiantiger.org>
Date: Wed, 27 Mar 2013 01:41:54 +0200
Subject: [PATCH] Close Unloaded Save Files
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 900ed68..829f4a3 100644
index f4f72ef..1b03878 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -10,7 +10,7 @@ import java.util.Map;
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 d997b48..6dc4157 100644
index 0d23ec1..2da23eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -85,6 +85,8 @@ 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;
@@ -1062,6 +1064,30 @@ public final class CraftServer implements Server {
@@ -945,6 +945,31 @@ 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.
@ -62,5 +54,5 @@ index d997b48..6dc4157 100644
}
--
1.9.1
2.1.0

View File

@ -1,74 +0,0 @@
From db9b904657edc497a64cf54815bc9e0a45c6e59e 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 ec708d1..d22b6c9 100644
--- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
@@ -37,23 +37,29 @@ 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();
@@ -88,7 +94,7 @@ 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 1a150d9..c9f0027 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
@@ -18,7 +18,7 @@ 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;
--
1.9.1

View File

@ -1,4 +1,4 @@
From 6a1f16ee41738ccbf252c9ccefbf677780592a29 Mon Sep 17 00:00:00 2001
From 74aa07fb1297175eaebfd4192c8b8e2668518e2e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 19 May 2013 18:29:48 +1000
Subject: [PATCH] Remove -o Option
@ -6,10 +6,10 @@ Subject: [PATCH] Remove -o Option
Serves no purpose other than to confuse users.
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index c6cd6fb..fefa221 100644
index 00b35a1..622d6e0 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -52,7 +52,7 @@ public class PropertyManager {
@@ -53,7 +53,7 @@ public class PropertyManager {
}
private <T> T getOverride(String name, T value) {
@ -19,5 +19,5 @@ index c6cd6fb..fefa221 100644
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 4dd7d2d2d253da40bdf2d9fd35d5171d9d0fea92 Mon Sep 17 00:00:00 2001
From d7c816bdcb7621b4a0d16b696c01c3b248f25f8c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 1 Jun 2013 16:34:38 +1000
Subject: [PATCH] Recipe Deconstruction
@ -6,30 +6,30 @@ Subject: [PATCH] Recipe Deconstruction
Some non API methods contributed by Asphodan to allow recipe deconstruction.
diff --git a/src/main/java/net/minecraft/server/IRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java
index bb28c12..c0836e4 100644
index d2655a0..e5b116f 100644
--- a/src/main/java/net/minecraft/server/IRecipe.java
+++ b/src/main/java/net/minecraft/server/IRecipe.java
@@ -11,4 +11,6 @@ public interface IRecipe {
ItemStack b();
@@ -13,4 +13,6 @@ public interface IRecipe {
ItemStack[] b(InventoryCrafting inventorycrafting);
org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
+
+ java.util.List<ItemStack> getIngredients(); // Spigot
}
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index cc444db..867dd07 100644
index 407cbfb..6c3de90 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -10,7 +10,7 @@ public class ShapedRecipes implements IRecipe {
private int width;
private int height;
private ItemStack[] items;
- private ItemStack result;
@@ -11,7 +11,7 @@ public class ShapedRecipes implements IRecipe {
private final int width;
private final int height;
private final ItemStack[] items;
- private final ItemStack result;
+ public ItemStack result; // Spigot
private boolean e;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
@@ -156,4 +156,11 @@ public class ShapedRecipes implements IRecipe {
@@ -171,4 +171,11 @@ public class ShapedRecipes implements IRecipe {
this.e = true;
return this;
}
@ -42,10 +42,10 @@ index cc444db..867dd07 100644
+ // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
index 0fab83c..21181fb 100644
index 2d243d1..b6106db 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
@@ -11,7 +11,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
public class ShapelessRecipes implements IRecipe {
@ -54,7 +54,7 @@ index 0fab83c..21181fb 100644
private final List ingredients;
public ShapelessRecipes(ItemStack itemstack, List list) {
@@ -75,4 +75,11 @@ public class ShapelessRecipes implements IRecipe {
@@ -90,4 +90,11 @@ public class ShapelessRecipes implements IRecipe {
public int a() {
return this.ingredients.size();
}
@ -67,5 +67,5 @@ index 0fab83c..21181fb 100644
+ // Spigot end
}
--
1.9.1
2.1.0

View File

@ -1,11 +1,11 @@
From 9589617ddac0217b8c431e7a87697d549876eb8f Mon Sep 17 00:00:00 2001
From fee2702652112ad10f09a9a7234fdd897ed1cc6a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:16:05 +1000
Subject: [PATCH] Implement Arrow API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 09e7223..8c8a173 100644
index bf48e6e..ad489cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -75,6 +75,17 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
@ -15,7 +15,7 @@ index 09e7223..8c8a173 100644
+ @Override
+ public double getDamage()
+ {
+ return getHandle().e();
+ return getHandle().j();
+ }
+
+ @Override
@ -27,5 +27,5 @@ index 09e7223..8c8a173 100644
public Arrow.Spigot spigot()
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 7d24f487bbcc6261883e52a027a1223ab999e5b9 Mon Sep 17 00:00:00 2001
From 01eedb54f5e95a52f76687ef625bddea00f9f368 Mon Sep 17 00:00:00 2001
From: erocs <github@erocs.org>
Date: Sun, 8 Sep 2013 12:06:15 -0700
Subject: [PATCH] Hopper Customisations
@ -6,76 +6,74 @@ Subject: [PATCH] Hopper Customisations
Allows editing hopper cooldowns and amount transferred per tick.
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index ebdf08e..d77708b 100644
index 7fe1f46..f4dc9c7 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -189,12 +189,18 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -193,12 +193,18 @@ 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;
@@ -246,7 +252,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (this.getItem(j) != null) {
ItemStack itemstack = this.getItem(j).cloneItemStack();
@@ -252,7 +258,7 @@ 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
@@ -260,11 +266,11 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -266,9 +272,10 @@ 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();
@@ -274,7 +280,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -280,7 +287,7 @@ 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);
}
}
@@ -379,7 +385,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) {
@@ -386,7 +393,7 @@ 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
@@ -396,13 +402,14 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -403,13 +410,14 @@ 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 ebdf08e..d77708b 100644
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) {
@@ -415,6 +422,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -421,6 +429,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
// CraftBukkit end
return true;
}
+ itemstack1.count -= origCount - itemstack2.count; // Spigot
iinventory.setItem(i, itemstack1);
}
@@ -502,7 +510,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
@@ -511,7 +520,7 @@ 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 6421bf2..956c628 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -129,5 +127,5 @@ index 6421bf2..956c628 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From ae39328c915d12f99f3dfa349331d8c17a4653e6 Mon Sep 17 00:00:00 2001
From 83d0c4260671e7729eb482d7ce8fbe7d3b9b53e0 Mon Sep 17 00:00:00 2001
From: Andy Shulman <andy.shulman@hotmail.com>
Date: Mon, 15 Apr 2013 20:06:37 -0500
Subject: [PATCH] Implement SpawnerSpawnEvent.
@ -6,10 +6,10 @@ Subject: [PATCH] Implement SpawnerSpawnEvent.
Adds BUKKIT-267
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 93bb1ad..e39d533 100644
index 0b177f0..13c7d58 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -5,7 +5,11 @@ import java.util.Collection;
@@ -4,7 +4,11 @@ import com.google.common.collect.Lists;
import java.util.Iterator;
import java.util.List;
@ -22,13 +22,13 @@ index 93bb1ad..e39d533 100644
public abstract class MobSpawnerAbstract {
@@ -128,7 +132,12 @@ public abstract class MobSpawnerAbstract {
@@ -131,7 +135,12 @@ 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
+ }
@ -36,37 +36,37 @@ index 93bb1ad..e39d533 100644
}
NBTTagCompound nbttagcompound1;
@@ -152,6 +161,11 @@ public abstract class MobSpawnerAbstract {
@@ -155,6 +164,11 @@ public abstract class MobSpawnerAbstract {
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
}
@@ -163,7 +177,12 @@ public abstract class MobSpawnerAbstract {
@@ -166,7 +180,12 @@ 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
}
return entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 2c0065d..0db8897 100644
index cc1d371..982e45c 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -41,6 +41,7 @@ import org.bukkit.Statistic.Type;
@@ -18,6 +18,7 @@ import org.bukkit.Statistic.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
@ -74,7 +74,7 @@ index 2c0065d..0db8897 100644
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftStatistic;
import org.bukkit.craftbukkit.CraftWorld;
@@ -150,6 +151,22 @@ public class CraftEventFactory {
@@ -127,6 +128,22 @@ public class CraftEventFactory {
}
/**
@ -96,7 +96,7 @@ index 2c0065d..0db8897 100644
+ /**
* 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) {
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 28e812c423844da20c528ce9b11b5ebd8a918754 Mon Sep 17 00:00:00 2001
From 0680e62f3ebfa2e03d9eeef5188b4b2707304028 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 15 Jun 2013 21:34:48 +1000
Subject: [PATCH] Firework Meta Crash Fix
@ -27,5 +27,5 @@ index 0f7da6b..5a409ae 100644
}
--
1.9.1
2.1.0

View File

@ -1,24 +1,23 @@
From abe67ad73f7f5c0d156def0bec08583d78a823d3 Mon Sep 17 00:00:00 2001
From b3bcb677bd5bc7c5f845659b9239db32b9e293a6 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 18:01:29 +1000
Subject: [PATCH] Allow Disabling of Command Logging
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9596da2..3a24fcd 100644
index 0e4f35d..19aaf8f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -944,7 +944,7 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -1034,6 +1034,7 @@ 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 6dfa8b0..c9e6dc5 100644
index fdd4fe1..4e7d731 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -148,4 +148,10 @@ public class SpigotConfig
@ -33,5 +32,5 @@ index 6dfa8b0..c9e6dc5 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,14 +1,14 @@
From 42d2418969eb65f19fbd37e70ce1d614c60c052d Mon Sep 17 00:00:00 2001
From 12e15f58613b671b868f1a0e74838e4780229a41 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 18:05:54 +1000
Subject: [PATCH] Allow Disabling of Command TabComplete
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6dc4157..fdac2f6 100644
index 2da23eb..463c0d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1698,6 +1698,13 @@ public final class CraftServer implements Server {
@@ -1549,6 +1549,13 @@ public final class CraftServer implements Server {
}
public List<String> tabCompleteCommand(Player player, String message) {
@ -23,7 +23,7 @@ index 6dc4157..fdac2f6 100644
try {
completions = getCommandMap().tabComplete(player, message.substring(1));
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index c9e6dc5..f611334 100644
index 4e7d731..0a6ab75 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -154,4 +154,21 @@ public class SpigotConfig
@ -49,5 +49,5 @@ index c9e6dc5..f611334 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,32 +0,0 @@
From 94c56282c7a751537d77bb10a8fc050662fe338a 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 e6012fb..9eb25df 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1152,8 +1152,15 @@ 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
}
}
--
1.9.1

View File

@ -1,54 +1,54 @@
From 5831308359be4561f282629032c081d3fee9187d Mon Sep 17 00:00:00 2001
From 47b279108fd9133ea5de128653e563793275c2e1 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 19:21:58 +1000
Subject: [PATCH] Configurable Messages
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 52bc69b..b98079c 100644
index f8bac48..e036bc6 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -64,11 +64,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -62,11 +62,11 @@ 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
index 9eb25df..110b7e0 100644
index 5e882cc..2b8a3e5 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -365,7 +365,7 @@ public abstract class PlayerList {
@@ -357,7 +357,7 @@ public abstract class PlayerList {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s);
} else if (!this.isWhitelisted(gameprofile)) {
// 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);
@@ -379,7 +379,7 @@ public abstract class PlayerList {
@@ -371,7 +371,7 @@ 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
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index fdac2f6..f8e2f0f 100644
index 463c0d8..0741d7b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -745,11 +745,7 @@ public final class CraftServer implements Server {
@@ -626,11 +626,7 @@ public final class CraftServer implements Server {
return true;
}
@ -62,7 +62,7 @@ index fdac2f6..f8e2f0f 100644
return false;
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index f611334..4a89e70 100644
index 0a6ab75..95bb141 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -12,6 +12,7 @@ import java.util.Map;
@ -81,7 +81,7 @@ index f611334..4a89e70 100644
+ 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 f611334..4a89e70 100644
+ }
+ private static void messages()
+ {
+ if (version < 4)
+ if (version < 8)
+ {
+ set( "messages.outdated-client", outdatedClientMessage );
+ set( "messages.outdated-server", outdatedServerMessage );
@ -103,5 +103,5 @@ index f611334..4a89e70 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,27 +1,27 @@
From 50a56d97e571d9998e56d5b8a0342d17296c13fc Mon Sep 17 00:00:00 2001
From 88b404cb998842371744ba03f5ebd98f592f961c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 22 Jun 2013 16:12:02 +1000
Subject: [PATCH] Allow Disabling of Random Lighting Updates
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index b6f3761..40c878b 100644
index c3059b6..9e9ea23 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -931,7 +931,7 @@ public class Chunk {
@@ -994,7 +994,7 @@ 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 e876b66..3806f7f 100644
index c006526..fcb6557 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2108,7 +2108,7 @@ public abstract class World implements IBlockAccess {
@@ -2009,7 +2009,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.a("playerCheckLight");
@ -47,5 +47,5 @@ index 956c628..8868ea3 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 13bf7c59fcc316dd8adecba24c0dcbdc5b4ee654 Mon Sep 17 00:00:00 2001
From 2847ce7bd37c53add794fec473be60b60224a17b Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 27 Jun 2013 17:26:09 +1000
Subject: [PATCH] Properly Close Inventories
@ -6,17 +6,17 @@ Subject: [PATCH] Properly Close Inventories
Properly close inventories when unloading and switching worlds.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 40c878b..ab0af12 100644
index 9e9ea23..208ba6b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -783,6 +783,18 @@ public class Chunk {
@@ -808,6 +808,18 @@ public class Chunk {
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
+ // 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 40c878b..ab0af12 100644
+ }
+ // Spigot End
this.world.a(tileentity);
this.world.b(tileentity);
}
@@ -792,6 +804,18 @@ public class Chunk {
java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
@@ -818,6 +830,18 @@ public class Chunk {
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 )
+ {
@ -48,13 +48,13 @@ index 40c878b..ab0af12 100644
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index 13b75ff..bf8e745 100644
index ab1b3a5..bf882de 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -149,6 +149,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@@ -124,6 +124,12 @@ 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,8 +62,8 @@ index 13b75ff..bf8e745 100644
+ }
+ // Spigot End
this.b = false;
super.b(i);
super.c(i);
}
--
1.9.1
2.1.0

View File

@ -1,27 +1,27 @@
From 69835bb2783298e5849be719334d3f7884152f03 Mon Sep 17 00:00:00 2001
From 9e733588f48678280a2209ff0b56c3d677aa9e02 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 28 Jun 2013 19:52:54 +1000
Subject: [PATCH] Disallow Interaction With Self
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3a24fcd..cc9878f 100644
index 3bfcd94..24dd7f0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1058,6 +1058,13 @@ public class PlayerConnection implements PacketPlayInListener {
if (this.player.dead) return; // CraftBukkit
@@ -1169,6 +1169,13 @@ 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) {
--
1.9.1
2.1.0

View File

@ -1,27 +1,27 @@
From eb9ab3071de9fcfaf291a6ac0e86e79833abc238 Mon Sep 17 00:00:00 2001
From 3deeab2aa8e79f1f1d45d3eb551e2ab981ee90cb Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 20:32:49 +1000
Subject: [PATCH] Entity Mount and Dismount Events
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 18e4d8d..85d7665 100644
index 10e99d1..afa789f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1450,6 +1450,7 @@ public abstract class Entity {
@@ -1545,6 +1545,7 @@ 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;
@@ -1485,6 +1486,17 @@ public abstract class Entity {
}
@@ -1579,6 +1580,18 @@ 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,21 +31,10 @@ index 18e4d8d..85d7665 100644
+ }
+ }
+ // 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 03485fe..54c77f8 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -323,6 +323,7 @@ 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.
}
--
1.9.1
2.1.0

View File

@ -1,4 +1,4 @@
From 44a7e0bcabdf2affdd2638c4d5ee13253352490d Mon Sep 17 00:00:00 2001
From c963624b5abc0547e7c0eb224d362f23e130ac00 Mon Sep 17 00:00:00 2001
From: Alex Ciuba <alexciuba@gmail.com>
Date: Tue, 11 Jun 2013 15:23:03 -0400
Subject: [PATCH] Prevent Ghost Players Caused by Plugins
@ -6,13 +6,13 @@ Subject: [PATCH] Prevent Ghost Players Caused by Plugins
Check if the player is still connected after firing event. Fixes BUKKIT-4327
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 110b7e0..6341b2b 100644
index 2b8a3e5..fe4121f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -492,6 +492,11 @@ public abstract class PlayerList {
Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
@@ -481,6 +481,11 @@ public abstract class PlayerList {
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;
@ -22,5 +22,5 @@ index 110b7e0..6341b2b 100644
location = respawnEvent.getRespawnLocation();
entityplayer.reset();
--
1.9.1
2.1.0

View File

@ -1,22 +1,22 @@
From db804ccfb6c609e8cbb15a593db03cc5b542992b Mon Sep 17 00:00:00 2001
From e6efbdee7fa312e978fc1cb5eedfd3568eb5684f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:02:59 +1000
Subject: [PATCH] Plug World Unload Memory Leak
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 8e01414..e0469bb 100644
index 2cdf7d3..6acfb62 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
@@ -10,7 +10,7 @@ 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) {
--
1.9.1
2.1.0

View File

@ -1,40 +1,47 @@
From bfb15639e961d653d3ed86908db36ce3324f65fa Mon Sep 17 00:00:00 2001
From 1416d961e1445f05084e49af2b1e7c64b293761f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:27:07 +1000
Subject: [PATCH] Player Collision API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index a4e29b2..aeab36b 100644
index 7c47e5b..6e9354f 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -430,7 +430,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
@@ -425,6 +425,7 @@ 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);
@@ -432,6 +433,7 @@ 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 92ad5c7..859e91f 100644
index 86474de..6358f5e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1596,7 +1596,7 @@ public abstract class EntityLiving extends Entity {
protected void bo() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
@@ -1616,7 +1616,7 @@ public abstract class EntityLiving extends Entity {
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);
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 84673b4..46aa10e 100644
index dc7654a..3bc77ae 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -63,6 +63,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -62,6 +62,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double maxHealthCache;
public boolean joining = true;
// CraftBukkit end
@ -42,25 +49,25 @@ index 84673b4..46aa10e 100644
+ 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
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d02d728..62d237d 100644
index 01b1822..984bea1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1292,6 +1292,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1314,6 +1314,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Spigot start
private final Player.Spigot spigot = new Player.Spigot()
{
@ -81,5 +88,5 @@ index d02d728..62d237d 100644
public Player.Spigot spigot()
--
1.9.1
2.1.0

View File

@ -1,27 +1,27 @@
From b082ecfc606ef0d3f554e5edd3a37c1342c7c59c Mon Sep 17 00:00:00 2001
From 7cbfd8567af8064f01aba1ff03ce9b581d46226f Mon Sep 17 00:00:00 2001
From: agentk20 <agentkid20@gmail.com>
Date: Sat, 3 Aug 2013 19:28:48 +1000
Subject: [PATCH] Fully Disable Snooper When Not Required
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 523f429..a9431be 100644
index 1cb9d38..a227340 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -585,11 +585,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -627,11 +627,11 @@ 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();
}
--
1.9.1
2.1.0

View File

@ -1,36 +0,0 @@
From 5717bbdf08a5430b7014a788bde0cdc202f77c18 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 734faef..613c1f1 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -24,7 +24,7 @@ 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 3eac231..bf3a139 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -22,7 +22,7 @@ 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
--
1.9.1

View File

@ -1,25 +1,25 @@
From 43f1384e6eae1c1e76e195cee7eb63d2951898e3 Mon Sep 17 00:00:00 2001
From d55e61ec721eaca35a88a0ff4fd900288beebe76 Mon Sep 17 00:00:00 2001
From: DerFlash <bte@freenet.de>
Date: Sat, 3 Aug 2013 19:53:48 +1000
Subject: [PATCH] Add Getter for Entity Invulnerability
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 4198dae..ce18aea 100644
index 4b26bb0..c50396d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -406,6 +406,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -440,6 +440,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// Spigot start
private final Spigot spigot = new Spigot()
{
+ @Override
+ public boolean isInvulnerable()
+ {
+ return getHandle().isInvulnerable();
+ return getHandle().isInvulnerable(net.minecraft.server.DamageSource.GENERIC);
+ }
};
public Spigot spigot()
--
1.9.1
2.1.0

View File

@ -1,14 +1,14 @@
From 4b235a101141d1b82eeca1187c71d3d9fb37a184 Mon Sep 17 00:00:00 2001
From 3c4614e2e411ef1ffcb250b7c2dfde392fd0f340 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 5 Aug 2013 20:17:20 +1000
Subject: [PATCH] Cap Minimum Player Speed
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 62d237d..6ac6520 100644
index 984bea1..bf9dd99 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1165,7 +1165,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1178,7 +1178,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setFlySpeed(float value) {
validateSpeed(value);
EntityPlayer player = getHandle();
@ -17,7 +17,7 @@ index 62d237d..6ac6520 100644
player.updateAbilities();
}
@@ -1173,7 +1173,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1187,7 +1187,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setWalkSpeed(float value) {
validateSpeed(value);
EntityPlayer player = getHandle();
@ -27,5 +27,5 @@ index 62d237d..6ac6520 100644
}
--
1.9.1
2.1.0

View File

@ -1,17 +1,17 @@
From 607ebff4ad51575949273908f73cb1dddc531ba1 Mon Sep 17 00:00:00 2001
From bccecea300f4b3dc11024365a81ce16978dd240e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 14 Sep 2013 10:16:38 +1000
Subject: [PATCH] Update Inventory and Health for PlayerConsumeItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 4bde9c1..01062ce 100644
index 6e9354f..0844b60 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -277,6 +277,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
@@ -298,6 +298,10 @@ 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();
@ -20,5 +20,5 @@ index 4bde9c1..01062ce 100644
return;
}
--
1.9.1
2.1.0

View File

@ -0,0 +1,26 @@
From 8a3ecfb1768bc58ad25261d4ff1922989d3d1c2f Mon Sep 17 00:00:00 2001
From: BlackHole <black-hole@live.com>
Date: Tue, 16 Jul 2013 22:34:50 +0200
Subject: [PATCH] Call EntityChangeBlockEvent for Fire Arrows hitting TNT
Adds BUKKIT-4355
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index cc61759..7443873 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -77,6 +77,11 @@ public class BlockTNT extends Block {
EntityArrow entityarrow = (EntityArrow) entity;
if (entityarrow.isBurning()) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
world.setAir(blockposition);
}
--
2.1.0

View File

@ -1,29 +1,29 @@
From c1ded3f7da6746c8632b43730918a38f713dd21c Mon Sep 17 00:00:00 2001
From 42a42f6ec9d5ad895bf66a398ac9de97f6a25d45 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 21 Sep 2013 12:33:09 +1000
Subject: [PATCH] Allow Disabling of 1.6.3 Structure Saving
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 97308d0..4d336d8 100644
index 49b7aa1..ecab5d1 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -178,7 +178,15 @@ public abstract class StructureGenerator extends WorldGenBase {
@@ -171,7 +171,15 @@ 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 8868ea3..48ae475 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -46,5 +46,5 @@ index 8868ea3..48ae475 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,17 +1,17 @@
From 1516f2ee15c86afee40f177aafd6be011cbb8412 Mon Sep 17 00:00:00 2001
From f6fe4b96cae27d007b322988f85dc7c3876c5a25 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 22 Sep 2013 19:10:53 +1000
Subject: [PATCH] Item Despawn Rate
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index c8c0d6a..a45bed9 100644
index 7f16401..e35f78f 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -104,7 +104,7 @@ public class EntityItem extends Entity {
}
@@ -108,7 +108,7 @@ 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
@ -34,5 +34,5 @@ index 48ae475..6d31363 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,14 +1,14 @@
From 422f1722ca154f6cc792cc86ec87cd91ae91ab30 Mon Sep 17 00:00:00 2001
From f27c8faa6a5a02f356acebca0f5c178265c79fef Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 6 Oct 2013 17:36:28 +1100
Subject: [PATCH] Don't Special Case X Move Value
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cc9878f..f170ad0 100644
index b903a81..310ab0c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -106,6 +106,7 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -108,6 +108,7 @@ 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 cc9878f..f170ad0 100644
// For the PacketPlayOutBlockPlace hack :(
Long lastPacket;
@@ -203,6 +204,18 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -214,6 +215,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
}
// CraftBukkit start - fire PlayerMoveEvent
Player player = this.getPlayer();
+ // Spigot Start
@ -35,7 +35,7 @@ index cc9878f..f170ad0 100644
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.
@@ -231,7 +244,7 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -242,7 +255,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
this.lastPitch = to.getPitch();
// Skip the first time we do this
@ -45,5 +45,5 @@ index cc9878f..f170ad0 100644
this.server.getPluginManager().callEvent(event);
--
1.9.1
2.1.0

View File

@ -1,14 +1,14 @@
From 08f8db2d7755e34ca34784fcafe639ee3f781963 Mon Sep 17 00:00:00 2001
From c45455632dc675c3f43ba0f0b811e9479ddc9c40 Mon Sep 17 00:00:00 2001
From: ninja- <xninja@openmailbox.org>
Date: Tue, 8 Oct 2013 14:34:49 +0200
Subject: [PATCH] Implement respawn API.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6ac6520..1a9c381 100644
index bf9dd99..494c0bc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1305,6 +1305,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1327,6 +1327,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().collidesWithEntities = collides;
getHandle().k = collides; // First boolean of Entity
}
@ -25,5 +25,5 @@ index 6ac6520..1a9c381 100644
public Player.Spigot spigot()
--
1.9.1
2.1.0

View File

@ -1,22 +1,22 @@
From a6c2721133c875399815dc33b31a119e0d5382f4 Mon Sep 17 00:00:00 2001
From ac8b907b3f05c7f88346f5ed2d0fdbe0ab281d12 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 14 Oct 2013 19:20:10 +1100
Subject: [PATCH] Arrow Despawn Rate
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index ac5d5d2..de8dda7 100644
index ae00f60..7d1727d 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -156,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile {
@@ -155,7 +155,7 @@ 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 6d31363..1814b4f 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
@ -34,5 +34,5 @@ index 6d31363..1814b4f 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,35 +0,0 @@
From 4ba768774a4de3edd890f0f358adf4c513d559a7 Mon Sep 17 00:00:00 2001
From: BlackHole <black-hole@live.com>
Date: Tue, 16 Jul 2013 22:34:50 +0200
Subject: [PATCH] Call EntityChangeBlockEvent for Fire Arrows hitting TNT
Adds BUKKIT-4355
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index 8cc7d5e..35bf1a3 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -54,7 +54,7 @@ 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;
@@ -68,6 +68,11 @@ 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()) {
+ return;
+ }
+ // CraftBukkit end
this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
world.setAir(i, j, k);
}
--
1.9.1

View File

@ -0,0 +1,38 @@
From 99ee83952a261f744f8c689615e28c49e5853cbf 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 38e9602..3d08a82 100644
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -40,13 +40,13 @@ 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
}
}
}
@@ -77,7 +77,7 @@ 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) {
--
2.1.0

View File

@ -1,14 +1,27 @@
From c6dabc5a4f93d00a08a7cdb8e3270342e4111b27 Mon Sep 17 00:00:00 2001
From d4ad0adea49e54a330c38b8e44c10b9ce8fa1234 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
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 390c6eb..240c909 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -225,7 +225,7 @@ 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 da69706..d596924 100644
index a227340..c5a6bec 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -498,6 +498,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -537,6 +537,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.a(crashreport);
} finally {
try {
@ -16,7 +29,7 @@ index da69706..d596924 100644
this.stop();
this.isStopped = true;
} catch (Throwable throwable1) {
@@ -595,6 +596,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -637,6 +638,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.methodProfiler.b();
this.methodProfiler.b();
@ -155,7 +168,7 @@ index 0000000..429c258
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 4a89e70..069111c 100644
index 95bb141..c071421 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -196,4 +196,18 @@ public class SpigotConfig
@ -301,5 +314,5 @@ index 0000000..de08ad6
+ }
+}
--
1.9.1
2.1.0

View File

@ -1,21 +1,21 @@
From f65a56e851df25543ce7622d5484db9828661375 Mon Sep 17 00:00:00 2001
From c58440804a708a12053e7d0938f6bd85f7bf4c10 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 3 Dec 2013 11:07:48 +1100
Subject: [PATCH] Clear Flower Pot on Drop
diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java
index aa82a50..e468eb8 100644
index d1275a3..0fdfdde 100644
--- a/src/main/java/net/minecraft/server/BlockFlowerPot.java
+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java
@@ -90,6 +90,7 @@ 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);
--
1.9.1
2.1.0

View File

@ -1,18 +1,18 @@
From 161cdb522267db951b26782afcb45782d21cf0b5 Mon Sep 17 00:00:00 2001
From 0fa249558b94c997140a25a1236626c9e22f7340 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Mon, 2 Dec 2013 23:42:09 +0000
Subject: [PATCH] Fix some chunks not being sent to the client
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ab0af12..b1213f0 100644
index 208ba6b..e664e55 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -961,7 +961,15 @@ public class Chunk {
@@ -1036,7 +1036,15 @@ public class Chunk {
}
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,7 +24,7 @@ index ab0af12..b1213f0 100644
+ // Spigot End
}
public ChunkCoordIntPair l() {
public ChunkCoordIntPair j() {
--
1.9.1
2.1.0

View File

@ -1,28 +0,0 @@
From ec811040fba08b7084c23760094615bdf41b3e39 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 6ce80db..9f49f43 100644
--- a/src/main/java/net/minecraft/server/BlockBrewingStand.java
+++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java
@@ -86,7 +86,13 @@ 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 );
}
}
}
--
1.9.1

View File

@ -1,24 +1,25 @@
From 791420e61002cf87a890188c250e438005feb39e Mon Sep 17 00:00:00 2001
From 21fba8d7f5b9b5384f1168dd7d9bb4276de80c81 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 5 Dec 2013 13:55:53 +1100
Subject: [PATCH] Fix Broken Async Chat
diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java
index 604a7af..d419f0f 100644
index 8e1740d..cb614ef 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java
@@ -43,7 +43,25 @@ public class PacketPlayInChat extends Packet {
@@ -30,7 +30,26 @@ 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,15 +27,15 @@ index 604a7af..d419f0f 100644
+ @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);
}
}
--
1.9.1
2.1.0

View File

@ -1,135 +1,119 @@
From 7a368a07559457241a612939e55e43459c4221c8 Mon Sep 17 00:00:00 2001
From 75e2457256bf4e36cc2ce32af9a8b188bcf5d182 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 5576f15..df602bd 100644
index 22dc42d..fd78677 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -83,6 +83,7 @@ public class EntityFallingBlock extends Entity {
@@ -60,6 +60,7 @@ public class EntityFallingBlock extends Entity {
blockposition = new BlockPosition(this);
if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
this.world.setAir(blockposition);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
} else if (!this.world.isStatic) {
this.die();
return;
@@ -84,6 +85,7 @@ public class EntityFallingBlock extends Entity {
return;
}
this.world.setAir(i, j, k);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
}
if (this.onGround) {
@@ -98,6 +99,7 @@ public class EntityFallingBlock extends Entity {
}
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 56fa999..4502f68 100644
index 5ce4985..735a7d4 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -203,6 +203,7 @@ 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
@@ -195,6 +195,7 @@ public class Explosion {
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 613c1f1..7479600 100644
index e24d3ae..e106a1f 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -28,6 +28,7 @@ public class PacketPlayOutMapChunk extends Packet {
@@ -18,6 +18,7 @@ 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 bf3a139..30bf8a7 100644
index 8af5e1f..9df0d53 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -26,6 +26,7 @@ public class PacketPlayOutMapChunkBulk extends Packet {
}
};
// CraftBukkit end
@@ -8,6 +8,7 @@ public class PacketPlayOutMapChunkBulk implements Packet {
private int[] b;
private ChunkMap[] c;
private boolean d;
+ private World world; // Spigot
public PacketPlayOutMapChunkBulk() {}
@@ -44,6 +45,9 @@ 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];
@@ -52,6 +56,8 @@ public class PacketPlayOutMapChunkBulk extends Packet {
@@ -27,7 +28,8 @@ 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;
@@ -79,6 +85,22 @@ 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) {
@@ -67,6 +69,7 @@ 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 7607155..b4461b9 100644
index 3e24620..f0d915f 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -173,6 +173,7 @@ public class PlayerInteractManager {
this.o = i1;
}
}
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
}
@@ -197,6 +197,7 @@ public class PlayerInteractManager {
}
}
+ 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 3806f7f..c7c33b0 100644
index fcb6557..e0a7160 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -237,9 +237,16 @@ public abstract class World implements IBlockAccess {
return this.getType(i, k, j);
@@ -445,6 +445,7 @@ public abstract class World implements IBlockAccess {
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) {
@@ -658,9 +659,16 @@ 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,25 +121,18 @@ index 3806f7f..c7c33b0 100644
Iterator<BlockState> it = capturedBlockStates.iterator();
while (it.hasNext()) {
BlockState previous = it.next();
@@ -551,6 +558,7 @@ 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 0000000..fad22e2
index 0000000..6f28cd8
--- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,227 @@
@@ -0,0 +1,234 @@
+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 0000000..fad22e2
+ * 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 0000000..fad22e2
+ 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 0000000..fad22e2
+ }
+ // 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 0000000..fad22e2
+ {
+ 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 0000000..fad22e2
+ }
+ }
+
+ 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 0000000..fad22e2
+ // 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
@ -427,5 +410,5 @@ index 1814b4f..45b2aae 100644
+ }
}
--
1.9.1
2.1.0

View File

@ -1,38 +0,0 @@
From 1655f0ec885e96045d38ab18bcfcdfc13ed0510f 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 c207a9c..ae1bf65 100644
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -41,13 +41,13 @@ 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
}
}
}
@@ -78,7 +78,7 @@ 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) {
--
1.9.1

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