Skip to content

Commit

Permalink
ranked: hide player id
Browse files Browse the repository at this point in the history
  • Loading branch information
buj committed Dec 8, 2024
1 parent f124715 commit ed13f5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/darkdustry/listeners/NetHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ public static void connect(NetConnection con, ConnectPacket packet) {
var data = Database.getPlayerData(uuid);
if (!config.whitelistKickSpectator && (!netServer.admins.isWhitelisted(uuid, usid) || (
!config.whitelist.isEmpty() &&
data == null ||
!config.whitelist.contains(data.id)
(data == null ||
!config.whitelist.contains(data.id))
))) {
info.adminUsid = usid;
info.names.addUnique(info.lastName = name);
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/darkdustry/listeners/PluginEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static void load() {
app.post(() -> data.effects.join.get(event.player));

Log.info("@ has connected. [@ / @]", event.player.plainName(), event.player.uuid(), data.id);
Bundle.send("events.join", event.player.coloredName(), data.id);
Bundle.send("events.join", event.player.coloredName(), config.mode.maskUsernames ? "??" : "" + data.id);

Socket.send(new ServerMessageEmbedEvent(config.mode.name(), event.player.plainName() + " [" + data.id + "] joined", Color.MEDIUM_SEA_GREEN));

Expand All @@ -214,7 +214,7 @@ else if (data.discordLink)

Events.on(PlayerLeave.class, event -> {
Cache.mutes.remove(event.player.uuid());
Admins.forget(player);
Admins.forget(event.player);
var data = Cache.remove(event.player);
Database.savePlayerData(data);

Expand Down Expand Up @@ -245,7 +245,10 @@ else if (data.discordLink)

if (Groups.player.size() <= 1 && config.mode.restartOnNoPlayers) {
Log.info("Scheduling rtv in 60s...");
noPlayersRestartTask = Timer.schedule(() -> instance.play(() -> world.loadMap(maps.getNextMap(instance.lastMode, state.map))), 60);
noPlayersRestartTask = Timer.schedule(() -> {
instance.play(() -> world.loadMap(maps.getNextMap(instance.lastMode, state.map)));
noPlayersRestartTask = null;
}, 60);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/darkdustry/utils/Admins.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void updateRealName(Player player, String name) {
}

public static void forget(Player player) {
realNames.remove(player);
if (player != null) realNames.remove(player);
}

public static String realname(Player player) {
Expand Down

0 comments on commit ed13f5d

Please sign in to comment.