Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 93e39ce1 Clarify documentation regarding getMaterial with legacyName = true c3aeaea0 Improve dependency tracker 14c9d275 Add support for transitive depends in load access warning c8afe560 SPIGOT-5526: Add EntityEnterBlockEvent 6bb6f07d SPIGOT-5548: Show error that hints towards plugins misusing reflection ed75537d SPIGOT-5546: Fix bad depend access using wrong provider in message 4e4c0ee9 Fix buggy classloader warning triggering for all classes 89586a4c Print warning when loading classes from depends that have not been specified d4fe9680 Fix bug where disablePlugin could remove ConfigurationSerializable classes from other plugins 85e683b7 Add additional checkstyle checks 612fd8e1 Correct max page count in BookMeta docs fa8a9781 Correct max title length in BookMeta docs CraftBukkit Changes: ab13a117 SPIGOT-5550: Cancelled ProjectileLaunchEvent still plays sound for eggs 44016b1d SPIGOT-5538: Using javaw to run GUI prints input error e653ae76 SPIGOT-5526: Call EntityEnterBlockEvent for bees trying to enter hives 6515ea49 SPIGOT-5537: Bee nests generated by growing trees near flower have no bees d82b3149 Remove unused CraftWorld.getId method 10763a88 Change some block == AIR checks to isAir to catch CAVE_AIR Spigot Changes: f2c1cd15 Rebuild patches bcd458ad Reformat patches
This commit is contained in:
parent
c9eebbb802
commit
5792c8626a
74 changed files with 596 additions and 597 deletions
|
@ -1,4 +1,4 @@
|
|||
From f6e991d49e6476fb94781ddaa0ec805bdd354243 Mon Sep 17 00:00:00 2001
|
||||
From 060742f1c76bdb9323a7208250965788502ad043 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 29 Feb 2016 18:48:17 -0600
|
||||
Subject: [PATCH] Timings v2
|
||||
|
@ -3139,7 +3139,7 @@ index 00000000..5989ee21
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 0822b8e5..940c643d 100644
|
||||
index bbc68de0..a85b8b86 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -574,7 +574,6 @@ public final class Bukkit {
|
||||
|
@ -3151,11 +3151,11 @@ index 0822b8e5..940c643d 100644
|
|||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 11c5c205..c197e381 100644
|
||||
index 042db4f5..f4f0f3da 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1250,6 +1250,26 @@ public interface Server extends PluginMessageRecipient {
|
||||
throw new UnsupportedOperationException( "Not supported yet." );
|
||||
@@ -1248,6 +1248,26 @@ public interface Server extends PluginMessageRecipient {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -3456,10 +3456,10 @@ index 81e4fa57..f020cb04 100644
|
|||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
deleted file mode 100644
|
||||
index 6023e4f6..00000000
|
||||
index 2a145d85..00000000
|
||||
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
+++ /dev/null
|
||||
@@ -1,253 +0,0 @@
|
||||
@@ -1,250 +0,0 @@
|
||||
-package org.bukkit.command.defaults;
|
||||
-
|
||||
-import com.google.common.collect.ImmutableList;
|
||||
|
@ -3506,26 +3506,23 @@ index 6023e4f6..00000000
|
|||
-
|
||||
- // Spigot start - redesigned Timings Command
|
||||
- public void executeSpigotTimings(@NotNull CommandSender sender, @NotNull String[] args) {
|
||||
- if ( "on".equals( args[0] ) )
|
||||
- {
|
||||
- ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( true );
|
||||
- if ("on".equals(args[0])) {
|
||||
- ((SimplePluginManager) Bukkit.getPluginManager()).useTimings(true);
|
||||
- CustomTimingsHandler.reload();
|
||||
- sender.sendMessage( "Enabled Timings & Reset" );
|
||||
- sender.sendMessage("Enabled Timings & Reset");
|
||||
- return;
|
||||
- } else if ( "off".equals( args[0] ) )
|
||||
- {
|
||||
- ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( false );
|
||||
- sender.sendMessage( "Disabled Timings" );
|
||||
- } else if ("off".equals(args[0])) {
|
||||
- ((SimplePluginManager) Bukkit.getPluginManager()).useTimings(false);
|
||||
- sender.sendMessage("Disabled Timings");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if ( !Bukkit.getPluginManager().useTimings() )
|
||||
- {
|
||||
- sender.sendMessage( "Please enable timings by typing /timings on" );
|
||||
- if (!Bukkit.getPluginManager().useTimings()) {
|
||||
- sender.sendMessage("Please enable timings by typing /timings on");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- boolean paste = "paste".equals( args[0] );
|
||||
- boolean paste = "paste".equals(args[0]);
|
||||
- if ("reset".equals(args[0])) {
|
||||
- CustomTimingsHandler.reload();
|
||||
- sender.sendMessage("Timings reset");
|
||||
|
@ -3535,27 +3532,26 @@ index 6023e4f6..00000000
|
|||
- File timingFolder = new File("timings");
|
||||
- timingFolder.mkdirs();
|
||||
- File timings = new File(timingFolder, "timings.txt");
|
||||
- ByteArrayOutputStream bout = ( paste ) ? new ByteArrayOutputStream() : null;
|
||||
- ByteArrayOutputStream bout = (paste) ? new ByteArrayOutputStream() : null;
|
||||
- while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt");
|
||||
- PrintStream fileTimings = null;
|
||||
- try {
|
||||
- fileTimings = ( paste ) ? new PrintStream( bout ) : new PrintStream( timings );
|
||||
- fileTimings = (paste) ? new PrintStream(bout) : new PrintStream(timings);
|
||||
-
|
||||
- CustomTimingsHandler.printTimings(fileTimings);
|
||||
- fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" );
|
||||
- fileTimings.println("Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)");
|
||||
-
|
||||
- fileTimings.println( "<spigotConfig>" );
|
||||
- fileTimings.println( Bukkit.spigot().getConfig().saveToString() );
|
||||
- fileTimings.println( "</spigotConfig>" );
|
||||
- fileTimings.println("<spigotConfig>");
|
||||
- fileTimings.println(Bukkit.spigot().getConfig().saveToString());
|
||||
- fileTimings.println("</spigotConfig>");
|
||||
-
|
||||
- if ( paste )
|
||||
- {
|
||||
- new PasteThread( sender, bout ).start();
|
||||
- if (paste) {
|
||||
- new PasteThread(sender, bout).start();
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- sender.sendMessage("Timings written to " + timings.getPath());
|
||||
- sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." );
|
||||
- sender.sendMessage("Paste contents of file into form at http://www.spigotmc.org/go/timings to read results.");
|
||||
-
|
||||
- } catch (IOException e) {
|
||||
- } finally {
|
||||
|
@ -3570,11 +3566,16 @@ index 6023e4f6..00000000
|
|||
- @Override
|
||||
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
- if (!testPermission(sender)) return true;
|
||||
- if (args.length < 1) { // Spigot
|
||||
- if (args.length < 1) { // Spigot
|
||||
- sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
- return false;
|
||||
- }
|
||||
- if (true) { executeSpigotTimings(sender, args); return true; } // Spigot
|
||||
- // Spigot start
|
||||
- if (true) {
|
||||
- executeSpigotTimings(sender, args);
|
||||
- return true;
|
||||
- }
|
||||
- // Spigot end
|
||||
- if (!sender.getServer().getPluginManager().useTimings()) {
|
||||
- sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml");
|
||||
- return true;
|
||||
|
@ -3613,8 +3614,9 @@ index 6023e4f6..00000000
|
|||
- if (separate) {
|
||||
- fileNames.println(pluginIdx + " " + plugin.getDescription().getFullName());
|
||||
- fileTimings.println("Plugin " + pluginIdx);
|
||||
- } else {
|
||||
- fileTimings.println(plugin.getDescription().getFullName());
|
||||
- }
|
||||
- else fileTimings.println(plugin.getDescription().getFullName());
|
||||
- for (RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) {
|
||||
- if (listener instanceof TimedRegisteredListener) {
|
||||
- TimedRegisteredListener trl = (TimedRegisteredListener) listener;
|
||||
|
@ -3663,15 +3665,13 @@ index 6023e4f6..00000000
|
|||
- }
|
||||
-
|
||||
- // Spigot start
|
||||
- private static class PasteThread extends Thread
|
||||
- {
|
||||
- private static class PasteThread extends Thread {
|
||||
-
|
||||
- private final CommandSender sender;
|
||||
- private final ByteArrayOutputStream bout;
|
||||
-
|
||||
- public PasteThread(@NotNull CommandSender sender, @NotNull ByteArrayOutputStream bout)
|
||||
- {
|
||||
- super( "Timings paste thread" );
|
||||
- public PasteThread(@NotNull CommandSender sender, @NotNull ByteArrayOutputStream bout) {
|
||||
- super("Timings paste thread");
|
||||
- this.sender = sender;
|
||||
- this.bout = bout;
|
||||
- }
|
||||
|
@ -3686,38 +3686,35 @@ index 6023e4f6..00000000
|
|||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void run()
|
||||
- {
|
||||
- try
|
||||
- {
|
||||
- HttpURLConnection con = (HttpURLConnection) new URL( "https://timings.spigotmc.org/paste" ).openConnection();
|
||||
- con.setDoOutput( true );
|
||||
- con.setRequestMethod( "POST" );
|
||||
- con.setInstanceFollowRedirects( false );
|
||||
- public void run() {
|
||||
- try {
|
||||
- HttpURLConnection con = (HttpURLConnection) new URL("https://timings.spigotmc.org/paste").openConnection();
|
||||
- con.setDoOutput(true);
|
||||
- con.setRequestMethod("POST");
|
||||
- con.setInstanceFollowRedirects(false);
|
||||
-
|
||||
- OutputStream out = con.getOutputStream();
|
||||
- out.write( bout.toByteArray() );
|
||||
- out.write(bout.toByteArray());
|
||||
- out.close();
|
||||
-
|
||||
- com.google.gson.JsonObject location = new com.google.gson.Gson().fromJson(new java.io.InputStreamReader(con.getInputStream()), com.google.gson.JsonObject.class);
|
||||
- con.getInputStream().close();
|
||||
-
|
||||
- String pasteID = location.get( "key" ).getAsString();
|
||||
- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at https://www.spigotmc.org/go/timings?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 );
|
||||
- String pasteID = location.get("key").getAsString();
|
||||
- sender.sendMessage(ChatColor.GREEN + "Timings results can be viewed at https://www.spigotmc.org/go/timings?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
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0052cc71..4d9ed678 100644
|
||||
index 9b0153f7..9d82a691 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1579,6 +1579,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1573,6 +1573,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
@ -3730,10 +3727,10 @@ index 0052cc71..4d9ed678 100644
|
|||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 2dfb8529..53e5045f 100644
|
||||
index c4ef983e..3c5d8a0e 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -298,7 +298,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -313,7 +313,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3741,7 +3738,7 @@ index 2dfb8529..53e5045f 100644
|
|||
return result.toArray(new Plugin[result.size()]);
|
||||
}
|
||||
|
||||
@@ -337,7 +336,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -352,7 +351,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
if (result != null) {
|
||||
plugins.add(result);
|
||||
|
@ -3750,7 +3747,7 @@ index 2dfb8529..53e5045f 100644
|
|||
}
|
||||
|
||||
return result;
|
||||
@@ -365,7 +364,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -380,7 +379,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@Nullable
|
||||
public synchronized Plugin getPlugin(@NotNull String name) {
|
||||
|
@ -3759,7 +3756,7 @@ index 2dfb8529..53e5045f 100644
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -586,7 +585,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -602,7 +601,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
|
||||
}
|
||||
|
||||
|
@ -3769,7 +3766,7 @@ index 2dfb8529..53e5045f 100644
|
|||
getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
|
||||
} else {
|
||||
getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
|
||||
@@ -783,7 +783,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -806,7 +806,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
@Override
|
||||
public boolean useTimings() {
|
||||
|
@ -3778,7 +3775,7 @@ index 2dfb8529..53e5045f 100644
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -792,6 +792,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -815,6 +815,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
* @param use True if per event timing code should be used
|
||||
*/
|
||||
public void useTimings(boolean use) {
|
||||
|
@ -3787,22 +3784,22 @@ index 2dfb8529..53e5045f 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 1173e433..82e379d1 100644
|
||||
index df8a5dcb..50a51394 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -53,7 +53,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
private final Pattern[] fileFilters = new Pattern[] { Pattern.compile("\\.jar$"), };
|
||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
||||
private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>();
|
||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||
- public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot
|
||||
|
||||
/**
|
||||
* This class was not meant to be constructed explicitly
|
||||
@@ -302,27 +301,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -301,27 +300,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- final CustomTimingsHandler timings = new CustomTimingsHandler("Plugin: " + plugin.getDescription().getFullName() + " Event: " + listener.getClass().getName() + "::" + method.getName()+"("+eventClass.getSimpleName()+")", pluginParentTimer); // Spigot
|
||||
- final CustomTimingsHandler timings = new CustomTimingsHandler("Plugin: " + plugin.getDescription().getFullName() + " Event: " + listener.getClass().getName() + "::" + method.getName() + "(" + eventClass.getSimpleName() + ")", pluginParentTimer); // Spigot
|
||||
- EventExecutor executor = new EventExecutor() {
|
||||
+ EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper
|
||||
@Override
|
||||
|
@ -3830,10 +3827,10 @@ index 1173e433..82e379d1 100644
|
|||
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
} else {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index a0551225..7133be0a 100644
|
||||
index 5830e8b9..36f542a8 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -25,7 +25,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -28,7 +28,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* A ClassLoader for plugins, to allow shared classes across multiple plugins
|
||||
*/
|
||||
|
@ -3867,7 +3864,7 @@ index 5ca863b3..612958a3 100644
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
index b71235f6..3cbe5c2b 100644
|
||||
index 44badfed..3cbe5c2b 100644
|
||||
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
@@ -1,3 +1,26 @@
|
||||
|
@ -3897,7 +3894,7 @@ index b71235f6..3cbe5c2b 100644
|
|||
package org.spigotmc;
|
||||
|
||||
import java.io.PrintStream;
|
||||
@@ -5,155 +28,84 @@ import java.util.Queue;
|
||||
@@ -5,133 +28,84 @@ import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -3923,14 +3920,8 @@ index b71235f6..3cbe5c2b 100644
|
|||
+ * @deprecated
|
||||
+ * @see co.aikar.timings.Timings#of
|
||||
*/
|
||||
-public class CustomTimingsHandler
|
||||
-{
|
||||
+@Deprecated
|
||||
+public final class CustomTimingsHandler {
|
||||
+ private final Timing handler;
|
||||
+ private static Boolean sunReflectAvailable;
|
||||
+ private static Method getCallerClass;
|
||||
|
||||
-public class CustomTimingsHandler {
|
||||
-
|
||||
- private static Queue<CustomTimingsHandler> HANDLERS = new ConcurrentLinkedQueue<CustomTimingsHandler>();
|
||||
- /*========================================================================*/
|
||||
- private final String name;
|
||||
|
@ -3941,21 +3932,23 @@ index b71235f6..3cbe5c2b 100644
|
|||
- private long totalTime = 0;
|
||||
- private long curTickTotal = 0;
|
||||
- private long violations = 0;
|
||||
+ public CustomTimingsHandler(@NotNull String name) {
|
||||
+@Deprecated
|
||||
+public final class CustomTimingsHandler {
|
||||
+ private final Timing handler;
|
||||
+ private static Boolean sunReflectAvailable;
|
||||
+ private static Method getCallerClass;
|
||||
|
||||
public CustomTimingsHandler(@NotNull String name) {
|
||||
- this(name, null);
|
||||
- }
|
||||
+ if (sunReflectAvailable == null) {
|
||||
+ String javaVer = System.getProperty("java.version");
|
||||
+ String[] elements = javaVer.split("\\.");
|
||||
|
||||
- public CustomTimingsHandler(@NotNull String name)
|
||||
- {
|
||||
- this( name, null );
|
||||
- }
|
||||
-
|
||||
- public CustomTimingsHandler(@NotNull String name, @Nullable CustomTimingsHandler parent)
|
||||
- {
|
||||
- public CustomTimingsHandler(@NotNull String name, @Nullable CustomTimingsHandler parent) {
|
||||
- this.name = name;
|
||||
- this.parent = parent;
|
||||
- HANDLERS.add( this );
|
||||
- HANDLERS.add(this);
|
||||
- }
|
||||
+ int major = Integer.parseInt(elements.length >= 2 ? elements[1] : javaVer);
|
||||
+ if (major <= 8) {
|
||||
|
@ -3966,15 +3959,12 @@ index b71235f6..3cbe5c2b 100644
|
|||
- *
|
||||
- * @param printStream output stream
|
||||
- */
|
||||
- public static void printTimings(@NotNull PrintStream printStream)
|
||||
- {
|
||||
- printStream.println( "Minecraft" );
|
||||
- for ( CustomTimingsHandler timings : HANDLERS )
|
||||
- {
|
||||
- public static void printTimings(@NotNull PrintStream printStream) {
|
||||
- printStream.println("Minecraft");
|
||||
- for (CustomTimingsHandler timings : HANDLERS) {
|
||||
- long time = timings.totalTime;
|
||||
- long count = timings.count;
|
||||
- if ( count == 0 )
|
||||
- {
|
||||
- if (count == 0) {
|
||||
- continue;
|
||||
+ try {
|
||||
+ Class<?> reflection = Class.forName("sun.reflect.Reflection");
|
||||
|
@ -3986,29 +3976,25 @@ index b71235f6..3cbe5c2b 100644
|
|||
}
|
||||
- long avg = time / count;
|
||||
-
|
||||
- printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations );
|
||||
- printStream.println(" " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations);
|
||||
- }
|
||||
- printStream.println( "# Version " + Bukkit.getVersion() );
|
||||
- printStream.println("# Version " + Bukkit.getVersion());
|
||||
- int entities = 0;
|
||||
- int livingEntities = 0;
|
||||
- for ( World world : Bukkit.getWorlds() )
|
||||
- {
|
||||
- for (World world : Bukkit.getWorlds()) {
|
||||
- entities += world.getEntities().size();
|
||||
- livingEntities += world.getLivingEntities().size();
|
||||
}
|
||||
- printStream.println( "# Entities " + entities );
|
||||
- printStream.println( "# LivingEntities " + livingEntities );
|
||||
- printStream.println("# Entities " + entities);
|
||||
- printStream.println("# LivingEntities " + livingEntities);
|
||||
- }
|
||||
|
||||
- /**
|
||||
- * Resets all timings.
|
||||
- */
|
||||
- public static void reload()
|
||||
- {
|
||||
- if ( Bukkit.getPluginManager().useTimings() )
|
||||
- {
|
||||
- for ( CustomTimingsHandler timings : HANDLERS )
|
||||
- {
|
||||
- public static void reload() {
|
||||
- if (Bukkit.getPluginManager().useTimings()) {
|
||||
- for (CustomTimingsHandler timings : HANDLERS) {
|
||||
- timings.reset();
|
||||
+ Class calling = null;
|
||||
+ if (sunReflectAvailable) {
|
||||
|
@ -4024,15 +4010,11 @@ index b71235f6..3cbe5c2b 100644
|
|||
- * 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 : HANDLERS )
|
||||
- {
|
||||
- if ( timings.curTickTotal > 50000000 )
|
||||
- {
|
||||
- timings.violations += Math.ceil( timings.curTickTotal / 50000000 );
|
||||
- public static void tick() {
|
||||
- if (Bukkit.getPluginManager().useTimings()) {
|
||||
- for (CustomTimingsHandler timings : HANDLERS) {
|
||||
- if (timings.curTickTotal > 50000000) {
|
||||
- timings.violations += Math.ceil(timings.curTickTotal / 50000000);
|
||||
- }
|
||||
- timings.curTickTotal = 0;
|
||||
- timings.timingDepth = 0; // incase reset messes this up
|
||||
|
@ -4044,14 +4026,11 @@ index b71235f6..3cbe5c2b 100644
|
|||
- /**
|
||||
- * Starts timing to track a section of code.
|
||||
- */
|
||||
- public void startTiming()
|
||||
- {
|
||||
- public void startTiming() {
|
||||
- // If second condtion fails we are already timing
|
||||
- if ( Bukkit.getPluginManager().useTimings() && ++timingDepth == 1 )
|
||||
- {
|
||||
- if (Bukkit.getPluginManager().useTimings() && ++timingDepth == 1) {
|
||||
- start = System.nanoTime();
|
||||
- if ( parent != null && ++parent.timingDepth == 1 )
|
||||
- {
|
||||
- if (parent != null && ++parent.timingDepth == 1) {
|
||||
- parent.start = start;
|
||||
- }
|
||||
- }
|
||||
|
@ -4064,12 +4043,9 @@ index b71235f6..3cbe5c2b 100644
|
|||
- /**
|
||||
- * Stops timing a section of code.
|
||||
- */
|
||||
- public void stopTiming()
|
||||
- {
|
||||
- if ( Bukkit.getPluginManager().useTimings() )
|
||||
- {
|
||||
- if ( --timingDepth != 0 || start == 0 )
|
||||
- {
|
||||
- public void stopTiming() {
|
||||
- if (Bukkit.getPluginManager().useTimings()) {
|
||||
- if (--timingDepth != 0 || start == 0) {
|
||||
- return;
|
||||
- }
|
||||
- long diff = System.nanoTime() - start;
|
||||
|
@ -4077,8 +4053,7 @@ index b71235f6..3cbe5c2b 100644
|
|||
- curTickTotal += diff;
|
||||
- count++;
|
||||
- start = 0;
|
||||
- if ( parent != null )
|
||||
- {
|
||||
- if (parent != null) {
|
||||
- parent.stopTiming();
|
||||
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
|
||||
+ if (plugin != null) {
|
||||
|
@ -4100,8 +4075,7 @@ index b71235f6..3cbe5c2b 100644
|
|||
- /**
|
||||
- * Reset this timer, setting all values to zero.
|
||||
- */
|
||||
- public void reset()
|
||||
- {
|
||||
- public void reset() {
|
||||
- count = 0;
|
||||
- violations = 0;
|
||||
- curTickTotal = 0;
|
||||
|
@ -4114,5 +4088,5 @@ index b71235f6..3cbe5c2b 100644
|
|||
+
|
||||
}
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue