aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands
diff options
context:
space:
mode:
authorSychic <Sychic@github.com>2020-12-17 21:43:37 -0500
committerSychic <Sychic@github.com>2020-12-17 21:43:37 -0500
commitc64eea238237c80a0c8361685ce8b9e01d61f9cb (patch)
tree2e14d4b302b3f79d7e1a0f1711bbc7d8636db2a5 /src/main/java/me/Danker/commands
parent7032f3ee8bd86d430e9aac7d641b849171fe2472 (diff)
downloadSkyblockMod-c64eea238237c80a0c8361685ce8b9e01d61f9cb.tar.gz
SkyblockMod-c64eea238237c80a0c8361685ce8b9e01d61f9cb.tar.bz2
SkyblockMod-c64eea238237c80a0c8361685ce8b9e01d61f9cb.zip
Add Repartying
Diffstat (limited to 'src/main/java/me/Danker/commands')
-rw-r--r--src/main/java/me/Danker/commands/RepartyCommand.java58
-rw-r--r--src/main/java/me/Danker/commands/SetPartyCommand.java46
2 files changed, 104 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java
new file mode 100644
index 0000000..1658298
--- /dev/null
+++ b/src/main/java/me/Danker/commands/RepartyCommand.java
@@ -0,0 +1,58 @@
+package me.Danker.commands;
+
+import me.Danker.DankersSkyblockMod;
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+
+public class RepartyCommand extends CommandBase implements ICommand {
+ public static String[] players;
+
+ @Override
+ public String getCommandName() { return "reparty"; }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName(); }
+
+ @Override
+ public int getRequiredPermissionLevel() { return 0; }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+
+ final EntityPlayer player = (EntityPlayer) sender;
+
+ if(!SetPartyCommand.set){
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Party unset! use " + SetPartyCommand.getUsage()));
+ return;
+ }
+ try{
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p disband");
+ Thread.sleep(210);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p " + String.join(" ",players));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public static void processCommand() {
+
+ if(!SetPartyCommand.set){
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Party unset! use " + SetPartyCommand.getUsage()));
+ return;
+ }
+ try{
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p disband");
+ Thread.sleep(210);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p " + String.join(" ",players));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/src/main/java/me/Danker/commands/SetPartyCommand.java b/src/main/java/me/Danker/commands/SetPartyCommand.java
new file mode 100644
index 0000000..f840527
--- /dev/null
+++ b/src/main/java/me/Danker/commands/SetPartyCommand.java
@@ -0,0 +1,46 @@
+package me.Danker.commands;
+
+import me.Danker.DankersSkyblockMod;
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class SetPartyCommand extends CommandBase implements ICommand {
+
+ public static boolean set = false;
+
+ @Override
+ public String getCommandName() { return "setparty"; }
+ public static String getName() { return "setparty"; }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName() + " <Party members>"; }
+ public static String getUsage(){ return "/" + getName() + " <Party members>"; }
+
+ @Override
+ public int getRequiredPermissionLevel() { return 0; }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ final EntityPlayer player = (EntityPlayer) sender;
+
+ if(args.length == 0) {
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(sender)));
+ return;
+ }
+
+ RepartyCommand.players = args;
+
+ String members = String.join("\n" + EnumChatFormatting.GOLD,RepartyCommand.players);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.GOLD + members + "\n" +
+ DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------"));
+
+ set = true;
+ }
+}