Skip to content

Commit a610654

Browse files
committed
Bug fixes, configurable things, and added party and guild ImageIcons.
1 parent 9ba8088 commit a610654

40 files changed

+828
-563
lines changed

src/main/java/cc/woverflow/hysentials/Hysentials.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class Hysentials {
103103

104104
public ImageIconRenderer imageIconRenderer;
105105
public JsonData sbBoxes;
106-
106+
public JsonData rankColors;
107107
public boolean isPatcher;
108108
public boolean isChatting;
109109
private boolean loadedCall;
@@ -125,6 +125,7 @@ public void onFMLPreInitialization(FMLPreInitializationEvent event) {
125125
public void init(FMLInitializationEvent event) {
126126
config = new HysentialsConfig();
127127
sbBoxes = new JsonData("./config/hysentials/lines.json", new JSONObject().put("lines", new JSONArray()));
128+
rankColors = new JsonData("/assets/minecraft/textures/icons/colors.json", "./config/hysentials/color.jsonn", true);
128129
try {
129130
SSLStore store = new SSLStore();
130131
store.load("/ssl/hysentials.der");
@@ -175,14 +176,22 @@ public void finishedStarting(FMLLoadCompleteEvent event) {
175176

176177
private void registerImages() {
177178
new ImageIcon("front", new ResourceLocation("textures/icons/front.png"));
179+
new ImageIcon("back", new ResourceLocation("textures/icons/back.png"));
178180
new ImageIcon("globalchat", new ResourceLocation("textures/icons/globalchat.png"));
181+
new ImageIcon("creator", new ResourceLocation("textures/icons/creator.png"));
182+
new ImageIcon("guild", new ResourceLocation("textures/icons/guild.png"));
183+
new ImageIcon("party", new ResourceLocation("textures/icons/party.png"));
179184

180185
for (HypixelRanks rank : HypixelRanks.values()) {
181186
try {
182187
new ImageIcon(rank.getIconName(), new ResourceLocation("textures/icons/" + rank.getIconName() + ".png"));
183188
} catch (Exception ignored) {
184189
}
185190
}
191+
192+
for (int i = 0; i < 10; i++) {
193+
new ImageIcon(String.valueOf(i), new ResourceLocation("textures/icons/" + i + ".png"));
194+
}
186195
imageIconRenderer = new ImageIconRenderer();
187196
Minecraft.getMinecraft().fontRendererObj = imageIconRenderer;
188197
}
@@ -294,6 +303,4 @@ public static InputStream post(String url, JSONObject json) throws IOException {
294303

295304
return connection.getInputStream();
296305
}
297-
298-
299306
}

src/main/java/cc/woverflow/hysentials/command/ClubCommand.java

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,23 @@
2323
import java.util.ArrayList;
2424
import java.util.HashMap;
2525
import java.util.List;
26+
import java.util.Map;
2627

28+
import static cc.woverflow.hysentials.guis.club.ClubDashboard.update;
2729
import static cc.woverflow.hysentials.handlers.redworks.BwRanks.randomString;
2830

29-
@Command(value = "club", description = "Club Commands")
31+
@Command(value = "club", description = "Club Commands",
32+
customHelpMessage = {
33+
"§9-----------------------------------------------------",
34+
"&aClub Commands: &c[BETA]",
35+
"&e/club create <name> &7- &bCreate a club with the specified name",
36+
"&e/club invite <player> &7- &bInvite a player to your club",
37+
"&e/club join <name> &7- &bUsed to accept a club invite",
38+
"&e/club leave &7- &bLeave your current club",
39+
"&e/club dashboard &7- &bOpen the club dashboard",
40+
"&e/club list &7- &bList all players in your club",
41+
"§9-----------------------------------------------------"
42+
})
3043
public class ClubCommand {
3144
@SubCommand(aliases = {"create"}, description = "Create a club")
3245
public void create(String name) {
@@ -61,10 +74,10 @@ public void join(String name) {
6174
"club", name,
6275
"uuid", Minecraft.getMinecraft().getSession().getProfile().getId(),
6376
"serverId", Socket.serverId
64-
).toString());
77+
).toString());
6578
}
6679

67-
@SubCommand(aliases = {"list"}, description = "Leave a club")
80+
@SubCommand(aliases = {"list"})
6881
public void list() {
6982
try {
7083
String s = NetworkUtils.getString("https://hysentials.redstone.llc/api/club?uuid="
@@ -75,7 +88,8 @@ public void list() {
7588
UChat.chat(HysentialsConfig.chatPrefix + " &c" + clubData.getString("message"));
7689
return;
7790
}
78-
JSONArray members = clubData.getJSONArray("members");
91+
JSONObject club = clubData.getJSONObject("club");
92+
JSONArray members = club.getJSONArray("members");
7993
Multithreading.runAsync(() -> {
8094
HashMap<String, String> userMap = new HashMap<>();
8195
for (int i = 0; i < members.length(); i++) {
@@ -84,25 +98,39 @@ public void list() {
8498
userMap.put(uuid, name);
8599
}
86100

87-
List<String> displayNames = new ArrayList<>();
88-
for (int i = 0; i < members.length(); i++) {
89-
String uuid = members.getString(i);
90-
String name = userMap.get(uuid);
91-
displayNames.add(HypixelAPIUtils.getDisplayName(name, uuid));
92-
}
93-
94101
UChat.chat(HysentialsConfig.chatPrefix + " &aClub Members:");
95-
for (String displayName : displayNames) {
96-
UChat.chat(" - &a" + displayName);
102+
for (Map.Entry<String, String> displayName : userMap.entrySet()) {
103+
String uuid = displayName.getKey();
104+
String name = displayName.getValue();
105+
UChat.chat(" - &a" + name + (club.getString("owner").equals(uuid) ? " &8(Owner)" : ""));
97106
}
98107
});
99108
} catch (Exception e) {
100109

101110
}
102111
}
112+
@SubCommand(aliases = {"invite"}, description = "Invite a player to your club")
113+
public void invite(String name) {
114+
Multithreading.runAsync(() -> {
115+
JSONObject jsonObject = new JSONObject();
116+
jsonObject.put("invitee", name);
117+
ClubDashboard.clubData = ClubDashboard.getClub();
118+
update(jsonObject);
119+
});
120+
}
121+
122+
@SubCommand(aliases = {"leave"}, description = "Leave a club")
123+
public void leave() {
124+
Multithreading.runAsync(() -> {
125+
JSONObject json = new JSONObject();
126+
json.put("leave", true);
127+
ClubDashboard.clubData = ClubDashboard.getClub();
128+
update(json);
129+
});
130+
}
103131

104-
@Main()
105-
public void main() {
132+
@SubCommand(aliases = {"dashboard", "db"}, description = "Open the club dashboard")
133+
public void dashboard() {
106134
try {
107135
String s = NetworkUtils.getString("https://hysentials.redstone.llc/api/club?uuid="
108136
+ Minecraft.getMinecraft().getSession().getProfile().getId().toString()

src/main/java/cc/woverflow/hysentials/command/HysentialsCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
import cc.woverflow.hysentials.config.HysentialsConfig;
2828
import cc.woverflow.hysentials.guis.actionLibrary.ActionLibrary;
2929
import cc.woverflow.hysentials.handlers.htsl.CodeEditor;
30+
import cc.woverflow.hysentials.handlers.imageicons.ImageIcon;
3031
import cc.woverflow.hysentials.htsl.compiler.Compiler;
3132
import cc.woverflow.hysentials.util.HypixelAPIUtils;
33+
import cc.woverflow.hysentials.util.JsonData;
3234
import cc.woverflow.hysentials.websocket.Socket;
3335
import cc.woverflow.hytils.HytilsReborn;
3436
import cc.woverflow.hytils.config.HytilsConfig;
@@ -54,6 +56,13 @@ public class HysentialsCommand {
5456

5557
}
5658

59+
@SubCommand(aliases = {"reload"}, description = "Reloads the mod")
60+
public void handleReload() {
61+
ImageIcon.reloadIcons();
62+
Hysentials.INSTANCE.rankColors = new JsonData("./config/hysentials/colors.json", new JSONObject());
63+
UChat.chat("§aReloaded Hysentials!");
64+
}
65+
5766
@Main
5867
private void handleDefault() {
5968
Hysentials.INSTANCE.getConfig().openGui();

src/main/java/cc/woverflow/hysentials/config/EditorConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ public class EditorConfig extends Config {
3131
description = "The regex to match the line. Don't edit this unless you know regex",
3232
category = "editor",
3333
subcategory = "general",
34-
size = 1
34+
size = 1,
35+
multiline = true
3536
)
3637
public String regex = "";
3738

3839
@Text(
3940
name = "display",
4041
description = "The text that will be displayed",
4142
category = "editor",
42-
subcategory = "general"
43+
subcategory = "general",
44+
size = 1,
45+
multiline = true
4346
)
4447
public String display = "";
4548

src/main/java/cc/woverflow/hysentials/config/HysentialsConfig.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@
2020

2121
import cc.polyfrost.oneconfig.config.Config;
2222
import cc.polyfrost.oneconfig.config.annotations.*;
23+
import cc.polyfrost.oneconfig.config.annotations.Button;
24+
import cc.polyfrost.oneconfig.config.annotations.Checkbox;
25+
import cc.polyfrost.oneconfig.config.annotations.Color;
2326
import cc.polyfrost.oneconfig.config.annotations.Number;
2427
import cc.polyfrost.oneconfig.config.core.OneColor;
2528
import cc.polyfrost.oneconfig.config.data.Mod;
2629
import cc.polyfrost.oneconfig.config.data.ModType;
2730
import cc.polyfrost.oneconfig.libs.checker.units.qual.N;
2831
import cc.woverflow.hytils.HytilsReborn;
2932

33+
import java.awt.*;
34+
import java.io.File;
35+
3036
public class HysentialsConfig extends Config {
3137
// GENERAL
3238
@Text(
@@ -61,6 +67,22 @@ public class HysentialsConfig extends Config {
6167
)
6268
public static boolean futuristicChannels = true;
6369

70+
@Button(
71+
name = "Rank Image Config",
72+
category = "General",
73+
subcategory = "Ranks",
74+
description = "Opens the rank image config directory.",
75+
text = "Open Folder")
76+
public void openRankImageConfig() {
77+
Desktop desktop = Desktop.getDesktop();
78+
File directory = new File("./config/hysentials/imageicons");
79+
try {
80+
desktop.open(directory);
81+
} catch (Exception e) {
82+
e.printStackTrace();
83+
}
84+
}
85+
6486
@Button(
6587
name = "Additional Configs",
6688
category = "General",

src/main/java/cc/woverflow/hysentials/guis/actionLibrary/ChooseOutput.java

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)