mirror of
https://github.com/darverdevs/PluginInstaller.git
synced 2024-11-24 18:26:04 -08:00
changed the list text spaces
This commit is contained in:
parent
0fafd12eb1
commit
87723670c0
Binary file not shown.
|
@ -3,6 +3,9 @@ package tech.nully.PluginInstaller;
|
|||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginList {
|
||||
private static String[] AlphaPluginList = new String[]{"AntiSwear", "AyunCord", "BitchFilter", "CoreProtect", "CrackShot", "CraftBook", "DupePatch", "DynMap", "Essentials",
|
||||
"EssenttialsAntiBuild", "EssentialsChat", "EssentialsProtect", "EssentialsSpawn", "Factions", "MCore", "Multiverse", "MyWarp", "PermissionSex", "ProtocolLib",
|
||||
|
@ -10,8 +13,14 @@ public class PluginList {
|
|||
public static void SendPG1ToSender(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
|
||||
int SecondCollumn = 8;
|
||||
|
||||
for (int i = 1; i < 8; i++) {
|
||||
sender.sendMessage(i+". "+ AlphaPluginList[i-1] + "" +SecondCollumn + ". " + AlphaPluginList[SecondCollumn-1]);
|
||||
int Spaces = 21-AlphaPluginList[i-1].length();
|
||||
List<String> spaces = new ArrayList<>();
|
||||
for (int forInt = 0; i < Spaces; i++) {
|
||||
spaces.add(" ");
|
||||
}
|
||||
sender.sendMessage(i+". "+ AlphaPluginList[i-1] + "" + Utils.ListToString(spaces) + "" +SecondCollumn + ". " + AlphaPluginList[SecondCollumn-1]);
|
||||
SecondCollumn++;
|
||||
}
|
||||
sender.sendMessage(" Page 1 of 12");
|
||||
|
@ -29,19 +38,25 @@ public class PluginList {
|
|||
String Col2 = "";
|
||||
|
||||
// Null checkers for elements in the Array
|
||||
if (AlphaPluginList[i-1] != null) {
|
||||
try {
|
||||
Col1 = AlphaPluginList[i-1];
|
||||
} else {
|
||||
} catch (ArrayIndexOutOfBoundsException y) {
|
||||
Col1 = "N/A";
|
||||
}
|
||||
if (AlphaPluginList[SecondCollumn-1] != null) {
|
||||
try {
|
||||
Col2 = AlphaPluginList[SecondCollumn-1];
|
||||
} else {
|
||||
} catch (ArrayIndexOutOfBoundsException a) {
|
||||
Col2 = "N/A";
|
||||
}
|
||||
// _________________________________________
|
||||
|
||||
sender.sendMessage(i+". "+ Col1 + "" + SecondCollumn + ". " + Col2);
|
||||
int Spaces = 21-AlphaPluginList[i-1].length();
|
||||
List<String> spaces = new ArrayList<>();
|
||||
for (int forInt = 0; i < Spaces; i++) {
|
||||
spaces.add(" ");
|
||||
}
|
||||
|
||||
sender.sendMessage(i+". "+ Col1 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col2);
|
||||
SecondCollumn++;
|
||||
}
|
||||
|
||||
|
@ -60,19 +75,25 @@ public class PluginList {
|
|||
String Col32;
|
||||
|
||||
// Null checkers for elements in the Array
|
||||
if (AlphaPluginList[i-1] != null) {
|
||||
try {
|
||||
Col31 = AlphaPluginList[i-1];
|
||||
} else {
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
Col31 = "N/A";
|
||||
}
|
||||
if (AlphaPluginList[SecondCollumn-1] != null) {
|
||||
try {
|
||||
Col32 = AlphaPluginList[SecondCollumn-1];
|
||||
} else {
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
Col32 = "N/A";
|
||||
}
|
||||
// _________________________________________
|
||||
|
||||
sender.sendMessage(i+". "+ Col31 + "" + SecondCollumn + ". " + Col32);
|
||||
int Spaces = 21-AlphaPluginList[i-1].length();
|
||||
List<String> spaces = new ArrayList<>();
|
||||
for (int forInt = 0; i < Spaces; i++) {
|
||||
spaces.add(" ");
|
||||
}
|
||||
|
||||
sender.sendMessage(i+". "+ Col31 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col32);
|
||||
SecondCollumn++;
|
||||
}
|
||||
|
||||
|
|
21
src/main/java/tech/nully/PluginInstaller/Utils.java
Normal file
21
src/main/java/tech/nully/PluginInstaller/Utils.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package tech.nully.PluginInstaller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Utils {
|
||||
public static String ArrayToString(String[] str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : str) {
|
||||
sb.append(s);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String ListToString(List<String> list) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : list) {
|
||||
sb.append(s);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -11,9 +11,10 @@ public class plistCommand implements CommandExecutor {
|
|||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (cmd.getName().equalsIgnoreCase("plist") && sender.isOp() || sender instanceof ConsoleCommandSender) {
|
||||
if (args.length >= 1) {
|
||||
if (args[0] == null) {
|
||||
PluginList.SendPG1ToSender(sender);
|
||||
return true;
|
||||
try {
|
||||
System.out.println(args[0]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
System.out.println("error");
|
||||
}
|
||||
int listPage = 0;
|
||||
boolean PageArgIsInt = false;
|
||||
|
@ -30,13 +31,13 @@ public class plistCommand implements CommandExecutor {
|
|||
switch (PageArg) {
|
||||
case 1:
|
||||
PluginList.SendPG1ToSender(sender);
|
||||
break;
|
||||
return true;
|
||||
case 2:
|
||||
PluginList.SendPG2ToSender(sender);
|
||||
break;
|
||||
return true;
|
||||
case 3:
|
||||
PluginList.SendPG3ToSender(sender);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user