chore: cleanup annotations in api adventure patch
This commit is contained in:
@@ -18,21 +18,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void resetPlayerWeather();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gives the player the amount of experience specified.
|
||||
+ *
|
||||
+ * @param amount Exp amount to give
|
||||
+ */
|
||||
+ public default void giveExp(int amount) {
|
||||
+ giveExp(amount, false);
|
||||
+ }
|
||||
/**
|
||||
* Gives the player the amount of experience specified.
|
||||
*
|
||||
* @param amount Exp amount to give
|
||||
+ * @param applyMending Mend players items with mending, with same behavior as picking up orbs. calls {@link #applyMending(int)}
|
||||
*/
|
||||
- public void giveExp(int amount);
|
||||
+ public default void giveExp(int amount) {
|
||||
+ giveExp(amount, false);
|
||||
+ }
|
||||
+ /**
|
||||
+ * Gives the player the amount of experience specified.
|
||||
+ *
|
||||
+ * @param amount Exp amount to give
|
||||
+ * @param applyMending Mend players items with mending, with same behavior as picking up orbs. calls {@link #applyMending(int)}
|
||||
+ */
|
||||
+ public void giveExp(int amount, boolean applyMending);
|
||||
+
|
||||
+ /**
|
||||
|
||||
@@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param message kick message
|
||||
*/
|
||||
void kick(final @Nullable net.kyori.adventure.text.Component message);
|
||||
void kick(final net.kyori.adventure.text.@Nullable Component message);
|
||||
+
|
||||
+ /**
|
||||
+ * Kicks player with custom kick message and cause.
|
||||
@@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @param message kick message
|
||||
+ * @param cause kick cause
|
||||
+ */
|
||||
+ void kick(final @Nullable net.kyori.adventure.text.Component message, @NotNull org.bukkit.event.player.PlayerKickEvent.Cause cause);
|
||||
+ void kick(final net.kyori.adventure.text.@Nullable Component message, org.bukkit.event.player.PlayerKickEvent.@NotNull Cause cause);
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.damager = damager;
|
||||
+ // Paper start - add critical damage API
|
||||
+ this.critical = critical;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Shows this damage instance was critical.
|
||||
+ * The damage instance can be critical if the attacking player met the respective conditions.
|
||||
@@ -44,8 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ public boolean isCritical() {
|
||||
+ return this.critical;
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
/**
|
||||
* Returns the entity that damaged the defender.
|
||||
*
|
||||
|
||||
@@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
public @NotNull net.kyori.adventure.text.Component displayName() {
|
||||
public net.kyori.adventure.text.@NotNull Component displayName() {
|
||||
return Bukkit.getServer().getItemFactory().displayName(this);
|
||||
}
|
||||
+
|
||||
|
||||
@@ -194,8 +194,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * recipes.
|
||||
*
|
||||
- * This includes it's name, description and other visible tags.
|
||||
- *
|
||||
- * @return a AdvancementDisplay object, or null if not set.
|
||||
+ * @return the display info
|
||||
+ */
|
||||
*/
|
||||
- @Nullable
|
||||
- AdvancementDisplay getDisplay();
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ io.papermc.paper.advancement.AdvancementDisplay getDisplay();
|
||||
+
|
||||
@@ -205,13 +209,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * completes the advancement. Will return the same as
|
||||
+ * {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an
|
||||
+ * {@link io.papermc.paper.advancement.AdvancementDisplay} is present.
|
||||
*
|
||||
- * @return a AdvancementDisplay object, or null if not set.
|
||||
+ *
|
||||
+ * @return the display name
|
||||
+ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName()
|
||||
*/
|
||||
- @Nullable
|
||||
- AdvancementDisplay getDisplay();
|
||||
+ */
|
||||
+ @NotNull net.kyori.adventure.text.Component displayName();
|
||||
+
|
||||
+ /**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.amount = amount;
|
||||
this.regainReason = regainReason;
|
||||
+ this.isFastRegen = isFastRegen; // Paper
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Paper start - Add getter for isFastRegen
|
||||
+ /**
|
||||
+ * Is this event a result of the fast regeneration mechanic
|
||||
@@ -35,8 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ public boolean isFastRegen() {
|
||||
+ return isFastRegen;
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
/**
|
||||
* Gets the amount of regained health
|
||||
*
|
||||
|
||||
@@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public void setConsumeArrow(boolean consumeArrow) {
|
||||
+ this.setConsumeItem(consumeArrow);
|
||||
+ }
|
||||
+
|
||||
|
||||
+ @Deprecated
|
||||
+ public boolean getConsumeArrow() {
|
||||
+ return this.shouldConsumeItem();
|
||||
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
|
||||
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Entity projectile, final float force) {
|
||||
+ this(shooter, bow, arrowItem, projectile, EquipmentSlot.HAND, force, true);
|
||||
|
||||
@@ -110,10 +110,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public WorldCreator(@NotNull String name) {
|
||||
- if (name == null) {
|
||||
- throw new IllegalArgumentException("World name cannot be null");
|
||||
- }
|
||||
-
|
||||
- this.name = name;
|
||||
- this.seed = (new Random()).nextLong();
|
||||
+ // Paper start
|
||||
+ this(name, getWorldKey(name));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ private static NamespacedKey getWorldKey(String name) {
|
||||
+ final String mainLevelName = Bukkit.getUnsafe().getMainLevelName();
|
||||
+ if (name.equals(mainLevelName)) {
|
||||
@@ -124,10 +128,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return NamespacedKey.minecraft("the_end");
|
||||
+ } else {
|
||||
+ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_"));
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- this.name = name;
|
||||
+
|
||||
+ /**
|
||||
+ * Creates an empty WorldCreator for the given world name and key
|
||||
+ *
|
||||
@@ -139,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ throw new IllegalArgumentException("World name and key cannot be null");
|
||||
+ }
|
||||
+ this.name = levelName;
|
||||
this.seed = (new Random()).nextLong();
|
||||
+ this.seed = (new Random()).nextLong();
|
||||
+ this.key = worldKey;
|
||||
+ }
|
||||
+
|
||||
@@ -183,8 +186,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @NotNull
|
||||
+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) {
|
||||
+ return new WorldCreator(worldKey);
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
/**
|
||||
* Copies the options from the specified world
|
||||
*
|
||||
|
||||
@@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
super(entity, from, to);
|
||||
this.searchRadius = searchRadius;
|
||||
+ this.type = org.bukkit.PortalType.CUSTOM; // Paper
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) {
|
||||
+ super(entity, from, to);
|
||||
@@ -63,11 +63,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public void setTo(@Nullable final Location to) {
|
||||
+ super.setTo(to);
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
/**
|
||||
* Set the Block radius to search in for available portals.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
|
||||
|
||||
@@ -16,25 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * Removes the given ItemStacks from the storage contents of the inventory.
|
||||
+ * For removing ItemStacks from the inventories that have other content groups,
|
||||
+ * like Player inventories, see {@link #removeItemAnySlot(ItemStack...)}.
|
||||
* <p>
|
||||
* It will try to remove 'as much as possible' from the types and amounts
|
||||
* you give as arguments.
|
||||
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
* @param items The ItemStacks to remove
|
||||
* @return A HashMap containing items that couldn't be removed.
|
||||
* @throws IllegalArgumentException if items is null
|
||||
+ * @see #removeItemAnySlot(ItemStack...)
|
||||
*/
|
||||
@NotNull
|
||||
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
|
||||
+ * <p>
|
||||
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
|
||||
+ * method will check all possible slots in the inventory, rather than just the main
|
||||
+ * storage contents.
|
||||
+ * <p>
|
||||
+ * It will try to remove 'as much as possible' from the types and amounts
|
||||
+ * you give as arguments.
|
||||
@@ -51,11 +32,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @param items The ItemStacks to remove
|
||||
+ * @return A HashMap containing items that couldn't be removed.
|
||||
+ * @throws IllegalArgumentException if items is null
|
||||
+ * @see #removeItemAnySlot(ItemStack...)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
|
||||
+ * <p>
|
||||
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
|
||||
+ * method will check all possible slots in the inventory, rather than just the main
|
||||
+ * storage contents.
|
||||
* <p>
|
||||
* It will try to remove 'as much as possible' from the types and amounts
|
||||
* you give as arguments.
|
||||
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
* @throws IllegalArgumentException if items is null
|
||||
*/
|
||||
@NotNull
|
||||
- public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
+ public HashMap<Integer, ItemStack> removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
|
||||
/**
|
||||
* Returns all ItemStacks from the inventory
|
||||
*
|
||||
|
||||
@@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, net.kyori.adventure.translat
|
||||
* @return the name of the enchantment with {@code level} applied
|
||||
*/
|
||||
public abstract @NotNull net.kyori.adventure.text.Component displayName(int level);
|
||||
public abstract net.kyori.adventure.text.@NotNull Component displayName(int level);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this enchantment can be found in villager trades.
|
||||
|
||||
@@ -2194,7 +2194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- javaPlugin.init(loader, loader.server, description, dataFolder, file, this);
|
||||
+ javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
@@ -2219,7 +2219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ Class<? extends org.bukkit.configuration.serialization.ConfigurationSerializable> serializable = clazz.asSubclass(org.bukkit.configuration.serialization.ConfigurationSerializable.class);
|
||||
+ org.bukkit.configuration.serialization.ConfigurationSerialization.unregisterClass(serializable);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup getGroup() {
|
||||
|
||||
@@ -8,6 +8,7 @@ Subject: [PATCH] Test changes
|
||||
- Ignore package-private methods for nullability annotations
|
||||
- Add excludes for classes which don't pass
|
||||
|
||||
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
@@ -146,6 +147,21 @@ diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bu
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -0,0 +0,0 @@ public class AnnotationTest {
|
||||
"Lorg/jetbrains/annotations/Nullable;",
|
||||
"Lorg/jetbrains/annotations/NotNull;",
|
||||
"Lorg/jetbrains/annotations/Contract;",
|
||||
- "Lorg/bukkit/UndefinedNullability;"
|
||||
+ "Lorg/bukkit/UndefinedNullability;",
|
||||
+ // Paper start
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/MonotonicNonNull;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/NonNull;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/Nullable;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/PolyNull;",
|
||||
+ // Paper end
|
||||
};
|
||||
|
||||
private static final String[] EXCLUDED_CLASSES = {
|
||||
@@ -0,0 +0,0 @@ public class AnnotationTest {
|
||||
"org/bukkit/util/io/Wrapper",
|
||||
"org/bukkit/plugin/java/PluginClassLoader",
|
||||
@@ -176,7 +192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } else if (method.invisibleTypeAnnotations != null) {
|
||||
+ dance: for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ warn = false;
|
||||
+ break dance; // cha cha real smooth
|
||||
+ }
|
||||
@@ -197,7 +213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (method.invisibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ continue dancing;
|
||||
+ }
|
||||
+ }
|
||||
@@ -272,12 +288,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
- private static boolean isWellAnnotated(@Nullable List<AnnotationNode> annotations) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
- private static boolean isWellAnnotated(@Nullable List<AnnotationNode> annotations) {
|
||||
+
|
||||
+ private static boolean isWellAnnotated(@Nullable List<? extends AnnotationNode> annotations) { // Paper
|
||||
if (annotations == null) {
|
||||
return false;
|
||||
|
||||
@@ -3400,12 +3400,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
+
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public int getPing() {
|
||||
+ throw new UnsupportedOperationException( "Not supported yet." );
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@@ -3611,7 +3611,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public CustomTimingsHandler(@NotNull String name) {
|
||||
- this(name, null);
|
||||
- }
|
||||
-
|
||||
+ Timing timing;
|
||||
|
||||
- public CustomTimingsHandler(@NotNull String name, @Nullable CustomTimingsHandler parent) {
|
||||
- this.name = name;
|
||||
- this.parent = parent;
|
||||
@@ -3634,7 +3635,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- long avg = time / count;
|
||||
-
|
||||
- printStream.println(" " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations);
|
||||
- }
|
||||
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
|
||||
+ try {
|
||||
+ final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class);
|
||||
+ ofSafe.setAccessible(true);
|
||||
+ timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null);
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
|
||||
+ timing = Timings.NULL_HANDLER;
|
||||
}
|
||||
- printStream.println("# Version " + Bukkit.getVersion());
|
||||
- int entities = 0;
|
||||
- int livingEntities = 0;
|
||||
@@ -3644,8 +3654,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
- printStream.println("# Entities " + entities);
|
||||
- printStream.println("# LivingEntities " + livingEntities);
|
||||
- }
|
||||
-
|
||||
+ handler = timing;
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Resets all timings.
|
||||
- */
|
||||
@@ -3657,7 +3668,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
- TimingsCommand.timingStart = System.nanoTime();
|
||||
- }
|
||||
-
|
||||
+ public void startTiming() { handler.startTiming(); }
|
||||
+ public void stopTiming() { handler.stopTiming(); }
|
||||
|
||||
- /**
|
||||
- * Ticked every tick by CraftBukkit to count the number of times a timer
|
||||
- * caused TPS loss.
|
||||
@@ -3673,8 +3686,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ Timing timing;
|
||||
|
||||
-
|
||||
- /**
|
||||
- * Starts timing to track a section of code.
|
||||
- */
|
||||
@@ -3685,19 +3697,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (parent != null && ++parent.timingDepth == 1) {
|
||||
- parent.start = start;
|
||||
- }
|
||||
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
|
||||
+ try {
|
||||
+ final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class);
|
||||
+ ofSafe.setAccessible(true);
|
||||
+ timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null);
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
|
||||
+ timing = Timings.NULL_HANDLER;
|
||||
}
|
||||
+ handler = timing;
|
||||
}
|
||||
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Stops timing a section of code.
|
||||
- */
|
||||
@@ -3716,9 +3718,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ public void startTiming() { handler.startTiming(); }
|
||||
+ public void stopTiming() { handler.stopTiming(); }
|
||||
|
||||
-
|
||||
- /**
|
||||
- * Reset this timer, setting all values to zero.
|
||||
- */
|
||||
|
||||
Reference in New Issue
Block a user