Apply our patches over Spigot-Server and Spigot-API directly
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user