Skip to content

Commit

Permalink
Fix some UI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed May 2, 2024
1 parent 9400881 commit f3a0b32
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ private void sendMobListPage(World world, CommandSender sender, Map.Entry<String
<field>%s: <value>%s %s %s %s
%s
<field>Health Modifier: %s %s %s
<field>%s: %s %s
%s
<field>Damage Modifier: %s %s %s
<field>%s: %s %s
%s
""".stripIndent()
.formatted(
// Mob name state
Expand All @@ -277,17 +277,18 @@ private void sendMobListPage(World world, CommandSender sender, Map.Entry<String
// Drop amount
changeableValueWithInput("field.dropAmount", entry.getDropAmount() == 0 ? escape("action.default") : entry.getDropAmount() + "x", cmd + "dropAmount "),
// Drops
escape("field.drops"),
entry.getDrops().size() + " " + escape("field.drops"),
escape("field.drops"), entry.getDrops().size() + " " + escape("field.drops"),
changeButton(cmd + "drops changeContent", "action.content", "change"),
changeButton(cmd + "drops changeWeight", "action.weight", "weight"),
changeButton(cmd + "drops clear", "action.clear", "delete"),
// default drops
getBooleanField(entry.isOverrideDefaultDrops(), cmd + "overrideDefault {bool} " + page, "field.overrideDefaultDrops", "state.override", "state.combine"),
// health modifier
getToggleField(entry.getHealthModifier() == MobValueModifier.DEFAULT, cmd + "healthModifier DEFAULT", "action.default"),
getToggleField(entry.getHealthModifier() == MobValueModifier.MULTIPLY, cmd + "healthModifier MULTIPLY", "action.multiply"),
getToggleField(entry.getHealthModifier() == MobValueModifier.VALUE, cmd + "healthModifier VALUE", "action.value"),
changeableValueWithInput("field.health", healthModifier, cmd + "health "),
getToggleField(entry.getDamageModifier() == MobValueModifier.DEFAULT, cmd + "damageModifier DEFAULT", localizer().getMessage("action.default")),
getToggleField(entry.getDamageModifier() == MobValueModifier.DEFAULT, cmd + "damageModifier DEFAULT", "action.default"),
getToggleField(entry.getDamageModifier() == MobValueModifier.MULTIPLY, cmd + "damageModifier MULTIPLY", "action.multiply"),
getToggleField(entry.getDamageModifier() == MobValueModifier.VALUE, cmd + "damageModifier VALUE", "action.value"),
changeableValueWithInput("field.damage", healthModifier, cmd + "damage ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private void sendWorldPage(World world, CommandSender sender, int page) {
String cmd = "/bloodnight manageWorlds " + ArgumentUtils.escapeWorldName(entry.getWorldName()) + " ";
BossBarSettings bbs = entry.getBossBarSettings();
return """
<header><%s></header> %s
%s
%s
Expand All @@ -126,11 +125,12 @@ private void sendWorldPage(World world, CommandSender sender, int page) {
<field>%s: %s %s %s
""".stripIndent()
.formatted(
// header
entry.getWorldName(), CommandUtil.getBooleanField(entry.isEnabled(), cmd + "state {bool} ", "", "state.enabled", "state.disabled"),
CommandUtil.getBooleanField(entry.isCreeperBlockDamage(), cmd + "creeperBlockDamage {bool} ", "field.creeperBlockDamage", "state.enabled", "state.disabled"),
CommandUtil.getBooleanField(entry.isAlwaysManageCreepers(), cmd + "manageCreeperAlways {bool} ", "field.alwaysManageCreepers", "state.enabled", "state.disabled"),
escape("field.bossBarSettings"),
CommandUtil.getBooleanField(bbs.isEnabled(), cmd + "bossBar state {bool} ", "", "state.enabled", "state.disabled"),
CommandUtil.getBooleanField(bbs.isEnabled(), cmd + "bossBar state {bool} ", "field.state", "state.enabled", "state.disabled"),
escape("field.title"), bbs.getTitle(), cmd + "bossBar title " + bbs.getTitle(), escape("action.change"),
escape("field.color"), bbs.getColor(), cmd + "bossBar color ", escape("action.change"),
escape("field.effects"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MobDeathActions actions(Player player, Arguments args) {
}

void sendMobDeathActions(Player player, World world) {
String cmd = "/bloodnight deathActions monster {command} " + ArgumentUtils.escapeWorldName(world.getName());
String cmd = "/bloodnight manageDeathActions monster {command} " + ArgumentUtils.escapeWorldName(world.getName());
String action = """
%s
<field>%s <click:run_command:'%s'><change>[%s]</click>
Expand Down Expand Up @@ -97,7 +97,7 @@ static class Shockwave extends Base implements IPlayerTabExecutor {
private final Configuration configuration;

public Shockwave(Plugin plugin, Configuration configuration) {
super(plugin, CommandMeta.builder("lightning").hidden().build(), configuration);
super(plugin, CommandMeta.builder("shockwave").hidden().build(), configuration);
this.configuration = configuration;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,23 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar
}

private void sendPlayerDeathActions(Player player, World world, PlayerDeathActions playerDeathActions) {
String cmd = "/bloodnight deathActions player " + ArgumentUtils.escapeWorldName(world.getName()) + " ";
String cmd = "/bloodnight manageDeathActions player " + ArgumentUtils.escapeWorldName(world.getName()) + " ";
var actions = """
%s
<field>%s <click:run_command:'%s'><change>[%s]</click>
<field>%s <click:run_command:'%s'><change>[%s]</click>
<field>%s <click:run_command:'%s'><change>[%s]</click> <click:run_command:'%s'><add>[%s]</click>
<field>%s <click:run_command:'%s'><change>[%s]</click>
<field>%s <click:run_command:'%s'><change>[%s]</click>
<field>%s: <value>%s <click:suggest_command:'%s'><change>[%s]</click>
<field>%s: <value>%s <click:suggest_command:'%s'><change>[%s]</click>
<field>%s:
<field>%s: <value>%s <click:suggest_command:'%s'><change>[%s]</click>
<field>%s: <value>%s <click:suggest_command:'%s'><change>[%s]</click>
""".stripIndent()
.formatted(CommandUtil.getHeader("manageDeathActions.player.title"),
escape("field.lightningSettings"), cmd + "lightning", escape("action.change"),
escape("field.shockwaveSettings"), cmd + "shockwave", escape("action.change"),
escape("field.deathCommands"), cmd + "commands", escape("action.change"), cmd + "addCommand", escape("action.add"),
escape("field.respawnEffect"), cmd + "effects", escape("action.change"),
escape("field.loseInventory"), cmd + "loseInv", escape("action.change"),
escape("field.loseInventory"),
escape("field.loseInventory"), playerDeathActions.getLoseInvProbability(), cmd + "loseInv ", escape("action.change"),
escape("field.loseExperience"), playerDeathActions.getLoseExpProbability(), cmd + "loseExp ", escape("action.change")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public static <T> String getPage(Collection<T> content, int page, int elementsPe
builder.newLine();
}

builder.text("<yellow>=====<| <field>%s<yellow> |>=====", escape(title));
builder.text("<yellow>=====<| <field>%s<yellow> |>=====", escape(title))
.newLine();
builder.text(elements.stream().map(mapping).toList());

return builder.newLine().text(getPageFooter(page, CommandUtil.pageCount(content, elementsPerPage), pageCommand)).build();
Expand Down
3 changes: 2 additions & 1 deletion BloodNight-core/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ field.nightDuration=Night duration
field.nightEnd=Night End
field.nightSelectionType=Night Selection Type
field.overrideDefaultDrops=Override Default Drops
field.overrideDuration=Override duration
field.overrideDuration=Override duration#
field.state=State
field.phase=Phase
field.power=Power
field.probability=Probability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ field.probability=Wahrscheinlichkeit
field.range=Reichweite
field.respawnEffect=Respawn Effekte
field.shockwaveSettings=Schockwelle Einstellungen
field.state=Status
field.showMobNames=Zeige Mob Namen
field.sleep=Schlafen
field.spawnPercentage=Spawn Wahrscheinlichkeit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ state.allow=allow
state.combine=combine
state.curve=Curve
state.custom=custom
field.state=State
state.darkenSky=Darken Sky
state.default=default
state.deny=deny
Expand Down

0 comments on commit f3a0b32

Please sign in to comment.