Skip to content

Added /userinfo and fun commands and various formatting changes to match hypixel#682

Closed
petethepossum wants to merge 27 commits intoSwofty-Developments:masterfrom
petethepossum:master
Closed

Added /userinfo and fun commands and various formatting changes to match hypixel#682
petethepossum wants to merge 27 commits intoSwofty-Developments:masterfrom
petethepossum:master

Conversation

@petethepossum
Copy link
Copy Markdown
Contributor

No description provided.

… caching so type.generic isnt calling the proxy or depending on it
…lock

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
fixed message and friend list showing rank prefix
…lock

# Conflicts:
#	type.generic/src/main/java/net/swofty/type/generic/command/commands/TeleportCommand.java
changed strings of /chat and permission dennied to match hypixel
* Parses Lynx-like durations: 1d, 3d, 14d, 2h, 30m, 1d12h, 2d6h30m
* Returns duration in milliseconds.
*/
public final class DurationParser {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should instead have this in StringUtility

}

/** Minimal duration parser: "1d", "3h", "30m", "10s" or plain seconds. */
public static long parseDurationMs(String input) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this done here again?

return Component.text(getUsername(), rank.getTextColor());
}

public String getColouredDisplayName() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather just do LegacyComponentSerializer.legacySection().serialize(Component.text(getDisplayName(), rank.getTextColor()));

Comment on lines +58 to +74
public static String getColouredDisplayName(UUID uuid) {
if (HypixelGenericLoader.getLoadedPlayers().stream().anyMatch(player -> player.getUuid().equals(uuid))) {
return HypixelGenericLoader.getLoadedPlayers().stream().filter(player -> player.getUuid().equals(uuid)).findFirst().get().getColouredDisplayName();
} else {
// Fallback for offline name display: use rank color + ign (no prefix)
HypixelDataHandler account = HypixelDataHandler.getOfOfflinePlayer(uuid);
Rank rank = account.get(HypixelDataHandler.Data.RANK, DatapointRank.class).getValue();
String colorCode = switch (rank) {
case STAFF, YOUTUBE -> "§c";
case MVP_PLUS, MVP -> "§b";
case VIP_PLUS, VIP -> "§a";
case DEFAULT -> "§7";
};
return colorCode + account.get(HypixelDataHandler.Data.IGN, DatapointString.class).getValue();
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after fetching the HypixelPlayer just use the player.getColouredDisplayName


player.transferTo(type);
}
// --- NEW: UUID transfer (for m1A / mini2B etc) ---
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are going to leave comments like this make them javadocs but I don't think this should be here

@ArikSquad
Copy link
Copy Markdown
Contributor

ArikSquad commented Jan 14, 2026

27 commits? at this point I would suggest to squash the commits. Also it's anti-pattern to push from a master branch instead of having a branch on your side like "punishments" or anything

Comment on lines +208 to +211
new net.swofty.proxyapi.ProxyInformation()
.getAllServersInformation()
.thenAccept(net.swofty.type.generic.utility.ProxyServersCache::update)
.exceptionally(ex -> null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import these

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this was actually done in an IDE.


private UUID resolveUuid(String name) {
try {
for (HypixelPlayer p : net.swofty.type.generic.HypixelGenericLoader.getLoadedPlayers()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import this


ProxyPlayer target = new ProxyPlayer(targetUUID);
if (!target.isOnline().join()) {
player.sendMessage("§cThe player you tried to boop, " + playerName + ", is not online.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here you should do "§cThat player is not online!"

Copy link
Copy Markdown
Owner

@Swofty-Developments Swofty-Developments left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We appreciate the support on our repository, but overall I'd be pretty surprised if this ever got merged, it appears to be done not in an IDE, probably by AI?

run: ./gradlew shadowJar

- name: Free disk space
run: rm -rf ~/.gradle/caches/build-cache-1
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what reason are we clearing the cache in the worker? We don't pay money for this worker as we are a public repository and I am on GitHub pro.

Comment on lines +208 to +211
new net.swofty.proxyapi.ProxyInformation()
.getAllServersInformation()
.thenAccept(net.swofty.type.generic.utility.ProxyServersCache::update)
.exceptionally(ex -> null);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this was actually done in an IDE.

/**
* Get the UUID of the current server
*/
public CompletableFuture<UUID> getServerUUID() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already stored in HypixelConst, go check that file.


private PunishmentService() {}

public static void ensureConnected() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is meant to be a service then you need to actually make this a service. I don't particularly like that we just have every server directly connecting to Mongo, both for race conditions and for per-instance speed.

@@ -0,0 +1,9 @@
package net.swofty.type.generic.data.handlers;

public enum PunishmentType {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be in commons

@@ -0,0 +1,59 @@
package net.swofty.type.generic.data.handlers;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be handled in its own service.

private final Long cancelledAtMs; // optional
private final String cancelReason; // optional

public PunishmentRecord(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not a record?

import java.util.UUID;

/**
* Low-level Mongo repository.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low level?

}

// Handle cross-server teleport from /tpto command
Object hook = player.getHookManager().getHook("tpto_target");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook manager is not cross-server, you should instead be doing sendWithIndication and on complete you can run .teleport on the ProxyPlayer

import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

public final class ProxyServersCache {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not already have this? Go check what the Lobby Selector in the SkyBlock Hub does

@petethepossum
Copy link
Copy Markdown
Contributor Author

We appreciate the support on our repository, but overall I'd be pretty surprised if this ever got merged, it appears to be done not in an IDE, probably by AI?

It's done in IntelliJ lol,
The only main issue I see is the placement of the punishment service.

@ArikSquad
Copy link
Copy Markdown
Contributor

Did you test this?

@Swofty-Developments
Copy link
Copy Markdown
Owner

We appreciate the support on our repository, but overall I'd be pretty surprised if this ever got merged, it appears to be done not in an IDE, probably by AI?

It's done in IntelliJ lol, The only main issue I see is the placement of the punishment service.

Oh that's odd because there's a file termination character that causes the PR to not compile, which I've only seen done by AI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants