Skip to content

Commit

Permalink
Merge branch '1.21.0' into 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Oct 25, 2024
2 parents 334e88c + 9441c6e commit 87be960
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ dependencies {
implementation("com.github.rfresh2.fastutil.maps:int-int-maps:$fastutilVersion")
implementation("com.github.rfresh2.fastutil.maps:reference-object-maps:$fastutilVersion")
implementation("com.github.rfresh2.fastutil.queues:int-queues:$fastutilVersion")
implementation("net.raphimc:ViaLoader:3.0.3")
implementation("com.viaversion:viaversion:5.0.5")
implementation("com.viaversion:viabackwards:5.0.4")
implementation("net.raphimc:ViaLoader:3.0.4")
implementation("com.viaversion:viaversion:5.1.0")
implementation("com.viaversion:viabackwards:5.1.0")
implementation("org.jline:jline:3.27.1")
implementation("org.jline:jline-terminal-jni:3.27.1")
implementation("ar.com.hjg:pngj:2.1.0")
Expand Down
11 changes: 8 additions & 3 deletions src/launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ def setup_execute(config):
if discord_bot:
print("See README.md for Discord bot setup instructions")
print("https://github.com/rfresh2/ZenithProxy/?tab=readme-ov-file#discord-bot-setup")
discord_verify_verbose = False
while True:
print("Enter Discord bot token:")
discord_bot_token = input("> ")
if len(discord_bot_token) < 50:
print("Invalid token")
continue
if verify_discord_bot_token(discord_bot_token):
if verify_discord_bot_token(discord_bot_token, discord_verify_verbose):
break
discord_verify_verbose = True # verbose on second attempt
print("")
while True:
print("Enter a Discord channel ID to manage ZenithProxy in:")
Expand Down Expand Up @@ -233,14 +235,17 @@ def rescue_invalid_system(config):
critical_error("Invalid system for release channel:", config.release_channel)


def verify_discord_bot_token(token):
def verify_discord_bot_token(token, verbose=False):
headers = {
"Authorization": "Bot " + token
"Authorization": "Bot " + token,
"User-Agent": "DiscordBot (https://github.com/rfresh2/ZenithProxy, 1.0)"
}
try:
response = requests.get("https://discord.com/api/applications/@me", headers=headers, timeout=10)
if response.status_code != 200:
print("Invalid token. Discord API response code:", response.status_code)
if verbose:
print("Full Discord Response:", response.text)
return False
response_json = response.json()
flags = response_json["flags"]
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zenith/command/CommandUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public String serialize(CommandSource commandSource) {
+ usageLines.stream()
.map(line -> "\n" + COMMAND.getCommandPrefix(commandSource) + name + " " + line)
.collect(Collectors.joining());
result += "\n\n[Commands Help Wiki](https://gg.gg/1bvpn4)";
result += "\n\n[Commands Help Wiki](https://t.ly/ue-sg)";
if (result.length() > 1024) {
DEFAULT_LOG.error("Command usage too long", new RuntimeException());
return this.shortSerialize(commandSource);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/zenith/command/impl/DebugCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CommandUsage commandUsage() {
"teleportResync on/off",
"ncpStrictInventory on/off",
"debugLogs on/off",
"restartReconnect on/off"
"serverRestartReconnect on/off"
)
);
}
Expand Down Expand Up @@ -171,7 +171,7 @@ public LiteralArgumentBuilder<CommandContext> register() {
.then(literal("serverRestartReconnect").then(argument("toggle", toggle()).executes(c -> {
CONFIG.client.extra.serverRestartReconnect = getToggle(c, "toggle");
c.getSource().getEmbed()
.title("Restart Reconnect " + toggleStrCaps(CONFIG.client.extra.serverRestartReconnect));
.title("Server Restart Reconnect " + toggleStrCaps(CONFIG.client.extra.serverRestartReconnect));
return OK;
})));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zenith/command/impl/KillAuraCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public CommandUsage commandUsage() {
"""
Attacks entities near the player.
Custom targets list: https://gg.gg/19i5rc
Custom targets list: https://t.ly/RLreZ
""",
asList("on/off",
"attackDelay <ticks>",
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/zenith/module/impl/AutoMend.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ private void handleBotTick(ClientBotTick event) {
return;
}
if (CACHE.getPlayerCache().getThePlayer().isAlive()) {
if (MODULE.get(AutoTotem.class).isEnabled()
&& MODULE.get(AutoTotem.class).playerHealthBelowThreshold()) {
delay = 50;
return;
}
delay = doInventoryActions();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zenith/module/impl/AutoTotem.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void onTotemPopEvent(TotemPopEvent totemPopEvent) {
}
}

private boolean playerHealthBelowThreshold() {
public boolean playerHealthBelowThreshold() {
return CACHE.getPlayerCache().getThePlayer().getHealth() <= CONFIG.client.extra.autoTotem.healthThreshold;
}

Expand Down

Large diffs are not rendered by default.

0 comments on commit 87be960

Please sign in to comment.