Added /userinfo and fun commands and various formatting changes to match hypixel#682
Added /userinfo and fun commands and various formatting changes to match hypixel#682petethepossum wants to merge 27 commits intoSwofty-Developments:masterfrom
Conversation
… 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.
Added basic tp command
fixed message and friend list showing rank prefix
…lock # Conflicts: # type.generic/src/main/java/net/swofty/type/generic/command/commands/TeleportCommand.java
| * Parses Lynx-like durations: 1d, 3d, 14d, 2h, 30m, 1d12h, 2d6h30m | ||
| * Returns duration in milliseconds. | ||
| */ | ||
| public final class DurationParser { |
There was a problem hiding this comment.
Probably should instead have this in StringUtility
| } | ||
|
|
||
| /** Minimal duration parser: "1d", "3h", "30m", "10s" or plain seconds. */ | ||
| public static long parseDurationMs(String input) { |
There was a problem hiding this comment.
why is this done here again?
| return Component.text(getUsername(), rank.getTextColor()); | ||
| } | ||
|
|
||
| public String getColouredDisplayName() { |
There was a problem hiding this comment.
Rather just do LegacyComponentSerializer.legacySection().serialize(Component.text(getDisplayName(), rank.getTextColor()));
| 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(); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
after fetching the HypixelPlayer just use the player.getColouredDisplayName
|
|
||
| player.transferTo(type); | ||
| } | ||
| // --- NEW: UUID transfer (for m1A / mini2B etc) --- |
There was a problem hiding this comment.
if you are going to leave comments like this make them javadocs but I don't think this should be here
|
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 |
| new net.swofty.proxyapi.ProxyInformation() | ||
| .getAllServersInformation() | ||
| .thenAccept(net.swofty.type.generic.utility.ProxyServersCache::update) | ||
| .exceptionally(ex -> null); |
There was a problem hiding this comment.
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()) { |
|
|
||
| ProxyPlayer target = new ProxyPlayer(targetUUID); | ||
| if (!target.isOnline().join()) { | ||
| player.sendMessage("§cThe player you tried to boop, " + playerName + ", is not online."); |
There was a problem hiding this comment.
While you're here you should do "§cThat player is not online!"
Swofty-Developments
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| new net.swofty.proxyapi.ProxyInformation() | ||
| .getAllServersInformation() | ||
| .thenAccept(net.swofty.type.generic.utility.ProxyServersCache::update) | ||
| .exceptionally(ex -> null); |
There was a problem hiding this comment.
I wonder if this was actually done in an IDE.
| /** | ||
| * Get the UUID of the current server | ||
| */ | ||
| public CompletableFuture<UUID> getServerUUID() { |
There was a problem hiding this comment.
This is already stored in HypixelConst, go check that file.
|
|
||
| private PunishmentService() {} | ||
|
|
||
| public static void ensureConnected() { |
There was a problem hiding this comment.
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 { | |||
There was a problem hiding this comment.
This should probably be in commons
| @@ -0,0 +1,59 @@ | |||
| package net.swofty.type.generic.data.handlers; | |||
There was a problem hiding this comment.
This should really be handled in its own service.
| private final Long cancelledAtMs; // optional | ||
| private final String cancelReason; // optional | ||
|
|
||
| public PunishmentRecord( |
There was a problem hiding this comment.
Why is this not a record?
| import java.util.UUID; | ||
|
|
||
| /** | ||
| * Low-level Mongo repository. |
| } | ||
|
|
||
| // Handle cross-server teleport from /tpto command | ||
| Object hook = player.getHookManager().getHook("tpto_target"); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Do we not already have this? Go check what the Lobby Selector in the SkyBlock Hub does
It's done in IntelliJ lol, |
|
Did you test this? |
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. |
No description provided.