Skip to content

Commit 5ce526f

Browse files
committed
better deprecation warning
1 parent 203f3a6 commit 5ce526f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
package com.falsepattern.lib.api;
22

33
final class Deprecation {
4+
private static boolean shortWarning = false;
45
static void warn() {
5-
new Exception("\nDEPRECATION WARNING\nDEPRECATION WARNING\n" +
6-
"Someone used the deprecated FalsePatternLib api from 0.5 and before.\n" +
7-
"This api was deprecated in 0.6.0, and will be REMOVED in FalsePatternLib 0.7! You should probably update your mods.\n" +
8-
"See the following stacktrace for hints on what mod might be the cause.").printStackTrace();
6+
if (shortWarning) {
7+
new DeprecationWarning("FalsePatternLib api deprecation warning. The api will be removed in 0.7! Update your mod. Stacktrace:").printStackTrace();
8+
} else {
9+
new DeprecationWarning("\nDEPRECATION WARNING\nDEPRECATION WARNING\n" +
10+
"Someone used the deprecated FalsePatternLib api from 0.5 and before.\n" +
11+
"This api was deprecated in 0.6.0, and will be REMOVED in FalsePatternLib 0.7! You should probably update your mods.\n" +
12+
"See the following stacktrace for hints on what mod might be the cause.").printStackTrace();
13+
shortWarning = true;
14+
}
15+
}
16+
17+
private static class DeprecationWarning extends Exception {
18+
public DeprecationWarning(String message) {
19+
super(message);
20+
}
921
}
1022
}

0 commit comments

Comments
 (0)