aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java62
-rw-r--r--src/main/java/me/Danker/commands/RepartyCommand.java34
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java3
3 files changed, 56 insertions, 43 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 8285bec..019ffe6 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -15,6 +15,7 @@ import net.minecraft.client.gui.*;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.command.ICommand;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.item.EntityItemFrame;
@@ -312,36 +313,39 @@ public class DankersSkyblockMod {
ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand());
ClientCommandHandler.instance.registerCommand(new DankerGuiCommand());
ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand());
- ClientCommandHandler.instance.registerCommand(new RepartyCommand());
}
@EventHandler
public void postInit(final FMLPostInitializationEvent event) {
Package[] packages = Package.getPackages();
for(Package p : packages){
- DSMLogger.info(p);
if(p.getName().startsWith("com.spiderfrog.gadgets") || p.getName().startsWith("com.spiderfrog.oldanimations")){
usingOAM = true;
- break;
}
}
System.out.println("OAM detection: " + usingOAM);
-
usingLabymod = Loader.isModLoaded("labymod");
System.out.println("LabyMod detection: " + usingLabymod);
+
+ if(!ClientCommandHandler.instance.getCommands().containsKey("reparty")) {
+ ClientCommandHandler.instance.registerCommand(new RepartyCommand());
+ } else if (ConfigHandler.getBoolean("commands", "reparty")) {
+ for(Map.Entry<String, ICommand> entry : ClientCommandHandler.instance.getCommands().entrySet()) {
+ if (entry.getKey().equals("reparty") || entry.getKey().equals("rp")) {
+ entry.setValue(new RepartyCommand());
+ }
+ }
+ }
+
}
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event){
if(event.gui instanceof GuiMainMenu && usingOAM && !OAMWarning){
- System.out.println("Gui opened: Instance of GuiMainMenu.");
if(!(event.gui instanceof WarningGui)){
- System.out.println("No instance of WarningGui");
event.gui = new WarningGuiRedirect(new WarningGui());
OAMWarning = true;
- }else{
- System.out.println("Instance of WarningGui");
}
}
}
@@ -500,16 +504,17 @@ public class DankersSkyblockMod {
// Inviting
if (RepartyCommand.inviting) {
if (message.contains("-----")) {
- if (RepartyCommand.Delimiter >= RepartyCommand.party.size() * 2 - 1) {
- event.setCanceled(true);
- RepartyCommand.Delimiter = 0;
- System.out.println("Done Inviting!");
- RepartyCommand.inviting = false;
- return;
- } else {
- RepartyCommand.Delimiter++;
- event.setCanceled(true);
- return;
+ switch (RepartyCommand.Delimiter) {
+ case 1:
+ event.setCanceled(true);
+ RepartyCommand.Delimiter = 0;
+ System.out.println("Player Invited!");
+ RepartyCommand.inviting = false;
+ return;
+ case 0:
+ RepartyCommand.Delimiter++;
+ event.setCanceled(true);
+ return;
}
} else if (message.endsWith(" to the party! They have 60 seconds to accept.")) {
Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)");
@@ -527,16 +532,17 @@ public class DankersSkyblockMod {
// Fail Inviting
if (RepartyCommand.failInviting) {
if (message.contains("-----")) {
- if (RepartyCommand.Delimiter >= RepartyCommand.repartyFailList.size() * 2 - 1) {
- event.setCanceled(true);
- RepartyCommand.Delimiter = 0;
- System.out.println("Done Inviting!");
- RepartyCommand.inviting = false;
- return;
- } else {
- RepartyCommand.Delimiter++;
- event.setCanceled(true);
- return;
+ switch (RepartyCommand.Delimiter) {
+ case 1:
+ event.setCanceled(true);
+ RepartyCommand.Delimiter = 0;
+ System.out.println("Player Invited!");
+ RepartyCommand.inviting = false;
+ return;
+ case 0:
+ RepartyCommand.Delimiter++;
+ event.setCanceled(true);
+ return;
}
} else if (message.endsWith(" to the party! They have 60 seconds to accept.")) {
Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)");
diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java
index fd63f39..d436f90 100644
--- a/src/main/java/me/Danker/commands/RepartyCommand.java
+++ b/src/main/java/me/Danker/commands/RepartyCommand.java
@@ -32,7 +32,6 @@ public class RepartyCommand extends CommandBase implements ICommand {
public static boolean failInviting = false;
public static List<String> party = new ArrayList<>();
public static List<String> repartyFailList = new ArrayList<>();
- public static List<String> joinList = new ArrayList<>();
public static Thread partyThread = null;
@Override
@@ -57,6 +56,9 @@ public class RepartyCommand extends CommandBase implements ICommand {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (args.length > 0 && args[0].startsWith("sbe")) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("ew imagine using sbe which breaks mojang tos"));
+ }
if (args.length > 0 && (args[0].startsWith("fail") || args[0].equals("f"))) {
partyThread = new Thread(() -> {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
@@ -91,12 +93,8 @@ public class RepartyCommand extends CommandBase implements ICommand {
return;
}
- boolean ghost = args.length > 0 && (args[0].toLowerCase().equals("g") || args[0].toLowerCase().equals("ghost"));
-
- if(ghost){
- party.clear();
- repartyFailList.clear();
- }
+ party.clear();
+ repartyFailList.clear();
// MULTI THREAD DRIFTING
partyThread = new Thread(() -> {
@@ -104,12 +102,10 @@ public class RepartyCommand extends CommandBase implements ICommand {
try {
- if(ghost){
- player.sendChatMessage("/pl");
- gettingParty = true;
- while (gettingParty) {
- Thread.sleep(10);
- }
+ player.sendChatMessage("/pl");
+ gettingParty = true;
+ while (gettingParty) {
+ Thread.sleep(10);
}
if (party.size() == 0) return;
player.sendChatMessage("/p disband");
@@ -117,14 +113,22 @@ public class RepartyCommand extends CommandBase implements ICommand {
while (disbanding) {
Thread.sleep(10);
}
- player.sendChatMessage("/p " + String.join(" ", party));
+// player.sendChatMessage("/p " + String.join(" ", party));
String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.YELLOW, RepartyCommand.party);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" +
DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + EnumChatFormatting.WHITE + "\n- " +
EnumChatFormatting.YELLOW + members + "\n" +
DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------"));
- inviting = true;
repartyFailList = new ArrayList<>(party);
+ for (String invitee : party) {
+ player.sendChatMessage("/p " + invitee);
+ inviting = true;
+ while (inviting) {
+ Thread.sleep(10);
+ }
+ Thread.sleep(100);
+ }
+// inviting = true;
while (inviting) {
Thread.sleep(10);
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 9f11aac..9038218 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -452,6 +452,9 @@ public class ConfigHandler {
if (!hasKey("colors", "pet80To89")) writeIntConfig("colors", "pet80To89", 0x5C1F35); // idk weird magenta
if (!hasKey("colors", "pet90To99")) writeIntConfig("colors", "pet90To99", 0x9E794E); // Brown
if (!hasKey("colors", "pet100")) writeIntConfig("colors", "pet100", 0xF2D249); // Gold
+
+ //Commands
+ if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false);
ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty");
ToggleCommand.coordsToggled = getBoolean("toggles", "Coords");