diff options
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java | 1162 |
1 files changed, 66 insertions, 1096 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java index 9fbe27dd..de017cb5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java @@ -1,1104 +1,74 @@ package io.github.moulberry.notenoughupdates.commands; -import com.google.common.collect.Lists; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import io.github.moulberry.notenoughupdates.NEUEventListener; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.auction.CustomAHGui; -import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; -import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; -import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor; -import io.github.moulberry.notenoughupdates.core.util.MiscUtils; -import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics; -import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; -import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor; -import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; +import io.github.moulberry.notenoughupdates.commands.dev.*; +import io.github.moulberry.notenoughupdates.commands.dungeon.DhCommand; +import io.github.moulberry.notenoughupdates.commands.dungeon.DnCommand; +import io.github.moulberry.notenoughupdates.commands.dungeon.JoinDungeonCommand; +import io.github.moulberry.notenoughupdates.commands.dungeon.MapCommand; +import io.github.moulberry.notenoughupdates.commands.help.*; +import io.github.moulberry.notenoughupdates.commands.misc.AhCommand; +import io.github.moulberry.notenoughupdates.commands.misc.CalendarCommand; +import io.github.moulberry.notenoughupdates.commands.misc.CosmeticsCommand; +import io.github.moulberry.notenoughupdates.commands.misc.CustomizeCommand; +import io.github.moulberry.notenoughupdates.commands.profile.CataCommand; +import io.github.moulberry.notenoughupdates.commands.profile.PeekCommand; +import io.github.moulberry.notenoughupdates.commands.profile.PvCommand; +import io.github.moulberry.notenoughupdates.commands.profile.ViewProfileCommand; +import io.github.moulberry.notenoughupdates.commands.repo.ReloadRepoCommand; +import io.github.moulberry.notenoughupdates.commands.repo.RepoModeCommand; +import io.github.moulberry.notenoughupdates.commands.repo.ResetRepoCommand; import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls; -import io.github.moulberry.notenoughupdates.miscfeatures.FancyPortals; -import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper; -import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere; -import io.github.moulberry.notenoughupdates.miscgui.*; -import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; -import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; -import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; -import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats; -import io.github.moulberry.notenoughupdates.util.Constants; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.ClickEvent; -import net.minecraft.item.ItemMap; -import net.minecraft.item.ItemStack; -import net.minecraft.util.*; -import net.minecraft.world.storage.MapData; +import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour; +import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; +import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements; import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.text.WordUtils; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.awt.datatransfer.StringSelection; -import java.io.*; -import java.lang.management.ManagementFactory; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; public class Commands { - - public Commands(){ - //ClientCommandHandler.instance.registerCommand(collectionLogCommand); - //ClientCommandHandler.instance.registerCommand(collectionLogCommand2); - ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand); - ClientCommandHandler.instance.registerCommand(cosmeticsCommand); - ClientCommandHandler.instance.registerCommand(linksCommand); - //ClientCommandHandler.instance.registerCommand(gamemodesCommand); - ClientCommandHandler.instance.registerCommand(stWhyCommand); - ClientCommandHandler.instance.registerCommand(buttonsCommand); - ClientCommandHandler.instance.registerCommand(resetRepoCommand); - ClientCommandHandler.instance.registerCommand(reloadRepoCommand); - //ClientCommandHandler.instance.registerCommand(itemRenameCommand); - ClientCommandHandler.instance.registerCommand(joinDungeonCommand); - ClientCommandHandler.instance.registerCommand(viewProfileCommand); - ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); - ClientCommandHandler.instance.registerCommand(dhCommand); - ClientCommandHandler.instance.registerCommand(dnCommand); - ClientCommandHandler.instance.registerCommand(customizeCommand); - ClientCommandHandler.instance.registerCommand(customizeCommand2); - ClientCommandHandler.instance.registerCommand(devTestCommand); - ClientCommandHandler.instance.registerCommand(packDevCommand); - if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); - ClientCommandHandler.instance.registerCommand(peekCommand); -// ClientCommandHandler.instance.registerCommand(tutorialCommand); - ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); - ClientCommandHandler.instance.registerCommand(enchantColourCommand); - ClientCommandHandler.instance.registerCommand(neuAhCommand); - ClientCommandHandler.instance.registerCommand(new StatsCommand()); - ClientCommandHandler.instance.registerCommand(neumapCommand); - ClientCommandHandler.instance.registerCommand(settingsCommand); - ClientCommandHandler.instance.registerCommand(settingsCommand2); - ClientCommandHandler.instance.registerCommand(settingsCommand3); - ClientCommandHandler.instance.registerCommand(dungeonWinTest); - ClientCommandHandler.instance.registerCommand(calendarCommand); - ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); - ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); - ClientCommandHandler.instance.registerCommand(neuHelp); - ClientCommandHandler.instance.registerCommand(neuFeatures); - } - - SimpleCommand.ProcessCommandRunnable collectionLogRun = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NotEnoughUpdates.INSTANCE.openGui = new GuiCollectionLog(); - } - }; - - SimpleCommand collectionLogCommand = new SimpleCommand("neucl", collectionLogRun); - SimpleCommand collectionLogCommand2 = new SimpleCommand("collectionlog", collectionLogRun); - - SimpleCommand nullzeeSphereCommand = new SimpleCommand("neuzeesphere", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Usage: /neuzeesphere [on/off] or /neuzeesphere (radius) or /neuzeesphere setCenter")); - return; - } - if(args[0].equalsIgnoreCase("on")) { - NullzeeSphere.enabled = true; - } else if(args[0].equalsIgnoreCase("off")) { - NullzeeSphere.enabled = false; - } else if(args[0].equalsIgnoreCase("setCenter")) { - EntityPlayerSP p = ((EntityPlayerSP)sender); - NullzeeSphere.centerPos = new BlockPos(p.posX, p.posY, p.posZ); - NullzeeSphere.overlayVBO = null; - } else { - try { - float radius = Float.parseFloat(args[0]); - NullzeeSphere.size = radius; - NullzeeSphere.overlayVBO = null; - } catch(Exception e) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Can't parse radius: " + args[0])); - } - } - } - }); - - /*SimpleCommand itemRenameCommand = new SimpleCommand("neurename", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length == 0) { - args = new String[]{"help"}; - } - String heldUUID = NotEnoughUpdates.INSTANCE.manager.getUUIDForItem(Minecraft.getMinecraft().thePlayer.getHeldItem()); - switch(args[0].toLowerCase()) { - case "clearall": - NotEnoughUpdates.INSTANCE.manager.itemRenameJson = new JsonObject(); - NotEnoughUpdates.INSTANCE.manager.saveItemRenameConfig(); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for all items")); - break; - case "clear": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); - return; - } - NotEnoughUpdates.INSTANCE.manager.itemRenameJson.remove(heldUUID); - NotEnoughUpdates.INSTANCE.manager.saveItemRenameConfig(); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for held item")); - break; - case "copyuuid": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); - return; - } - StringSelection selection = new StringSelection(heldUUID); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] UUID copied to clipboard")); - break; - case "uuid": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't get UUID - no UUID")); - return; - } - ChatStyle style = new ChatStyle(); - style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ChatComponentText(EnumChatFormatting.GRAY+"Click to copy to clipboard"))); - style.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/neurename copyuuid")); - - ChatComponentText text = new ChatComponentText(EnumChatFormatting.YELLOW+"[NEU] The UUID of your currently held item is: " + - EnumChatFormatting.GREEN + heldUUID); - text.setChatStyle(style); - sender.addChatMessage(text); - break; - case "set": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't rename item - no UUID")); - return; - } - if(args.length == 1) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Usage: /neurename set [name...]")); - return; - } - StringBuilder sb = new StringBuilder(); - for(int i=1; i<args.length; i++) { - sb.append(args[i]); - if(i<args.length-1) sb.append(" "); - } - String name = sb.toString() - .replace("\\&", "{amp}") - .replace("&", "\u00a7") - .replace("{amp}", "&"); - name = new UnicodeUnescaper().translate(name); - NotEnoughUpdates.INSTANCE.manager.itemRenameJson.addProperty(heldUUID, name); - NotEnoughUpdates.INSTANCE.manager.saveItemRenameConfig(); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Set custom name for held item")); - break; - default: - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Unknown subcommand \""+args[0]+"\"")); - case "help": - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Available commands:")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "help: Print this message")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "clearall: Clears all custom names " - + EnumChatFormatting.BOLD + "(Cannot be undone)")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "clear: Clears held item name " - + EnumChatFormatting.BOLD + "(Cannot be undone)")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "uuid: Returns the UUID of the currently held item")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "set: Sets the custom name of the currently held item")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Usage: /neurename set [name...]")); - - } - } - });*/ - - SimpleCommand neuHelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - ArrayList<String> neuHelpMessages = Lists.newArrayList( - "\u00a75\u00a7lNotEnoughUpdates commands", - "\u00a76/neu \u00a77- Opens the main neu GUI.", - "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", - "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.", - "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", - "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", - - "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.", - "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.", - "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.", - "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's catacombs page.", - "\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.", - "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.", - "\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.", - "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.", - "\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.", - "", - "\u00a76\u00a7lOld commands:", - "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quickly stats for a user.", - "", - "\u00a76\u00a7lDebug commands:", - "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.", - "\u00a76/neustats modlist \u00a7r\u00a77- Copies modlist info to clipboard.", - "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.", - "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.", - "", - "\u00a76\u00a7lDev commands:", - "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); - for (int i = 0; i < neuHelpMessages.size(); i++) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) - )); - - } - if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { - ArrayList<String> neuDevHelpMessages = Lists.newArrayList( - "\u00a76/neudevtest \u00a7r\u00a77- dev test command", - "\u00a76/neuzeephere \u00a7r\u00a77- sphere", - "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); - - for (int i = 0; i < neuDevHelpMessages.size(); i++) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i) - )); - - } - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); - } - }); - - SimpleCommand neuFeatures = new SimpleCommand("neufeatures", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load URL from repo.")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - return; - } - String url = Constants.MISC.get("featureslist").getAsString(); - - Desktop desk = Desktop.getDesktop(); - try { - desk.browse(new URI(url)); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Opening Feature List in browser.")); - } catch (URISyntaxException | IOException ignored){ - - ChatComponentText clickTextFeatures = new ChatComponentText( - EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Click here to open the Feature List in your browser."); - clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); - Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); - - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - - } - }); - - - SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NEUEventListener.displayNotification(Lists.newArrayList( - "\u00a7eStorage Viewer", - "\u00a77Currently, the storage viewer requires you to click twice", - "\u00a77in order to switch between pages. This is because Hypixel", - "\u00a77has not yet added a shortcut command to go to any enderchest/", - "\u00a77storage page.", - "\u00a77While it is possible to send the second click", - "\u00a77automatically, doing so violates Hypixel's new mod rules."), true); - } - }); - - SimpleCommand gamemodesCommand = new SimpleCommand("neugamemodes", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - boolean upgradeOverride = args.length == 1 && args[0].equals("upgradeOverride"); - NotEnoughUpdates.INSTANCE.openGui = new GuiGamemodes(upgradeOverride); - } - }); - - SimpleCommand buttonsCommand = new SimpleCommand("neubuttons", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NotEnoughUpdates.INSTANCE.openGui = new GuiInvButtonEditor(); - } - }); - - SimpleCommand enchantColourCommand = new SimpleCommand("neuec", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour(); - } - }); - - SimpleCommand resetRepoCommand = new SimpleCommand("neuresetrepo", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NotEnoughUpdates.INSTANCE.manager.resetRepo(); - } - }); - - SimpleCommand dungeonWinTest = new SimpleCommand("neudungeonwintest", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length > 0) { - DungeonWin.TEAM_SCORE = new ResourceLocation("notenoughupdates:dungeon_win/"+args[0].toLowerCase()+".png"); - } - - DungeonWin.displayWin(); - } - }); - - SimpleCommand reloadRepoCommand = new SimpleCommand("neureloadrepo", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - File items = new File(NotEnoughUpdates.INSTANCE.manager.repoLocation, "items"); - if(items.exists()) { - File[] itemFiles = new File(NotEnoughUpdates.INSTANCE.manager.repoLocation, "items").listFiles(); - if(itemFiles != null) { - for(File f : itemFiles) { - String internalname = f.getName().substring(0, f.getName().length()-5); - NotEnoughUpdates.INSTANCE.manager.loadItem(internalname); - } - } - } - Constants.reload(); - - NotEnoughUpdates.INSTANCE.newConfigFile(); - if(NotEnoughUpdates.INSTANCE.getConfigFile().exists()) { - try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(NotEnoughUpdates.INSTANCE.getConfigFile()), StandardCharsets.UTF_8))) { - NotEnoughUpdates.INSTANCE.config = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, NEUConfig.class); - } catch(Exception e) { } - } - } - }); - - ScheduledExecutorService peekCommandExecutorService = null; - - SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - String name; - if(args.length == 0) { - name = Minecraft.getMinecraft().thePlayer.getName(); - } else { - name = args[0]; - } - int id = new Random().nextInt(Integer.MAX_VALUE/2)+Integer.MAX_VALUE/2; - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.YELLOW+"[PEEK] Getting player information..."), id); - NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(name, profile -> { - if (profile == null) { - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] Unknown player or api is down."), id); - } else { - profile.resetCache(); - - if(peekCommandExecutorService == null || peekCommandExecutorService.isShutdown()) { - peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); - } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] New peek command run, cancelling old one.")); - peekCommandExecutorService.shutdownNow(); - peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); - } - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.YELLOW+"[PEEK] Getting player skyblock profiles..."), id); - - long startTime = System.currentTimeMillis(); - peekCommandExecutorService.schedule(new Runnable() { - public void run() { - if(System.currentTimeMillis() - startTime > 10*1000) { - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] Getting profile info took too long, aborting."), id); - return; - } - - String g = EnumChatFormatting.GRAY.toString(); - - JsonObject profileInfo = profile.getProfileInformation(null); - if(profileInfo != null) { - float overallScore = 0; - - boolean isMe = name.equalsIgnoreCase("moulberry"); - - PlayerStats.Stats stats = profile.getStats(null); - JsonObject skill = profile.getSkillInfo(null); - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(EnumChatFormatting.GREEN+" "+ - EnumChatFormatting.STRIKETHROUGH+"-=-" +EnumChatFormatting.RESET+EnumChatFormatting.GREEN+" "+ - Utils.getElementAsString(profile.getHypixelProfile().get("displayname"), name) + "'s Info " + - EnumChatFormatting.STRIKETHROUGH+"-=-"), id); - - if(skill == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+"Skills api disabled!")); - } else { - float totalSkillLVL = 0; - float totalSkillCount = 0; - - for(Map.Entry<String, JsonElement> entry : skill.entrySet()) { - if(entry.getKey().startsWith("level_skill")) { - if(entry.getKey().contains("runecrafting")) continue; - if(entry.getKey().contains("carpentry")) continue; - totalSkillLVL += entry.getValue().getAsFloat(); - totalSkillCount++; - } - } - - float combat = Utils.getElementAsFloat(skill.get("level_skill_combat"), 0); - float zombie = Utils.getElementAsFloat(skill.get("level_slayer_zombie"), 0); - float spider = Utils.getElementAsFloat(skill.get("level_slayer_spider"), 0); - float wolf = Utils.getElementAsFloat(skill.get("level_slayer_wolf"), 0); - float enderman = Utils.getElementAsFloat(skill.get("level_slayer_enderman"), 0); - - float avgSkillLVL = totalSkillLVL/totalSkillCount; - - if(isMe) { - avgSkillLVL = 6; - combat = 4; - zombie = 2; - spider = 1; - wolf = 2; - enderman = 0; - } - - EnumChatFormatting combatPrefix = combat>20?(combat>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting zombiePrefix = zombie>3?(zombie>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting spiderPrefix = spider>3?(spider>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting wolfPrefix = wolf>3?(wolf>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting endermanPrefix = enderman>3?(enderman>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting avgPrefix = avgSkillLVL>20?(avgSkillLVL>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - overallScore += zombie*zombie/81f; - overallScore += spider*spider/81f; - overallScore += wolf*wolf/81f; - overallScore += enderman*enderman/81f; - overallScore += avgSkillLVL/20f; - - int cata = (int)Utils.getElementAsFloat(skill.get("level_skill_catacombs"), 0); - EnumChatFormatting cataPrefix = cata>15?(cata>25?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - overallScore += cata*cata/2000f; - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Combat: "+combatPrefix+(int)Math.floor(combat) + - (cata > 0 ? g+" - Cata: "+cataPrefix+cata : "")+ - g+" - AVG: " + avgPrefix+(int)Math.floor(avgSkillLVL))); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Slayer: "+zombiePrefix+(int)Math.floor(zombie)+g+"-"+ - spiderPrefix+(int)Math.floor(spider)+g+"-"+ - wolfPrefix+(int)Math.floor(wolf)+"-"+ - endermanPrefix+(int)Math.floor(enderman))); - } - if (stats == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW+"Skills, collection and/or inventory apis disabled!")); - } else { - int health = (int)stats.get("health"); - int defence = (int)stats.get("defence"); - int strength = (int)stats.get("strength"); - int intelligence = (int)stats.get("intelligence"); - - EnumChatFormatting healthPrefix = health>800?(health>1600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting defencePrefix = defence>200?(defence>600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting strengthPrefix = strength>100?(strength>300?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting intelligencePrefix = intelligence>300?(intelligence>900?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Stats : "+healthPrefix+health+EnumChatFormatting.RED+"\u2764 "+ - defencePrefix+defence+EnumChatFormatting.GREEN+"\u2748 "+ - strengthPrefix+strength+EnumChatFormatting.RED+"\u2741 "+ - intelligencePrefix+intelligence+EnumChatFormatting.AQUA+"\u270e ")); - } - float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1); - float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); - - long networth = profile.getNetWorth(null); - float money = Math.max(bankBalance+purseBalance, networth); - EnumChatFormatting moneyPrefix = money>50*1000*1000? - (money>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " + - (bankBalance == -1 ? EnumChatFormatting.YELLOW+"N/A" : moneyPrefix+ - (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))) + - (networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 0) : ""))); - - overallScore += Math.min(2, money/(100f*1000*1000)); - - String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"), - "None Active"); - String activePetTier = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.tier"), "UNKNOWN"); - - String col = NotEnoughUpdates.petRarityToColourMap.get(activePetTier); - if(col == null) col = EnumChatFormatting.LIGHT_PURPLE.toString(); - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Pet : " + - col + WordUtils.capitalizeFully(activePet.replace("_", " ")))); - - String overall = "Skywars Main"; - if(isMe) { - overall = Utils.chromaString("Literally the best player to exist"); // ego much - } else if(overallScore < 5 && (bankBalance+purseBalance) > 500*1000*1000) { - overall = EnumChatFormatting.GOLD+"Bill Gates"; - } else if(overallScore > 9) { - overall = Utils.chromaString("Didn't even think this score was possible"); - } else if(overallScore > 8) { - overall = Utils.chromaString("Mentally unstable"); - } else if(overallScore > 7) { - overall = EnumChatFormatting.GOLD+"Why though 0.0"; - } else if(overallScore > 5.5) { - overall = EnumChatFormatting.GOLD+"Bro stop playing"; - } else if(overallScore > 4) { - overall = EnumChatFormatting.GREEN+"Kinda sweaty"; - } else if(overallScore > 3) { - overall = EnumChatFormatting.YELLOW+"Alright I guess"; - } else if(overallScore > 2) { - overall = EnumChatFormatting.YELLOW+"Ender Non"; - } else if(overallScore > 1) { - overall = EnumChatFormatting.RED+"Played Skyblock"; - } - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Overall score: " + - overall + g + " (" + Math.round(overallScore*10)/10f + ")")); - - peekCommandExecutorService.shutdownNow(); - } else { - peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS); - } - } - }, 200, TimeUnit.MILLISECONDS); - } - }); - } - }, new SimpleCommand.TabCompleteRunnable() { - @Override - public java.util.List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length != 1) return null; - - String lastArg = args[args.length - 1]; - List<String> playerMatches = new ArrayList<>(); - for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - String playerName = player.getName(); - if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { - playerMatches.add(playerName); - } - } - return playerMatches; - } - }); - - public SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(!OpenGlHelper.isFramebufferEnabled()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); - - } - if (NotEnoughUpdates.INSTANCE.config.apiKey.apiKey == null || NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.trim().isEmpty()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Can't view profile, apikey is not set. Run /api new and put the result in settings.")); - } else if (args.length == 0) { - NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> { - if(profile == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Invalid player name/api key. Maybe api is down? Try /api new.")); - } else { - profile.resetCache(); - NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile); - } - }); - } else if (args.length > 1) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Too many arguments. Usage: /neuprofile [name]")); - } else { - NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(args[0], profile -> { - if(profile == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Invalid player name/api key. Maybe api is down? Try /api new.")); - } else { - profile.resetCache(); - NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile); - } - }); - } - } - }; - - - SimpleCommand joinDungeonCommand = new SimpleCommand("join", new SimpleCommand.ProcessCommandRunnable() { - @Override |
