chore: cleanup annotations in api adventure patch

This commit is contained in:
Riley Park
2023-03-23 09:49:24 -07:00
parent c4351787c6
commit 39255145b6
64 changed files with 1308 additions and 1246 deletions

View File

@@ -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.
- */