Skip to content

Commit

Permalink
Added command to see who is whitelisted/blacklisted of grave generation
Browse files Browse the repository at this point in the history
  • Loading branch information
B1n-ry committed Feb 11, 2024
1 parent c1994d5 commit c24ca22
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# You're in Grave Danger 2.0.0-beta.9

### Changes
* Added `/yigd whitelist list` command to list all whitelisted/blacklisted players

---

# You're in Grave Danger 2.0.0-beta.8

### Changes
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ publishMods {
}

github {
displayName = project.mod_version

accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = "B1n-ry/Youre-in-grave-danger"
commitish = "1.20"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.parallel=true
loader_version=0.15.6

# Mod Properties
mod_version = 2.0.0-beta.8
mod_version = 2.0.0-beta.9
maven_group = com.b1n_ry.yigd
archives_base_name = youre-in-grave-danger

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/b1n_ry/yigd/data/DeathInfoManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public void clear() {
this.affectedPlayers.clear();
}

public Set<GameProfile> getAffectedPlayers() {
return affectedPlayers;
}

/**
* Tries to delete a grave based on its grave ID
* @param graveId the ID of the grave
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/b1n_ry/yigd/util/YigdCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public static void register() {
.then(argument("target", EntityArgumentType.players())
.executes(context -> removeFromList(context, EntityArgumentType.getPlayers(context, "target")))))
.then(literal("toggle")
.executes(YigdCommands::toggleListType)))
.executes(YigdCommands::toggleListType))
.then(literal("list")
.executes(YigdCommands::showList)))
));
}

Expand Down Expand Up @@ -238,6 +240,18 @@ private static int toggleListType(CommandContext<ServerCommandSource> context) {
DeathInfoManager.INSTANCE.markDirty();
context.getSource().sendMessage(Text.translatable("text.yigd.command.whitelist.toggle", newMode.name()));

return 1;
}
private static int showList(CommandContext<ServerCommandSource> context) {
ListMode listMode = DeathInfoManager.INSTANCE.getGraveListMode();
Set<GameProfile> affectedPlayers = DeathInfoManager.INSTANCE.getAffectedPlayers();

StringJoiner joiner = new StringJoiner(", ");
for (GameProfile profile : affectedPlayers) {
joiner.add(profile.getName());
}
context.getSource().sendMessage(Text.literal(listMode.name() + ": %s" + joiner));

return 1;
}
}

0 comments on commit c24ca22

Please sign in to comment.