33import org .bukkit .ChatColor ;
44import org .bukkit .command .CommandSender ;
55
6+ import java .util .ArrayList ;
7+ import java .util .List ;
8+
69public class PluginList {
710 private static String [] AlphaPluginList = new String []{"AntiSwear" , "AyunCord" , "BitchFilter" , "CoreProtect" , "CrackShot" , "CraftBook" , "DupePatch" , "DynMap" , "Essentials" ,
811 "EssenttialsAntiBuild" , "EssentialsChat" , "EssentialsProtect" , "EssentialsSpawn" , "Factions" , "MCore" , "Multiverse" , "MyWarp" , "PermissionSex" , "ProtocolLib" ,
912 "Vault" , "WorldEdit" , "WorldGuard" };
1013 public static void SendPG1ToSender (CommandSender sender ) {
1114 sender .sendMessage (ChatColor .GREEN + "Here is a list of available plugins in the database:" );
1215 int SecondCollumn = 8 ;
16+
1317 for (int i = 1 ; i < 8 ; i ++) {
14- sender .sendMessage (i +". " + AlphaPluginList [i -1 ] + "" +SecondCollumn + ". " + AlphaPluginList [SecondCollumn -1 ]);
18+ int Spaces = 21 -AlphaPluginList [i -1 ].length ();
19+ List <String > spaces = new ArrayList <>();
20+ for (int forInt = 0 ; i < Spaces ; i ++) {
21+ spaces .add (" " );
22+ }
23+ sender .sendMessage (i +". " + AlphaPluginList [i -1 ] + "" + Utils .ListToString (spaces ) + "" +SecondCollumn + ". " + AlphaPluginList [SecondCollumn -1 ]);
1524 SecondCollumn ++;
1625 }
1726 sender .sendMessage (" Page 1 of 12" );
@@ -29,19 +38,25 @@ public static void SendPG2ToSender(CommandSender sender) {
2938 String Col2 = "" ;
3039
3140 // Null checkers for elements in the Array
32- if ( AlphaPluginList [ i - 1 ] != null ) {
41+ try {
3342 Col1 = AlphaPluginList [i -1 ];
34- } else {
43+ } catch ( ArrayIndexOutOfBoundsException y ) {
3544 Col1 = "N/A" ;
3645 }
37- if ( AlphaPluginList [ SecondCollumn - 1 ] != null ) {
46+ try {
3847 Col2 = AlphaPluginList [SecondCollumn -1 ];
39- } else {
48+ } catch ( ArrayIndexOutOfBoundsException a ) {
4049 Col2 = "N/A" ;
4150 }
4251 // _________________________________________
4352
44- sender .sendMessage (i +". " + Col1 + "" + SecondCollumn + ". " + Col2 );
53+ int Spaces = 21 -AlphaPluginList [i -1 ].length ();
54+ List <String > spaces = new ArrayList <>();
55+ for (int forInt = 0 ; i < Spaces ; i ++) {
56+ spaces .add (" " );
57+ }
58+
59+ sender .sendMessage (i +". " + Col1 + "" + Utils .ListToString (spaces ) + "" + SecondCollumn + ". " + Col2 );
4560 SecondCollumn ++;
4661 }
4762
@@ -60,19 +75,25 @@ public static void SendPG3ToSender(CommandSender sender) {
6075 String Col32 ;
6176
6277 // Null checkers for elements in the Array
63- if ( AlphaPluginList [ i - 1 ] != null ) {
78+ try {
6479 Col31 = AlphaPluginList [i -1 ];
65- } else {
80+ } catch ( ArrayIndexOutOfBoundsException e ) {
6681 Col31 = "N/A" ;
6782 }
68- if ( AlphaPluginList [ SecondCollumn - 1 ] != null ) {
83+ try {
6984 Col32 = AlphaPluginList [SecondCollumn -1 ];
70- } else {
85+ } catch ( ArrayIndexOutOfBoundsException e ) {
7186 Col32 = "N/A" ;
7287 }
7388 // _________________________________________
7489
75- sender .sendMessage (i +". " + Col31 + "" + SecondCollumn + ". " + Col32 );
90+ int Spaces = 21 -AlphaPluginList [i -1 ].length ();
91+ List <String > spaces = new ArrayList <>();
92+ for (int forInt = 0 ; i < Spaces ; i ++) {
93+ spaces .add (" " );
94+ }
95+
96+ sender .sendMessage (i +". " + Col31 + "" + Utils .ListToString (spaces ) + "" + SecondCollumn + ". " + Col32 );
7697 SecondCollumn ++;
7798 }
7899
0 commit comments