File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/de/littleprogrammer/guiapi Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,23 @@ public void init() {
4949 String preTrdIndicator = plugin .getServer ().getBukkitVersion ().split ("\\ ." )[2 ];
5050 String trdIndicator = preTrdIndicator .split ("-" )[0 ];
5151
52+ //If version is like 1.21 it threw an error
53+ try {
54+ Integer .parseInt (secIndicator );
55+ } catch (NumberFormatException e ) {
56+ secIndicator = secIndicator .split ("-" )[0 ];
57+ }
58+
59+ //If version is like 1.21 there is no .0 in the input string, but it needs to be for the following method
60+ try {
61+ Integer .parseInt (preTrdIndicator );
62+ } catch (NumberFormatException e ) {
63+ trdIndicator = "0" ;
64+ }
65+
66+ //1.20.x
5267 if (Integer .parseInt (secIndicator ) == 20 ) {
68+ //1.20.2
5369 if (Integer .parseInt (trdIndicator ) >= 2 ) {
5470 version = ServerVersion .POST_1_20_2 ;
5571 } else {
You can’t perform that action at this time.
0 commit comments