Skip to content

Commit

Permalink
Merge pull request #2 from darverdevs/dev-1.1.1-ALPHA
Browse files Browse the repository at this point in the history
Dev 1.1.1 alpha
  • Loading branch information
Fangoboyo authored Jun 16, 2022
2 parents c8906c5 + e5b6621 commit 819cf99
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 18 deletions.
1 change: 1 addition & 0 deletions .idea/artifacts/EaglerPluginInstaller_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R1.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
</dependencies>


Expand Down
10 changes: 9 additions & 1 deletion src/main/java/tech/nully/PluginInstaller/InstallCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,23 @@ public boolean onCommand(CommandSender snder, Command cmd, String label, String[
try (InputStream in = plugin.openStream()) {

// Installs the plugin
ins.InstallPlugin(in, Install_Jar.toLowerCase());
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
return true;
} catch (IOException e) {}
} else if (Install_Jar.equalsIgnoreCase("recommended")) {
InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar")
.toURL().openStream();
InputStream reco2 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentials.jar")
.toURL().openStream();
InputStream reco3 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentialsspawn.jar")
.toURL().openStream();
ins.InstallPlugin(reco1, "DupePatch");
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "DupePatch" + ChatColor.WHITE + " plugin!");
ins.InstallPlugin(reco1, "Essentials");
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Essentials" + ChatColor.WHITE + " plugin!");
ins.InstallPlugin(reco1, "EssentialsSpawn");
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "EssentialsSpawn" + ChatColor.WHITE + " plugin!");
return true;
}
} catch (IOException e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tech/nully/PluginInstaller/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onEnable() {
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " EaglerPluginInstaller V1.1.0 is now Enabled! :D");
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " EaglerPluginInstaller V1.1.1 is now Enabled! :D");
getServer().getConsoleSender().sendMessage("To use PluginInstaller, run the command \"/install <pluginname>\" (\"install <pluginname>\" in console) to install a plugin");
getServer().getConsoleSender().sendMessage("To get a list of installable plugins, use the command \"/plist\" or \"plist\" in console");
getServer().getConsoleSender().sendMessage("You can request to add a new plugin to the database by going to https://github.com/darverdevs/PluginInstallerRepo/tree/main");
Expand All @@ -39,7 +39,7 @@ public void onDisable() {
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.1.0 is now Disabled! D:");
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.1.1 is now Disabled! D:");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
}
Expand Down
103 changes: 103 additions & 0 deletions src/main/java/tech/nully/PluginInstaller/PluginList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
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",
"Vault", "WorldEdit", "WorldGuard"};
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++) {
int Spaces = 21-AlphaPluginList[i-1].length();
List<String> spaces = new ArrayList<>();
for (int forInt = 0; forInt < Spaces; forInt++) {
spaces.add(" ");
}
sender.sendMessage(i+". "+ AlphaPluginList[i-1] + "" + Utils.ListToString(spaces) + "" +SecondCollumn + ". " + AlphaPluginList[SecondCollumn-1]);
SecondCollumn++;
}
sender.sendMessage(" Page 1 of 12");
sender.sendMessage("Note: You do not need to have proper");
sender.sendMessage("capitalization when using the install command");
}

public static void SendPG2ToSender(CommandSender sender) {
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");

// List -------------------------------------------------------------
int SecondCollumn = 22;
for (int i = 15; i < 22; i++) {
String Col1;
String Col2;

// Null checkers for elements in the Array
try {
Col1 = AlphaPluginList[i-1];
} catch (ArrayIndexOutOfBoundsException y) {
Col1 = "N/A";
}
try {
Col2 = AlphaPluginList[SecondCollumn-1];
} catch (ArrayIndexOutOfBoundsException a) {
Col2 = "N/A";
}
// _________________________________________

int Spaces = 21-AlphaPluginList[i-1].length();
List<String> spaces = new ArrayList<>();
for (int forInt = 0; forInt < Spaces; forInt++) {
spaces.add(" ");
}
sender.sendMessage(i+". "+ Col1 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col2);
SecondCollumn++;
}

sender.sendMessage(" Page 2 of 12");
sender.sendMessage("Note: You do not need to have proper");
sender.sendMessage("capitalization when using the install command");
}

public static void SendPG3ToSender(CommandSender sender) {
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");

// List -------------------------------------------------------------
int SecondCollumn = 36;
for (int i = 29; i < 36; i++) {
String Col31;
String Col32;

// Null checkers for elements in the Array
try {
Col31 = AlphaPluginList[i-1];
} catch (ArrayIndexOutOfBoundsException e) {
Col31 = "N/A";
}
try {
Col32 = AlphaPluginList[SecondCollumn-1];
} catch (ArrayIndexOutOfBoundsException e) {
Col32 = "N/A";
}
// _________________________________________

int Spaces = 21-Col31.length();
List<String> spaces = new ArrayList<>();
for (int forInt = 0; forInt < Spaces; forInt++) {
spaces.add(" ");
}
sender.sendMessage(i+". "+ Col31 + "" + Utils.ListToString(spaces) + "" + SecondCollumn + ". " + Col32);
SecondCollumn++;
}

sender.sendMessage(" Page 3 of 12");
sender.sendMessage("Note: You do not need to have proper");
sender.sendMessage("capitalization when using the install command");
}
}

21 changes: 21 additions & 0 deletions src/main/java/tech/nully/PluginInstaller/Utils.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
45 changes: 34 additions & 11 deletions src/main/java/tech/nully/PluginInstaller/plistCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;

public class plistCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("plist")) {
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
// TODO: Finish this list
sender.sendMessage("1. Factions 8. AntiSwear");
sender.sendMessage("2. ProtocolLib 9. ProtocolLib");
sender.sendMessage("3. PermissionSex 10. MCore");
sender.sendMessage("4. Vault 11. ");
sender.sendMessage("5. CoreProtect 12. ");
sender.sendMessage("6. DupePatch 13. ");
sender.sendMessage("7. BitchFilter 14. ");
}
if (cmd.getName().equalsIgnoreCase("plist") && sender.isOp() || sender instanceof ConsoleCommandSender) {
if (args.length >= 1) {
try {
System.out.println(args[0]);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("error");
}
int listPage = 0;
boolean PageArgIsInt = false;
try {
listPage= Integer.parseInt(args[0]);
PageArgIsInt = true;
} catch (NumberFormatException n) {
sender.sendMessage(ChatColor.RED + "That is not a valid page number!");
PageArgIsInt = false;
return true;
}
if (PageArgIsInt) {
int PageArg = Integer.parseInt(args[0]);
switch (PageArg) {
case 1:
PluginList.SendPG1ToSender(sender);
return true;
case 2:
PluginList.SendPG2ToSender(sender);
return true;
case 3:
PluginList.SendPG3ToSender(sender);
return true;
}
}
}
}
return false;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: EaglerPluginInstaller
version: 1.1.0
version: 1.1.1
main: tech.nully.PluginInstaller.Main
prefix: [EaglerPluginInstaller]
loadbefore: [EaglerPluginUpdater]
authors: [BongoCat]
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
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.
website: nully.tech
commands:
install:
Expand Down
4 changes: 2 additions & 2 deletions target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: EaglerPluginInstaller
version: 1.1.0
version: 1.1.1
main: tech.nully.PluginInstaller.Main
prefix: [EaglerPluginInstaller]
loadbefore: [EaglerPluginUpdater]
authors: [BongoCat]
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
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.
website: nully.tech
commands:
install:
Expand Down
Binary file modified target/classes/tech/nully/PluginInstaller/InstallCommand.class
Binary file not shown.
Binary file modified target/classes/tech/nully/PluginInstaller/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified target/classes/tech/nully/PluginInstaller/plistCommand.class
Binary file not shown.

0 comments on commit 819cf99

Please sign in to comment.