aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDoKM <mcazzyman@gmail.com>2021-10-03 22:56:18 +0200
committerDoKM <mcazzyman@gmail.com>2021-10-03 22:56:18 +0200
commitcdc452e0e0aed1c25e9f3044a7d68b3d4f41cdb1 (patch)
tree5ac7f814570e302131079f174fcb02b9369d3e76 /src/main/java
parent0aa7768a4c8c3119644f58bd166935ff0d29bef0 (diff)
downloadNotEnoughUpdates-cdc452e0e0aed1c25e9f3044a7d68b3d4f41cdb1.tar.gz
NotEnoughUpdates-cdc452e0e0aed1c25e9f3044a7d68b3d4f41cdb1.tar.bz2
NotEnoughUpdates-cdc452e0e0aed1c25e9f3044a7d68b3d4f41cdb1.zip
Move the commands to a seperate class
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java1118
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java1179
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java25
4 files changed, 1219 insertions, 1105 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 09fa865f..42b53ef2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -1434,7 +1434,7 @@ public class NEUEventListener {
if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){
String username = tag.getCompoundTag("SkullOwner").getString("Name");
Utils.playPressSound();
- NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{username});
+ NotEnoughUpdates.INSTANCE.commands.viewProfileRunnable.processCommand(null, new String[]{username});
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 5eb0f861..6a0d3ab4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -8,6 +8,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog;
+import io.github.moulberry.notenoughupdates.commands.Commands;
import io.github.moulberry.notenoughupdates.commands.SimpleCommand;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
@@ -96,6 +97,13 @@ public class NotEnoughUpdates {
private File configFile;
+ public File getConfigFile(){
+ return this.configFile;
+ }
+ public void newConfigFile(){
+ this.configFile = new File(NotEnoughUpdates.INSTANCE.getNeuDir(), "configNew.json");
+ }
+
private static final long CHAT_MSG_COOLDOWN = 200;
private long lastChatMessage = 0;
private long secondLastChatMessage = 0;
@@ -107,284 +115,11 @@ public class NotEnoughUpdates {
public GuiScreen openGui = null;
public long lastOpenedGui = 0;
- SimpleCommand.ProcessCommandRunnable collectionLogRun = new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- 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 = manager.getUUIDForItem(Minecraft.getMinecraft().thePlayer.getHeldItem());
- switch(args[0].toLowerCase()) {
- case "clearall":
- manager.itemRenameJson = new JsonObject();
- 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;
- }
- manager.itemRenameJson.remove(heldUUID);
- 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);
- manager.itemRenameJson.addProperty(heldUUID, name);
- 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)
- ));
+ public Commands commands;
- }
- }
- 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");
- openGui = new GuiGamemodes(upgradeOverride);
- }
- });
- SimpleCommand buttonsCommand = new SimpleCommand("neubuttons", new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- openGui = new GuiInvButtonEditor();
- }
- });
-
- SimpleCommand enchantColourCommand = new SimpleCommand("neuec", new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- openGui = new GuiEnchantColour();
- }
- });
-
- SimpleCommand resetRepoCommand = new SimpleCommand("neuresetrepo", new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- 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(manager.repoLocation, "items");
- if(items.exists()) {
- File[] itemFiles = new File(manager.repoLocation, "items").listFiles();
- if(itemFiles != null) {
- for(File f : itemFiles) {
- String internalname = f.getName().substring(0, f.getName().length()-5);
- manager.loadItem(internalname);
- }
- }
- }
- Constants.reload();
-
- configFile = new File(neuDir, "configNew.json");
- if(configFile.exists()) {
- try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) {
- config = gson.fromJson(reader, NEUConfig.class);
- } catch(Exception e) { }
- }
- }
- });
- private static HashMap<String, String> petRarityToColourMap = new HashMap<>();
+ public static HashMap<String, String> petRarityToColourMap = new HashMap<>();
static {
petRarityToColourMap.put("UNKNOWN", EnumChatFormatting.RED.toString());
@@ -395,806 +130,17 @@ public class NotEnoughUpdates {
petRarityToColourMap.put("LEGENDARY", EnumChatFormatting.GOLD.toString());
petRarityToColourMap.put("MYTHIC", EnumChatFormatting.LIGHT_PURPLE.toString());
}
- 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);
- 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 = 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 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;
- }
- });
-
-
- SimpleCommand pcStatsCommand = new SimpleCommand("neustats", new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- Minecraft mc = Minecraft.getMinecraft();
- StringBuilder builder = new StringBuilder();
-
- if (args.length > 0 && args[0].toLowerCase().equals("modlist")){
- builder.append("```md\n");
- builder.append("# Mods Loaded").append("\n");
- for (ModContainer modContainer : Loader.instance().getActiveModList()) {
- builder.append("[").append(modContainer.getName()).append("]")
- .append("[").append(modContainer.getSource().getName()).append("]\n");
- }
- builder.append("```");
- } else {
- long memorySize = -1;
- try {
- memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
- } catch(Exception e){}
- long maxMemory = Runtime.getRuntime().maxMemory();
- long totalMemory = Runtime.getRuntime().totalMemory();
- long freeMemory = Runtime.getRuntime().freeMemory();
- long currentMemory = totalMemory - freeMemory;
- int modCount = Loader.instance().getModList().size();
- int activeModCount = Loader.instance().getActiveModList().size();
-
- builder.append("```md\n");
- builder.append("# System Stats").append("\n");
- builder.append("[OS]").append("[").append(System.getProperty("os.name")).append("]").append("\n");
- builder.append("[CPU]").append("[").append(OpenGlHelper.getCpu()).append("]").append("\n");
- builder.append("[Display]").append("[").append(String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))).append("]").append("\n");
- builder.append("[GPU]").append("[").append(GL11.glGetString(GL11.GL_RENDERER)).append("]").append("\n");
- builder.append("[GPU Driver]").append("[").append(GL11.glGetString(GL11.G