From 5ce526fb4756309d125ed0262125ff6b9245322c Mon Sep 17 00:00:00 2001 From: FalsePattern <30945458+FalsePattern@users.noreply.github.com> Date: Fri, 6 May 2022 13:51:02 +0200 Subject: [PATCH] better deprecation warning --- .../com/falsepattern/lib/api/Deprecation.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/falsepattern/lib/api/Deprecation.java b/src/main/java/com/falsepattern/lib/api/Deprecation.java index 4b1279e..c3f3751 100644 --- a/src/main/java/com/falsepattern/lib/api/Deprecation.java +++ b/src/main/java/com/falsepattern/lib/api/Deprecation.java @@ -1,10 +1,22 @@ package com.falsepattern.lib.api; final class Deprecation { + private static boolean shortWarning = false; static void warn() { - new Exception("\nDEPRECATION WARNING\nDEPRECATION WARNING\n" + - "Someone used the deprecated FalsePatternLib api from 0.5 and before.\n" + - "This api was deprecated in 0.6.0, and will be REMOVED in FalsePatternLib 0.7! You should probably update your mods.\n" + - "See the following stacktrace for hints on what mod might be the cause.").printStackTrace(); + if (shortWarning) { + new DeprecationWarning("FalsePatternLib api deprecation warning. The api will be removed in 0.7! Update your mod. Stacktrace:").printStackTrace(); + } else { + new DeprecationWarning("\nDEPRECATION WARNING\nDEPRECATION WARNING\n" + + "Someone used the deprecated FalsePatternLib api from 0.5 and before.\n" + + "This api was deprecated in 0.6.0, and will be REMOVED in FalsePatternLib 0.7! You should probably update your mods.\n" + + "See the following stacktrace for hints on what mod might be the cause.").printStackTrace(); + shortWarning = true; + } + } + + private static class DeprecationWarning extends Exception { + public DeprecationWarning(String message) { + super(message); + } } }