Skip to content

Commit 819cf99

Browse files
authored
Merge pull request #2 from darverdevs/dev-1.1.1-ALPHA
Dev 1.1.1 alpha
2 parents c8906c5 + e5b6621 commit 819cf99

15 files changed

Lines changed: 179 additions & 18 deletions

File tree

.idea/artifacts/EaglerPluginInstaller_jar.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
<artifactId>craftbukkit</artifactId>
3434
<version>1.5.2-R1.0</version>
3535
</dependency>
36+
<dependency>
37+
<groupId>com.googlecode.json-simple</groupId>
38+
<artifactId>json-simple</artifactId>
39+
<version>1.1</version>
40+
</dependency>
3641
</dependencies>
3742

3843

src/main/java/tech/nully/PluginInstaller/InstallCommand.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@ public boolean onCommand(CommandSender snder, Command cmd, String label, String[
3535
try (InputStream in = plugin.openStream()) {
3636

3737
// Installs the plugin
38-
ins.InstallPlugin(in, Install_Jar.toLowerCase());
38+
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
3939
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
4040
return true;
4141
} catch (IOException e) {}
4242
} else if (Install_Jar.equalsIgnoreCase("recommended")) {
4343
InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar")
4444
.toURL().openStream();
45+
InputStream reco2 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentials.jar")
46+
.toURL().openStream();
47+
InputStream reco3 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentialsspawn.jar")
48+
.toURL().openStream();
4549
ins.InstallPlugin(reco1, "DupePatch");
4650
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "DupePatch" + ChatColor.WHITE + " plugin!");
51+
ins.InstallPlugin(reco1, "Essentials");
52+
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Essentials" + ChatColor.WHITE + " plugin!");
53+
ins.InstallPlugin(reco1, "EssentialsSpawn");
54+
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "EssentialsSpawn" + ChatColor.WHITE + " plugin!");
4755
return true;
4856
}
4957
} catch (IOException e) {

src/main/java/tech/nully/PluginInstaller/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void onEnable() {
2525
getServer().getConsoleSender().sendMessage("--------------------------------------------");
2626
getServer().getConsoleSender().sendMessage("--------------------------------------------");
2727
getServer().getConsoleSender().sendMessage(
28-
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " EaglerPluginInstaller V1.1.0 is now Enabled! :D");
28+
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " EaglerPluginInstaller V1.1.1 is now Enabled! :D");
2929
getServer().getConsoleSender().sendMessage("To use PluginInstaller, run the command \"/install <pluginname>\" (\"install <pluginname>\" in console) to install a plugin");
3030
getServer().getConsoleSender().sendMessage("To get a list of installable plugins, use the command \"/plist\" or \"plist\" in console");
3131
getServer().getConsoleSender().sendMessage("You can request to add a new plugin to the database by going to https://github.com/darverdevs/PluginInstallerRepo/tree/main");
@@ -39,7 +39,7 @@ public void onDisable() {
3939
getServer().getConsoleSender().sendMessage("--------------------------------------------");
4040
getServer().getConsoleSender().sendMessage("--------------------------------------------");
4141
getServer().getConsoleSender().sendMessage(
42-
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.1.0 is now Disabled! D:");
42+
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.1.1 is now Disabled! D:");
4343
getServer().getConsoleSender().sendMessage("--------------------------------------------");
4444
getServer().getConsoleSender().sendMessage("--------------------------------------------");
4545
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package tech.nully.PluginInstaller;
2+
3+
import org.bukkit.ChatColor;
4+
import org.bukkit.command.CommandSender;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
9+
public class PluginList {
10+
private static String[] AlphaPluginList = new String[]{"AntiSwear", "AyunCord", "BitchFilter", "CoreProtect", "CrackShot", "CraftBook", "DupePatch", "DynMap", "Essentials",
11+
"EssenttialsAntiBuild", "EssentialsChat", "EssentialsProtect", "EssentialsSpawn", "Factions", "MCore", "Multiverse", "MyWarp", "PermissionSex", "ProtocolLib",
12+
"Vault", "WorldEdit", "WorldGuard"};
13+
public static void SendPG1ToSender(CommandSender sender) {
14+
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
15+
int SecondCollumn = 8;
16+
17+
for (int i = 1; i < 8; i++) {
18+
int Spaces = 21-AlphaPluginList[i-1].length();
19+
List<String> spaces = new ArrayList<>();
20+
for (int forInt = 0; forInt < Spaces; forInt++) {
21+
spaces.add(" ");
22+
}
23+
sender.sendMessage(i+". "+ AlphaPluginList[i-1] + "" + Utils.ListToString(spaces) + "" +SecondCollumn + ". " + AlphaPluginList[SecondCollumn-1]);
24+
SecondCollumn++;
25+
}
26+
sender.sendMessage(" Page 1 of 12");
27+
sender.sendMessage("Note: You do not need to have proper");
28+
sender.sendMessage("capitalization when using the install command");
29+
}
30+
31+
public static void SendPG2ToSender(CommandSender sender) {
32+
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
33+
34+
// List -------------------------------------------------------------
35+
int SecondCollumn = 22;
36+
for (int i = 15; i < 22; i++) {
37+
String Col1;
38+
String Col2;
39+
40+
// Null checkers for elements in the Array
41+
try {
42+
Col1 = AlphaPluginList[i-1];
43+
} catch (ArrayIndexOutOfBoundsException y) {
44+
Col1 = "N/A";
45+
}
46+
try {
47+
Col2 = AlphaPluginList[SecondCollumn-1];
48+
} catch (ArrayIndexOutOfBoundsException a) {
49+
Col2 = "N/A";
50+
}
51+
// _________________________________________
52+
53+
int Spaces = 21-AlphaPluginList[i-1].length();
54+
List<String> spaces = new ArrayList<>();
55+
for (int forInt = 0; forInt < Spaces; forInt++) {
56+
spaces.add(" ");
57+
}
58+
sender.sendMessage(i+". "+ Col1 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col2);
59+
SecondCollumn++;
60+
}
61+
62+
sender.sendMessage(" Page 2 of 12");
63+
sender.sendMessage("Note: You do not need to have proper");
64+
sender.sendMessage("capitalization when using the install command");
65+
}
66+
67+
public static void SendPG3ToSender(CommandSender sender) {
68+
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
69+
70+
// List -------------------------------------------------------------
71+
int SecondCollumn = 36;
72+
for (int i = 29; i < 36; i++) {
73+
String Col31;
74+
String Col32;
75+
76+
// Null checkers for elements in the Array
77+
try {
78+
Col31 = AlphaPluginList[i-1];
79+
} catch (ArrayIndexOutOfBoundsException e) {
80+
Col31 = "N/A";
81+
}
82+
try {
83+
Col32 = AlphaPluginList[SecondCollumn-1];
84+
} catch (ArrayIndexOutOfBoundsException e) {
85+
Col32 = "N/A";
86+
}
87+
// _________________________________________
88+
89+
int Spaces = 21-Col31.length();
90+
List<String> spaces = new ArrayList<>();
91+
for (int forInt = 0; forInt < Spaces; forInt++) {
92+
spaces.add(" ");
93+
}
94+
sender.sendMessage(i+". "+ Col31 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col32);
95+
SecondCollumn++;
96+
}
97+
98+
sender.sendMessage(" Page 3 of 12");
99+
sender.sendMessage("Note: You do not need to have proper");
100+
sender.sendMessage("capitalization when using the install command");
101+
}
102+
}
103+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package tech.nully.PluginInstaller;
2+
3+
import java.util.List;
4+
5+
public class Utils {
6+
public static String ArrayToString(String[] str) {
7+
StringBuilder sb = new StringBuilder();
8+
for (String s : str) {
9+
sb.append(s);
10+
}
11+
return sb.toString();
12+
}
13+
14+
public static String ListToString(List<String> list) {
15+
StringBuilder sb = new StringBuilder();
16+
for (String s : list) {
17+
sb.append(s);
18+
}
19+
return sb.toString();
20+
}
21+
}

src/main/java/tech/nully/PluginInstaller/plistCommand.java

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,44 @@
44
import org.bukkit.command.Command;
55
import org.bukkit.command.CommandExecutor;
66
import org.bukkit.command.CommandSender;
7+
import org.bukkit.command.ConsoleCommandSender;
78

89
public class plistCommand implements CommandExecutor {
910
@Override
1011
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
11-
if (cmd.getName().equalsIgnoreCase("plist")) {
12-
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
13-
// TODO: Finish this list
14-
sender.sendMessage("1. Factions 8. AntiSwear");
15-
sender.sendMessage("2. ProtocolLib 9. ProtocolLib");
16-
sender.sendMessage("3. PermissionSex 10. MCore");
17-
sender.sendMessage("4. Vault 11. ");
18-
sender.sendMessage("5. CoreProtect 12. ");
19-
sender.sendMessage("6. DupePatch 13. ");
20-
sender.sendMessage("7. BitchFilter 14. ");
21-
}
12+
if (cmd.getName().equalsIgnoreCase("plist") && sender.isOp() || sender instanceof ConsoleCommandSender) {
13+
if (args.length >= 1) {
14+
try {
15+
System.out.println(args[0]);
16+
} catch (ArrayIndexOutOfBoundsException e) {
17+
System.out.println("error");
18+
}
19+
int listPage = 0;
20+
boolean PageArgIsInt = false;
21+
try {
22+
listPage= Integer.parseInt(args[0]);
23+
PageArgIsInt = true;
24+
} catch (NumberFormatException n) {
25+
sender.sendMessage(ChatColor.RED + "That is not a valid page number!");
26+
PageArgIsInt = false;
27+
return true;
28+
}
29+
if (PageArgIsInt) {
30+
int PageArg = Integer.parseInt(args[0]);
31+
switch (PageArg) {
32+
case 1:
33+
PluginList.SendPG1ToSender(sender);
34+
return true;
35+
case 2:
36+
PluginList.SendPG2ToSender(sender);
37+
return true;
38+
case 3:
39+
PluginList.SendPG3ToSender(sender);
40+
return true;
41+
}
42+
}
43+
}
44+
}
2245
return false;
2346
}
2447
}

src/main/resources/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: EaglerPluginInstaller
2-
version: 1.1.0
2+
version: 1.1.1
33
main: tech.nully.PluginInstaller.Main
44
prefix: [EaglerPluginInstaller]
55
loadbefore: [EaglerPluginUpdater]
66
authors: [BongoCat]
7-
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
7+
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository weith the executing of a command.
88
website: nully.tech
99
commands:
1010
install:

target/classes/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: EaglerPluginInstaller
2-
version: 1.1.0
2+
version: 1.1.1
33
main: tech.nully.PluginInstaller.Main
44
prefix: [EaglerPluginInstaller]
55
loadbefore: [EaglerPluginUpdater]
66
authors: [BongoCat]
7-
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
7+
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository weith the executing of a command.
88
website: nully.tech
99
commands:
1010
install:

0 commit comments

Comments
 (0)