diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-28 11:50:08 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-09-28 11:50:08 -0400 |
commit | 3629f2f90c24a76c3568cb63d4d03623ce1d54c7 (patch) | |
tree | 4714a88cc81809acfa5210bd09799bbc0f6d3c40 | |
parent | 861a1b604991986963dde848c4a86c586408640b (diff) | |
download | SkyblockMod-3629f2f90c24a76c3568cb63d4d03623ce1d54c7.tar.gz SkyblockMod-3629f2f90c24a76c3568cb63d4d03623ce1d54c7.tar.bz2 SkyblockMod-3629f2f90c24a76c3568cb63d4d03623ce1d54c7.zip |
Fix player tab complete and UUID returning error 204
-rw-r--r-- | src/main/java/me/Danker/handlers/APIHandler.java | 5 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index 34a73ff..b8d52dc 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -53,8 +53,11 @@ public class APIHandler { JsonObject object = gson.fromJson(error, JsonObject.class); return object; } + } else if (urlString.startsWith("https://api.mojang.com/users/profiles/minecraft/") && conn.getResponseCode() == 204) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: Player does not exist.")); + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } } catch (MalformedURLException ex) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details.")); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index e6f35b4..d872aa2 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,6 +1,7 @@ package me.Danker.utils; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.regex.Matcher; @@ -12,7 +13,7 @@ import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.scoreboard.ScoreObjective; @@ -64,10 +65,10 @@ public class Utils { public static List<String> getMatchingPlayers(String arg) { List<String> matchingPlayers = new ArrayList<>(); - List<EntityPlayer> players = Minecraft.getMinecraft().theWorld.playerEntities; + Collection<NetworkPlayerInfo> players = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap(); - for (EntityPlayer player : players) { - String playerName = player.getName(); + for (NetworkPlayerInfo player : players) { + String playerName = player.getGameProfile().getName(); if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { matchingPlayers.add(playerName); } |