mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
Apply our patches over Spigot-Server and Spigot-API directly
This commit is contained in:
parent
84046eaf04
commit
1207bc585d
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,6 +1,6 @@
|
||||
[submodule "Bukkit"]
|
||||
path = Bukkit
|
||||
url = https://github.com/Bukkit/Bukkit.git
|
||||
url = https://github.com/SpigotMC/Spigot-API.git
|
||||
[submodule "CraftBukkit"]
|
||||
path = CraftBukkit
|
||||
url = https://github.com/Bukkit/CraftBukkit.git
|
||||
url = https://github.com/SpigotMC/Spigot-Server.git
|
||||
|
2
Bukkit
2
Bukkit
@ -1 +1 @@
|
||||
Subproject commit 028525f8fcb975f8191e3a232b2ed1697e859a09
|
||||
Subproject commit 234249b83038e1346be7f922930549b23f7e6d24
|
@ -1,4 +1,4 @@
|
||||
From dc0d012d546ff97273c1dc7eb099ac84c0748ca9 Mon Sep 17 00:00:00 2001
|
||||
From 3b7ac3151a777aab1df4e00075df2b75525c9951 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Mon, 19 May 2014 22:51:45 -0500
|
||||
Subject: [PATCH] Add float methods to configs
|
@ -1,66 +0,0 @@
|
||||
From 34f763cc0aea978efc5e76c9c3df06df012bafa1 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 dcf7ed3..f7d100a 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,42 +1,21 @@
|
||||
<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.9-R0.3-SNAPSHOT</version>
|
||||
- <name>Bukkit</name>
|
||||
- <url>http://www.bukkit.org</url>
|
||||
+ <name>Spigot-API</name>
|
||||
+ <url>http://www.spigotmc.org</url>
|
||||
|
||||
<properties>
|
||||
<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>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 1f6a76a0f4b393f20dbca3ccfc8521fef61d9832 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 2 Jun 2013 10:42:57 +1000
|
||||
Subject: [PATCH] Measure Timings Duration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
index 05cfcb0..c2874f1 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class TimingsCommand extends BukkitCommand {
|
||||
private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate");
|
||||
+ public static long timingStart = 0; // Spigot
|
||||
|
||||
public TimingsCommand(String name) {
|
||||
super(name);
|
||||
@@ -50,9 +51,11 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ timingStart = System.nanoTime(); // Spigot
|
||||
sender.sendMessage("Timings reset");
|
||||
} else if ("merged".equals(args[0]) || separate) {
|
||||
|
||||
+ long sampleTime = System.nanoTime() - timingStart; // Spigot
|
||||
int index = 0;
|
||||
int pluginIdx = 0;
|
||||
File timingFolder = new File("timings");
|
||||
@@ -92,6 +95,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)");
|
||||
}
|
||||
+ fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); // Spigot
|
||||
sender.sendMessage("Timings written to " + timings.getPath());
|
||||
if (separate) sender.sendMessage("Names written to " + names.getPath());
|
||||
} catch (IOException e) {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index d2fe422..1d51908 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -295,6 +295,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ org.bukkit.command.defaults.TimingsCommand.timingStart = System.nanoTime(); // Spigot
|
||||
return result.toArray(new Plugin[result.size()]);
|
||||
}
|
||||
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,140 +0,0 @@
|
||||
From 7d888e10bd2282fadffab90e213be2b412655b04 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 2 Jun 2013 10:55:20 +1000
|
||||
Subject: [PATCH] Timings Paste Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
index c2874f1..7c28b75 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
@@ -19,6 +19,15 @@ import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
+// Spigot start
|
||||
+import java.io.ByteArrayOutputStream;
|
||||
+import java.io.OutputStream;
|
||||
+import java.net.HttpURLConnection;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLEncoder;
|
||||
+import java.util.logging.Level;
|
||||
+// Spigot end
|
||||
+
|
||||
public class TimingsCommand extends BukkitCommand {
|
||||
private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate");
|
||||
public static long timingStart = 0; // Spigot
|
||||
@@ -26,14 +35,14 @@ public class TimingsCommand extends BukkitCommand {
|
||||
public TimingsCommand(String name) {
|
||||
super(name);
|
||||
this.description = "Records timings for all plugin events";
|
||||
- this.usageMessage = "/timings <reset|merged|separate>";
|
||||
+ this.usageMessage = "/timings <reset|merged|separate> [paste]"; // Spigot
|
||||
this.setPermission("bukkit.command.timings");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||
if (!testPermission(sender)) return true;
|
||||
- if (args.length != 1) {
|
||||
+ if (args.length < 1) { // Spigot
|
||||
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
return false;
|
||||
}
|
||||
@@ -43,6 +52,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
boolean separate = "separate".equals(args[0]);
|
||||
+ boolean paste = "paste".equals( args[0] ); // Spigot
|
||||
if ("reset".equals(args[0])) {
|
||||
for (HandlerList handlerList : HandlerList.getHandlerLists()) {
|
||||
for (RegisteredListener listener : handlerList.getRegisteredListeners()) {
|
||||
@@ -53,8 +63,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
timingStart = System.nanoTime(); // Spigot
|
||||
sender.sendMessage("Timings reset");
|
||||
- } else if ("merged".equals(args[0]) || separate) {
|
||||
-
|
||||
+ } else if ("merged".equals(args[0]) || separate || paste) { // Spigot
|
||||
long sampleTime = System.nanoTime() - timingStart; // Spigot
|
||||
int index = 0;
|
||||
int pluginIdx = 0;
|
||||
@@ -62,11 +71,12 @@ public class TimingsCommand extends BukkitCommand {
|
||||
timingFolder.mkdirs();
|
||||
File timings = new File(timingFolder, "timings.txt");
|
||||
File names = null;
|
||||
+ ByteArrayOutputStream bout = ( paste ) ? new ByteArrayOutputStream() : null; // Spigot
|
||||
while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt");
|
||||
PrintStream fileTimings = null;
|
||||
PrintStream fileNames = null;
|
||||
try {
|
||||
- fileTimings = new PrintStream(timings);
|
||||
+ fileTimings = ( paste ) ? new PrintStream( bout ) : new PrintStream( timings );
|
||||
if (separate) {
|
||||
names = new File(timingFolder, "names" + index + ".txt");
|
||||
fileNames = new PrintStream(names);
|
||||
@@ -96,6 +106,13 @@ public class TimingsCommand extends BukkitCommand {
|
||||
fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)");
|
||||
}
|
||||
fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); // Spigot
|
||||
+ // Spigot start
|
||||
+ if ( paste )
|
||||
+ {
|
||||
+ new PasteThread( sender, bout ).start();
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
sender.sendMessage("Timings written to " + timings.getPath());
|
||||
if (separate) sender.sendMessage("Names written to " + names.getPath());
|
||||
} catch (IOException e) {
|
||||
@@ -122,4 +139,47 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ private static class PasteThread extends Thread
|
||||
+ {
|
||||
+
|
||||
+ private final CommandSender sender;
|
||||
+ private final ByteArrayOutputStream bout;
|
||||
+
|
||||
+ public PasteThread(CommandSender sender, ByteArrayOutputStream bout)
|
||||
+ {
|
||||
+ super( "Timings paste thread" );
|
||||
+ this.sender = sender;
|
||||
+ this.bout = bout;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run()
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ HttpURLConnection con = (HttpURLConnection) new URL( "http://paste.ubuntu.com/" ).openConnection();
|
||||
+ con.setDoOutput( true );
|
||||
+ con.setRequestMethod( "POST" );
|
||||
+ con.setInstanceFollowRedirects( false );
|
||||
+
|
||||
+ OutputStream out = con.getOutputStream();
|
||||
+ out.write( "poster=Spigot&syntax=text&content=".getBytes( "UTF-8" ) );
|
||||
+ out.write( URLEncoder.encode( bout.toString( "UTF-8" ), "UTF-8" ).getBytes( "UTF-8" ) );
|
||||
+ out.close();
|
||||
+ con.getInputStream().close();
|
||||
+
|
||||
+ String location = con.getHeaderField( "Location" );
|
||||
+ String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 );
|
||||
+ sender.sendMessage( ChatColor.GREEN + "Your timings have been pasted to " + location );
|
||||
+ sender.sendMessage( ChatColor.GREEN + "You can view the results at http://aikar.co/timings.php?url=" + pasteID );
|
||||
+ } catch ( IOException ex )
|
||||
+ {
|
||||
+ sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" );
|
||||
+ Bukkit.getServer().getLogger().log( Level.WARNING, "Could not paste timings", ex );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,377 +0,0 @@
|
||||
From 10a9ecc0525f696d36f969090d5393b0c29c151d Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 2 Jun 2013 11:17:05 +1000
|
||||
Subject: [PATCH] Enchanced Timings
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index fb3c90f..ffbcac1 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -20,6 +20,7 @@ public class ReloadCommand extends BukkitCommand {
|
||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
+ org.spigotmc.CustomTimingsHandler.reload(); // Spigot: TODO: Why is this here?
|
||||
Bukkit.reload();
|
||||
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
index 7c28b75..69d629c 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
@@ -35,7 +35,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||
public TimingsCommand(String name) {
|
||||
super(name);
|
||||
this.description = "Records timings for all plugin events";
|
||||
- this.usageMessage = "/timings <reset|merged|separate> [paste]"; // Spigot
|
||||
+ this.usageMessage = "/timings <reset|merged|separate|on|off> [paste]"; // Spigot
|
||||
this.setPermission("bukkit.command.timings");
|
||||
}
|
||||
|
||||
@@ -46,14 +46,34 @@ public class TimingsCommand extends BukkitCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
return false;
|
||||
}
|
||||
- if (!sender.getServer().getPluginManager().useTimings()) {
|
||||
+ /*if (!sender.getServer().getPluginManager().useTimings()) {
|
||||
sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml");
|
||||
return true;
|
||||
+ }*/
|
||||
+
|
||||
+ // Spigot start - dynamic enable
|
||||
+ if ( "on".equals( args[0] ) )
|
||||
+ {
|
||||
+ // ( (org.bukkit.plugin.SimplePluginManager) Bukkit.getPluginManager() ).useTimings( true );
|
||||
+ sender.sendMessage( ChatColor.RED + "This command is disabled as it does not produce accurate results. Please enable plugin-profiling in bukkit.yml and restart." );
|
||||
+ sender.sendMessage( ChatColor.RED + "Please see http://www.spigotmc.org/wiki/disabled-timings-on-command/ for further information." );
|
||||
+ } else if ( "off".equals( args[0] ) )
|
||||
+ {
|
||||
+ sender.sendMessage( ChatColor.RED + "This command is disabled as it does not produce accurate results. Please disable plugin-profiling in bukkit.yml and restart." );
|
||||
+ sender.sendMessage( ChatColor.RED + "Please see http://www.spigotmc.org/wiki/disabled-timings-on-command/ for further information." );
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
boolean separate = "separate".equals(args[0]);
|
||||
boolean paste = "paste".equals( args[0] ); // Spigot
|
||||
- if ("reset".equals(args[0])) {
|
||||
+ if ("on".equals(args[0]) || "reset".equals(args[0])) { // Spigot
|
||||
+ // Spigot start
|
||||
+ if ( !"on".equals( args[0] ) && !Bukkit.getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ sender.sendMessage( "Please enable timings by typing /timings on" );
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
for (HandlerList handlerList : HandlerList.getHandlerLists()) {
|
||||
for (RegisteredListener listener : handlerList.getRegisteredListeners()) {
|
||||
if (listener instanceof TimedRegisteredListener) {
|
||||
@@ -61,10 +81,18 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
- timingStart = System.nanoTime(); // Spigot
|
||||
+ // Spigot start
|
||||
+ org.spigotmc.CustomTimingsHandler.reload();
|
||||
+ timingStart = System.nanoTime();
|
||||
sender.sendMessage("Timings reset");
|
||||
- } else if ("merged".equals(args[0]) || separate || paste) { // Spigot
|
||||
- long sampleTime = System.nanoTime() - timingStart; // Spigot
|
||||
+ } else if ("merged".equals(args[0]) || separate || paste) {
|
||||
+ if ( !Bukkit.getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ sender.sendMessage( "Please enable timings by typing /timings on" );
|
||||
+ return true;
|
||||
+ }
|
||||
+ long sampleTime = System.nanoTime() - timingStart;
|
||||
+ // Spigot end
|
||||
int index = 0;
|
||||
int pluginIdx = 0;
|
||||
File timingFolder = new File("timings");
|
||||
@@ -99,12 +127,15 @@ public class TimingsCommand extends BukkitCommand {
|
||||
totalTime += time;
|
||||
Class<? extends Event> eventClass = trl.getEventClass();
|
||||
if (count > 0 && eventClass != null) {
|
||||
- fileTimings.println(" " + eventClass.getSimpleName() + (trl.hasMultiple() ? " (and sub-classes)" : "") + " Time: " + time + " Count: " + count + " Avg: " + avg);
|
||||
+ fileTimings.println(" " + eventClass.getSimpleName() + (trl.hasMultiple() ? " (and sub-classes)" : "") + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + trl.violations); // Spigot
|
||||
}
|
||||
}
|
||||
}
|
||||
fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)");
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ org.spigotmc.CustomTimingsHandler.printTimings(fileTimings);
|
||||
fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); // Spigot
|
||||
// Spigot start
|
||||
if ( paste )
|
||||
@@ -114,6 +145,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
// Spigot end
|
||||
sender.sendMessage("Timings written to " + timings.getPath());
|
||||
+ sender.sendMessage( "Paste contents of file into form at http://aikar.co/timings.php to read results." );
|
||||
if (separate) sender.sendMessage("Names written to " + names.getPath());
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java b/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java
|
||||
index e09234c..ab2c65e 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java
|
||||
@@ -11,6 +11,10 @@ import org.bukkit.event.Listener;
|
||||
public class TimedRegisteredListener extends RegisteredListener {
|
||||
private int count;
|
||||
private long totalTime;
|
||||
+ // Spigot start
|
||||
+ public long curTickTotal = 0;
|
||||
+ public long violations = 0;
|
||||
+ // Spigot end
|
||||
private Class<? extends Event> eventClass;
|
||||
private boolean multiple = false;
|
||||
|
||||
@@ -20,6 +24,13 @@ public class TimedRegisteredListener extends RegisteredListener {
|
||||
|
||||
@Override
|
||||
public void callEvent(Event event) throws EventException {
|
||||
+ // Spigot start
|
||||
+ if ( org.bukkit.Bukkit.getServer() != null && !org.bukkit.Bukkit.getServer().getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ super.callEvent( event );
|
||||
+ return;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
if (event.isAsynchronous()) {
|
||||
super.callEvent(event);
|
||||
return;
|
||||
@@ -34,7 +45,11 @@ public class TimedRegisteredListener extends RegisteredListener {
|
||||
}
|
||||
long start = System.nanoTime();
|
||||
super.callEvent(event);
|
||||
- totalTime += System.nanoTime() - start;
|
||||
+ // Spigot start
|
||||
+ long diff = System.nanoTime() - start;
|
||||
+ curTickTotal += diff;
|
||||
+ totalTime += diff;
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
private static Class<?> getCommonSuperclass(Class<?> class1, Class<?> class2) {
|
||||
@@ -50,6 +65,10 @@ public class TimedRegisteredListener extends RegisteredListener {
|
||||
public void reset() {
|
||||
count = 0;
|
||||
totalTime = 0;
|
||||
+ // Spigot start
|
||||
+ curTickTotal = 0;
|
||||
+ violations = 0;
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index b178c0d..a1639f8 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -297,7 +297,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
};
|
||||
- if (useTimings) {
|
||||
+ if (true) { // Spigot - TRL handles useTimings check now
|
||||
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
} else {
|
||||
eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
new file mode 100644
|
||||
index 0000000..9fca481
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
@@ -0,0 +1,175 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+import org.bukkit.plugin.RegisteredListener;
|
||||
+import org.bukkit.plugin.TimedRegisteredListener;
|
||||
+import java.io.PrintStream;
|
||||
+import java.util.Collection;
|
||||
+import java.util.HashSet;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.World;
|
||||
+
|
||||
+/**
|
||||
+ * Provides custom timing sections for /timings merged.
|
||||
+ */
|
||||
+public class CustomTimingsHandler
|
||||
+{
|
||||
+
|
||||
+ private static final Collection<CustomTimingsHandler> ALL_HANDLERS = new HashSet<CustomTimingsHandler>();
|
||||
+ private static CustomTimingsHandler[] BAKED_HANDLERS;
|
||||
+ /*========================================================================*/
|
||||
+ private final String name;
|
||||
+ private final CustomTimingsHandler parent;
|
||||
+ private long count = 0;
|
||||
+ private long start = 0;
|
||||
+ private long timingDepth = 0;
|
||||
+ private long totalTime = 0;
|
||||
+ private long curTickTotal = 0;
|
||||
+ private long violations = 0;
|
||||
+
|
||||
+ public CustomTimingsHandler(String name)
|
||||
+ {
|
||||
+ this( name, null );
|
||||
+ }
|
||||
+
|
||||
+ public CustomTimingsHandler(String name, CustomTimingsHandler parent)
|
||||
+ {
|
||||
+ this.name = name;
|
||||
+ this.parent = parent;
|
||||
+ ALL_HANDLERS.add( this );
|
||||
+ BAKED_HANDLERS = ALL_HANDLERS.toArray( new CustomTimingsHandler[ ALL_HANDLERS.size() ] );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Prints the timings and extra data to the given stream.
|
||||
+ *
|
||||
+ * @param printStream
|
||||
+ */
|
||||
+ public static void printTimings(PrintStream printStream)
|
||||
+ {
|
||||
+ printStream.println( "Minecraft" );
|
||||
+ for ( CustomTimingsHandler timings : BAKED_HANDLERS )
|
||||
+ {
|
||||
+ long time = timings.totalTime;
|
||||
+ long count = timings.count;
|
||||
+ if ( count == 0 )
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ long avg = time / count;
|
||||
+
|
||||
+ printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations );
|
||||
+ }
|
||||
+ printStream.println( "# Version " + Bukkit.getVersion() );
|
||||
+ int entities = 0;
|
||||
+ int livingEntities = 0;
|
||||
+ for ( World world : Bukkit.getWorlds() )
|
||||
+ {
|
||||
+ entities += world.getEntities().size();
|
||||
+ livingEntities += world.getLivingEntities().size();
|
||||
+ }
|
||||
+ printStream.println( "# Entities " + entities );
|
||||
+ printStream.println( "# LivingEntities " + livingEntities );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Resets all timings.
|
||||
+ */
|
||||
+ public static void reload()
|
||||
+ {
|
||||
+ if ( Bukkit.getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ for ( CustomTimingsHandler timings : BAKED_HANDLERS )
|
||||
+ {
|
||||
+ timings.reset();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Ticked every tick by CraftBukkit to count the number of times a timer
|
||||
+ * caused TPS loss.
|
||||
+ */
|
||||
+ public static void tick()
|
||||
+ {
|
||||
+ if ( Bukkit.getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ for ( CustomTimingsHandler timings : BAKED_HANDLERS )
|
||||
+ {
|
||||
+ if ( timings.curTickTotal > 50000000 )
|
||||
+ {
|
||||
+ timings.violations += Math.ceil( timings.curTickTotal / 50000000 );
|
||||
+ }
|
||||
+ timings.curTickTotal = 0;
|
||||
+ timings.timingDepth = 0; // incase reset messes this up
|
||||
+ }
|
||||
+
|
||||
+ for ( Plugin plugin : Bukkit.getPluginManager().getPlugins() )
|
||||
+ {
|
||||
+ for ( RegisteredListener listener : HandlerList.getRegisteredListeners( plugin ) )
|
||||
+ {
|
||||
+ if ( listener instanceof TimedRegisteredListener )
|
||||
+ {
|
||||
+ TimedRegisteredListener timings = (TimedRegisteredListener) listener;
|
||||
+ if ( timings.curTickTotal > 50000000 )
|
||||
+ {
|
||||
+ timings.violations += Math.ceil( timings.curTickTotal / 50000000 );
|
||||
+ }
|
||||
+ timings.curTickTotal = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Starts timing to track a section of code.
|
||||
+ */
|
||||
+ public void startTiming()
|
||||
+ {
|
||||
+ // If second condtion fails we are already timing
|
||||
+ if ( Bukkit.getPluginManager().useTimings() && ++timingDepth == 1 )
|
||||
+ {
|
||||
+ start = System.nanoTime();
|
||||
+ if ( parent != null && ++parent.timingDepth == 1 )
|
||||
+ {
|
||||
+ parent.start = start;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Stops timing a section of code.
|
||||
+ */
|
||||
+ public void stopTiming()
|
||||
+ {
|
||||
+ if ( Bukkit.getPluginManager().useTimings() )
|
||||
+ {
|
||||
+ if ( --timingDepth != 0 || start == 0 )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ long diff = System.nanoTime() - start;
|
||||
+ totalTime += diff;
|
||||
+ curTickTotal += diff;
|
||||
+ count++;
|
||||
+ start = 0;
|
||||
+ if ( parent != null )
|
||||
+ {
|
||||
+ parent.stopTiming();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Reset this timer, setting all values to zero.
|
||||
+ */
|
||||
+ public void reset()
|
||||
+ {
|
||||
+ count = 0;
|
||||
+ violations = 0;
|
||||
+ curTickTotal = 0;
|
||||
+ totalTime = 0;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java b/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java
|
||||
index b206b1f..01b62fb 100644
|
||||
--- a/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java
|
||||
+++ b/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java
|
||||
@@ -15,7 +15,6 @@ import org.junit.Test;
|
||||
|
||||
public class TimedRegisteredListenerTest {
|
||||
|
||||
- @Test
|
||||
public void testEventClass() throws EventException {
|
||||
Listener listener = new Listener() {};
|
||||
EventExecutor executor = new EventExecutor() {
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,69 +0,0 @@
|
||||
From eaceb28e82b974d618828104f86074e74529b2e9 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..38a72ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+
|
||||
+public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final ItemStack item;
|
||||
+ private int damage;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public PlayerItemDamageEvent(Player player, ItemStack what, int damage) {
|
||||
+ super(player);
|
||||
+ this.item = what;
|
||||
+ this.damage = damage;
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the amount of durability damage this item will be taking.
|
||||
+ *
|
||||
+ * @return durability change
|
||||
+ */
|
||||
+ public int getDamage() {
|
||||
+ return damage;
|
||||
+ }
|
||||
+
|
||||
+ public void setDamage(int damage) {
|
||||
+ this.damage = damage;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 8e9bba3a806a6d5d2304117410300b74d30b436d 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index fe8a0bd..e851b98 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1035,4 +1035,23 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
* @see Player#setHealthScaled(boolean)
|
||||
*/
|
||||
public double getHealthScale();
|
||||
+
|
||||
+ // Spigot start
|
||||
+ public class Spigot extends Entity.Spigot
|
||||
+ {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the connection address of this player, regardless of whether it
|
||||
+ * has been spoofed or not.
|
||||
+ *
|
||||
+ * @return the player's connection address
|
||||
+ */
|
||||
+ public InetSocketAddress getRawAddress()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Spigot spigot();
|
||||
+ // Spigot end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
index b74b7b8..081e994 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
@@ -14,6 +14,7 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
private final String hostname;
|
||||
private Result result = Result.ALLOWED;
|
||||
private String message = "";
|
||||
+ private final InetAddress realAddress; // Spigot
|
||||
|
||||
/**
|
||||
* @deprecated Address should be provided in other constructor
|
||||
@@ -40,10 +41,17 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
* @param address The address the player used to connect, provided for
|
||||
* timing issues
|
||||
*/
|
||||
- public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) {
|
||||
+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address, final InetAddress realAddress) { // Spigot
|
||||
super(player);
|
||||
this.hostname = hostname;
|
||||
this.address = address;
|
||||
+ // Spigot start
|
||||
+ this.realAddress = realAddress;
|
||||
+ }
|
||||
+
|
||||
+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) {
|
||||
+ this(player, hostname, address, address);
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +60,7 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
*/
|
||||
@Deprecated
|
||||
public PlayerLoginEvent(final Player player, final Result result, final String message) {
|
||||
- this(player, "", null, result, message);
|
||||
+ this(player, "", null, result, message, null); // Spigot
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,12 +73,23 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
* @param result The result status for this event
|
||||
* @param message The message to be displayed if result denies login
|
||||
*/
|
||||
- public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message) {
|
||||
- this(player, hostname, address);
|
||||
+ public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message, final InetAddress realAddress) { // Spigot
|
||||
+ this(player, hostname, address, realAddress); // Spigot
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Gets the connection address of this player, regardless of whether it has been spoofed or not.
|
||||
+ *
|
||||
+ * @return the player's connection address
|
||||
+ */
|
||||
+ public InetAddress getRealAddress() {
|
||||
+ return realAddress;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
/**
|
||||
* Gets the current result of the login, as an enum
|
||||
*
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,34 +0,0 @@
|
||||
From cbf63431431dd4051330fae4332ab3c8344632be 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java
|
||||
index e49eef0..e7a32f7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Arrow.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Arrow.java
|
||||
@@ -39,4 +39,20 @@ public interface Arrow extends Projectile {
|
||||
* @param critical whether or not it should be critical
|
||||
*/
|
||||
public void setCritical(boolean critical);
|
||||
+
|
||||
+ public class Spigot extends Entity.Spigot
|
||||
+ {
|
||||
+
|
||||
+ public double getDamage()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+
|
||||
+ public void setDamage(double damage)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Spigot spigot();
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,364 +0,0 @@
|
||||
From d62993211f88621e18c42f081425815346e4495e 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
|
||||
index 2474a2d..9964203 100644
|
||||
--- a/src/main/java/org/bukkit/Effect.java
|
||||
+++ b/src/main/java/org/bukkit/Effect.java
|
||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.Potion;
|
||||
|
||||
/**
|
||||
@@ -79,27 +80,183 @@ public enum Effect {
|
||||
/**
|
||||
* The flames seen on a mobspawner; a visual effect.
|
||||
*/
|
||||
- MOBSPAWNER_FLAMES(2004, Type.VISUAL);
|
||||
+ MOBSPAWNER_FLAMES(2004, Type.VISUAL),
|
||||
+ /**
|
||||
+ * The spark that comes off a fireworks
|
||||
+ */
|
||||
+ FIREWORKS_SPARK("fireworksSpark", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Critical hit particles
|
||||
+ */
|
||||
+ CRIT("crit", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Blue critical hit particles
|
||||
+ */
|
||||
+ MAGIC_CRIT("magicCrit", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Multicolored potion effect particles
|
||||
+ */
|
||||
+ POTION_SWIRL("mobSpell", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Multicolored potion effect particles that are slightly transparent
|
||||
+ */
|
||||
+ POTION_SWIRL_TRANSPARENT("mobSpellAmbient", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A puff of white potion swirls
|
||||
+ */
|
||||
+ SPELL("spell", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A puff of white stars
|
||||
+ */
|
||||
+ INSTANT_SPELL("instantSpell", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A puff of purple particles
|
||||
+ */
|
||||
+ WITCH_MAGIC("witchMagic", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The note that appears above note blocks
|
||||
+ */
|
||||
+ NOTE("note", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particles shown at nether portals
|
||||
+ */
|
||||
+ PORTAL("portal", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The symbols that fly towards the enchantment table
|
||||
+ */
|
||||
+ FLYING_GLYPH("enchantmenttable", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Fire particles
|
||||
+ */
|
||||
+ FLAME("flame", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particles that pop out of lava
|
||||
+ */
|
||||
+ LAVA_POP("lava", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A small gray square
|
||||
+ */
|
||||
+ FOOTSTEP("footstep", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Water particles
|
||||
+ */
|
||||
+ SPLASH("splash", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Smoke particles
|
||||
+ */
|
||||
+ PARTICLE_SMOKE("smoke", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The biggest explosion particle effect
|
||||
+ */
|
||||
+ EXPLOSION_HUGE("hugeexplosion", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A larger version of the explode particle
|
||||
+ */
|
||||
+ EXPLOSION_LARGE("largeexplode", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Explosion particles
|
||||
+ */
|
||||
+ EXPLOSION("explode", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Small gray particles
|
||||
+ */
|
||||
+ VOID_FOG("depthsuspend", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Small gray particles
|
||||
+ */
|
||||
+ SMALL_SMOKE("townaura", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * A puff of white smoke
|
||||
+ */
|
||||
+ CLOUD("cloud", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Multicolored dust particles
|
||||
+ */
|
||||
+ COLOURED_DUST("reddust", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * Snowball breaking
|
||||
+ */
|
||||
+ SNOWBALL_BREAK("snowballpoof", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The water drip particle that appears on blocks under water
|
||||
+ */
|
||||
+ WATERDRIP("dripWater", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The lava drip particle that appears on blocks under lava
|
||||
+ */
|
||||
+ LAVADRIP("dripLava", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * White particles
|
||||
+ */
|
||||
+ SNOW_SHOVEL("snowshovel", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particle shown when a slime jumps
|
||||
+ */
|
||||
+ SLIME("slime", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particle that appears when breading animals
|
||||
+ */
|
||||
+ HEART("heart", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particle that appears when hitting a villager
|
||||
+ */
|
||||
+ VILLAGER_THUNDERCLOUD("angryVillager", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particle that appears when trading with a villager
|
||||
+ */
|
||||
+ HAPPY_VILLAGER("happyVillager", Type.PARTICLE),
|
||||
+ /**
|
||||
+ * The particles generated when a tool breaks.
|
||||
+ * This particle requires a Material so that the client can select the correct texture.
|
||||
+ */
|
||||
+ ITEM_BREAK("iconcrack", Type.PARTICLE, Material.class),
|
||||
+ /**
|
||||
+ * The particles generated while breaking a block.
|
||||
+ * This particle requires a Material and data value so that the client can select the correct texture.
|
||||
+ */
|
||||
+ TILE_BREAK("blockcrack", Type.PARTICLE, MaterialData.class),
|
||||
+ /**
|
||||
+ * The particles generated while sprinting a block
|
||||
+ * This particle requires a Material and data value so that the client can select the correct texture.
|
||||
+ */
|
||||
+ TILE_DUST("blockdust", Type.PARTICLE, MaterialData.class);
|
||||
|
||||
private final int id;
|
||||
private final Type type;
|
||||
private final Class<?> data;
|
||||
private static final Map<Integer, Effect> BY_ID = Maps.newHashMap();
|
||||
+ private static final Map<String, Effect> BY_NAME = Maps.newHashMap();
|
||||
+ private final String particleName;
|
||||
|
||||
- Effect(int id, Type type) {
|
||||
+ private Effect(int id, Type type) {
|
||||
this(id,type,null);
|
||||
}
|
||||
|
||||
- Effect(int id, Type type, Class<?> data) {
|
||||
+ private Effect(int id, Type type, Class<?> data) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
+ particleName = null;
|
||||
+ }
|
||||
+
|
||||
+ private Effect(String particleName, Type type, Class<?> data) {
|
||||
+ this.particleName = particleName;
|
||||
+ this.type = type;
|
||||
+ id = 0;
|
||||
+ this.data = data;
|
||||
+ }
|
||||
+
|
||||
+ private Effect(String particleName, Type type) {
|
||||
+ this.particleName = particleName;
|
||||
+ this.type = type;
|
||||
+ id = 0;
|
||||
+ this.data = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID for this effect.
|
||||
*
|
||||
- * @return ID of this effect
|
||||
+ * @return if this Effect isn't of type PARTICLE it returns ID of this effect
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -108,6 +265,15 @@ public enum Effect {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Returns the effect's name. This returns null if the effect is not a particle
|
||||
+ *
|
||||
+ * @return The effect's name
|
||||
+ */
|
||||
+ public String getName() {
|
||||
+ return particleName;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* @return The type of the effect.
|
||||
*/
|
||||
public Type getType() {
|
||||
@@ -115,8 +281,7 @@ public enum Effect {
|
||||
}
|
||||
|
||||
/**
|
||||
- * @return The class which represents data for this effect, or null if
|
||||
- * none
|
||||
+ * @return if this Effect isn't of type PARTICLE it returns the class which represents data for this effect, or null if none
|
||||
*/
|
||||
public Class<?> getData() {
|
||||
return this.data;
|
||||
@@ -136,12 +301,32 @@ public enum Effect {
|
||||
|
||||
static {
|
||||
for (Effect effect : values()) {
|
||||
- BY_ID.put(effect.id, effect);
|
||||
+ if (effect.type != Type.PARTICLE) {
|
||||
+ BY_ID.put(effect.id, effect);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Effect associated with the given name.
|
||||
+ *
|
||||
+ * @param name name of the Effect to return
|
||||
+ * @return Effect with the given name
|
||||
+ */
|
||||
+ public static Effect getByName(String name) {
|
||||
+ return BY_NAME.get(name);
|
||||
+ }
|
||||
+
|
||||
+ static {
|
||||
+ for (Effect effect : values()) {
|
||||
+ if (effect.type == Type.PARTICLE) {
|
||||
+ BY_NAME.put(effect.particleName, effect);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the type of an effect.
|
||||
*/
|
||||
- public enum Type {SOUND, VISUAL}
|
||||
+ public enum Type {SOUND, VISUAL, PARTICLE}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 9bf2c41..6cf3ff0 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -1155,6 +1155,56 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
||||
*/
|
||||
public boolean isGameRule(String rule);
|
||||
|
||||
+ // Spigot start
|
||||
+ public class Spigot
|
||||
+ {
|
||||
+
|
||||
+ /**
|
||||
+ * Plays an effect to all players within a default radius around a given
|
||||
+ * location.
|
||||
+ *
|
||||
+ * @param location the {@link Location} around which players must be to
|
||||
+ * see the effect
|
||||
+ * @param effect the {@link Effect}
|
||||
+ * @throws IllegalArgumentException if the location or effect is null.
|
||||
+ * It also throws when the effect requires a material or a material data
|
||||
+ */
|
||||
+ public void playEffect(Location location, Effect effect)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Plays an effect to all players within a default radius around a given
|
||||
+ * location. The effect will use the provided material (and material
|
||||
+ * data if required). The particle's position on the client will be the
|
||||
+ * given location, adjusted on each axis by a normal distribution with
|
||||
+ * mean 0 and standard deviation given in the offset parameters, each
|
||||
+ * particle has independently calculated offsets. The effect will have
|
||||
+ * the given speed and particle count if the effect is a particle. Some
|
||||
+ * effect will create multiple particles.
|
||||
+ *
|
||||
+ * @param location the {@link Location} around which players must be to
|
||||
+ * see the effect
|
||||
+ * @param effect effect the {@link Effect}
|
||||
+ * @param id the item/block/data id for the effect
|
||||
+ * @param data the data value of the block/item for the effect
|
||||
+ * @param offsetX the amount to be randomly offset by in the X axis
|
||||
+ * @param offsetY the amount to be randomly offset by in the Y axis
|
||||
+ * @param offsetZ the amount to be randomly offset by in the Z axis
|
||||
+ * @param speed the speed of the particles
|
||||
+ * @param particleCount the number of particles
|
||||
+ * @param radius the radius around the location
|
||||
+ */
|
||||
+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Spigot spigot();
|
||||
+ // Spigot end
|
||||
+
|
||||
/**
|
||||
* Represents various map environment types that a world may be
|
||||
*/
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index e851b98..c6bb787 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1050,6 +1050,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java
|
||||
index 08aa71d..5217aec 100644
|
||||
--- a/src/test/java/org/bukkit/EffectTest.java
|
||||
+++ b/src/test/java/org/bukkit/EffectTest.java
|
||||
@@ -9,7 +9,11 @@ public class EffectTest {
|
||||
@Test
|
||||
public void getById() {
|
||||
for (Effect effect : Effect.values()) {
|
||||
- assertThat(Effect.getById(effect.getId()), is(effect));
|
||||
+ if (effect.getType() != Effect.Type.PARTICLE) {
|
||||
+ assertThat(Effect.getById(effect.getId()), is(effect));
|
||||
+ } else {
|
||||
+ assertThat(Effect.getByName(effect.getName()), is(effect));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,220 +0,0 @@
|
||||
From 8aa02378d120ed69b1ec15830c150205580ef74b 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
|
||||
|
||||
Defines EntitySpawnEvent and SpawnerSpawnEvent. Adds BUKKIT-267 and BUKKIT-1559
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
index 46b8262..182f634 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
@@ -4,17 +4,13 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
-import org.bukkit.event.Cancellable;
|
||||
-import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a creature is spawned into a world.
|
||||
* <p>
|
||||
* If a Creature Spawn event is cancelled, the creature will not spawn.
|
||||
*/
|
||||
-public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private boolean canceled;
|
||||
+public class CreatureSpawnEvent extends EntitySpawnEvent {
|
||||
private final SpawnReason spawnReason;
|
||||
|
||||
public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) {
|
||||
@@ -28,29 +24,12 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
spawnReason = reason;
|
||||
}
|
||||
|
||||
- public boolean isCancelled() {
|
||||
- return canceled;
|
||||
- }
|
||||
-
|
||||
- public void setCancelled(boolean cancel) {
|
||||
- canceled = cancel;
|
||||
- }
|
||||
-
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
- * Gets the location at which the creature is spawning.
|
||||
- *
|
||||
- * @return The location at which the creature is spawning
|
||||
- */
|
||||
- public Location getLocation() {
|
||||
- return getEntity().getLocation();
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
* Gets the type of creature being spawned.
|
||||
*
|
||||
* @return A CreatureType value detailing the type of creature being
|
||||
@@ -72,15 +51,6 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
return spawnReason;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
/**
|
||||
* An enum to specify the type of spawning
|
||||
*/
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..5dcf98f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package org.bukkit.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity is spawned into a world.
|
||||
+ * <p>
|
||||
+ * If an Entity Spawn event is cancelled, the entity will not spawn.
|
||||
+ */
|
||||
+public class EntitySpawnEvent extends EntityEvent implements org.bukkit.event.Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+
|
||||
+ public EntitySpawnEvent(final Entity spawnee) {
|
||||
+ super(spawnee);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location at which the entity is spawning.
|
||||
+ *
|
||||
+ * @return The location at which the entity is spawning
|
||||
+ */
|
||||
+ public Location getLocation() {
|
||||
+ return getEntity().getLocation();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java
|
||||
index bafd934..776f8e7 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java
|
||||
@@ -1,51 +1,23 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
-import org.bukkit.entity.Item;
|
||||
import org.bukkit.Location;
|
||||
-import org.bukkit.event.Cancellable;
|
||||
-import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.entity.Item;
|
||||
|
||||
/**
|
||||
* Called when an item is spawned into a world
|
||||
*/
|
||||
-public class ItemSpawnEvent extends EntityEvent implements Cancellable {
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private final Location location;
|
||||
- private boolean canceled;
|
||||
-
|
||||
- public ItemSpawnEvent(final Item spawnee, final Location loc) {
|
||||
+public class ItemSpawnEvent extends EntitySpawnEvent {
|
||||
+ public ItemSpawnEvent(final Item spawnee) {
|
||||
super(spawnee);
|
||||
- this.location = loc;
|
||||
}
|
||||
|
||||
- public boolean isCancelled() {
|
||||
- return canceled;
|
||||
- }
|
||||
-
|
||||
- public void setCancelled(boolean cancel) {
|
||||
- canceled = cancel;
|
||||
+ @Deprecated
|
||||
+ public ItemSpawnEvent(final Item spawnee, final Location loc) {
|
||||
+ this(spawnee);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEntity() {
|
||||
return (Item) entity;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Gets the location at which the item is spawning.
|
||||
- *
|
||||
- * @return The location at which the item is spawning
|
||||
- */
|
||||
- public Location getLocation() {
|
||||
- return location;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..1acb3c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package org.bukkit.event.entity;
|
||||
+
|
||||
+import org.bukkit.block.CreatureSpawner;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity is spawned into a world by a spawner.
|
||||
+ * <p>
|
||||
+ * If a Spawner Spawn event is cancelled, the entity will not spawn.
|
||||
+ */
|
||||
+public class SpawnerSpawnEvent extends EntitySpawnEvent {
|
||||
+ private final CreatureSpawner spawner;
|
||||
+
|
||||
+ public SpawnerSpawnEvent(final Entity spawnee, final CreatureSpawner spawner) {
|
||||
+ super(spawnee);
|
||||
+ this.spawner = spawner;
|
||||
+ }
|
||||
+
|
||||
+ public CreatureSpawner getSpawner() {
|
||||
+ return spawner;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,112 +0,0 @@
|
||||
From 58be738382c873e893de43f6c04c4d32d896c4d1 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..24d4942
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
@@ -0,0 +1,39 @@
|
||||
+package org.spigotmc.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity stops riding another entity.
|
||||
+ *
|
||||
+ */
|
||||
+public class EntityDismountEvent extends EntityEvent
|
||||
+{
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final Entity dismounted;
|
||||
+
|
||||
+ public EntityDismountEvent(Entity what, Entity dismounted)
|
||||
+ {
|
||||
+ super( what );
|
||||
+ this.dismounted = dismounted;
|
||||
+ }
|
||||
+
|
||||
+ public Entity getDismounted()
|
||||
+ {
|
||||
+ return dismounted;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers()
|
||||
+ {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList()
|
||||
+ {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..16aa2a7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package org.spigotmc.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity attempts to ride another entity.
|
||||
+ *
|
||||
+ */
|
||||
+public class EntityMountEvent extends EntityEvent implements Cancellable
|
||||
+{
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final Entity mount;
|
||||
+
|
||||
+ public EntityMountEvent(Entity what, Entity mount)
|
||||
+ {
|
||||
+ super( what );
|
||||
+ this.mount = mount;
|
||||
+ }
|
||||
+
|
||||
+ public Entity getMount()
|
||||
+ {
|
||||
+ return mount;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled()
|
||||
+ {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel)
|
||||
+ {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers()
|
||||
+ {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList()
|
||||
+ {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,48 +0,0 @@
|
||||
From b1dcd5bfb51249023019a871be0586f76faf18ba 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
|
||||
|
||||
- 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 b394a33..4252e34 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -76,21 +76,21 @@
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
- <version>1.9</version>
|
||||
+ <version>1.12</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
- <version>1.1</version>
|
||||
+ <version>1.1.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.avaje</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
- <version>2.7.3</version>
|
||||
+ <version>2.8.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -104,7 +104,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
- <version>2.3</version>
|
||||
+ <version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- testing -->
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From e8c2741c4a8f6c5080bebca67e88220ede5419ef 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
|
||||
|
||||
Add InventoryClickEvent.getClickedInventory. Adds BUKKIT-4495
|
||||
Plugins currently have to do the logic themselves on the raw slot ID
|
||||
in order to determine the inventory clicked. This provides the logic for plugins to
|
||||
readily identify which inventory was clicked.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
index 28198b8..3313d91 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
@@ -47,6 +47,7 @@ public class InventoryClickEvent extends InventoryInteractEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final ClickType click;
|
||||
private final InventoryAction action;
|
||||
+ private final Inventory clickedInventory;
|
||||
private SlotType slot_type;
|
||||
private int whichSlot;
|
||||
private int rawSlot;
|
||||
@@ -62,6 +63,13 @@ public class InventoryClickEvent extends InventoryInteractEvent {
|
||||
super(view);
|
||||
this.slot_type = type;
|
||||
this.rawSlot = slot;
|
||||
+ if (slot < 0) {
|
||||
+ this.clickedInventory = null;
|
||||
+ } else if (view.getTopInventory() != null && slot < view.getTopInventory().getSize()) {
|
||||
+ this.clickedInventory = view.getTopInventory();
|
||||
+ } else {
|
||||
+ this.clickedInventory = view.getBottomInventory();
|
||||
+ }
|
||||
this.whichSlot = view.convertSlot(slot);
|
||||
this.click = click;
|
||||
this.action = action;
|
||||
@@ -73,6 +81,14 @@ public class InventoryClickEvent extends InventoryInteractEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Gets the inventory that was clicked, or null if outside of window
|
||||
+ * @return The clicked inventory
|
||||
+ */
|
||||
+ public Inventory getClickedInventory() {
|
||||
+ return clickedInventory;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Gets the type of slot that was clicked.
|
||||
*
|
||||
* @return the slot type
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 70ce792e4a61366ea17987ebf1ad1d90cb4df908 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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/conversations/ConversationContext.java b/src/main/java/org/bukkit/conversations/ConversationContext.java
|
||||
index 4f33ff4..7390a77 100644
|
||||
--- a/src/main/java/org/bukkit/conversations/ConversationContext.java
|
||||
+++ b/src/main/java/org/bukkit/conversations/ConversationContext.java
|
||||
@@ -46,6 +46,14 @@ public class ConversationContext {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Gets the entire sessionData map.
|
||||
+ * @return The full sessionData map.
|
||||
+ */
|
||||
+ public Map<Object, Object> getAllSessionData() {
|
||||
+ return sessionData;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Gets session data shared between all {@link Prompt} invocations. Use
|
||||
* this as a way to pass data through each Prompt as the conversation
|
||||
* develops.
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,34 +0,0 @@
|
||||
From a0feb888a9a0017132f70f0fdce1b99e587c1735 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/conversations/Conversation.java b/src/main/java/org/bukkit/conversations/Conversation.java
|
||||
index d4c1f6d..46912c8 100644
|
||||
--- a/src/main/java/org/bukkit/conversations/Conversation.java
|
||||
+++ b/src/main/java/org/bukkit/conversations/Conversation.java
|
||||
@@ -209,6 +209,7 @@ public class Conversation {
|
||||
* @param input The user's chat text.
|
||||
*/
|
||||
public void acceptInput(String input) {
|
||||
+ try { // Spigot
|
||||
if (currentPrompt != null) {
|
||||
|
||||
// Echo the user's input
|
||||
@@ -228,6 +229,12 @@ public class Conversation {
|
||||
currentPrompt = currentPrompt.acceptInput(context, input);
|
||||
outputNextPrompt();
|
||||
}
|
||||
+ // Spigot Start
|
||||
+ } catch ( Throwable t )
|
||||
+ {
|
||||
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.SEVERE, "Error handling conversation prompt", t );
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 07f1e37031ec86f69acce0c4c66deb0d1a978473 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index c6bb787..b879ecb 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1055,6 +1055,27 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the player collides with entities
|
||||
+ *
|
||||
+ * @return the player's collision toggle state
|
||||
+ */
|
||||
+ public boolean getCollidesWithEntities()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the player collides with entities
|
||||
+ *
|
||||
+ * @param collides whether the player should collide with entities or
|
||||
+ * not.
|
||||
+ */
|
||||
+ public void setCollidesWithEntities(boolean collides)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From bf0593497a0cf78104fdec4b477bf18528ab6d60 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/src/main/java/org/bukkit/conversations/BooleanPrompt.java
|
||||
index 3f2c97f..81ef78c 100644
|
||||
--- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java
|
||||
+++ b/src/main/java/org/bukkit/conversations/BooleanPrompt.java
|
||||
@@ -15,12 +15,13 @@ public abstract class BooleanPrompt extends ValidatingPrompt{
|
||||
|
||||
@Override
|
||||
protected boolean isInputValid(ConversationContext context, String input) {
|
||||
- String[] accepted = {"true", "false", "on", "off", "yes", "no"};
|
||||
+ String[] accepted = {"true", "false", "on", "off", "yes", "no" /* Spigot: */, "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"}; // Spigot
|
||||
return ArrayUtils.contains(accepted, input.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
+ if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true"; // Spigot
|
||||
return acceptValidatedInput(context, BooleanUtils.toBoolean(input));
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 084c77ae158c6f4a05ed31f39d1fed72a113378a 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 396ea20..294e80b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -291,4 +291,22 @@ public interface Entity extends Metadatable {
|
||||
* @return The current vehicle.
|
||||
*/
|
||||
public Entity getVehicle();
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ public class Spigot
|
||||
+ {
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether this entity is invulnerable.
|
||||
+ *
|
||||
+ * @return True if the entity is invulnerable.
|
||||
+ */
|
||||
+ public boolean isInvulnerable()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Spigot spigot();
|
||||
+ // Spigot End
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,28 +0,0 @@
|
||||
From e97e54dbdcfe6c517061020a5fc377a2249fbd4e 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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index b879ecb..6559243 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1076,6 +1076,14 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Respawns the player if dead.
|
||||
+ */
|
||||
+ public void respawn()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,30 +0,0 @@
|
||||
From eef94addd975a73d35545f162b33c192290c15b7 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
|
||||
index a906f8d..4c171e8 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
|
||||
@@ -421,7 +421,15 @@ public class StandardMessenger implements Messenger {
|
||||
Set<PluginMessageListenerRegistration> registrations = getIncomingChannelRegistrations(channel);
|
||||
|
||||
for (PluginMessageListenerRegistration registration : registrations) {
|
||||
- registration.getListener().onPluginMessageReceived(channel, source, message);
|
||||
+ // Spigot Start
|
||||
+ try
|
||||
+ {
|
||||
+ registration.getListener().onPluginMessageReceived( channel, source, message );
|
||||
+ } catch ( Throwable t )
|
||||
+ {
|
||||
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Could not pass incoming plugin message to " + registration.getPlugin(), t );
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,85 +0,0 @@
|
||||
From 7962f8977790ecd6de241dff015c3d105984ff14 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
index b888da1..e21d167 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
@@ -40,4 +40,12 @@ public class PluginsCommand extends BukkitCommand {
|
||||
|
||||
return "(" + plugins.length + "): " + pluginList.toString();
|
||||
}
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
+ {
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index ffbcac1..16dfdbd 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -26,4 +26,12 @@ public class ReloadCommand extends BukkitCommand {
|
||||
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
+ {
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TellCommand.java b/src/main/java/org/bukkit/command/defaults/TellCommand.java
|
||||
index 287f49f..fc49207 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TellCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/TellCommand.java
|
||||
@@ -45,4 +45,16 @@ public class TellCommand extends VanillaCommand {
|
||||
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
+ {
|
||||
+ if ( args.length == 0 )
|
||||
+ {
|
||||
+ return super.tabComplete( sender, alias, args );
|
||||
+ }
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TestForCommand.java b/src/main/java/org/bukkit/command/defaults/TestForCommand.java
|
||||
index c9ac1ce..a687fef 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TestForCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/TestForCommand.java
|
||||
@@ -23,4 +23,16 @@ public class TestForCommand extends VanillaCommand {
|
||||
sender.sendMessage(ChatColor.RED + "/testfor is only usable by commandblocks with analog output.");
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
+ {
|
||||
+ if ( args.length == 0 )
|
||||
+ {
|
||||
+ return super.tabComplete( sender, alias, args );
|
||||
+ }
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,29 +0,0 @@
|
||||
From a4659b2634e53721ab1f46d0539415c1bbf290e4 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
|
||||
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index a51766e..1905b8d 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -1,11 +1,11 @@
|
||||
-Bukkit
|
||||
+Spigot-API
|
||||
======
|
||||
|
||||
A Minecraft Server API.
|
||||
|
||||
-Website: [http://bukkit.org](http://bukkit.org)
|
||||
-Bugs/Suggestions: [http://leaky.bukkit.org](http://leaky.bukkit.org)
|
||||
-Contributing Guidelines: [CONTRIBUTING.md](https://github.com/Bukkit/Bukkit/blob/master/CONTRIBUTING.md)
|
||||
+Website: [http://spigotmc.org](http://spigotmc.org)
|
||||
+Bugs/Suggestions: [http://www.spigotmc.org/forums/bugs-feature-requests.8/](http://www.spigotmc.org/forums/bugs-feature-requests.8/)
|
||||
+Contributing Guidelines: [CONTRIBUTING.md](https://github.com/SpigotMC/Spigot-API/blob/master/CONTRIBUTING.md)
|
||||
|
||||
Compilation
|
||||
-----------
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 57dfad3a6d1085ebc7006402c196285e10e27d6f 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 6559243..2cc19a7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1084,6 +1084,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets player locale language.
|
||||
+ *
|
||||
+ * @return the player's client language settings
|
||||
+ */
|
||||
+ public String getLocale()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 267dd31ea425a46cc9c6169944a397dc285f5270 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 2cc19a7..37c8a58 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1094,6 +1094,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all players hidden with {@link hidePlayer(org.bukkit.entity.Player)}.
|
||||
+ *
|
||||
+ * @return a Set with all hidden players
|
||||
+ */
|
||||
+ public java.util.Set<Player> getHiddenPlayers()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,70 +0,0 @@
|
||||
From 4a9e3da0eefb80e5c6eea75b99f965da7d4d7354 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 6cf3ff0..ab73174 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -1200,6 +1200,30 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
||||
{
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Strikes lightning at the given {@link Location} and possibly without sound
|
||||
+ *
|
||||
+ * @param loc The location to strike lightning
|
||||
+ * @param isSilent Whether this strike makes no sound
|
||||
+ * @return The lightning entity.
|
||||
+ */
|
||||
+ public LightningStrike strikeLightning(Location loc, boolean isSilent)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Strikes lightning at the given {@link Location} without doing damage and possibly without sound
|
||||
+ *
|
||||
+ * @param loc The location to strike lightning
|
||||
+ * @param isSilent Whether this strike makes no sound
|
||||
+ * @return The lightning entity.
|
||||
+ */
|
||||
+ public LightningStrike strikeLightningEffect(Location loc, boolean isSilent)
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
}
|
||||
|
||||
Spigot spigot();
|
||||
diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
index c8b5154..1ed4ac9 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
@@ -12,4 +12,21 @@ public interface LightningStrike extends Weather {
|
||||
*/
|
||||
public boolean isEffect();
|
||||
|
||||
+
|
||||
+ public class Spigot extends Entity.Spigot
|
||||
+ {
|
||||
+
|
||||
+ /*
|
||||
+ * Returns whether the strike is silent.
|
||||
+ *
|
||||
+ * @return whether the strike is silent.
|
||||
+ */
|
||||
+ public boolean isSilent()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ Spigot spigot();
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,79 +0,0 @@
|
||||
From 6f3e1435bb97f1388c4a9c1b98077c9a9f673137 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
|
||||
|
||||
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 dafea2e..8b0005e 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -183,7 +183,6 @@ public final class Bukkit {
|
||||
/**
|
||||
* @see Server#getPlayer(String name)
|
||||
*/
|
||||
- @Deprecated
|
||||
public static Player getPlayer(String name) {
|
||||
return server.getPlayer(name);
|
||||
}
|
||||
@@ -191,7 +190,6 @@ public final class Bukkit {
|
||||
/**
|
||||
* @see Server#matchPlayer(String name)
|
||||
*/
|
||||
- @Deprecated
|
||||
public static List<Player> matchPlayer(String name) {
|
||||
return server.matchPlayer(name);
|
||||
}
|
||||
@@ -433,7 +431,6 @@ public final class Bukkit {
|
||||
/**
|
||||
* @see Server#getPlayerExact(String name)
|
||||
*/
|
||||
- @Deprecated
|
||||
public static Player getPlayerExact(String name) {
|
||||
return server.getPlayerExact(name);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 3c4d541..fbc8b87 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -268,23 +268,17 @@ public interface Server extends PluginMessageRecipient {
|
||||
* <p>
|
||||
* This method may not return objects for offline players.
|
||||
*
|
||||
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
||||
- * guaranteed to be unique
|
||||
* @param name the name to look up
|
||||
* @return a player if one was found, null otherwise
|
||||
*/
|
||||
- @Deprecated
|
||||
public Player getPlayer(String name);
|
||||
|
||||
/**
|
||||
* Gets the player with the exact given name, case insensitive.
|
||||
*
|
||||
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
||||
- * guaranteed to be unique
|
||||
* @param name Exact name of the player to retrieve
|
||||
* @return a player object if one was found, null otherwise
|
||||
*/
|
||||
- @Deprecated
|
||||
public Player getPlayerExact(String name);
|
||||
|
||||
/**
|
||||
@@ -294,12 +288,9 @@ public interface Server extends PluginMessageRecipient {
|
||||
* This list is not sorted in any particular order. If an exact match is
|
||||
* found, the returned list will only contain a single result.
|
||||
*
|
||||
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
|
||||
- * guaranteed to be unique
|
||||
* @param name the (partial) name to match
|
||||
* @return list of all possible players
|
||||
*/
|
||||
- @Deprecated
|
||||
public List<Player> matchPlayer(String name);
|
||||
|
||||
/**
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,75 +0,0 @@
|
||||
From 8bfe38430d6e27b6d5d7343162c47f9bb9636566 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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index 50c6f76..b90b9c3 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -118,6 +118,15 @@ public interface Team {
|
||||
*/
|
||||
Set<OfflinePlayer> getPlayers() throws IllegalStateException;
|
||||
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Same as the player method, but with an arbitrary string.
|
||||
+ *
|
||||
+ * @see #getPlayers()
|
||||
+ */
|
||||
+ Set<String> getEntries() throws IllegalStateException;
|
||||
+ // Spigot End
|
||||
+
|
||||
/**
|
||||
* Gets the size of the team
|
||||
*
|
||||
@@ -145,6 +154,15 @@ public interface Team {
|
||||
*/
|
||||
void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Same as the player method, but with an arbitrary string.
|
||||
+ *
|
||||
+ * @see #addPlayer(org.bukkit.OfflinePlayer)
|
||||
+ */
|
||||
+ void addEntry(String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Spigot end
|
||||
+
|
||||
/**
|
||||
* Removes the player from this team.
|
||||
*
|
||||
@@ -155,6 +173,15 @@ public interface Team {
|
||||
*/
|
||||
boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Same as the player method, but with an arbitrary string.
|
||||
+ *
|
||||
+ * @see #removePlayer(org.bukkit.OfflinePlayer)
|
||||
+ */
|
||||
+ boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Spigot end
|
||||
+
|
||||
/**
|
||||
* Unregisters this team from the Scoreboard
|
||||
*
|
||||
@@ -171,4 +198,13 @@ public interface Team {
|
||||
* @throws IllegalStateException if this team has been unregistered
|
||||
*/
|
||||
boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException;
|
||||
+
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Same as the player method, but with an arbitrary string.
|
||||
+ *
|
||||
+ * @see #hasPlayer(org.bukkit.OfflinePlayer)
|
||||
+ */
|
||||
+ boolean hasEntry(String entry) throws IllegalArgumentException,IllegalStateException;
|
||||
+ // Spigot end
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 42fb4c3837a133f6bbfd221dbe690c5a59e3c561 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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
index 4c10346..2410cbd 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
@@ -51,6 +51,17 @@ public interface Score {
|
||||
*/
|
||||
void setScore(int score) throws IllegalStateException;
|
||||
|
||||
+ // Spigot start
|
||||
+ /**
|
||||
+ * Shows if this score has been set at any point in time.
|
||||
+ *
|
||||
+ * @return if this score has been set before
|
||||
+ * @throws IllegalStateException if the associated objective has been
|
||||
+ * unregistered
|
||||
+ */
|
||||
+ boolean isScoreSet() throws IllegalStateException;
|
||||
+ // Spigot end
|
||||
+
|
||||
/**
|
||||
* Gets the scoreboard for the associated objective.
|
||||
*
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,65 +0,0 @@
|
||||
From 0257e758e92240022e5ca1559204ab058942c368 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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java
|
||||
new file mode 100644
|
||||
index 0000000..dd3f58c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package org.spigotmc.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Called when player is about to spawn in a world after joining the server.
|
||||
+ */
|
||||
+public class PlayerSpawnLocationEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private Location spawnLocation;
|
||||
+
|
||||
+ public PlayerSpawnLocationEvent(final Player who, Location spawnLocation) {
|
||||
+ super(who);
|
||||
+ this.spawnLocation = spawnLocation;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Gets player's spawn location.
|
||||
+ * If the player {@link Player#hasPlayedBefore()}, it's going to default to the location inside player.dat file.
|
||||
+ * For new players, the default spawn location is spawn of the main Bukkit world.
|
||||
+ *
|
||||
+ * @return the spawn location
|
||||
+ */
|
||||
+ public Location getSpawnLocation() {
|
||||
+ return spawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets player's spawn location.
|
||||
+ *
|
||||
+ * @param location the spawn location
|
||||
+ */
|
||||
+ public void setSpawnLocation(Location location) {
|
||||
+ this.spawnLocation = location;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 07d07b09f4aeb0147092ff5f892ce4b4e3bed3a9
|
||||
Subproject commit e6e1f9366d1eae43ec52cab474ed9268662873fd
|
@ -1,160 +0,0 @@
|
||||
From 4c0a6720e1aa3018860c091f0eab1744a7009ec6 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
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index b2e2002..df02bd3 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,12 +1,12 @@
|
||||
<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>craftbukkit</artifactId>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.7.9-R0.3-SNAPSHOT</version>
|
||||
- <name>CraftBukkit</name>
|
||||
- <url>http://www.bukkit.org</url>
|
||||
+ <name>Spigot</name>
|
||||
+ <url>http://www.spigotmc.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -18,24 +18,12 @@
|
||||
<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,8 +41,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
- <groupId>org.bukkit</groupId>
|
||||
- <artifactId>bukkit</artifactId>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
@@ -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 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
- <defaultGoal>clean install</defaultGoal>
|
||||
+ <defaultGoal>install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.lukegb.mojo</groupId>
|
||||
<artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
- <outputPrefix>${buildtag.prefix}</outputPrefix>
|
||||
- <outputPostfix>${buildtag.suffix}</outputPostfix>
|
||||
+ <outputPrefix>git-Spigot-</outputPrefix>
|
||||
+ <outputPostfix></outputPostfix>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -212,7 +173,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
- <version>1.4</version>
|
||||
+ <version>2.1</version>
|
||||
<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 3be5174..853e5d2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -308,7 +308,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
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.bukkit/bukkit/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties");
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From fd771d95f61823e3bd28a839118cadbba647b60b Mon Sep 17 00:00:00 2001
|
||||
From 05ddf5f50ce8dc6bef17a65aaf7273396f6ffff8 Mon Sep 17 00:00:00 2001
|
||||
From: gsand <gsandowns@gmail.com>
|
||||
Date: Tue, 15 Apr 2014 07:12:20 -0700
|
||||
Subject: [PATCH] Rename to PaperSpigot
|
@ -1,4 +1,4 @@
|
||||
From 6642bbcbdf4d07ec3f6b80f8917616071446109a Mon Sep 17 00:00:00 2001
|
||||
From 8d6838044492d45dd084529a225da4c2cf9b8791 Mon Sep 17 00:00:00 2001
|
||||
From: Suddenly <suddenly@suddenly.coffee>
|
||||
Date: Tue, 27 May 2014 14:00:41 +0100
|
||||
Subject: [PATCH] Prevent null hopper owners crashing the server
|
File diff suppressed because it is too large
Load Diff
@ -1,30 +1,28 @@
|
||||
From a2dda87b26fb042d7ea601e89d3f7569cc715b9f Mon Sep 17 00:00:00 2001
|
||||
From e68eda97f02a4f7e595977de5259eb89eb4f6dbd Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Sat, 17 May 2014 00:18:54 -0500
|
||||
Date: Tue, 24 Jun 2014 07:32:04 -0500
|
||||
Subject: [PATCH] Allow undead horse types to be leashed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
index f2a1cb3..0bda363 100644
|
||||
index 76bde8c..2b783e5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
@@ -9,6 +9,10 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
// CraftBukkit end
|
||||
@@ -5,6 +5,8 @@ import java.util.List;
|
||||
|
||||
+// PaperSpigot start
|
||||
+import org.spigotmc.SpigotWorldConfig;
|
||||
+// PaperSpigot end
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
|
||||
|
||||
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
|
||||
+
|
||||
public class EntityHorse extends EntityAnimal implements IInventoryListener {
|
||||
|
||||
private static final IEntitySelector bu = new EntitySelectorHorse();
|
||||
@@ -173,7 +177,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
|
||||
@@ -169,7 +171,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
|
||||
}
|
||||
|
||||
public boolean bM() {
|
||||
- return !this.cE() && super.bM();
|
||||
+ // PaperSpigot start - Configurable undead horse leashing
|
||||
+ // PaperSpigot start - configurable undead horse leashing
|
||||
+ if (SpigotWorldConfig.allowUndeadHorseLeashing) {
|
||||
+ return super.bM();
|
||||
+ } else {
|
||||
@ -35,23 +33,21 @@ index f2a1cb3..0bda363 100644
|
||||
|
||||
protected void o(float f) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index a81b7c9..4a6edad 100644
|
||||
index a81b7c9..b3015bb 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -292,6 +292,13 @@ public class SpigotWorldConfig
|
||||
log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns );
|
||||
@@ -317,4 +317,11 @@ public class SpigotWorldConfig
|
||||
{
|
||||
witherSpawnSoundRadius = getInt( "wither-spawn-sound-radius", 0 );
|
||||
}
|
||||
|
||||
+
|
||||
+ public static boolean allowUndeadHorseLeashing;
|
||||
+ private void allowUndeadHorseLeashing()
|
||||
+ {
|
||||
+ allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", true);
|
||||
+ log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
|
||||
+ }
|
||||
+
|
||||
public int maxBulkChunk;
|
||||
private void bulkChunkCount()
|
||||
{
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,88 +0,0 @@
|
||||
From 59b4d5f7a05bcd2a37573713843d2598e069e38e 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 9bc72aa..fc3aece 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 {
|
||||
cps.queueUnload(chunk.locX, chunk.locZ);
|
||||
}
|
||||
}
|
||||
+ // Spigot start
|
||||
+ private final Spigot spigot = new Spigot()
|
||||
+ {
|
||||
+ };
|
||||
+
|
||||
+ public Spigot spigot()
|
||||
+ {
|
||||
+ return spigot;
|
||||
+ }
|
||||
+ // 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
|
||||
--- 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 {
|
||||
public void _INVALID_setShooter(LivingEntity shooter) {
|
||||
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ private final Arrow.Spigot spigot = new Arrow.Spigot()
|
||||
+ {
|
||||
+ };
|
||||
+
|
||||
+ public Arrow.Spigot spigot()
|
||||
+ {
|
||||
+ return spigot;
|
||||
+ }
|
||||
+ // 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 fe0f200..e026c1f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -399,4 +399,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
return getHandle().vehicle.getBukkitEntity();
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ private final Spigot spigot = new Spigot()
|
||||
+ {
|
||||
+ };
|
||||
+
|
||||
+ public 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 55ea121..dea26e0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1285,4 +1285,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
collection.add(new AttributeModifiable(getHandle().bb(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ private final Player.Spigot spigot = new Player.Spigot()
|
||||
+ {
|
||||
+ };
|
||||
+
|
||||
+ public Player.Spigot spigot()
|
||||
+ {
|
||||
+ return spigot;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 58337f50edfe719fbf71c940574371d23afc97d0 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 00bb455..dda2602 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
|
||||
}
|
||||
}
|
||||
|
||||
+ // Spigot Start
|
||||
+ public ServerConnection getServerConnection()
|
||||
+ {
|
||||
+ return this.p;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
public ServerConnection ai() {
|
||||
return this.p;
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,14 +1,14 @@
|
||||
From dd79ea4473f63cc8add72b2b7eb2badf874bb5c0 Mon Sep 17 00:00:00 2001
|
||||
From f163857be5f8d4f0247074e67a45b6f47f5d84f2 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 17 May 2014 02:12:39 -0500
|
||||
Subject: [PATCH] Teleport passenger/vehicle with player
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 5ac54e3..258bc9d 100644
|
||||
index 0635c20..66bba33 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -39,6 +39,13 @@ public abstract class Entity {
|
||||
@@ -38,6 +38,13 @@ public abstract class Entity {
|
||||
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
|
||||
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
}
|
||||
@ -22,7 +22,7 @@ index 5ac54e3..258bc9d 100644
|
||||
// CraftBukkit end
|
||||
|
||||
private static int entityCount;
|
||||
@@ -1858,7 +1865,7 @@ public abstract class Entity {
|
||||
@@ -1849,7 +1856,7 @@ public abstract class Entity {
|
||||
// minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1);
|
||||
boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
|
||||
worldserver1.chunkProviderServer.forceChunkLoad = true;
|
||||
@ -31,7 +31,7 @@ index 5ac54e3..258bc9d 100644
|
||||
worldserver1.chunkProviderServer.forceChunkLoad = before;
|
||||
// CraftBukkit end
|
||||
this.world.methodProfiler.c("reloading");
|
||||
@@ -1866,6 +1873,10 @@ public abstract class Entity {
|
||||
@@ -1857,6 +1864,10 @@ public abstract class Entity {
|
||||
|
||||
if (entity != null) {
|
||||
entity.a(this, true);
|
@ -1,4 +1,4 @@
|
||||
From 11641dc3de03120d089f1233b2a8355798738817 Mon Sep 17 00:00:00 2001
|
||||
From 1854692678903221be3d08d66f448b47b1d9311f Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Sun, 18 May 2014 16:35:38 -0500
|
||||
Subject: [PATCH] Invisible players don't have rights
|
@ -1,301 +0,0 @@
|
||||
From 45a5a5488e6357d94cc9f197e876d8d1a86f81bb 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index f1caa38..00f9b89 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -109,6 +109,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
if (this.L() < 0) {
|
||||
this.setPort(this.propertyManager.getInt("server-port", 25565));
|
||||
}
|
||||
+ // Spigot start
|
||||
+ this.a((PlayerList) (new DedicatedPlayerList(this)));
|
||||
+ org.spigotmc.SpigotConfig.init();
|
||||
+ org.spigotmc.SpigotConfig.registerCommands();
|
||||
+ // Spigot end
|
||||
|
||||
i.info("Generating keypair");
|
||||
this.a(MinecraftEncryption.b());
|
||||
@@ -123,7 +128,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
return false;
|
||||
}
|
||||
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
|
||||
+ // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here
|
||||
+ // this.a((PlayerList) (new DedicatedPlayerList(this)));
|
||||
+ server.loadPlugins();
|
||||
+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
+ // Spigot End
|
||||
|
||||
if (!this.getOnlineMode()) {
|
||||
i.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 eb5da2a..c6ba026 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;
|
||||
+ public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
@@ -121,6 +122,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
|
||||
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 853e5d2..95742fa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -314,8 +314,10 @@ public final class CraftServer implements Server {
|
||||
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update"));
|
||||
updater.check(serverVersion);
|
||||
|
||||
- loadPlugins();
|
||||
- enablePlugins(PluginLoadOrder.STARTUP);
|
||||
+ // Spigot Start - Moved to old location of new DedicatedPlayerList in DedicatedServer
|
||||
+ // loadPlugins();
|
||||
+ // enablePlugins(PluginLoadOrder.STARTUP);
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -749,6 +751,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.setSpawnFlags(monsters, animals);
|
||||
@@ -763,11 +766,14 @@ public final class CraftServer implements Server {
|
||||
} else {
|
||||
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
|
||||
}
|
||||
+ world.spigotConfig.init(); // Spigot
|
||||
}
|
||||
|
||||
pluginManager.clearPlugins();
|
||||
commandMap.clearCommands();
|
||||
resetRecipes();
|
||||
+ org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
+
|
||||
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
|
||||
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..fd5997d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -0,0 +1,120 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+public class SpigotConfig
|
||||
+{
|
||||
+
|
||||
+ private static final File CONFIG_FILE = new File( "spigot.yml" );
|
||||
+ private static final String HEADER = "This is the main configuration file for Spigot.\n"
|
||||
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
|
||||
+ + "with caution, and make sure you know what each option does before configuring.\n"
|
||||
+ + "For a reference for any variable inside this file, check out the Spigot wiki at\n"
|
||||
+ + "http://www.spigotmc.org/wiki/spigot-configuration/\n"
|
||||
+ + "\n"
|
||||
+ + "If you need help with the configuration or have any questions related to Spigot,\n"
|
||||
+ + "join us at the IRC or drop by our forums and leave a post.\n"
|
||||
+ + "\n"
|
||||
+ + "IRC: #spigot @ irc.esper.net ( http://webchat.esper.net/?channel=spigot )\n"
|
||||
+ + "Forums: http://www.spigotmc.org/forum/\n";
|
||||
+ /*========================================================================*/
|
||||
+ static YamlConfiguration config;
|
||||
+ static int version;
|
||||
+ static Map<String, Command> commands;
|
||||
+ /*========================================================================*/
|
||||
+
|
||||
+ public static void init()
|
||||
+ {
|
||||
+ config = YamlConfiguration.loadConfiguration( CONFIG_FILE );
|
||||
+ config.options().header( HEADER );
|
||||
+ config.options().copyDefaults( true );
|
||||
+
|
||||
+ commands = new HashMap<String, Command>();
|
||||
+
|
||||
+ version = getInt( "config-version", 6 );
|
||||
+ set( "config-version", 6 );
|
||||
+ readConfig( SpigotConfig.class, null );
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands()
|
||||
+ {
|
||||
+ for ( Map.Entry<String, Command> entry : commands.entrySet() )
|
||||
+ {
|
||||
+ MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "Spigot", entry.getValue() );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance)
|
||||
+ {
|
||||
+ for ( Method method : clazz.getDeclaredMethods() )
|
||||
+ {
|
||||
+ if ( Modifier.isPrivate( method.getModifiers() ) )
|
||||
+ {
|
||||
+ if ( method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE )
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ method.setAccessible( true );
|
||||
+ method.invoke( instance );
|
||||
+ } catch ( InvocationTargetException ex )
|
||||
+ {
|
||||
+ Throwables.propagate( ex.getCause() );
|
||||
+ } catch ( Exception ex )
|
||||
+ {
|
||||
+ Bukkit.getLogger().log( Level.SEVERE, "Error invoking " + method, ex );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ config.save( CONFIG_FILE );
|
||||
+ } catch ( IOException ex )
|
||||
+ {
|
||||
+ Bukkit.getLogger().log( Level.SEVERE, "Could not save " + CONFIG_FILE, ex );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void set(String path, Object val)
|
||||
+ {
|
||||
+ config.set( path, val );
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBoolean(String path, boolean def)
|
||||
+ {
|
||||
+ config.addDefault( path, def );
|
||||
+ return config.getBoolean( path, config.getBoolean( path ) );
|
||||
+ }
|
||||
+
|
||||
+ private static int getInt(String path, int def)
|
||||
+ {
|
||||
+ config.addDefault( path, def );
|
||||
+ return config.getInt( path, config.getInt( path ) );
|
||||
+ }
|
||||
+
|
||||
+ private static <T> List getList(String path, T def)
|
||||
+ {
|
||||
+ config.addDefault( path, def );
|
||||
+ return (List<T>) config.getList( path, config.getList( path ) );
|
||||
+ }
|
||||
+
|
||||
+ private static String getString(String path, String def)
|
||||
+ {
|
||||
+ config.addDefault( path, def );
|
||||
+ return config.getString( path, config.getString( path ) );
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000..961ddb4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +1,71 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+public class SpigotWorldConfig
|
||||
+{
|
||||
+
|
||||
+ private final String worldName;
|
||||
+ private final YamlConfiguration config;
|
||||
+ private boolean verbose;
|
||||
+
|
||||
+ public SpigotWorldConfig(String worldName)
|
||||
+ {
|
||||
+ this.worldName = worldName;
|
||||
+ this.config = SpigotConfig.config;
|
||||
+ init();
|
||||
+ }
|
||||
+
|
||||
+ public void init()
|
||||
+ {
|
||||
+ this.verbose = getBoolean( "verbose", true );
|
||||
+
|
||||
+ log( "-------- World Settings For [" + worldName + "] --------" );
|
||||
+ SpigotConfig.readConfig( SpigotWorldConfig.class, this );
|
||||
+ }
|
||||
+
|
||||
+ private void log(String s)
|
||||
+ {
|
||||
+ if ( verbose )
|
||||
+ {
|
||||
+ Bukkit.getLogger().info( s );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val)
|
||||
+ {
|
||||
+ config.set( "world-settings.default." + path, val );
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def)
|
||||
+ {
|
||||
+ config.addDefault( "world-settings.default." + path, def );
|
||||
+ return config.getBoolean( "world-settings." + worldName + "." + path, config.getBoolean( "world-settings.default." + path ) );
|
||||
+ }
|
||||
+
|
||||
+ private double getDouble(String path, double def)
|
||||
+ {
|
||||
+ config.addDefault( "world-settings.default." + path, def );
|
||||
+ return config.getDouble( "world-settings." + worldName + "." + path, config.getDouble( "world-settings.default." + path ) );
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def)
|
||||
+ {
|
||||
+ config.addDefault( "world-settings.default." + path, def );
|
||||
+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) );
|
||||
+ }
|
||||
+
|
||||
+ private <T> List getList(String path, T def)
|
||||
+ {
|
||||
+ config.addDefault( "world-settings.default." + path, def );
|
||||
+ return (List<T>) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) );
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def)
|
||||
+ {
|
||||
+ config.addDefault( "world-settings.default." + path, def );
|
||||
+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,182 +0,0 @@
|
||||
From 622e47b08274e5a09f6a7e0bcf98300fb438062f 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c6ba026..02600a7 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
|
||||
- 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;
|
||||
|
||||
+ // Spigot start
|
||||
+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList;
|
||||
+ protected float growthOdds = 100;
|
||||
+ protected float modifiedOdds = 100;
|
||||
+ private final byte chunkTickRadius;
|
||||
+
|
||||
+ public static long chunkToKey(int x, int z)
|
||||
+ {
|
||||
+ long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 );
|
||||
+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 );
|
||||
+ return k;
|
||||
+ }
|
||||
+
|
||||
+ public static int keyToX(long k)
|
||||
+ {
|
||||
+ return (int) ( ( ( k >> 16 ) & 0xFFFF0000 ) | ( k & 0x0000FFFF ) );
|
||||
+ }
|
||||
+
|
||||
+ public static int keyToZ(long k)
|
||||
+ {
|
||||
+ return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) );
|
||||
+ }
|
||||
+ // 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 {
|
||||
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.setAutoCompactionFactor( 0 );
|
||||
+ // Spigot end
|
||||
|
||||
this.K = this.random.nextInt(12000);
|
||||
this.allowMonsters = true;
|
||||
@@ -1986,17 +2015,44 @@ public abstract class World implements IBlockAccess {
|
||||
int k;
|
||||
int l;
|
||||
|
||||
+ // Spigot start
|
||||
+ int optimalChunks = spigotConfig.chunksPerTick;
|
||||
+ // Quick conditions to allow us to exist early
|
||||
+ if ( optimalChunks <= 0 || players.isEmpty() )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Keep chunks with growth inside of the optimal chunk range
|
||||
+ int chunksPerPlayer = Math.min( 200, Math.max( 1, (int) ( ( ( optimalChunks - players.size() ) / (double) players.size() ) + 0.5 ) ) );
|
||||
+ int randRange = 3 + chunksPerPlayer / 30;
|
||||
+ // Limit to normal tick radius - including view distance
|
||||
+ randRange = ( randRange > chunkTickRadius ) ? chunkTickRadius : randRange;
|
||||
+ // odds of growth happening vs growth happening in vanilla
|
||||
+ this.growthOdds = this.modifiedOdds = Math.max( 35, Math.min( 100, ( ( chunksPerPlayer + 1 ) * 100F ) / 15F ) );
|
||||
+ // Spigot end
|
||||
for (i = 0; i < this.players.size(); ++i) {
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX / 16.0D);
|
||||
k = MathHelper.floor(entityhuman.locZ / 16.0D);
|
||||
l = this.p();
|
||||
|
||||
- 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
|
||||
+ // 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
|
||||
+ chunkTickList.put(key, (short) (existingPlayers + 1));
|
||||
+
|
||||
+ // Check and see if we update the chunks surrounding the player this tick
|
||||
+ for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ )
|
||||
+ {
|
||||
+ 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 ) )
|
||||
+ {
|
||||
+ chunkTickList.put( hash, (short) -1 ); // no players
|
||||
}
|
||||
}
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
this.methodProfiler.b();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 3fa3a81..a30b79e 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()) {
|
||||
+ // Spigot start
|
||||
+ for (net.minecraft.util.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 ) ) )
|
||||
+ {
|
||||
+ iter.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
// ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
- int chunkX = LongHash.msw(chunkCoord);
|
||||
- int chunkZ = LongHash.lsw(chunkCoord);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -409,6 +420,12 @@ public class WorldServer extends World {
|
||||
|
||||
this.methodProfiler.b();
|
||||
}
|
||||
+ // Spigot Start
|
||||
+ if ( spigotConfig.clearChunksOnTick )
|
||||
+ {
|
||||
+ chunkTickList.clear();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
public boolean a(int i, int j, int k, Block block) {
|
||||
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
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -68,4 +68,15 @@ public class SpigotWorldConfig
|
||||
config.addDefault( "world-settings.default." + path, def );
|
||||
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
||||
}
|
||||
+
|
||||
+ public int chunksPerTick;
|
||||
+ public boolean clearChunksOnTick;
|
||||
+ private void chunksPerTick()
|
||||
+ {
|
||||
+ chunksPerTick = getInt( "chunks-per-tick", 650 );
|
||||
+ log( "Chunks to Grow per Tick: " + chunksPerTick );
|
||||
+
|
||||
+ clearChunksOnTick = getBoolean( "clear-tick-list", false );
|
||||
+ log( "Clear tick list: " + clearChunksOnTick );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 04a108c91f4b58f0b4bfd6ed1d82fe331d86e56a Mon Sep 17 00:00:00 2001
|
||||
From 37a993f71e3fb84bb873012982895af12dbd29eb Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Mon, 19 May 2014 19:30:58 -0500
|
||||
Subject: [PATCH] Configurable squid spawn ranges
|
||||
@ -26,7 +26,7 @@ index 493b3d8..1282544 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 4a6edad..f9f8c05 100644
|
||||
index b3015bb..55914bf 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -206,6 +206,14 @@ public class SpigotWorldConfig
|
@ -1,4 +1,4 @@
|
||||
From 5a76dd1adc306ba33b20b2f8845b3dfd9358be47 Mon Sep 17 00:00:00 2001
|
||||
From b9b862aedb0d9a26c58bc9e42c49b813299d6337 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Mon, 19 May 2014 21:08:44 -0500
|
||||
Subject: [PATCH] Add getFloat method to configs
|
||||
@ -24,7 +24,7 @@ index 7c9b298..1e30d4d 100644
|
||||
{
|
||||
config.addDefault( path, def );
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index f9f8c05..c340fb3 100644
|
||||
index 55914bf..5abecfd 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -52,6 +52,14 @@ public class SpigotWorldConfig
|
@ -1,176 +0,0 @@
|
||||
From 1e1bd1813fe7ea78783f98d772faa52ba59005f6 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
||||
index 14c00c5..51f8279 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 {
|
||||
return 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Spigot start
|
||||
+ public static float range(float min, float value, float max) {
|
||||
+ if (value < min) {
|
||||
+ return min;
|
||||
+ }
|
||||
+ if (value > max) {
|
||||
+ return max;
|
||||
+ }
|
||||
+ return value;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
|
||||
index 57eb59d..6778cae 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);
|
||||
|
||||
- if (i1 == 15) {
|
||||
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 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);
|
||||
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
|
||||
--- 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);
|
||||
|
||||
- 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
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
|
||||
index abd991b..7c00158 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 {
|
||||
}
|
||||
// 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;
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
|
||||
index 5b90eb9..c720a7f 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
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
final int sourceX = i, sourceY = j, sourceZ = k; // 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;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
|
||||
index a01a6e6..2854bbc 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 {
|
||||
}
|
||||
// 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;
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
|
||||
index a1350f6..6c04ad2 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);
|
||||
|
||||
- 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 {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
|
||||
index ab8b07c..348a00e 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) {
|
||||
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
|
||||
// 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
|
||||
--- 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);
|
||||
|
||||
- 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);
|
||||
|
||||
if (l < 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
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -79,4 +79,35 @@ public class SpigotWorldConfig
|
||||
clearChunksOnTick = getBoolean( "clear-tick-list", false );
|
||||
log( "Clear tick list: " + clearChunksOnTick );
|
||||
}
|
||||
+
|
||||
+ // Crop growth rates
|
||||
+ public int cactusModifier;
|
||||
+ public int caneModifier;
|
||||
+ public int melonModifier;
|
||||
+ public int mushroomModifier;
|
||||
+ public int pumpkinModifier;
|
||||
+ public int saplingModifier;
|
||||
+ public int wheatModifier;
|
||||
+ private int getAndValidateGrowth(String crop)
|
||||
+ {
|
||||
+ int modifier = getInt( "growth." + crop.toLowerCase() + "-modifier", 100 );
|
||||
+ if ( modifier == 0 )
|
||||
+ {
|
||||
+ log( "Cannot set " + crop + " growth to zero, defaulting to 100" );
|
||||
+ modifier = 100;
|
||||
+ }
|
||||
+ log( crop + " Growth Modifier: " + modifier + "%" );
|
||||
+
|
||||
+ return modifier;
|
||||
+ }
|
||||
+ private void growthModifiers()
|
||||
+ {
|
||||
+ cactusModifier = getAndValidateGrowth( "Cactus" );
|
||||
+ caneModifier = getAndValidateGrowth( "Cane" );
|
||||
+ melonModifier = getAndValidateGrowth( "Melon" );
|
||||
+ mushroomModifier = getAndValidateGrowth( "Mushroom" );
|
||||
+ pumpkinModifier = getAndValidateGrowth( "Pumpkin" );
|
||||
+ saplingModifier = getAndValidateGrowth( "Sapling" );
|
||||
+ wheatModifier = getAndValidateGrowth( "Wheat" );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 1aea32433cebe0d71abf57b157b26d18b8f23c02 Mon Sep 17 00:00:00 2001
|
||||
From 066bebc34a5e98872c03aa1d671cca61322cbd3e Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Mon, 19 May 2014 21:13:31 -0500
|
||||
Date: Tue, 24 Jun 2014 07:39:37 -0500
|
||||
Subject: [PATCH] Configurable damage multiplier for PvP blocking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index c3a0dc3..f50dcf5 100644
|
||||
index 408c514..27e8938 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -20,6 +20,8 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -17,26 +17,26 @@ index c3a0dc3..f50dcf5 100644
|
||||
public abstract class EntityHuman extends EntityLiving implements ICommandListener {
|
||||
|
||||
public PlayerInventory inventory = new PlayerInventory(this);
|
||||
@@ -807,7 +809,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
protected void d(DamageSource damagesource, float f) {
|
||||
@@ -812,7 +814,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
// CraftBukkit end
|
||||
if (!this.isInvulnerable()) {
|
||||
if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) {
|
||||
- f = (1.0F + f) * 0.5F;
|
||||
+ f = (1.0F + f) * SpigotWorldConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for players blocking
|
||||
+ f = (1.0F + f) * SpigotWorldConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable PvP blocking damage multiplier
|
||||
}
|
||||
|
||||
f = this.b(damagesource, f);
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index c340fb3..a2947d6 100644
|
||||
index 5abecfd..c253a1b 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -340,4 +340,10 @@ public class SpigotWorldConfig
|
||||
{
|
||||
witherSpawnSoundRadius = getInt( "wither-spawn-sound-radius", 0 );
|
||||
allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", true);
|
||||
log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
|
||||
}
|
||||
+
|
||||
+ public static float playerBlockingDamageMultiplier;
|
||||
+ private void setPlayerBlockingDamageMultiplier()
|
||||
+ private void playerBlockingDamageMultiplier()
|
||||
+ {
|
||||
+ playerBlockingDamageMultiplier = getFloat( "player-blocking-damage-multiplier", 0.5F );
|
||||
+ }
|
@ -1,100 +0,0 @@
|
||||
From 0094c2822caafc637fff7309e009c67424aabc2a 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 26bafe0..49acc9a 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;
|
||||
|
||||
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 {
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
|
||||
synchronized (this.d) {
|
||||
- if (this.c.contains(chunkcoordintpair)) {
|
||||
- for (int k = 0; k < this.b.size(); ++k) {
|
||||
- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ // Spigot start
|
||||
+ if (pendingSaves.containsKey(chunkcoordintpair)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
|
||||
@@ -63,14 +62,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
Object object = this.d;
|
||||
|
||||
synchronized (this.d) {
|
||||
- if (this.c.contains(chunkcoordintpair)) {
|
||||
- for (int k = 0; k < this.b.size(); ++k) {
|
||||
- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
|
||||
- nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ // Spigot start
|
||||
+ PendingChunkToSave pendingchunktosave = pendingSaves.get(chunkcoordintpair);
|
||||
+ if (pendingchunktosave != null) {
|
||||
+ nbttagcompound = pendingchunktosave.b;
|
||||
}
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
@@ -150,17 +147,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
Object object = this.d;
|
||||
|
||||
synchronized (this.d) {
|
||||
- if (this.c.contains(chunkcoordintpair)) {
|
||||
- for (int i = 0; i < this.b.size(); ++i) {
|
||||
- if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) {
|
||||
- this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
+ // Spigot start
|
||||
+ if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) {
|
||||
+ return;
|
||||
}
|
||||
-
|
||||
- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
|
||||
- this.c.add(chunkcoordintpair);
|
||||
+ // Spigot end
|
||||
FileIOThread.a.a(this);
|
||||
}
|
||||
}
|
||||
@@ -170,12 +161,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
Object object = this.d;
|
||||
|
||||
synchronized (this.d) {
|
||||
- if (this.b.isEmpty()) {
|
||||
+ // Spigot start
|
||||
+ if (this.pendingSaves.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
- pendingchunktosave = (PendingChunkToSave) this.b.remove(0);
|
||||
- this.c.remove(pendingchunktosave.a);
|
||||
+ pendingchunktosave = this.pendingSaves.values().iterator().next();
|
||||
+ this.pendingSaves.remove(pendingchunktosave.a);
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
if (pendingchunktosave != null) {
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,16 +1,16 @@
|
||||
From 1f32650458050fa1e47300ad012a26512aa553cf Mon Sep 17 00:00:00 2001
|
||||
From 3bdde40036b6b182e64b4e97e3007313fae0d96a Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Tue, 20 May 2014 20:17:36 -0500
|
||||
Date: Tue, 24 Jun 2014 07:44:59 -0500
|
||||
Subject: [PATCH] Configurable cactus and reed natural growth heights
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
|
||||
index 6778cae..bd9d129 100644
|
||||
index f55e531..7c3e426 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockCactus.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
|
||||
@@ -4,6 +4,8 @@ import java.util.Random;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent; // CraftBukkit
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
|
||||
+
|
||||
@ -48,7 +48,7 @@ index 6c04ad2..d41c2fe 100644
|
||||
|
||||
if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index a2947d6..8f8e936 100644
|
||||
index c253a1b..48ae578 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -222,6 +222,14 @@ public class SpigotWorldConfig
|
@ -1,96 +0,0 @@
|
||||
From 2f9ed9fae66cee9278ba2ce8fc6a93a578e99243 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
|
||||
|
||||
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 8343ac9..95beb11 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 {
|
||||
}
|
||||
|
||||
private void k() {
|
||||
- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.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();
|
||||
+ // Spigot end
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityItem entityitem = (EntityItem) iterator.next();
|
||||
@@ -148,11 +151,13 @@ public class EntityItem extends Entity {
|
||||
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
|
||||
return false;
|
||||
} else {
|
||||
- itemstack1.count += itemstack.count;
|
||||
- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
|
||||
- entityitem.age = Math.min(entityitem.age, this.age);
|
||||
- entityitem.setItemStack(itemstack1);
|
||||
- this.die();
|
||||
+ // Spigot start
|
||||
+ itemstack.count += itemstack1.count;
|
||||
+ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
|
||||
+ this.age = Math.min(entityitem.age, this.age);
|
||||
+ this.setItemStack(itemstack);
|
||||
+ entityitem.die();
|
||||
+ // Spigot end
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 02600a7..7c18d86 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 {
|
||||
// Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
|
||||
event = CraftEventFactory.callProjectileLaunchEvent(entity);
|
||||
}
|
||||
+ // Spigot start
|
||||
+ else if (entity instanceof EntityExperienceOrb) {
|
||||
+ EntityExperienceOrb xp = (EntityExperienceOrb) entity;
|
||||
+ double radius = spigotConfig.expMerge;
|
||||
+ if (radius > 0) {
|
||||
+ List<Entity> entities = this.getEntities(entity, entity.boundingBox.grow(radius, radius, radius));
|
||||
+ for (Entity e : entities) {
|
||||
+ if (e instanceof EntityExperienceOrb) {
|
||||
+ EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
|
||||
+ if (!loopItem.dead) {
|
||||
+ xp.value += loopItem.value;
|
||||
+ loopItem.die();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } // Spigot end
|
||||
|
||||
if (event != null && (event.isCancelled() || entity.dead)) {
|
||||
entity.dead = true;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 7e79ba5..1545a61 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -110,4 +110,18 @@ public class SpigotWorldConfig
|
||||
saplingModifier = getAndValidateGrowth( "Sapling" );
|
||||
wheatModifier = getAndValidateGrowth( "Wheat" );
|
||||
}
|
||||
+
|
||||
+ public double itemMerge;
|
||||
+ private void itemMerge()
|
||||
+ {
|
||||
+ itemMerge = getDouble("merge-radius.item", 2.5 );
|
||||
+ log( "Item Merge Radius: " + itemMerge );
|
||||
+ }
|
||||
+
|
||||
+ public double expMerge;
|
||||
+ private void expMerge()
|
||||
+ {
|
||||
+ expMerge = getDouble("merge-radius.exp", 3.0 );
|
||||
+ log( "Experience Merge Radius: " + expMerge );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From a9032dacbabca8fe1dbeee1af2b4e34b58df3d43 Mon Sep 17 00:00:00 2001
|
||||
From 347bab8975bf4d615060df418ca3c90d15681583 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Wed, 21 May 2014 15:35:12 -0500
|
||||
Subject: [PATCH] Configurable baby zombie movement speed
|
||||
@ -24,7 +24,7 @@ index 6cb5b14..66dd5fa 100644
|
||||
private int bt;
|
||||
private boolean bu = false;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 8f8e936..20a1189 100644
|
||||
index 48ae578..f818eca 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -354,4 +354,10 @@ public class SpigotWorldConfig
|
@ -1,224 +0,0 @@
|
||||
From 0ed4d284bbdfffc523e2c2c731443a31df66de15 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
|
||||
|
||||
|
||||
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.8.3.2
|
||||
|
@ -1,173 +0,0 @@
|
||||
From 8fec23d1020ed297e0c44f477a6466bdd89222b3 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
|
||||
|
||||
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 51f8279..aaead32 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 {
|
||||
return 10;
|
||||
}
|
||||
|
||||
- public void onPlace(World world, int i, int j, int k) {}
|
||||
+ public void onPlace(World world, int i, int j, int k) {
|
||||
+ 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) {
|
||||
+ 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
|
||||
--- 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 {
|
||||
}
|
||||
|
||||
public void addEntity(Entity entity, int i, int j, boolean flag) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
|
||||
if (i > this.e) {
|
||||
i = this.e;
|
||||
}
|
||||
@@ -125,6 +126,7 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
public void untrackEntity(Entity entity) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity untrack"); // Spigot
|
||||
if (entity instanceof EntityPlayer) {
|
||||
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 c148c4d..a2b54a4 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 {
|
||||
}
|
||||
|
||||
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 {
|
||||
}
|
||||
|
||||
public void clear(EntityPlayer entityplayer) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot
|
||||
if (this.trackedPlayers.contains(entityplayer)) {
|
||||
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 7c18d86..1fea307 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 {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -1085,6 +1086,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void removeEntity(Entity entity) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot
|
||||
entity.die();
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.players.remove(entity);
|
||||
@@ -2465,6 +2467,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void a(List list) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot
|
||||
// CraftBukkit start
|
||||
// this.entityList.addAll(list);
|
||||
Entity entity = null;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index fc3aece..81913ac 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 {
|
||||
}
|
||||
|
||||
public boolean unloadChunkRequest(int x, int z, boolean safe) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot
|
||||
if (safe && isChunkInUse(x, z)) {
|
||||
return false;
|
||||
}
|
||||
@@ -172,6 +173,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot
|
||||
if (safe && isChunkInUse(x, z)) {
|
||||
return false;
|
||||
}
|
||||
@@ -239,6 +241,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot
|
||||
chunkLoadCount++;
|
||||
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 f700f0b..4d2374d 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 {
|
||||
|
||||
@Override
|
||||
public void kickPlayer(String message) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "player kick"); // Spigot
|
||||
if (getHandle().playerConnection == null) return;
|
||||
|
||||
getHandle().playerConnection.disconnect(message == null ? "" : message);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
index 84091a4..a8f28d7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
@@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
||||
}
|
||||
|
||||
public CraftScoreboard getNewScoreboard() {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "scoreboard creation"); // Spigot
|
||||
CraftScoreboard scoreboard = new CraftScoreboard(new ScoreboardServer(server));
|
||||
scoreboards.add(scoreboard);
|
||||
return scoreboard;
|
||||
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
new file mode 100644
|
||||
index 0000000..4b3aa85
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+
|
||||
+public class AsyncCatcher
|
||||
+{
|
||||
+
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ public static void catchOp(String reason)
|
||||
+ {
|
||||
+ if ( enabled && Thread.currentThread() != MinecraftServer.getServer().primaryThread )
|
||||
+ {
|
||||
+ throw new IllegalStateException( "Asynchronous " + reason + "!" );
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 997475dca0a503a3fa4b074f6aea2347b55e29df Mon Sep 17 00:00:00 2001
|
||||
From 010964894e41934c2fba1bde8885bfb6495da2ff Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Fri, 30 May 2014 19:42:50 -0500
|
||||
Subject: [PATCH] Make destroyed boats drop the boat item
|
@ -1,14 +1,14 @@
|
||||
From dc75a519f7261309bf4ef06afb83b177952388f5 Mon Sep 17 00:00:00 2001
|
||||
From b1322fcbf7d370dd8290bc6080640cd22ceb7a40 Mon Sep 17 00:00:00 2001
|
||||
From: gsand <gsandowns@gmail.com>
|
||||
Date: Tue, 15 Apr 2014 18:00:02 -0700
|
||||
Subject: [PATCH] Configurable hunger multiplier for player sprint jumping
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index f50dcf5..a645b1e 100644
|
||||
index 27e8938..5619179 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -1250,7 +1250,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
@@ -1256,7 +1256,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
super.bi();
|
||||
this.a(StatisticList.r, 1);
|
||||
if (this.isSprinting()) {
|
||||
@ -18,7 +18,7 @@ index f50dcf5..a645b1e 100644
|
||||
this.a(0.2F);
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 20a1189..c6095f2 100644
|
||||
index f818eca..ecf7381 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -355,6 +355,12 @@ public class SpigotWorldConfig
|
@ -1,55 +0,0 @@
|
||||
From e58171001d40f747655e603fd0fdc2701be5e465 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
|
||||
|
||||
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
|
||||
--- 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 {
|
||||
private final int[][] i = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
|
||||
private boolean wasNotEmpty; // CraftBukkit - add field
|
||||
|
||||
- public PlayerChunkMap(WorldServer worldserver) {
|
||||
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
|
||||
this.world = worldserver;
|
||||
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
|
||||
+ 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 9b5b370..3d938d8 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 {
|
||||
// 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();
|
||||
}
|
||||
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
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -124,4 +124,11 @@ public class SpigotWorldConfig
|
||||
expMerge = getDouble("merge-radius.exp", 3.0 );
|
||||
log( "Experience Merge Radius: " + expMerge );
|
||||
}
|
||||
+
|
||||
+ public int viewDistance;
|
||||
+ private void viewDistance()
|
||||
+ {
|
||||
+ viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
|
||||
+ log( "View Distance: " + viewDistance );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,394 +0,0 @@
|
||||
From 5458bbfb3dfe9c40834dd68fe0e9bec527971fad Mon Sep 17 00:00:00 2001
|
||||
From: Mike Primm <mike@primmhome.com>
|
||||
Date: Sun, 13 Jan 2013 03:49:07 -0800
|
||||
Subject: [PATCH] Compressed Nibble Arrays
|
||||
|
||||
Implement 'lightening' of NibbleArrays - only allocate
|
||||
buffers when non-trivial value Saving from 40-45% of memory use by chunk
|
||||
section data.
|
||||
|
||||
Finish up NibbleArray lightening work - use for Snapshots, reduce copies
|
||||
|
||||
Fix nibble handling with NBT - arrays aren't copied by NBTByteArray
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 49acc9a..ce7a8bf 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -224,15 +224,15 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
nbttagcompound1.setByte("Y", (byte) (chunksection.getYPosition() >> 4 & 255));
|
||||
nbttagcompound1.setByteArray("Blocks", chunksection.getIdArray());
|
||||
if (chunksection.getExtendedIdArray() != null) {
|
||||
- nbttagcompound1.setByteArray("Add", chunksection.getExtendedIdArray().a);
|
||||
+ nbttagcompound1.setByteArray("Add", chunksection.getExtendedIdArray().getValueArray()); // Spigot
|
||||
}
|
||||
|
||||
- nbttagcompound1.setByteArray("Data", chunksection.getDataArray().a);
|
||||
- nbttagcompound1.setByteArray("BlockLight", chunksection.getEmittedLightArray().a);
|
||||
+ nbttagcompound1.setByteArray("Data", chunksection.getDataArray().getValueArray()); // Spigot
|
||||
+ nbttagcompound1.setByteArray("BlockLight", chunksection.getEmittedLightArray().getValueArray()); // Spigot
|
||||
if (flag) {
|
||||
- nbttagcompound1.setByteArray("SkyLight", chunksection.getSkyLightArray().a);
|
||||
+ nbttagcompound1.setByteArray("SkyLight", chunksection.getSkyLightArray().getValueArray()); // Spigot
|
||||
} else {
|
||||
- nbttagcompound1.setByteArray("SkyLight", new byte[chunksection.getEmittedLightArray().a.length]);
|
||||
+ nbttagcompound1.setByteArray("SkyLight", new byte[chunksection.getEmittedLightArray().getValueArray().length]); // Spigot
|
||||
}
|
||||
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
|
||||
index a05efa0..360de1a 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
|
||||
@@ -140,7 +140,8 @@ public class ChunkSection {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- byte[] ext = this.extBlockIds.a;
|
||||
+ this.extBlockIds.forceToNonTrivialArray(); // Spigot
|
||||
+ byte[] ext = this.extBlockIds.getValueArray();
|
||||
for (int off = 0, off2 = 0; off < blkIds.length;) {
|
||||
byte extid = ext[off2];
|
||||
int l = (blkIds[off] & 0xFF) | ((extid & 0xF) << 8); // Even data
|
||||
@@ -171,6 +172,12 @@ public class ChunkSection {
|
||||
off++;
|
||||
off2++;
|
||||
}
|
||||
+ // Spigot start
|
||||
+ this.extBlockIds.detectAndProcessTrivialArray();
|
||||
+ if (this.extBlockIds.isTrivialArray() && (this.extBlockIds.getTrivialArrayValue() == 0)) {
|
||||
+ this.extBlockIds = null;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
this.nonEmptyBlockCount = cntNonEmpty;
|
||||
this.tickingBlockCount = cntTicking;
|
||||
@@ -224,12 +231,11 @@ public class ChunkSection {
|
||||
public void setExtendedIdArray(NibbleArray nibblearray) {
|
||||
// CraftBukkit start - Don't hang on to an empty nibble array
|
||||
boolean empty = true;
|
||||
- for (int i = 0; i < nibblearray.a.length; i++) {
|
||||
- if (nibblearray.a[i] != 0) {
|
||||
- empty = false;
|
||||
- break;
|
||||
- }
|
||||
+ // Spigot start
|
||||
+ if ((!nibblearray.isTrivialArray()) || (nibblearray.getTrivialArrayValue() != 0)) {
|
||||
+ empty = false;
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
if (empty) {
|
||||
return;
|
||||
@@ -253,11 +259,11 @@ public class ChunkSection {
|
||||
|
||||
// CraftBukkit start - Validate array lengths
|
||||
private NibbleArray validateNibbleArray(NibbleArray nibbleArray) {
|
||||
- if (nibbleArray != null && nibbleArray.a.length < 2048) {
|
||||
- byte[] newArray = new byte[2048];
|
||||
- System.arraycopy(nibbleArray.a, 0, newArray, 0, ((nibbleArray.a.length > 2048) ? 2048 : nibbleArray.a.length));
|
||||
- nibbleArray = new NibbleArray(newArray, 4);
|
||||
+ // Spigot start - fix for more awesome nibble arrays
|
||||
+ if (nibbleArray != null && nibbleArray.getByteLength() < 2048) {
|
||||
+ nibbleArray.resizeArray(2048);
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
return nibbleArray;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java
|
||||
index 5d75a54..c9bc20c 100644
|
||||
--- a/src/main/java/net/minecraft/server/NibbleArray.java
|
||||
+++ b/src/main/java/net/minecraft/server/NibbleArray.java
|
||||
@@ -1,13 +1,117 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import java.util.Arrays; // Spigot
|
||||
+
|
||||
public class NibbleArray {
|
||||
|
||||
- public final byte[] a;
|
||||
+ private byte[] a; // Spigot - remove final, make private (anyone directly accessing this is broken already)
|
||||
private final int b;
|
||||
private final int c;
|
||||
+ // Spigot start
|
||||
+ private byte trivialValue;
|
||||
+ private byte trivialByte;
|
||||
+ private int length;
|
||||
+ private static final int LEN2K = 2048; // Universal length used right now - optimize around this
|
||||
+ private static final byte[][] TrivLen2k;
|
||||
+
|
||||
+ static {
|
||||
+ TrivLen2k = new byte[16][];
|
||||
+ for (int i = 0; i < 16; i++) {
|
||||
+ TrivLen2k[i] = new byte[LEN2K];
|
||||
+ Arrays.fill(TrivLen2k[i], (byte) (i | (i << 4)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Try to convert array to trivial array
|
||||
+ public void detectAndProcessTrivialArray() {
|
||||
+ trivialValue = (byte) (a[0] & 0xF);
|
||||
+ trivialByte = (byte) (trivialValue | (trivialValue << 4));
|
||||
+ for (int i = 0; i < a.length; i++) {
|
||||
+ if (a[i] != trivialByte) return;
|
||||
+ }
|
||||
+ // All values matches, so array is trivial
|
||||
+ this.length = a.length;
|
||||
+ this.a = null;
|
||||
+ }
|
||||
+
|
||||
+ // Force array to non-trivial state
|
||||
+ public void forceToNonTrivialArray() {
|
||||
+ if (this.a == null) {
|
||||
+ this.a = new byte[this.length];
|
||||
+ if (this.trivialByte != 0) {
|
||||
+ Arrays.fill(this.a, this.trivialByte);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Test if array is in trivial state
|
||||
+ public boolean isTrivialArray() {
|
||||
+ return (this.a == null);
|
||||
+ }
|
||||
+
|
||||
+ // Get value of all elements (only valid if array is in trivial state)
|
||||
+ public int getTrivialArrayValue() {
|
||||
+ return this.trivialValue;
|
||||
+ }
|
||||
+
|
||||
+ // Get logical length of byte array for nibble data (whether trivial or non-trivial)
|
||||
+ public int getByteLength() {
|
||||
+ if (this.a == null) {
|
||||
+ return this.length;
|
||||
+ } else {
|
||||
+ return this.a.length;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Return byte encoding of array (whether trivial or non-trivial) - returns read-only array if trivial (do not modify!)
|
||||
+ public byte[] getValueArray() {
|
||||
+ if (this.a != null) {
|
||||
+ return this.a;
|
||||
+ } else {
|
||||
+ byte[] rslt;
|
||||
+
|
||||
+ if (this.length == LEN2K) { // All current uses are 2k long, but be safe
|
||||
+ rslt = TrivLen2k[this.trivialValue];
|
||||
+ } else {
|
||||
+ rslt = new byte[this.length];
|
||||
+ if (this.trivialByte != 0) {
|
||||
+ Arrays.fill(rslt, this.trivialByte);
|
||||
+ }
|
||||
+ }
|
||||
+ return rslt;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Copy byte representation of array to given offset in given byte array
|
||||
+ public int copyToByteArray(byte[] dest, int off) {
|
||||
+ if (this.a == null) {
|
||||
+ Arrays.fill(dest, off, off + this.length, this.trivialByte);
|
||||
+ return off + this.length;
|
||||
+ } else {
|
||||
+ System.arraycopy(this.a, 0, dest, off, this.a.length);
|
||||
+ return off + this.a.length;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Resize array to given byte length
|
||||
+ public void resizeArray(int len) {
|
||||
+ if (this.a == null) {
|
||||
+ this.length = len;
|
||||
+ } else if (this.a.length != len) {
|
||||
+ byte[] newa = new byte[len];
|
||||
+ System.arraycopy(this.a, 0, newa, 0, ((this.a.length > len) ? len : this.a.length));
|
||||
+ this.a = newa;
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
public NibbleArray(int i, int j) {
|
||||
- this.a = new byte[i >> 1];
|
||||
+ // Spigot start
|
||||
+ //this.a = new byte[i >> 1];
|
||||
+ this.a = null; // Start off as trivial value (all same zero value)
|
||||
+ this.length = i >> 1;
|
||||
+ this.trivialByte = this.trivialValue = 0;
|
||||
+ // Spigot end
|
||||
this.b = j;
|
||||
this.c = j + 4;
|
||||
}
|
||||
@@ -16,9 +120,11 @@ public class NibbleArray {
|
||||
this.a = abyte;
|
||||
this.b = i;
|
||||
this.c = i + 4;
|
||||
+ detectAndProcessTrivialArray(); // Spigot
|
||||
}
|
||||
|
||||
public int a(int i, int j, int k) {
|
||||
+ if (this.a == null) return this.trivialValue; // Spigot
|
||||
int l = j << this.c | k << this.b | i;
|
||||
int i1 = l >> 1;
|
||||
int j1 = l & 1;
|
||||
@@ -27,6 +133,18 @@ public class NibbleArray {
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, int l) {
|
||||
+ // Spigot start
|
||||
+ if (this.a == null) {
|
||||
+ if (l != this.trivialValue) { // Not same as trivial value, array no longer trivial
|
||||
+ this.a = new byte[this.length];
|
||||
+ if (this.trivialByte != 0) {
|
||||
+ Arrays.fill(this.a, this.trivialByte);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
int i1 = j << this.c | k << this.b | i;
|
||||
int j1 = i1 >> 1;
|
||||
int k1 = i1 & 1;
|
||||
diff --git a/src/main/java/net/minecraft/server/OldChunkLoader.java b/src/main/java/net/minecraft/server/OldChunkLoader.java
|
||||
index fcb9912..6ee28cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/OldChunkLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/OldChunkLoader.java
|
||||
@@ -94,9 +94,11 @@ public class OldChunkLoader {
|
||||
|
||||
nbttagcompound1.setByte("Y", (byte) (k & 255));
|
||||
nbttagcompound1.setByteArray("Blocks", abyte);
|
||||
- nbttagcompound1.setByteArray("Data", nibblearray.a);
|
||||
- nbttagcompound1.setByteArray("SkyLight", nibblearray1.a);
|
||||
- nbttagcompound1.setByteArray("BlockLight", nibblearray2.a);
|
||||
+ // Spigot start - a -> getValueArray() accessor
|
||||
+ nbttagcompound1.setByteArray("Data", nibblearray.getValueArray());
|
||||
+ nbttagcompound1.setByteArray("SkyLight", nibblearray1.getValueArray());
|
||||
+ nbttagcompound1.setByteArray("BlockLight", nibblearray2.getValueArray());
|
||||
+ // Spigot end
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
index c7b799a..856e825 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
@@ -138,16 +138,16 @@ public class PacketPlayOutMapChunk extends Packet {
|
||||
for (l = 0; l < achunksection.length; ++l) {
|
||||
if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
|
||||
nibblearray = achunksection[l].getDataArray();
|
||||
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
||||
- j += nibblearray.a.length;
|
||||
+ nibblearray.copyToByteArray(abyte, j);
|
||||
+ j += nibblearray.getByteLength();
|
||||
}
|
||||
}
|
||||
|
||||
for (l = 0; l < achunksection.length; ++l) {
|
||||
if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
|
||||
nibblearray = achunksection[l].getEmittedLightArray();
|
||||
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
||||
- j += nibblearray.a.length;
|
||||
+ nibblearray.copyToByteArray(abyte, j);
|
||||
+ j += nibblearray.getByteLength();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ public class PacketPlayOutMapChunk extends Packet {
|
||||
for (l = 0; l < achunksection.length; ++l) {
|
||||
if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
|
||||
nibblearray = achunksection[l].getSkyLightArray();
|
||||
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
||||
- j += nibblearray.a.length;
|
||||
+ nibblearray.copyToByteArray(abyte, j);
|
||||
+ j += nibblearray.getByteLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,8 +165,8 @@ public class PacketPlayOutMapChunk extends Packet {
|
||||
for (l = 0; l < achunksection.length; ++l) {
|
||||
if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) {
|
||||
nibblearray = achunksection[l].getExtendedIdArray();
|
||||
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
||||
- j += nibblearray.a.length;
|
||||
+ nibblearray.copyToByteArray(abyte, j);
|
||||
+ j += nibblearray.getByteLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index b2c6ef4..55f5225 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -174,7 +174,18 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
if (cs[i].getExtendedIdArray() != null) { /* If we've got extended IDs */
|
||||
- byte[] extids = cs[i].getExtendedIdArray().a;
|
||||
+ // Spigot start
|
||||
+ if (cs[i].getExtendedIdArray().isTrivialArray()) {
|
||||
+ int tval = cs[i].getExtendedIdArray().getTrivialArrayValue();
|
||||
+ if (tval != 0) {
|
||||
+ tval = tval << 8;
|
||||
+ for (int j = 0; j < 4096; j++) {
|
||||
+ blockids[j] |= tval;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ byte[] extids = cs[i].getExtendedIdArray().getValueArray();
|
||||
+ // Spigot end
|
||||
|
||||
for (int j = 0; j < 2048; j++) {
|
||||
short b = (short) (extids[j] & 0xFF);
|
||||
@@ -186,21 +197,42 @@ public class CraftChunk implements Chunk {
|
||||
blockids[j<<1] |= (b & 0x0F) << 8;
|
||||
blockids[(j<<1)+1] |= (b & 0xF0) << 4;
|
||||
}
|
||||
+ } // Spigot
|
||||
}
|
||||
|
||||
sectionBlockIDs[i] = blockids;
|
||||
|
||||
/* Get block data nibbles */
|
||||
- sectionBlockData[i] = new byte[2048];
|
||||
- System.arraycopy(cs[i].getDataArray().a, 0, sectionBlockData[i], 0, 2048);
|
||||
+ // Spigot start
|
||||
+ if (cs[i].getDataArray().isTrivialArray() && (cs[i].getDataArray().getTrivialArrayValue() == 0)) {
|
||||
+ sectionBlockData[i] = emptyData;
|
||||
+ } else {
|
||||
+ sectionBlockData[i] = new byte[2048];
|
||||
+ cs[i].getDataArray().copyToByteArray(sectionBlockData[i], 0);
|
||||
+ }
|
||||
if (cs[i].getSkyLightArray() == null) {
|
||||
sectionSkyLights[i] = emptyData;
|
||||
+ }
|
||||
+ else if (cs[i].getSkyLightArray().isTrivialArray()) {
|
||||
+ if (cs[i].getSkyLightArray().getTrivialArrayValue() == 0) {
|
||||
+ sectionSkyLights[i] = emptyData;
|
||||
+ } else if (cs[i].getSkyLightArray().getTrivialArrayValue() == 15) {
|
||||
+ sectionSkyLights[i] = emptySkyLight;
|
||||
+ } else {
|
||||
+ sectionSkyLights[i] = new byte[2048];
|
||||
+ cs[i].getSkyLightArray().copyToByteArray(sectionSkyLights[i], 0);
|
||||
+ }
|
||||
} else {
|
||||
sectionSkyLights[i] = new byte[2048];
|
||||
- System.arraycopy(cs[i].getSkyLightArray().a, 0, sectionSkyLights[i], 0, 2048);
|
||||
+ cs[i].getSkyLightArray().copyToByteArray(sectionSkyLights[i], 0);
|
||||
+ }
|
||||
+ if (cs[i].getEmittedLightArray().isTrivialArray() && (cs[i].getEmittedLightArray().getTrivialArrayValue() == 0)) {
|
||||
+ sectionEmitLights[i] = emptyData;
|
||||
+ } else {
|
||||
+ sectionEmitLights[i] = new byte[2048];
|
||||
+ cs[i].getEmittedLightArray().copyToByteArray(sectionEmitLights[i], 0);
|
||||
}
|
||||
- sectionEmitLights[i] = new byte[2048];
|
||||
- System.arraycopy(cs[i].getEmittedLightArray().a, 0, sectionEmitLights[i], 0, 2048);
|
||||
+ // Spigot end
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.2
|
||||
|
@ -1,46 +1,42 @@
|
||||
From 5db9c82f05dfda72ae7d4eaa8466bb7245ca6113 Mon Sep 17 00:00:00 2001
|
||||
From 6313ae5947261f6c23337186e362fb860e34d839 Mon Sep 17 00:00:00 2001
|
||||
From: gsand <gsandowns@gmail.com>
|
||||
Date: Tue, 15 Apr 2014 22:57:01 -0700
|
||||
Date: Tue, 24 Jun 2014 08:01:42 -0500
|
||||
Subject: [PATCH] Inverted Daylight Detector Toggle
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
|
||||
index 96e9c37..536fad0 100644
|
||||
index 96e9c37..ceda7d4 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
|
||||
@@ -2,6 +2,10 @@ package net.minecraft.server;
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
|
||||
+
|
||||
import java.util.Random;
|
||||
|
||||
+// PaperSpigot start
|
||||
+import org.spigotmc.SpigotWorldConfig;
|
||||
+// PaperSpigot end
|
||||
+
|
||||
public class BlockDaylightDetector extends BlockContainer {
|
||||
|
||||
private IIcon[] a = new IIcon[2];
|
||||
@@ -38,14 +42,29 @@ public class BlockDaylightDetector extends BlockContainer {
|
||||
@@ -38,14 +40,27 @@ public class BlockDaylightDetector extends BlockContainer {
|
||||
f += (6.2831855F - f) * 0.2F;
|
||||
}
|
||||
|
||||
- i1 = Math.round((float) i1 * MathHelper.cos(f));
|
||||
- if (i1 < 0) {
|
||||
- i1 = 0;
|
||||
- }
|
||||
+ // PaperSpigot start - Inverted Daylight Detectors
|
||||
+ if (SpigotWorldConfig.InvertedDaylightDetectors) {
|
||||
+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15);
|
||||
+ if (i1 < 10) {
|
||||
+ i1 = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (i1 > 9) {
|
||||
+ i1 = 15;
|
||||
+ }
|
||||
}
|
||||
|
||||
- if (i1 > 15) {
|
||||
- i1 = 15;
|
||||
+ else {
|
||||
+ if (i1 > 9) {
|
||||
+ i1 = 15;
|
||||
+ }
|
||||
+ } else {
|
||||
+ i1 = Math.round((float) i1 * MathHelper.cos(f));
|
||||
+ if (i1 < 0) {
|
||||
+ i1 = 0;
|
||||
@ -55,23 +51,21 @@ index 96e9c37..536fad0 100644
|
||||
if (l != i1) {
|
||||
i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index c6095f2..aa30c9d 100644
|
||||
index ecf7381..4faa4c7 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -323,6 +323,13 @@ public class SpigotWorldConfig
|
||||
log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
|
||||
@@ -366,4 +366,11 @@ public class SpigotWorldConfig
|
||||
{
|
||||
babyZombieMovementSpeed = getDouble( "baby-zombie-movement-speed", 0.5D );
|
||||
}
|
||||
|
||||
+
|
||||
+ public static boolean InvertedDaylightDetectors;
|
||||
+ private void InvertedDaylightDetectors()
|
||||
+ {
|
||||
+ InvertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false);
|
||||
+ log( "Inverted Redstone Lamps: " + InvertedDaylightDetectors );
|
||||
+ }
|
||||
+
|
||||
public int maxBulkChunk;
|
||||
private void bulkChunkCount()
|
||||
{
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,542 +0,0 @@
|
||||
From 240e3a0afa47aa7e53f6f647c000dc5c627d5d95 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 10 Jan 2013 00:18:11 -0500
|
||||
Subject: [PATCH] Improved Timings System
|
||||
|
||||
Tracks nearly every point of minecraft internals and plugin events to give a good quick overview on what is causing TPS loss.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 8cc2efd..64ae190 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;
|
||||
|
||||
if (chunk == null) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
chunk = this.loadChunk(i, j);
|
||||
if (chunk == null) {
|
||||
if (this.chunkProvider == null) {
|
||||
@@ -187,6 +188,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
// CraftBukkit end
|
||||
chunk.a(this, this, i, j);
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
return chunk;
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 04f5bc6..0999562 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;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
+import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
@@ -114,6 +115,8 @@ public abstract class Entity {
|
||||
public boolean valid; // CraftBukkit
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
|
||||
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
|
||||
+
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
@@ -426,7 +429,8 @@ public abstract class Entity {
|
||||
if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) {
|
||||
return;
|
||||
}
|
||||
- // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
+ 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;
|
||||
@@ -735,6 +739,7 @@ public abstract class Entity {
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
protected String G() {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 17b15f6..21cf068 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;
|
||||
|
||||
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() {}
|
||||
|
||||
protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
+ SpigotTimings.serverTickTimer.startTiming(); // Spigot
|
||||
long i = System.nanoTime();
|
||||
|
||||
++this.ticks;
|
||||
@@ -596,6 +598,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
public void v() {
|
||||
this.methodProfiler.a("levels");
|
||||
|
||||
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||
// CraftBukkit start
|
||||
this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||
|
||||
@@ -604,7 +607,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
processQueue.remove().run();
|
||||
}
|
||||
|
||||
+ SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||
+ SpigotTimings.chunkIOTickTimer.startTiming(); // Spigot
|
||||
org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick();
|
||||
+ SpigotTimings.chunkIOTickTimer.stopTiming(); // Spigot
|
||||
|
||||
// Send time updates to everyone, it will get the right time from the world the player is in.
|
||||
if (this.ticks % 20 == 0) {
|
||||
@@ -655,7 +661,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("tracker");
|
||||
+ worldserver.timings.tracker.startTiming(); // Spigot
|
||||
worldserver.getTracker().updatePlayers();
|
||||
+ worldserver.timings.tracker.stopTiming(); // Spigot
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.b();
|
||||
// } // CraftBukkit
|
||||
@@ -664,16 +672,24 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
this.methodProfiler.c("connection");
|
||||
+ SpigotTimings.connectionTimer.startTiming(); // Spigot
|
||||
this.ai().c();
|
||||
+ SpigotTimings.connectionTimer.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("players");
|
||||
+ SpigotTimings.playerListTimer.startTiming(); // Spigot
|
||||
this.u.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();
|
||||
}
|
||||
+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot
|
||||
|
||||
this.methodProfiler.b();
|
||||
+ SpigotTimings.serverTickTimer.stopTiming(); // Spigot
|
||||
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot
|
||||
}
|
||||
|
||||
public boolean getAllowNether() {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index ec45c30..92284eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -940,6 +940,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
// CraftBukkit end
|
||||
|
||||
private void handleCommand(String s) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
|
||||
// CraftBukkit start - whole method
|
||||
this.c.info(this.player.getName() + " issued server command: " + s);
|
||||
|
||||
@@ -949,18 +950,22 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
|
||||
return;
|
||||
}
|
||||
} catch (org.bukkit.command.CommandException ex) {
|
||||
player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
|
||||
java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
|
||||
return;
|
||||
}
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
|
||||
//this.minecraftServer.getCommandHandler().a(this.player, s);
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 2a3d647..78e17d7 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;
|
||||
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 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();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 1fea307..40a3fcf 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;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.craftbukkit.util.LongHashSet;
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
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;
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot
|
||||
+
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
@@ -215,6 +218,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.a();
|
||||
|
||||
this.getServer().addWorld(this.world); // CraftBukkit
|
||||
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot
|
||||
}
|
||||
|
||||
protected abstract IChunkProvider j();
|
||||
@@ -1312,6 +1316,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.f.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);
|
||||
@@ -1327,7 +1332,9 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.a("tick");
|
||||
if (!entity.dead) {
|
||||
try {
|
||||
+ SpigotTimings.tickEntityTimer.startTiming(); // Spigot
|
||||
this.playerJoinedWorld(entity);
|
||||
+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
|
||||
} catch (Throwable throwable1) {
|
||||
crashreport = CrashReport.a(throwable1, "Ticking entity");
|
||||
crashreportsystemdetails = crashreport.a("Entity being ticked");
|
||||
@@ -1352,7 +1359,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;
|
||||
// CraftBukkit start - From below, clean up tile entities before ticking them
|
||||
if (!this.b.isEmpty()) {
|
||||
@@ -1368,8 +1377,11 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
|
||||
try {
|
||||
+ tileentity.tickTimer.startTiming(); // Spigot
|
||||
tileentity.h();
|
||||
+ tileentity.tickTimer.stopTiming(); // Spigot
|
||||
} catch (Throwable throwable2) {
|
||||
+ tileentity.tickTimer.stopTiming(); // Spigot
|
||||
crashreport = CrashReport.a(throwable2, "Ticking block entity");
|
||||
crashreportsystemdetails = crashreport.a("Block entity being ticked");
|
||||
tileentity.a(crashreportsystemdetails);
|
||||
@@ -1389,6 +1401,8 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
}
|
||||
|
||||
+ timings.tileEntityTick.stopTiming(); // Spigot
|
||||
+ timings.tileEntityPending.startTiming(); // Spigot
|
||||
this.M = false;
|
||||
/* CraftBukkit start - Moved up
|
||||
if (!this.b.isEmpty()) {
|
||||
@@ -1429,6 +1443,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.a.clear();
|
||||
}
|
||||
|
||||
+ timings.tileEntityPending.stopTiming(); // Spigot
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.b();
|
||||
}
|
||||
@@ -1453,6 +1468,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) */) {
|
||||
+ entity.tickTimer.startTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
entity.S = entity.locX;
|
||||
entity.T = entity.locY;
|
||||
@@ -1515,6 +1531,7 @@ public abstract class World implements IBlockAccess {
|
||||
entity.passenger = null;
|
||||
}
|
||||
}
|
||||
+ 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 e74f777..8cbfa30 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 {
|
||||
// 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)) {
|
||||
+ 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);
|
||||
+ timings.mobSpawn.stopTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ timings.doChunkUnload.startTiming(); // Spigot
|
||||
this.methodProfiler.c("chunkSource");
|
||||
this.chunkProvider.unloadChunks();
|
||||
int j = this.a(1.0F);
|
||||
@@ -202,21 +205,36 @@ public class WorldServer extends World {
|
||||
this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
|
||||
}
|
||||
|
||||
+ timings.doChunkUnload.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("tickPending");
|
||||
+ timings.doTickPending.startTiming(); // Spigot
|
||||
this.a(false);
|
||||
+ timings.doTickPending.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("tickBlocks");
|
||||
+ timings.doTickTiles.startTiming(); // Spigot
|
||||
this.g();
|
||||
+ timings.doTickTiles.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("chunkMap");
|
||||
+ timings.doChunkMap.startTiming(); // Spigot
|
||||
this.manager.flush();
|
||||
+ timings.doChunkMap.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("village");
|
||||
+ timings.doVillages.startTiming(); // Spigot
|
||||
this.villages.tick();
|
||||
this.siegeManager.a();
|
||||
+ timings.doVillages.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("portalForcer");
|
||||
+ timings.doPortalForcer.startTiming(); // Spigot
|
||||
this.Q.a(this.getTime());
|
||||
+ timings.doPortalForcer.stopTiming(); // Spigot
|
||||
this.methodProfiler.b();
|
||||
+ timings.doSounds.startTiming(); // Spigot
|
||||
this.Z();
|
||||
+ timings.doSounds.stopTiming(); // Spigot
|
||||
|
||||
+ timings.doChunkGC.startTiming(); // Spigot
|
||||
this.getWorld().processChunkGC(); // CraftBukkit
|
||||
+ timings.doChunkGC.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
new file mode 100644
|
||||
index 0000000..8340c13
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
@@ -0,0 +1,125 @@
|
||||
+package org.bukkit.craftbukkit;
|
||||
+
|
||||
+import net.minecraft.server.*;
|
||||
+import org.spigotmc.CustomTimingsHandler;
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import org.bukkit.craftbukkit.scheduler.CraftTask;
|
||||
+
|
||||
+public class SpigotTimings {
|
||||
+
|
||||
+ public static final CustomTimingsHandler serverTickTimer = new CustomTimingsHandler("** Full Server Tick");
|
||||
+ public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List");
|
||||
+ public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Player Tick");
|
||||
+ public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables");
|
||||
+ public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler");
|
||||
+ public static final CustomTimingsHandler chunkIOTickTimer = new CustomTimingsHandler("ChunkIOTick");
|
||||
+ public static final CustomTimingsHandler syncChunkLoadTimer = new CustomTimingsHandler("syncChunkLoad");
|
||||
+
|
||||
+ public static final CustomTimingsHandler entityMoveTimer = new CustomTimingsHandler("** entityMove");
|
||||
+ public static final CustomTimingsHandler tickEntityTimer = new CustomTimingsHandler("** tickEntity");
|
||||
+ public static final CustomTimingsHandler activatedEntityTimer = new CustomTimingsHandler("** activatedTickEntity");
|
||||
+ public static final CustomTimingsHandler tickTileEntityTimer = new CustomTimingsHandler("** tickTileEntity");
|
||||
+
|
||||
+ public static final CustomTimingsHandler timerEntityBaseTick = new CustomTimingsHandler("** livingEntityBaseTick");
|
||||
+ public static final CustomTimingsHandler timerEntityAI = new CustomTimingsHandler("** livingEntityAI");
|
||||
+ public static final CustomTimingsHandler timerEntityAICollision = new CustomTimingsHandler("** livingEntityAICollision");
|
||||
+ public static final CustomTimingsHandler timerEntityAIMove = new CustomTimingsHandler("** livingEntityAIMove");
|
||||
+ public static final CustomTimingsHandler timerEntityTickRest = new CustomTimingsHandler("** livingEntityTickRest");
|
||||
+
|
||||
+ public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand");
|
||||
+
|
||||
+ public static final HashMap<String, CustomTimingsHandler> entityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
+ public static final HashMap<String, CustomTimingsHandler> tileEntityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
+ public static final HashMap<String, CustomTimingsHandler> pluginTaskTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a timer associated with a plugins tasks.
|
||||
+ * @param task
|
||||
+ * @param period
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) {
|
||||
+ String plugin = task.getOwner().getDescription().getFullName();
|
||||
+ String name = "Task: " + plugin + " Runnable: " + ( (CraftTask) task ).getTaskClass().getSimpleName();
|
||||
+ if (period > 0) {
|
||||
+ name += "(interval:" + period +")";
|
||||
+ } else {
|
||||
+ name += "(Single)";
|
||||
+ }
|
||||
+ CustomTimingsHandler result = pluginTaskTimingMap.get(name);
|
||||
+ if (result == null) {
|
||||
+ result = new CustomTimingsHandler(name);
|
||||
+ pluginTaskTimingMap.put(name, result);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a named timer for the specified entity type to track type specific timings.
|
||||
+ * @param entity
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static CustomTimingsHandler getEntityTimings(Entity entity) {
|
||||
+ String entityType = entity.getClass().getSimpleName();
|
||||
+ CustomTimingsHandler result = entityTypeTimingMap.get(entityType);
|
||||
+ if (result == null) {
|
||||
+ result = new CustomTimingsHandler("** tickEntity - " + entityType, activatedEntityTimer);
|
||||
+ entityTypeTimingMap.put(entityType, result);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a named timer for the specified tile entity type to track type specific timings.
|
||||
+ * @param entity
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static CustomTimingsHandler getTileEntityTimings(TileEntity entity) {
|
||||
+ String entityType = entity.getClass().getSimpleName();
|
||||
+ CustomTimingsHandler result = tileEntityTypeTimingMap.get(entityType);
|
||||
+ if (result == null) {
|
||||
+ result = new CustomTimingsHandler("** tickTileEntity - " + entityType, tickTileEntityTimer);
|
||||
+ tileEntityTypeTimingMap.put(entityType, result);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set of timers per world, to track world specific timings.
|
||||
+ */
|
||||
+ public static class WorldTimingsHandler {
|
||||
+ public final CustomTimingsHandler mobSpawn;
|
||||
+ public final CustomTimingsHandler doChunkUnload;
|
||||
+ public final CustomTimingsHandler doPortalForcer;
|
||||
+ public final CustomTimingsHandler doTickPending;
|
||||
+ public final CustomTimingsHandler doTickTiles;
|
||||
+ public final CustomTimingsHandler doVillages;
|
||||
+ public final CustomTimingsHandler doChunkMap;
|
||||
+ public final CustomTimingsHandler doChunkGC;
|
||||
+ public final CustomTimingsHandler doSounds;
|
||||
+ public final CustomTimingsHandler entityTick;
|
||||
+ public final CustomTimingsHandler tileEntityTick;
|
||||
+ public final CustomTimingsHandler tileEntityPending;
|
||||
+ public final CustomTimingsHandler tracker;
|
||||
+
|
||||
+ public WorldTimingsHandler(World server) {
|
||||
+ String name = server.worldData.getName() +" - ";
|
||||
+
|
||||
+ mobSpawn = new CustomTimingsHandler(name + "mobSpawn");
|
||||
+ doChunkUnload = new CustomTimingsHandler(name + "doChunkUnload");
|
||||
+ doTickPending = new CustomTimingsHandler(name + "doTickPending");
|
||||
+ doTickTiles = new CustomTimingsHandler(name + "doTickTiles");
|
||||
+ doVillages = new CustomTimingsHandler(name + "doVillages");
|
||||
+ doChunkMap = new CustomTimingsHandler(name + "doChunkMap");
|
||||
+ doSounds = new CustomTimingsHandler(name + "doSounds");
|
||||
+ doChunkGC = new CustomTimingsHandler(name + "doChunkGC");
|
||||
+ doPortalForcer = new CustomTimingsHandler(name + "doPortalForcer");
|
||||
+ entityTick = new CustomTimingsHandler(name + "entityTick");
|
||||
+ tileEntityTick = new CustomTimingsHandler(name + "tileEntityTick");
|
||||
+ tileEntityPending = new CustomTimingsHandler(name + "tileEntityPending");
|
||||
+ tracker = new CustomTimingsHandler(name + "tracker");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
||||
index 55db3ff..7d294c0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.bukkit.craftbukkit.scheduler;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
+import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
|
||||
-class CraftTask implements BukkitTask, Runnable {
|
||||
+public class CraftTask implements BukkitTask, Runnable { // Spigot
|
||||
|
||||
private volatile CraftTask next = null;
|
||||
/**
|
||||
@@ -22,6 +24,7 @@ class CraftTask implements BukkitTask, Runnable {
|
||||
private final Plugin plugin;
|
||||
private final int id;
|
||||
|
||||
+ CustomTimingsHandler timings = null; // Spigot
|
||||
CraftTask() {
|
||||
this(null, null, -1, -1);
|
||||
}
|
||||
@@ -50,7 +53,22 @@ class CraftTask implements BukkitTask, Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
+ // Spigot start - Wrap custom timings on Tasks
|
||||
+ if (!Bukkit.getServer().getPluginManager().useTimings()) {
|
||||
+ task.run();
|
||||
+ return;
|
||||
+ }
|
||||
+ if (timings == null && this.getOwner() != null && this.isSync()) {
|
||||
+ timings = SpigotTimings.getPluginTaskTimings(this, period);
|
||||
+ }
|
||||
+ if (timings != null) {
|
||||
+ timings.startTiming();
|
||||
+ }
|
||||
task.run();
|
||||
+ if (timings != null) {
|
||||
+ timings.stopTiming();
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
long getPeriod() {
|
||||
@@ -77,7 +95,7 @@ class CraftTask implements BukkitTask, Runnable {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
- Class<? extends Runnable> getTaskClass() {
|
||||
+ public Class<? extends Runnable> getTaskClass() { // Spigot
|
||||
return task.getClass();
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,155 +0,0 @@
|
||||
From ad6096243ee953cfd0208b1d9aaef93122d95a12 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index d770e4e..39767d0 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
|
||||
|
||||
// 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;
|
||||
this.entitySlices[k].add(entity);
|
||||
+ // Spigot start - increment creature type count
|
||||
+ // Keep this synced up with World.a(Class)
|
||||
+ if (entity instanceof EntityInsentient) {
|
||||
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ for ( EnumCreatureType creatureType : EnumCreatureType.values() )
|
||||
+ {
|
||||
+ if ( creatureType.a().isAssignableFrom( entity.getClass() ) )
|
||||
+ {
|
||||
+ this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 );
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
@@ -651,6 +668,22 @@ public class Chunk {
|
||||
}
|
||||
|
||||
this.entitySlices[i].remove(entity);
|
||||
+ // Spigot start - decrement creature type count
|
||||
+ // Keep this synced up with World.a(Class)
|
||||
+ if (entity instanceof EntityInsentient) {
|
||||
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ for ( EnumCreatureType creatureType : EnumCreatureType.values() )
|
||||
+ {
|
||||
+ if ( creatureType.a().isAssignableFrom( entity.getClass() ) )
|
||||
+ {
|
||||
+ this.entityCount.adjustValue( creatureType.a(), -1 );
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
public boolean d(int i, int j, int k) {
|
||||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
index 2ef15d2..23d6611 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);
|
||||
}
|
||||
|
||||
+ // 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() )
|
||||
+ {
|
||||
+ int x = LongHash.msw( coord );
|
||||
+ int z = LongHash.lsw( coord );
|
||||
+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z ) )
|
||||
+ {
|
||||
+ i += server.getChunkAt( x, z ).entityCount.get( oClass );
|
||||
+ }
|
||||
+ }
|
||||
+ return i;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) {
|
||||
if (!flag && !flag1) {
|
||||
return 0;
|
||||
@@ -42,6 +59,11 @@ public final class SpawnerCreature {
|
||||
|
||||
j = MathHelper.floor(entityhuman.locZ / 16.0D);
|
||||
byte b0 = 8;
|
||||
+ // Spigot Start
|
||||
+ b0 = worldserver.spigotConfig.mobSpawnRange;
|
||||
+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0;
|
||||
+ 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 {
|
||||
if (limit == 0) {
|
||||
continue;
|
||||
}
|
||||
+ int mobcnt = 0;
|
||||
// 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();
|
||||
|
||||
+ 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
|
||||
// CraftBukkit start = use LongHash and LongObjectHashMap
|
||||
long key = ((Long) iterator.next()).longValue();
|
||||
|
||||
@@ -160,6 +184,13 @@ public final class SpawnerCreature {
|
||||
groupdataentity = entityinsentient.a(groupdataentity);
|
||||
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL);
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ if ( --moblimit <= 0 )
|
||||
+ {
|
||||
+ // If we're past limit, stop spawn
|
||||
+ continue label110;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
if (j2 >= entityinsentient.bB()) {
|
||||
continue label110;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 6cc3a91..46249d7 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -131,4 +131,11 @@ public class SpigotWorldConfig
|
||||
viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
|
||||
log( "View Distance: " + viewDistance );
|
||||
}
|
||||
+
|
||||
+ public byte mobSpawnRange;
|
||||
+ private void mobSpawnRange()
|
||||
+ {
|
||||
+ mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||
+ log( "Mob Spawn Range: " + mobSpawnRange );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 12c06cd7b3eb049c7e2a170566a9f72c96f29d17 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 40a3fcf..3e93cfd 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1374,6 +1374,13 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
TileEntity tileentity = (TileEntity) iterator.next();
|
||||
+ // Spigot start
|
||||
+ if (tileentity == null) {
|
||||
+ getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
+ iterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
|
||||
try {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,522 +0,0 @@
|
||||
From a972387b658808e5a9bdfaf911454fd39dda1300 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
|
||||
|
||||
This feature gives 3 new configurable ranges that if an entity of the matching type is outside of this radius of any player, will tick at 5% of its normal rate.
|
||||
|
||||
This will drastically cut down on tick timings for entities that are not in range of a user to actually be "used".
|
||||
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 0999562..e966314 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -91,7 +91,7 @@ public abstract class Entity {
|
||||
public int ticksLived;
|
||||
public int maxFireTicks;
|
||||
public int fireTicks; // CraftBukkit - private -> public
|
||||
- protected boolean inWater;
|
||||
+ public boolean inWater; // Spigot - protected -> public
|
||||
public int noDamageTicks;
|
||||
private boolean justCreated;
|
||||
protected boolean fireProof;
|
||||
@@ -115,7 +115,13 @@ public abstract class Entity {
|
||||
public boolean valid; // CraftBukkit
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
|
||||
+ // Spigot start
|
||||
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
|
||||
+ public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||
+ public final boolean defaultActivationState;
|
||||
+ public long activatedTick = 0;
|
||||
+ public void inactiveTick() { }
|
||||
+ // Spigot end
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
@@ -142,7 +148,12 @@ public abstract class Entity {
|
||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||
if (world != null) {
|
||||
this.dimension = world.worldProvider.dimension;
|
||||
+ // Spigot start
|
||||
+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig);
|
||||
+ } else {
|
||||
+ this.defaultActivationState = false;
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
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
|
||||
--- 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;
|
||||
public boolean ageLocked = false; // CraftBukkit
|
||||
|
||||
+ // Spigot start
|
||||
+ @Override
|
||||
+ public void inactiveTick()
|
||||
+ {
|
||||
+ super.inactiveTick();
|
||||
+ if ( this.world.isStatic || this.ageLocked )
|
||||
+ { // CraftBukkit
|
||||
+ this.a( this.isBaby() );
|
||||
+ } else
|
||||
+ {
|
||||
+ int i = this.getAge();
|
||||
+
|
||||
+ if ( i < 0 )
|
||||
+ {
|
||||
+ ++i;
|
||||
+ this.setAge( i );
|
||||
+ } else if ( i > 0 )
|
||||
+ {
|
||||
+ --i;
|
||||
+ this.setAge( i );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public EntityAgeable(World world) {
|
||||
super(world);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index 3628774..3137bcf 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 {
|
||||
private int f = -1;
|
||||
private Block g;
|
||||
private int h;
|
||||
- private boolean inGround;
|
||||
+ public boolean inGround = false; // Spigot - private -> public
|
||||
public int fromPlayer;
|
||||
public int shake;
|
||||
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
|
||||
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public void inactiveTick()
|
||||
+ {
|
||||
+ if ( this.inGround )
|
||||
+ {
|
||||
+ this.at += 19; // Despawn counter. First int after shooter
|
||||
+ }
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+
|
||||
public EntityArrow(World world) {
|
||||
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 a228a2c..0a81006 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
|
||||
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public void inactiveTick()
|
||||
+ {
|
||||
+ this.ticksFlown += 19;
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+
|
||||
public EntityFireworks(World world) {
|
||||
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 b3bf43a..a180c89 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -80,6 +80,13 @@ public abstract class EntityLiving extends Entity {
|
||||
public int maxAirTicks = 300;
|
||||
ArrayList<org.bukkit.inventory.ItemStack> drops = null;
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ public void inactiveTick()
|
||||
+ {
|
||||
+ super.inactiveTick();
|
||||
+ ++this.aU; // Above all the floats
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
public EntityLiving(World world) {
|
||||
super(world);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3e93cfd..0cb803e 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1316,6 +1316,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.f.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) {
|
||||
@@ -1472,9 +1473,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) */) {
|
||||
+ // Spigot start
|
||||
+ if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
|
||||
+ entity.ticksLived++;
|
||||
+ entity.inactiveTick();
|
||||
+ } else {
|
||||
entity.tickTimer.startTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
entity.S = entity.locX;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
index 8340c13..541dfe4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
@@ -30,6 +30,9 @@ public class SpigotTimings {
|
||||
|
||||
public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand");
|
||||
|
||||
+ public static final CustomTimingsHandler entityActivationCheckTimer = new CustomTimingsHandler("entityActivationCheck");
|
||||
+ public static final CustomTimingsHandler checkIfActiveTimer = new CustomTimingsHandler("** checkIfActive");
|
||||
+
|
||||
public static final HashMap<String, CustomTimingsHandler> entityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
public static final HashMap<String, CustomTimingsHandler> tileEntityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
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..06284ad
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +1,296 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import net.minecraft.server.AxisAlignedBB;
|
||||
+import net.minecraft.server.Chunk;
|
||||
+import net.minecraft.server.Entity;
|
||||
+import net.minecraft.server.EntityAmbient;
|
||||
+import net.minecraft.server.EntityAnimal;
|
||||
+import net.minecraft.server.EntityArrow;
|
||||
+import net.minecraft.server.EntityComplexPart;
|
||||
+import net.minecraft.server.EntityCreature;
|
||||
+import net.minecraft.server.EntityEnderCrystal;
|
||||
+import net.minecraft.server.EntityEnderDragon;
|
||||
+import net.minecraft.server.EntityFireball;
|
||||
+import net.minecraft.server.EntityFireworks;
|
||||
+import net.minecraft.server.EntityHuman;
|
||||
+import net.minecraft.server.EntityLiving;
|
||||
+import net.minecraft.server.EntityMonster;
|
||||
+import net.minecraft.server.EntityProjectile;
|
||||
+import net.minecraft.server.EntitySheep;
|
||||
+import net.minecraft.server.EntitySlime;
|
||||
+import net.minecraft.server.EntityTNTPrimed;
|
||||
+import net.minecraft.server.EntityVillager;
|
||||
+import net.minecraft.server.EntityWeather;
|
||||
+import net.minecraft.server.EntityWither;
|
||||
+import net.minecraft.server.MathHelper;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.World;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.SpigotTimings;
|
||||
+
|
||||
+public class ActivationRange
|
||||
+{
|
||||
+
|
||||
+ static AxisAlignedBB maxBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB miscBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB animalBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB monsterBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+
|
||||
+ /**
|
||||
+ * Initializes an entities type on construction to specify what group this
|
||||
+ * entity is in for activation ranges.
|
||||
+ *
|
||||
+ * @param entity
|
||||
+ * @return group id
|
||||
+ */
|
||||
+ public static byte initializeEntityActivationType(Entity entity)
|
||||
+ {
|
||||
+ if ( entity instanceof EntityMonster || entity instanceof EntitySlime )
|
||||
+ {
|
||||
+ return 1; // Monster
|
||||
+ } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbient )
|
||||
+ {
|
||||
+ return 2; // Animal
|
||||
+ } else
|
||||
+ {
|
||||
+ return 3; // Misc
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * These entities are excluded from Activation range checks.
|
||||
+ *
|
||||
+ * @param entity
|
||||
+ * @param world
|
||||
+ * @return boolean If it should always tick.
|
||||
+ */
|
||||
+ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
|
||||
+ {
|
||||
+ if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|
||||
+ || ( entity.activationType == 2 && config.animalActivationRange == 0 )
|
||||
+ || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|
||||
+ || entity instanceof EntityHuman
|
||||
+ || entity instanceof EntityProjectile
|
||||
+ || entity instanceof EntityEnderDragon
|
||||
+ || entity instanceof EntityComplexPart
|
||||
+ || entity instanceof EntityWither
|
||||
+ || entity instanceof EntityFireball
|
||||
+ || entity instanceof EntityWeather
|
||||
+ || entity instanceof EntityTNTPrimed
|
||||
+ || entity instanceof EntityEnderCrystal
|
||||
+ || entity instanceof EntityFireworks )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * @param world
|
||||
+ */
|
||||
+ public static void activateEntities(World world)
|
||||
+ {
|
||||
+ SpigotTimings.entityActivationCheckTimer.startTiming();
|
||||
+ final int miscActivationRange = world.spigotConfig.miscActivationRange;
|
||||
+ final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
||||
+ final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
|
||||
+
|
||||
+ int maxRange = Math.max( monsterActivationRange, animalActivationRange );
|
||||
+ maxRange = Math.max( maxRange, miscActivationRange );
|
||||
+ maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
|
||||
+
|
||||
+ for ( Entity player : new ArrayList<Entity>( world.players ) )
|
||||
+ {
|
||||
+
|
||||
+ 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 );
|
||||
+
|
||||
+ int i = MathHelper.floor( maxBB.a / 16.0D );
|
||||
+ int j = MathHelper.floor( maxBB.d / 16.0D );
|
||||
+ int k = MathHelper.floor( maxBB.c / 16.0D );
|
||||
+ int l = MathHelper.floor( maxBB.f / 16.0D );
|
||||
+
|
||||
+ for ( int i1 = i; i1 <= j; ++i1 )
|
||||
+ {
|
||||
+ for ( int j1 = k; j1 <= l; ++j1 )
|
||||
+ {
|
||||
+ if ( world.getWorld().isChunkLoaded( i1, j1 ) )
|
||||
+ {
|
||||
+ activateChunkEntities( world.getChunkAt( i1, j1 ) );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ SpigotTimings.entityActivationCheckTimer.stopTiming();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks for the activation state of all entities in this chunk.
|
||||
+ *
|
||||
+ * @param chunk
|
||||
+ */
|
||||
+ private static void activateChunkEntities(Chunk chunk)
|
||||
+ {
|
||||
+ for ( List<Entity> slice : chunk.entitySlices )
|
||||
+ {
|
||||
+ for ( Entity entity : slice )
|
||||
+ {
|
||||
+ if ( MinecraftServer.currentTick > entity.activatedTick )
|
||||
+ {
|
||||
+ if ( entity.defaultActivationState )
|
||||
+ {
|
||||
+ entity.activatedTick = MinecraftServer.currentTick;
|
||||
+ continue;
|
||||
+ }
|
||||
+ switch ( entity.activationType )
|
||||
+ {
|
||||
+ case 1:
|
||||
+ if ( monsterBB.b( entity.boundingBox ) )
|
||||
+ {
|
||||
+ entity.activatedTick = MinecraftServer.currentTick;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ if ( animalBB.b( entity.boundingBox ) )
|
||||
+ {
|
||||
+ entity.activatedTick = MinecraftServer.currentTick;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ default:
|
||||
+ if ( miscBB.b( entity.boundingBox ) )
|
||||
+ {
|
||||
+ entity.activatedTick = MinecraftServer.currentTick;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If an entity is not in range, do some more checks to see if we should
|
||||
+ * give it a shot.
|
||||
+ *
|
||||
+ * @param entity
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static boolean checkEntityImmunities(Entity entity)
|
||||
+ {
|
||||
+ // quick checks.
|
||||
+ if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( !( entity instanceof EntityArrow ) )
|
||||
+ {
|
||||
+ if ( !entity.onGround || entity.passenger != null
|
||||
+ || entity.vehicle != null )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ } else if ( !( (EntityArrow) entity ).inGround )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // special cases.
|
||||
+ if ( entity instanceof EntityLiving )
|
||||
+ {
|
||||
+ EntityLiving living = (EntityLiving) entity;
|
||||
+ if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bY() /* Getter for first boolean */ )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntityAnimal )
|
||||
+ {
|
||||
+ EntityAnimal animal = (EntityAnimal) entity;
|
||||
+ if ( animal.isBaby() || animal.ce() /*love*/ )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).isSheared() )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the entity is active for this tick.
|
||||
+ *
|
||||
+ * @param entity
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static boolean checkIfActive(Entity entity)
|
||||
+ {
|
||||
+ SpigotTimings.checkIfActiveTimer.startTiming();
|
||||
+ boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;
|
||||
+
|
||||
+ // Should this entity tick?
|
||||
+ if ( !isActive )
|
||||
+ {
|
||||
+ if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
|
||||
+ {
|
||||
+ // Check immunities every 20 ticks.
|
||||
+ if ( checkEntityImmunities( entity ) )
|
||||
+ {
|
||||
+ // Triggered some sort of immunity, give 20 full ticks before we check again.
|
||||
+ entity.activatedTick = MinecraftServer.currentTick + 20;
|
||||
+ }
|
||||
+ isActive = true;
|
||||
+ }
|
||||
+ // Add a little performance juice to active entities. Skip 1/4 if not immune.
|
||||
+ } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
|
||||
+ {
|
||||
+ isActive = false;
|
||||
+ }
|
||||
+ int x = MathHelper.floor( entity.locX );
|
||||
+ int z = MathHelper.floor( entity.locZ );
|
||||
+ // Make sure not on edge of unloaded chunk
|
||||
+ if ( isActive && !entity.world.areChunksLoaded( x, 0, z, 16 ) )
|
||||
+ {
|
||||
+ isActive = false;
|
||||
+ }
|
||||
+ SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
+ return isActive;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 46249d7..ed2836a 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -138,4 +138,15 @@ public class SpigotWorldConfig
|
||||
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||
log( "Mob Spawn Range: " + mobSpawnRange );
|
||||
}
|
||||
+
|
||||
+ public int animalActivationRange = 32;
|
||||
+ public int monsterActivationRange = 32;
|
||||
+ public int miscActivationRange = 16;
|
||||
+ private void activationRange()
|
||||
+ {
|
||||
+ animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange );
|
||||
+ monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange );
|
||||
+ miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
|
||||
+ log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,692 +0,0 @@
|
||||
From 64fa9cb277665dcf02463a4ad93472e5a5f10cb8 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java
|
||||
new file mode 100644
|
||||
index 0000000..f1690a2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/Metrics.java
|
||||
@@ -0,0 +1,645 @@
|
||||
+/*
|
||||
+ * Copyright 2011-2013 Tyler Blair. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without modification, are
|
||||
+ * permitted provided that the following conditions are met:
|
||||
+ *
|
||||
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
+ * conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
+ * of conditions and the following disclaimer in the documentation and/or other materials
|
||||
+ * provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ *
|
||||
+ * The views and conclusions contained in the software and documentation are those of the
|
||||
+ * authors and contributors and should not be interpreted as representing official policies,
|
||||
+ * either expressed or implied, of anybody else.
|
||||
+ */
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+import org.bukkit.plugin.PluginDescriptionFile;
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import java.io.BufferedReader;
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.io.InputStreamReader;
|
||||
+import java.io.OutputStreamWriter;
|
||||
+import java.io.UnsupportedEncodingException;
|
||||
+import java.net.Proxy;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLConnection;
|
||||
+import java.net.URLEncoder;
|
||||
+import java.util.Collections;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.LinkedHashSet;
|
||||
+import java.util.Set;
|
||||
+import java.util.Timer;
|
||||
+import java.util.TimerTask;
|
||||
+import java.util.UUID;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.logging.Level;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+
|
||||
+/**
|
||||
+ * <p> The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. </p> <p>
|
||||
+ * Public methods provided by this class: </p>
|
||||
+ * <code>
|
||||
+ * Graph createGraph(String name); <br/>
|
||||
+ * void addCustomData(BukkitMetrics.Plotter plotter); <br/>
|
||||
+ * void start(); <br/>
|
||||
+ * </code>
|
||||
+ */
|
||||
+public class Metrics {
|
||||
+
|
||||
+ /**
|
||||
+ * The current revision number
|
||||
+ */
|
||||
+ private final static int REVISION = 6;
|
||||
+ /**
|
||||
+ * The base url of the metrics domain
|
||||
+ */
|
||||
+ private static final String BASE_URL = "http://mcstats.org";
|
||||
+ /**
|
||||
+ * The url used to report a server's status
|
||||
+ */
|
||||
+ private static final String REPORT_URL = "/report/%s";
|
||||
+ /**
|
||||
+ * The separator to use for custom data. This MUST NOT change unless you are hosting your own version of metrics and
|
||||
+ * want to change it.
|
||||
+ */
|
||||
+ private static final String CUSTOM_DATA_SEPARATOR = "~~";
|
||||
+ /**
|
||||
+ * Interval of time to ping (in minutes)
|
||||
+ */
|
||||
+ private static final int PING_INTERVAL = 10;
|
||||
+ /**
|
||||
+ * All of the custom graphs to submit to metrics
|
||||
+ */
|
||||
+ private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
|
||||
+ /**
|
||||
+ * The default graph, used for addCustomData when you don't want a specific graph
|
||||
+ */
|
||||
+ private final Graph defaultGraph = new Graph("Default");
|
||||
+ /**
|
||||
+ * The plugin configuration file
|
||||
+ */
|
||||
+ private final YamlConfiguration configuration;
|
||||
+ /**
|
||||
+ * The plugin configuration file
|
||||
+ */
|
||||
+ private final File configurationFile;
|
||||
+ /**
|
||||
+ * Unique server id
|
||||
+ */
|
||||
+ private final String guid;
|
||||
+ /**
|
||||
+ * Debug mode
|
||||
+ */
|
||||
+ private final boolean debug;
|
||||
+ /**
|
||||
+ * Lock for synchronization
|
||||
+ */
|
||||
+ private final Object optOutLock = new Object();
|
||||
+ /**
|
||||
+ * The scheduled task
|
||||
+ */
|
||||
+ private volatile Timer task = null;
|
||||
+
|
||||
+ public Metrics() throws IOException {
|
||||
+ // load the config
|
||||
+ configurationFile = getConfigFile();
|
||||
+ configuration = YamlConfiguration.loadConfiguration(configurationFile);
|
||||
+
|
||||
+ // add some defaults
|
||||
+ configuration.addDefault("opt-out", false);
|
||||
+ configuration.addDefault("guid", UUID.randomUUID().toString());
|
||||
+ configuration.addDefault("debug", false);
|
||||
+
|
||||
+ // Do we need to create the file?
|
||||
+ if (configuration.get("guid", null) == null) {
|
||||
+ configuration.options().header("http://mcstats.org").copyDefaults(true);
|
||||
+ configuration.save(configurationFile);
|
||||
+ }
|
||||
+
|
||||
+ // Load the guid then
|
||||
+ guid = configuration.getString("guid");
|
||||
+ debug = configuration.getBoolean("debug", false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
|
||||
+ * website. Plotters can be added to the graph object returned.
|
||||
+ *
|
||||
+ * @param name The name of the graph
|
||||
+ * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
|
||||
+ */
|
||||
+ public Graph createGraph(final String name) {
|
||||
+ if (name == null) {
|
||||
+ throw new IllegalArgumentException("Graph name cannot be null");
|
||||
+ }
|
||||
+
|
||||
+ // Construct the graph object
|
||||
+ final Graph graph = new Graph(name);
|
||||
+
|
||||
+ // Now we can add our graph
|
||||
+ graphs.add(graph);
|
||||
+
|
||||
+ // and return back
|
||||
+ return graph;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
|
||||
+ *
|
||||
+ * @param graph The name of the graph
|
||||
+ */
|
||||
+ public void addGraph(final Graph graph) {
|
||||
+ if (graph == null) {
|
||||
+ throw new IllegalArgumentException("Graph cannot be null");
|
||||
+ }
|
||||
+
|
||||
+ graphs.add(graph);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a custom data plotter to the default graph
|
||||
+ *
|
||||
+ * @param plotter The plotter to use to plot custom data
|
||||
+ */
|
||||
+ public void addCustomData(final Plotter plotter) {
|
||||
+ if (plotter == null) {
|
||||
+ throw new IllegalArgumentException("Plotter cannot be null");
|
||||
+ }
|
||||
+
|
||||
+ // Add the plotter to the graph o/
|
||||
+ defaultGraph.addPlotter(plotter);
|
||||
+
|
||||
+ // Ensure the default graph is included in the submitted graphs
|
||||
+ graphs.add(defaultGraph);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
|
||||
+ * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
|
||||
+ * ticks.
|
||||
+ *
|
||||
+ * @return True if statistics measuring is running, otherwise false.
|
||||
+ */
|
||||
+ public boolean start() {
|
||||
+ synchronized (optOutLock) {
|
||||
+ // Did we opt out?
|
||||
+ if (isOptOut()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Is metrics already running?
|
||||
+ if (task != null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // Begin hitting the server with glorious data
|
||||
+ task = new Timer("Spigot Metrics Thread", true);
|
||||
+
|
||||
+ task.scheduleAtFixedRate(new TimerTask() {
|
||||
+ private boolean firstPost = true;
|
||||
+
|
||||
+ public void run() {
|
||||
+ try {
|
||||
+ // This has to be synchronized or it can collide with the disable method.
|
||||
+ synchronized (optOutLock) {
|
||||
+ // Disable Task, if it is running and the server owner decided to opt-out
|
||||
+ if (isOptOut() && task != null) {
|
||||
+ task.cancel();
|
||||
+ task = null;
|
||||
+ // Tell all plotters to stop gathering information.
|
||||
+ for (Graph graph : graphs) {
|
||||
+ graph.onOptOut();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // We use the inverse of firstPost because if it is the first time we are posting,
|
||||
+ // it is not a interval ping, so it evaluates to FALSE
|
||||
+ // Each time thereafter it will evaluate to TRUE, i.e PING!
|
||||
+ postPlugin(!firstPost);
|
||||
+
|
||||
+ // After the first post we set firstPost to false
|
||||
+ // Each post thereafter will be a ping
|
||||
+ firstPost = false;
|
||||
+ } catch (IOException e) {
|
||||
+ if (debug) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }, 0, TimeUnit.MINUTES.toMillis(PING_INTERVAL));
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Has the server owner denied plugin metrics?
|
||||
+ *
|
||||
+ * @return true if metrics should be opted out of it
|
||||
+ */
|
||||
+ public boolean isOptOut() {
|
||||
+ synchronized (optOutLock) {
|
||||
+ try {
|
||||
+ // Reload the metrics file
|
||||
+ configuration.load(getConfigFile());
|
||||
+ } catch (IOException ex) {
|
||||
+ if (debug) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||
+ }
|
||||
+ return true;
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ if (debug) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ return configuration.getBoolean("opt-out", false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
||||
+ *
|
||||
+ * @throws java.io.IOException
|
||||
+ */
|
||||
+ public void enable() throws IOException {
|
||||
+ // This has to be synchronized or it can collide with the check in the task.
|
||||
+ synchronized (optOutLock) {
|
||||
+ // Check if the server owner has already set opt-out, if not, set it.
|
||||
+ if (isOptOut()) {
|
||||
+ configuration.set("opt-out", false);
|
||||
+ configuration.save(configurationFile);
|
||||
+ }
|
||||
+
|
||||
+ // Enable Task, if it is not running
|
||||
+ if (task == null) {
|
||||
+ start();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||
+ *
|
||||
+ * @throws java.io.IOException
|
||||
+ */
|
||||
+ public void disable() throws IOException {
|
||||
+ // This has to be synchronized or it can collide with the check in the task.
|
||||
+ synchronized (optOutLock) {
|
||||
+ // Check if the server owner has already set opt-out, if not, set it.
|
||||
+ if (!isOptOut()) {
|
||||
+ configuration.set("opt-out", true);
|
||||
+ configuration.save(configurationFile);
|
||||
+ }
|
||||
+
|
||||
+ // Disable Task, if it is running
|
||||
+ if (task != null) {
|
||||
+ task.cancel();
|
||||
+ task = null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
|
||||
+ *
|
||||
+ * @return the File object for the config file
|
||||
+ */
|
||||
+ public File getConfigFile() {
|
||||
+ // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
|
||||
+ // is to abuse the plugin object we already have
|
||||
+ // plugin.getDataFolder() => base/plugins/PluginA/
|
||||
+ // pluginsFolder => base/plugins/
|
||||
+ // The base is not necessarily relative to the startup directory.
|
||||
+ // File pluginsFolder = plugin.getDataFolder().getParentFile();
|
||||
+
|
||||
+ // return => base/plugins/PluginMetrics/config.yml
|
||||
+ return new File(new File((File) MinecraftServer.getServer().options.valueOf("plugins"), "PluginMetrics"), "config.yml");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Generic method that posts a plugin to the metrics website
|
||||
+ */
|
||||
+ private void postPlugin(final boolean isPing) throws IOException {
|
||||
+ // Server software specific section
|
||||
+ String pluginName = "Spigot";
|
||||
+ boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
||||
+ String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown";
|
||||
+ String serverVersion = Bukkit.getVersion();
|
||||
+ int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
|
||||
+
|
||||
+ // END server software specific section -- all code below does not use any code outside of this class / Java
|
||||
+
|
||||
+ // Construct the post data
|
||||
+ final StringBuilder data = new StringBuilder();
|
||||
+
|
||||
+ // The plugin's description file containg all of the plugin data such as name, version, author, etc
|
||||
+ data.append(encode("guid")).append('=').append(encode(guid));
|
||||
+ encodeDataPair(data, "version", pluginVersion);
|
||||
+ encodeDataPair(data, "server", serverVersion);
|
||||
+ encodeDataPair(data, "players", Integer.toString(playersOnline));
|
||||
+ encodeDataPair(data, "revision", String.valueOf(REVISION));
|
||||
+
|
||||
+ // New data as of R6
|
||||
+ String osname = System.getProperty("os.name");
|
||||
+ String osarch = System.getProperty("os.arch");
|
||||
+ String osversion = System.getProperty("os.version");
|
||||
+ String java_version = System.getProperty("java.version");
|
||||
+ int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
+
|
||||
+ // normalize os arch .. amd64 -> x86_64
|
||||
+ if (osarch.equals("amd64")) {
|
||||
+ osarch = "x86_64";
|
||||
+ }
|
||||
+
|
||||
+ encodeDataPair(data, "osname", osname);
|
||||
+ encodeDataPair(data, "osarch", osarch);
|
||||
+ encodeDataPair(data, "osversion", osversion);
|
||||
+ encodeDataPair(data, "cores", Integer.toString(coreCount));
|
||||
+ encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
|
||||
+ encodeDataPair(data, "java_version", java_version);
|
||||
+
|
||||
+ // If we're pinging, append it
|
||||
+ if (isPing) {
|
||||
+ encodeDataPair(data, "ping", "true");
|
||||
+ }
|
||||
+
|
||||
+ // Acquire a lock on the graphs, which lets us make the assumption we also lock everything
|
||||
+ // inside of the graph (e.g plotters)
|
||||
+ synchronized (graphs) {
|
||||
+ final Iterator<Graph> iter = graphs.iterator();
|
||||
+
|
||||
+ while (iter.hasNext()) {
|
||||
+ final Graph graph = iter.next();
|
||||
+
|
||||
+ for (Plotter plotter : graph.getPlotters()) {
|
||||
+ // The key name to send to the metrics server
|
||||
+ // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top
|
||||
+ // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME
|
||||
+ final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
|
||||
+
|
||||
+ // The value to send, which for the foreseeable future is just the string
|
||||
+ // value of plotter.getValue()
|
||||
+ final String value = Integer.toString(plotter.getValue());
|
||||
+
|
||||
+ // Add it to the http post data :)
|
||||
+ encodeDataPair(data, key, value);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Create the url
|
||||
+ URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName)));
|
||||
+
|
||||
+ // Connect to the website
|
||||
+ URLConnection connection;
|
||||
+
|
||||
+ // Mineshafter creates a socks proxy, so we can safely bypass it
|
||||
+ // It does not reroute POST requests so we need to go around it
|
||||
+ if (isMineshafterPresent()) {
|
||||
+ connection = url.openConnection(Proxy.NO_PROXY);
|
||||
+ } else {
|
||||
+ connection = url.openConnection();
|
||||
+ }
|
||||
+
|
||||
+ connection.setDoOutput(true);
|
||||
+
|
||||
+ // Write the data
|
||||
+ final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
|
||||
+ writer.write(data.toString());
|
||||
+ writer.flush();
|
||||
+
|
||||
+ // Now read the response
|
||||
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
+ final String response = reader.readLine();
|
||||
+
|
||||
+ // close resources
|
||||
+ writer.close();
|
||||
+ reader.close();
|
||||
+
|
||||
+ if (response == null || response.startsWith("ERR")) {
|
||||
+ throw new IOException(response); //Throw the exception
|
||||
+ } else {
|
||||
+ // Is this the first update this hour?
|
||||
+ if (response.contains("OK This is your first update this hour")) {
|
||||
+ synchronized (graphs) {
|
||||
+ final Iterator<Graph> iter = graphs.iterator();
|
||||
+
|
||||
+ while (iter.hasNext()) {
|
||||
+ final Graph graph = iter.next();
|
||||
+
|
||||
+ for (Plotter plotter : graph.getPlotters()) {
|
||||
+ plotter.reset();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
||||
+ *
|
||||
+ * @return true if mineshafter is installed on the server
|
||||
+ */
|
||||
+ private boolean isMineshafterPresent() {
|
||||
+ try {
|
||||
+ Class.forName("mineshafter.MineServer");
|
||||
+ return true;
|
||||
+ } catch (Exception e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first key/value pair
|
||||
+ * MUST be included manually, e.g:</p>
|
||||
+ * <code>
|
||||
+ * StringBuffer data = new StringBuffer();
|
||||
+ * data.append(encode("guid")).append('=').append(encode(guid));
|
||||
+ * encodeDataPair(data, "version", description.getVersion());
|
||||
+ * </code>
|
||||
+ *
|
||||
+ * @param buffer the stringbuilder to append the data pair onto
|
||||
+ * @param key the key value
|
||||
+ * @param value the value
|
||||
+ */
|
||||
+ private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException {
|
||||
+ buffer.append('&').append(encode(key)).append('=').append(encode(value));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Encode text as UTF-8
|
||||
+ *
|
||||
+ * @param text the text to encode
|
||||
+ * @return the encoded text, as UTF-8
|
||||
+ */
|
||||
+ private static String encode(final String text) throws UnsupportedEncodingException {
|
||||
+ return URLEncoder.encode(text, "UTF-8");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Represents a custom graph on the website
|
||||
+ */
|
||||
+ public static class Graph {
|
||||
+
|
||||
+ /**
|
||||
+ * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
|
||||
+ * rejected
|
||||
+ */
|
||||
+ private final String name;
|
||||
+ /**
|
||||
+ * The set of plotters that are contained within this graph
|
||||
+ */
|
||||
+ private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
|
||||
+
|
||||
+ private Graph(final String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the graph's name
|
||||
+ *
|
||||
+ * @return the Graph's name
|
||||
+ */
|
||||
+ public String getName() {
|
||||
+ return name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Add a plotter to the graph, which will be used to plot entries
|
||||
+ *
|
||||
+ * @param plotter the plotter to add to the graph
|
||||
+ */
|
||||
+ public void addPlotter(final Plotter plotter) {
|
||||
+ plotters.add(plotter);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Remove a plotter from the graph
|
||||
+ *
|
||||
+ * @param plotter the plotter to remove from the graph
|
||||
+ */
|
||||
+ public void removePlotter(final Plotter plotter) {
|
||||
+ plotters.remove(plotter);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
+ *
|
||||
+ * @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||
+ */
|
||||
+ public Set<Plotter> getPlotters() {
|
||||
+ return Collections.unmodifiableSet(plotters);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return name.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(final Object object) {
|
||||
+ if (!(object instanceof Graph)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ final Graph graph = (Graph) object;
|
||||
+ return graph.name.equals(name);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
|
||||
+ */
|
||||
+ protected void onOptOut() {
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Interface used to collect custom data for a plugin
|
||||
+ */
|
||||
+ public static abstract class Plotter {
|
||||
+
|
||||
+ /**
|
||||
+ * The plot's name
|
||||
+ */
|
||||
+ private final String name;
|
||||
+
|
||||
+ /**
|
||||
+ * Construct a plotter with the default plot name
|
||||
+ */
|
||||
+ public Plotter() {
|
||||
+ this("Default");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Construct a plotter with a specific plot name
|
||||
+ *
|
||||
+ * @param name the name of the plotter to use, which will show up on the website
|
||||
+ */
|
||||
+ public Plotter(final String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the current value for the plotted point. Since this function defers to an external function it may or may
|
||||
+ * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
|
||||
+ * from any thread so care should be taken when accessing resources that need to be synchronized.
|
||||
+ *
|
||||
+ * @return the current value for the point to be plotted.
|
||||
+ */
|
||||
+ public abstract int getValue();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the column name for the plotted point
|
||||
+ *
|
||||
+ * @return the plotted point's column name
|
||||
+ */
|
||||
+ public String getColumnName() {
|
||||
+ return name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called after the website graphs have been updated
|
||||
+ */
|
||||
+ public void reset() {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return getColumnName().hashCode();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(final Object object) {
|
||||
+ if (!(object instanceof Plotter)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ final Plotter plotter = (Plotter) object;
|
||||
+ return plotter.name.equals(name) && plotter.getValue() == getValue();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ 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 fd5997d..98fcb47 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -35,6 +35,7 @@ public class SpigotConfig
|
||||
static int version;
|
||||
static Map<String, Command> commands;
|
||||
/*========================================================================*/
|
||||
+ private static Metrics metrics;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -55,6 +56,18 @@ public class SpigotConfig
|
||||
{
|
||||
MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "Spigot", entry.getValue() );
|
||||
}
|
||||
+
|
||||
+ if ( metrics == null )
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ metrics = new Metrics();
|
||||
+ metrics.start();
|
||||
+ } catch ( IOException ex )
|
||||
+ {
|
||||
+ Bukkit.getServer().getLogger().log( Level.SEVERE, "Could not start metrics service", ex );
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
static void readConfig(Class<?> clazz, Object instance)
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From 6d1e63d8c59ecc36efdbd54880bb0ca1af9bda2c 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 f9aaf4a..f32f40d 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();
|
||||
}
|
||||
|
||||
+ // 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()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -294,7 +300,16 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
i -= k;
|
||||
- if (i <= 0) {
|
||||
+ // Spigot start
|
||||
+ if (entityliving instanceof EntityPlayer) {
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
|
||||
+ org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entityliving.getBukkitEntity(), item, i);
|
||||
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) return false;
|
||||
+ i = event.getDamage();
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+ if (i <= 0 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -307,7 +322,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.aH())) {
|
||||
+ if (this.isDamaged(i, entityliving.aH(), entityliving)) {
|
||||
entityliving.a(this);
|
||||
--this.count;
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,23 +0,0 @@
|
||||
From 057734283eef7808469dd78e94ea86d4177b8c82 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 0b6e9cf..9179baa 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -142,7 +142,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
|
||||
|
@ -1,36 +0,0 @@
|
||||
From f2da21e80183a5a42d4043949909cb82663ba5cd 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
|
||||
|
||||
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
|
||||
--- 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 {
|
||||
|
||||
CraftWorld world = (CraftWorld) block.getWorld();
|
||||
sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
+ // Spigot start
|
||||
+ if (sign == null) {
|
||||
+ lines = new String[]{"", "", "", ""};
|
||||
+ return;
|
||||
+ }
|
||||
+ // 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();
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 2d698107a735cb7fdfce121d5518a1c8d3761447 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
|
||||
|
||||
This will let you configure how far to track entities in range from players, so that the entity does not render on the client if out of this range.
|
||||
This has multiple benefits:
|
||||
|
||||
1) Less bandwidth. Not sending update packets for entities that are not even close to a player, or even close enough to clearly see.
|
||||
2) Less lag by maps in item frames - Default range is 160 blocks... Many players can track that item frame and cause lag and not even see it.
|
||||
3) Less lag in general - Less work for the server to do
|
||||
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
|
||||
--- 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 {
|
||||
|
||||
public void addEntity(Entity entity, int i, int j, boolean flag) {
|
||||
org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
|
||||
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
if (i > this.e) {
|
||||
i = this.e;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index ed2836a..6421bf2 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -149,4 +149,19 @@ public class SpigotWorldConfig
|
||||
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
|
||||
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange );
|
||||
}
|
||||
+
|
||||
+ public int playerTrackingRange = 48;
|
||||
+ public int animalTrackingRange = 48;
|
||||
+ public int monsterTrackingRange = 48;
|
||||
+ public int miscTrackingRange = 32;
|
||||
+ public int otherTrackingRange = 64;
|
||||
+ private void trackingRange()
|
||||
+ {
|
||||
+ playerTrackingRange = getInt( "entity-tracking-range.players", playerTrackingRange );
|
||||
+ animalTrackingRange = getInt( "entity-tracking-range.animals", animalTrackingRange );
|
||||
+ monsterTrackingRange = getInt( "entity-tracking-range.monsters", monsterTrackingRange );
|
||||
+ miscTrackingRange = getInt( "entity-tracking-range.misc", miscTrackingRange );
|
||||
+ otherTrackingRange = getInt( "entity-tracking-range.other", otherTrackingRange );
|
||||
+ log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange );
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
new file mode 100644
|
||||
index 0000000..4bf4d2a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
@@ -0,0 +1,51 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import net.minecraft.server.Entity;
|
||||
+import net.minecraft.server.EntityExperienceOrb;
|
||||
+import net.minecraft.server.EntityGhast;
|
||||
+import net.minecraft.server.EntityItem;
|
||||
+import net.minecraft.server.EntityItemFrame;
|
||||
+import net.minecraft.server.EntityPainting;
|
||||
+import net.minecraft.server.EntityPlayer;
|
||||
+
|
||||
+public class TrackingRange
|
||||
+{
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the range an entity should be 'tracked' by players and visible in
|
||||
+ * the client.
|
||||
+ *
|
||||
+ * @param entity
|
||||
+ * @param defaultRange Default range defined by Mojang
|
||||
+ * @return
|
||||
+ */
|
||||
+ public static int getEntityTrackingRange(Entity entity, int defaultRange)
|
||||
+ {
|
||||
+ SpigotWorldConfig config = entity.world.spigotConfig;
|
||||
+ if ( entity instanceof EntityPlayer )
|
||||
+ {
|
||||
+ return config.playerTrackingRange;
|
||||
+ } else if ( entity.activationType == 1 )
|
||||
+ {
|
||||
+ return config.monsterTrackingRange;
|
||||
+ } else if ( entity instanceof EntityGhast )
|
||||
+ {
|
||||
+ if ( config.monsterTrackingRange > config.monsterActivationRange )
|
||||
+ {
|
||||
+ return config.monsterTrackingRange;
|
||||
+ } else
|
||||
+ {
|
||||
+ return config.monsterActivationRange;
|
||||
+ }
|
||||
+ } else if ( entity.activationType == 2 )
|
||||
+ {
|
||||
+ return config.animalTrackingRange;
|
||||
+ } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb )
|
||||
+ {
|
||||
+ return config.miscTrackingRange;
|
||||
+ } else
|
||||
+ {
|
||||
+ return config.otherTrackingRange;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,74 +0,0 @@
|
||||
From 55030705cb3ebfa20d6d1f6891eee6b1758a1ca3 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..ef56386 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.g.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.g.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
|
||||
|
@ -1,23 +0,0 @@
|
||||
From 7b20e3085dc0b346f9ffb9f625465e53562ffb70 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
|
||||
|
||||
Removes the sleep forever thread and adds useful names for debugging to all staged thread files.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 84dcfcc..a30f217 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@@ -71,7 +71,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
*/
|
||||
private final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<Integer, CraftTask>();
|
||||
private volatile int currentTick = -1;
|
||||
- private final Executor executor = Executors.newCachedThreadPool();
|
||||
+ private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot
|
||||
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}};
|
||||
private CraftAsyncDebugger debugTail = debugHead;
|
||||
private static final int RECENT_TICKS;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,66 +0,0 @@
|
||||
From cabbfafe4301f951c0eb3d810af5350f45fc4cff 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
|
||||
--- 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
|
||||
|
||||
public static synchronized RegionFile a(File file1, int i, int j) {
|
||||
File file2 = new File(file1, "region");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 95742fa..24d4e76 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;
|
||||
@@ -1019,6 +1021,30 @@ 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.
|
||||
+ synchronized (RegionFileCache.class) {
|
||||
+ // RegionFileCache.a should be RegionFileCache.cache
|
||||
+ Iterator<Map.Entry<File, RegionFile>> i = RegionFileCache.a.entrySet().iterator();
|
||||
+ while(i.hasNext()) {
|
||||
+ Map.Entry<File, RegionFile> entry = i.next();
|
||||
+ File child = entry.getKey().getAbsoluteFile();
|
||||
+ while (child != null) {
|
||||
+ if (child.equals(parentFolder)) {
|
||||
+ i.remove();
|
||||
+ try {
|
||||
+ entry.getValue().c(); // Should be RegionFile.close();
|
||||
+ } catch (IOException ex) {
|
||||
+ getLogger().log(Level.SEVERE, null, ex);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ child = child.getParentFile();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,23 +0,0 @@
|
||||
From 85469a82bd3aa027e89d9b03d6731193eeb238f7 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
|
||||
|
||||
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 bb535c2..93968bd 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 {
|
||||
}
|
||||
|
||||
private <T> T getOverride(String name, T value) {
|
||||
- if ((this.options != null) && (this.options.has(name))) {
|
||||
+ if ((this.options != null) && (this.options.has(name)) && !name.equals( "online-mode")) { // Spigot
|
||||
return (T) this.options.valueOf(name);
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,71 +0,0 @@
|
||||
From 064f79546c3d9ed48f2535918baddf905fe22540 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
|
||||
|
||||
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
|
||||
--- 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();
|
||||
|
||||
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
|
||||
--- 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;
|
||||
+ 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 {
|
||||
this.e = true;
|
||||
return this;
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ public java.util.List<ItemStack> getIngredients()
|
||||
+ {
|
||||
+ return java.util.Arrays.asList( items );
|
||||
+ }
|
||||
+ // 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
|
||||
--- 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;
|
||||
|
||||
public class ShapelessRecipes implements IRecipe {
|
||||
|
||||
- private final ItemStack result;
|
||||
+ public final ItemStack result; // Spigot
|
||||
private final List ingredients;
|
||||
|
||||
public ShapelessRecipes(ItemStack itemstack, List list) {
|
||||
@@ -75,4 +75,11 @@ public class ShapelessRecipes implements IRecipe {
|
||||
public int a() {
|
||||
return this.ingredients.size();
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ public java.util.List<ItemStack> getIngredients()
|
||||
+ {
|
||||
+ return java.util.Collections.unmodifiableList( ingredients );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 37cf2bb33b714e62f1221b6494352bff100c1627 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
|
||||
--- 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 {
|
||||
// Spigot start
|
||||
private final Arrow.Spigot spigot = new Arrow.Spigot()
|
||||
{
|
||||
+ @Override
|
||||
+ public double getDamage()
|
||||
+ {
|
||||
+ return getHandle().e();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setDamage(double damage)
|
||||
+ {
|
||||
+ getHandle().b( damage );
|
||||
+ }
|
||||
};
|
||||
|
||||
public Arrow.Spigot spigot()
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,133 +0,0 @@
|
||||
From 331a947c4c7512a3f2ee370832717fe9229ed725 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
|
||||
|
||||
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 48a882a..51cbdad 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 {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
- this.c(8);
|
||||
+ this.c(world.spigotConfig.hopperTransfer); // Spigot
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+ // Spigot start
|
||||
+ if ( !this.j() )
|
||||
+ {
|
||||
+ this.c( 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();
|
||||
// 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
|
||||
|
||||
Inventory destinationInventory;
|
||||
// Have to special case large chests as they work oddly
|
||||
@@ -260,11 +266,11 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
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
|
||||
return false;
|
||||
}
|
||||
+ int origCount = event.getItem().getAmount(); // Spigot
|
||||
ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), i);
|
||||
-
|
||||
if (itemstack1 == null || itemstack1.count == 0) {
|
||||
if (event.getItem().equals(oitemstack)) {
|
||||
iinventory.update();
|
||||
@@ -274,7 +280,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
// CraftBukkit end
|
||||
return true;
|
||||
}
|
||||
-
|
||||
+ itemstack.count -= origCount - itemstack1.count; // Spigot
|
||||
this.setItem(j, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -379,7 +385,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) {
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
// 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 {
|
||||
iinventory.setItem(i, itemstack1);
|
||||
|
||||
if (ihopper instanceof TileEntityHopper) {
|
||||
- ((TileEntityHopper) ihopper).c(8); // Delay hopper checks
|
||||
+ ((TileEntityHopper) ihopper).c(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
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
+ int origCount = event.getItem().getAmount(); // Spigot
|
||||
ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), -1);
|
||||
|
||||
if (itemstack2 == null || itemstack2.count == 0) {
|
||||
@@ -415,6 +422,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
|
||||
return true;
|
||||
}
|
||||
+ itemstack1.count -= origCount - itemstack2.count; // Spigot
|
||||
|
||||
iinventory.setItem(i, itemstack1);
|
||||
}
|
||||
@@ -502,7 +510,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
|
||||
if (flag) {
|
||||
if (iinventory instanceof TileEntityHopper) {
|
||||
- ((TileEntityHopper) iinventory).c(8);
|
||||
+ ((TileEntityHopper) iinventory).c(((TileEntityHopper) iinventory).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
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -164,4 +164,19 @@ public class SpigotWorldConfig
|
||||
otherTrackingRange = getInt( "entity-tracking-range.other", otherTrackingRange );
|
||||
log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange );
|
||||
}
|
||||
+
|
||||
+ public int hopperTransfer;
|
||||
+ public int hopperCheck;
|
||||
+ public int hopperAmount;
|
||||
+ private void hoppers()
|
||||
+ {
|
||||
+ // Set the tick delay between hopper item movements
|
||||
+ hopperTransfer = getInt( "ticks-per.hopper-transfer", 8 );
|
||||
+ // Set the tick delay between checking for items after the associated
|
||||
+ // container is empty. Default to the hopperTransfer value to prevent
|
||||
+ // hopper sorting machines from becoming out of sync.
|
||||
+ hopperCheck = getInt( "ticks-per.hopper-check", hopperTransfer );
|
||||
+ hopperAmount = getInt( "hopper-amount", 1 );
|
||||
+ log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 296a8b176d18def1f52aec81873d7c68083d39fe 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 1dbce5c..2a15271 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
|
||||
|
@ -1,102 +0,0 @@
|
||||
From 722ea3f2c86af3f7e5819e4766f6211b3898cd17 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.
|
||||
|
||||
Adds BUKKIT-267
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
index 06f9b1f..b97ac4b 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;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
-import org.bukkit.event.entity.CreatureSpawnEvent; // CraftBukkit
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class MobSpawnerAbstract {
|
||||
|
||||
@@ -128,7 +132,12 @@ public abstract class MobSpawnerAbstract {
|
||||
|
||||
entity.f(nbttagcompound);
|
||||
if (entity.world != null) {
|
||||
- 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());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound1;
|
||||
@@ -152,6 +161,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());
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (entity.world != null) {
|
||||
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
}
|
||||
@@ -163,7 +177,12 @@ public abstract class MobSpawnerAbstract {
|
||||
}
|
||||
} else if (entity instanceof EntityLiving && entity.world != null) {
|
||||
((EntityInsentient) entity).a((GroupDataEntity) null);
|
||||
- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit 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 522d6b0..9a3c728 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -36,6 +36,7 @@ import org.bukkit.Statistic.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftStatistic;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@@ -141,6 +142,22 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Mob spawner event
|
||||
+ */
|
||||
+ public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, int spawnerX, int spawnerY, int spawnerZ) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity();
|
||||
+ BlockState state = entity.getWorld().getBlockAt(spawnerX, spawnerY, spawnerZ).getState();
|
||||
+
|
||||
+ if (!(state instanceof CreatureSpawner)) {
|
||||
+ state = null;
|
||||
+ }
|
||||
+
|
||||
+ SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (CreatureSpawner) state);
|
||||
+ entity.getServer().getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Bucket methods
|
||||
*/
|
||||
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From c13065ba778749814980d29d17c6804df9d6d368 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
index 0f7da6b..5a409ae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
@@ -145,7 +145,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
||||
case BURST:
|
||||
return 4;
|
||||
default:
|
||||
- throw new AssertionError(type);
|
||||
+ throw new IllegalStateException(type.toString()); // Spigot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
||||
case 4:
|
||||
return Type.BURST;
|
||||
default:
|
||||
- throw new AssertionError(nbt);
|
||||
+ throw new IllegalStateException(Integer.toString(nbt)); // Spigot
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 8123ddb10e530f8f513253a31a957a0c0cc2b545 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 253a448..c581334 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -942,7 +942,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
private void handleCommand(String s) {
|
||||
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); // Spigot
|
||||
|
||||
CraftPlayer player = this.getPlayer();
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 98fcb47..afd6b56 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -130,4 +130,10 @@ public class SpigotConfig
|
||||
config.addDefault( path, def );
|
||||
return config.getString( path, config.getString( path ) );
|
||||
}
|
||||
+
|
||||
+ public static boolean logCommands;
|
||||
+ private static void logCommands()
|
||||
+ {
|
||||
+ logCommands = getBoolean( "commands.log", true );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 8757372e0d0333692126e407de47cdba81e824b4 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 24d4e76..7b68460 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1600,6 +1600,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
public List<String> tabCompleteCommand(Player player, String message) {
|
||||
+ // Spigot Start
|
||||
+ if ( (org.spigotmc.SpigotConfig.tabComplete < 0 || message.length() <= org.spigotmc.SpigotConfig.tabComplete) && !message.contains( " " ) )
|
||||
+ {
|
||||
+ return ImmutableList.of();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+
|
||||
List<String> completions = null;
|
||||
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 afd6b56..20634f1 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -136,4 +136,21 @@ public class SpigotConfig
|
||||
{
|
||||
logCommands = getBoolean( "commands.log", true );
|
||||
}
|
||||
+
|
||||
+ public static int tabComplete;
|
||||
+ private static void tabComplete()
|
||||
+ {
|
||||
+ if ( version < 6 )
|
||||
+ {
|
||||
+ boolean oldValue = getBoolean( "commands.tab-complete", true );
|
||||
+ if ( oldValue )
|
||||
+ {
|
||||
+ set( "commands.tab-complete", 0 );
|
||||
+ } else
|
||||
+ {
|
||||
+ set( "commands.tab-complete", -1 );
|
||||
+ }
|
||||
+ }
|
||||
+ tabComplete = getInt( "commands.tab-complete", 0 );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,107 +0,0 @@
|
||||
From e35855cf232e8ca71cad50484959b98e247ae142 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 9cc9581..b98079c 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 {
|
||||
// CraftBukkit end
|
||||
|
||||
if (packethandshakinginsetprotocol.d() > 5) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.9");
|
||||
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot
|
||||
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
||||
this.b.close(chatcomponenttext);
|
||||
} else if (packethandshakinginsetprotocol.d() < 5) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.9");
|
||||
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot
|
||||
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
||||
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 2a15271..e156a5a 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 {
|
||||
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.j.get(gameprofile).e()) { // Should be hasExpired
|
||||
IpBanEntry ipbanentry = this.k.get(socketaddress);
|
||||
|
||||
@@ -379,7 +379,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, 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 7b68460..73d92fd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -706,11 +706,7 @@ public final class CraftServer implements Server {
|
||||
return true;
|
||||
}
|
||||
|
||||
- if (sender instanceof Player) {
|
||||
- sender.sendMessage("Unknown command. Type \"/help\" for help.");
|
||||
- } else {
|
||||
- sender.sendMessage("Unknown command. Type \"help\" for help.");
|
||||
- }
|
||||
+ sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 20634f1..efcd193 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;
|
||||
import java.util.logging.Level;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.Bukkit;
|
||||
+import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -153,4 +154,28 @@ public class SpigotConfig
|
||||
}
|
||||
tabComplete = getInt( "commands.tab-complete", 0 );
|
||||
}
|
||||
+
|
||||
+ public static String whitelistMessage;
|
||||
+ public static String unknownCommandMessage;
|
||||
+ public static String serverFullMessage;
|
||||
+ public static String outdatedClientMessage = "Outdated client! Please use {}";
|
||||
+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
|
||||
+ private static String transform(String s)
|
||||
+ {
|
||||
+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" );
|
||||
+ }
|
||||
+ private static void messages()
|
||||
+ {
|
||||
+ if (version < 4)
|
||||
+ {
|
||||
+ set( "messages.outdated-client", outdatedClientMessage );
|
||||
+ set( "messages.outdated-server", outdatedServerMessage );
|
||||
+ }
|
||||
+
|
||||
+ whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) );
|
||||
+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) );
|
||||
+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) );
|
||||
+ outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) );
|
||||
+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,51 +0,0 @@
|
||||
From 7d365125cbb0941da8dbc0894c426f4bad3cae07 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 39767d0..5ef6865 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -929,7 +929,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
this.m = 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();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0cb803e..dcbf520 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -2107,7 +2107,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
this.methodProfiler.a("playerCheckLight");
|
||||
- if (!this.players.isEmpty()) {
|
||||
+ if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot
|
||||
i = this.random.nextInt(this.players.size());
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 956c628..8868ea3 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -179,4 +179,11 @@ public class SpigotWorldConfig
|
||||
hopperAmount = getInt( "hopper-amount", 1 );
|
||||
log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount );
|
||||
}
|
||||
+
|
||||
+ public boolean randomLightUpdates;
|
||||
+ private void lightUpdates()
|
||||
+ {
|
||||
+ randomLightUpdates = getBoolean( "random-light-updates", false );
|
||||
+ log( "Random Lighting Updates: " + randomLightUpdates );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,63 +0,0 @@
|
||||
From d35c0a27272e11eb32a8202860148c501ee2956f 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
|
||||
|
||||
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 5ef6865..d74586e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -783,6 +783,15 @@ public class Chunk {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
TileEntity tileentity = (TileEntity) iterator.next();
|
||||
+ // Spigot Start
|
||||
+ if ( tileentity instanceof IInventory )
|
||||
+ {
|
||||
+ for ( org.bukkit.craftbukkit.entity.CraftHumanEntity h : new ArrayList<org.bukkit.craftbukkit.entity.CraftHumanEntity>( (List) ( (IInventory) tileentity ).getViewers() ) )
|
||||
+ {
|
||||
+ h.getHandle().closeInventory();
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
|
||||
this.world.a(tileentity);
|
||||
}
|
||||
@@ -792,6 +801,15 @@ public class Chunk {
|
||||
java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity entity = (Entity) iter.next();
|
||||
+ // Spigot Start
|
||||
+ if ( entity instanceof IInventory )
|
||||
+ {
|
||||
+ for ( org.bukkit.craftbukkit.entity.CraftHumanEntity h : new ArrayList<org.bukkit.craftbukkit.entity.CraftHumanEntity>( (List) ( (IInventory) entity ).getViewers() ) )
|
||||
+ {
|
||||
+ h.getHandle().closeInventory();
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
|
||||
// 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 b599eeb..2065e5a 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
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
+ // Spigot Start
|
||||
+ for ( HumanEntity human : new java.util.ArrayList<HumanEntity>( transaction ) )
|
||||
+ {
|
||||
+ human.closeInventory();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
this.b = false;
|
||||
super.b(i);
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From d4363413bc30737605f456aedc7a6f1b85e6de7b 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 c581334..662eb5a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1056,6 +1056,13 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||
+ // Spigot Start
|
||||
+ if ( entity == player )
|
||||
+ {
|
||||
+ disconnect( "Cannot interact with self!" );
|
||||
+ return;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
|
||||
this.player.v();
|
||||
if (entity != null) {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From d6302f62b973c46d0f259f951e2dd9c9785de896 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 856e825..09b34e9 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.inflatedBuffer = 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
|
||||
|
@ -1,51 +0,0 @@
|
||||
From c0e0deda0bfc821c7e234f387f9b28d079c692a8 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 e74e6d6..2a192e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1461,6 +1461,7 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
// 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.vehicle.passenger = null;
|
||||
@@ -1496,6 +1497,17 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Spigot Start
|
||||
+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4 ) )
|
||||
+ {
|
||||
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
|
||||
+ pluginManager.callEvent( event );
|
||||
+ if ( event.isCancelled() )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // 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 381ba31..1fc7a22 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
|
||||
|
@ -1,26 +0,0 @@
|
||||
From b3497c286e366bd54813d98a74c2041fe298fb28 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
|
||||
|
||||
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 e156a5a..4c5d77e 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);
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
|
||||
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||
+ // Spigot Start
|
||||
+ if (entityplayer.playerConnection.isDisconnected()) {
|
||||
+ return entityplayer;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
|
||||
location = respawnEvent.getRespawnLocation();
|
||||
entityplayer.reset();
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,22 +0,0 @@
|
||||
From 71ca2b1633955973b3a1d8fd74fda0f79fbe9826 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
|
||||
--- 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
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
private boolean isOn;
|
||||
- private static Map b = new HashMap();
|
||||
+ private static Map b = new java.util.WeakHashMap(); // Spigot
|
||||
|
||||
private boolean a(World world, int i, int j, int k, boolean flag) {
|
||||
if (!b.containsKey(world)) {
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,85 +0,0 @@
|
||||
From 87d34d87e622b96a4369337e20b7fc5135a5c4db 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 1fc7a22..d091bcf 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
|
||||
|
||||
List list = this.world.getEntities(this, axisalignedbb);
|
||||
|
||||
- if (list != null) {
|
||||
+ if (list != null && this.R()) { // Spigot: Add this.R() condition
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index a180c89..dbe58b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1495,7 +1495,7 @@ public abstract class EntityLiving extends Entity {
|
||||
protected void bn() {
|
||||
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
- if (list != null && !list.isEmpty()) {
|
||||
+ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() 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 3a0d679..367472d 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 {
|
||||
public double maxHealthCache;
|
||||
public boolean joining = true;
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ public boolean collidesWithEntities = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean Q()
|
||||
+ {
|
||||
+ return this.collidesWithEntities && super.Q();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean R()
|
||||
+ {
|
||||
+ return this.collidesWithEntities && super.R();
|
||||
+ }
|
||||
+ // 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 4d2374d..a5002d8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1290,6 +1290,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Spigot start
|
||||
private final Player.Spigot spigot = new Player.Spigot()
|
||||
{
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean getCollidesWithEntities()
|
||||
+ {
|
||||
+ return getHandle().collidesWithEntities;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCollidesWithEntities(boolean collides)
|
||||
+ {
|
||||
+ getHandle().collidesWithEntities = collides;
|
||||
+ getHandle().k = collides; // First boolean of Entity
|
||||
+ }
|
||||
};
|
||||
|
||||
public Player.Spigot spigot()
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From c26ed0885fe7d9a9a567a91574c8d77aa8ab9068 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 21cf068..007fb86 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -583,11 +583,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
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.ticks % 6000 == 0) {
|
||||
+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
|
||||
this.l.b();
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 324a21ec3861a69a7dd3837fb0f4c1b813f00b34 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 e026c1f..96d763b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -403,6 +403,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();
|
||||
+ }
|
||||
};
|
||||
|
||||
public Spigot spigot()
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From dcee57c4729f137fa10d740b99cfe99c2d46ddbf 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 a5002d8..fd64fcd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1162,7 +1162,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setFlySpeed(float value) {
|
||||
validateSpeed(value);
|
||||
EntityPlayer player = getHandle();
|
||||
- player.abilities.flySpeed = value / 2f;
|
||||
+ player.abilities.flySpeed = Math.max( value, 0.0001f ) / 2f; // Spigot
|
||||
player.updateAbilities();
|
||||
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setWalkSpeed(float value) {
|
||||
validateSpeed(value);
|
||||
EntityPlayer player = getHandle();
|
||||
- player.abilities.walkSpeed = value / 2f;
|
||||
+ player.abilities.walkSpeed = Math.max( value, 0.0001f ) / 2f; // Spigot
|
||||
player.updateAbilities();
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 2732a7fe07b2bad4ca22938a4e99b26bc2f74665 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 d091bcf..c3a0dc3 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
|
||||
// Update client
|
||||
if (this instanceof EntityPlayer) {
|
||||
((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
|
||||
+ // Spigot Start
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();
|
||||
+ // Spigot End
|
||||
}
|
||||
return;
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From eadf3b254418dadd61660c01c83a9970b6637ff7 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 e943676..7320a88 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.bE() != null && entityhuman.bE().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.bE().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
|
||||
|
@ -1,50 +0,0 @@
|
||||
From 9dcf96ddd617afe5aa500b21e38280ee90a58e22 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
|
||||
--- 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 {
|
||||
|
||||
private void a(World world) {
|
||||
if (this.e == null) {
|
||||
+ // Spigot Start
|
||||
+ if ( world.spigotConfig.saveStructureInfo )
|
||||
+ {
|
||||
this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
+ } else
|
||||
+ {
|
||||
+ this.e = new PersistentStructure( this.a() );
|
||||
+ }
|
||||
+ // Spigot End
|
||||
if (this.e == null) {
|
||||
this.e = new PersistentStructure(this.a());
|
||||
world.a(this.a(), (PersistentBase) this.e);
|
||||
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
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -186,4 +186,16 @@ public class SpigotWorldConfig
|
||||
randomLightUpdates = getBoolean( "random-light-updates", false );
|
||||
log( "Random Lighting Updates: " + randomLightUpdates );
|
||||
}
|
||||
+
|
||||
+ public boolean saveStructureInfo;
|
||||
+ private void structureInfo()
|
||||
+ {
|
||||
+ saveStructureInfo = getBoolean( "save-structure-info", true );
|
||||
+ log( "Structure Info Saving: " + saveStructureInfo );
|
||||
+ if ( !saveStructureInfo )
|
||||
+ {
|
||||
+ log( "*** WARNING *** You have selected to NOT save structure info. This may cause structures such as fortresses to not spawn mobs when updating to 1.7!" );
|
||||
+ log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" );
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 5d9bc356a50009e0cb33eaaad4473133e5747660 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 95beb11..0f1bcc7 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 {
|
||||
}
|
||||
|
||||
// ++this.age; // CraftBukkit - Moved up
|
||||
- if (!this.world.isStatic && this.age >= 6000) {
|
||||
+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
|
||||
// CraftBukkit start - fire ItemDespawnEvent
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
this.age = 0;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 48ae475..6d31363 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -198,4 +198,11 @@ public class SpigotWorldConfig
|
||||
log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" );
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public int itemDespawnRate;
|
||||
+ private void itemDespawnRate()
|
||||
+ {
|
||||
+ itemDespawnRate = getInt( "item-despawn-rate", 6000 );
|
||||
+ log( "Item Despawn Rate: " + itemDespawnRate );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user