Skip to content

Commit

Permalink
New redesigned command system (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
ANameSpace committed Sep 30, 2024
1 parent 2b21114 commit 892c6ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/main/java/net/elytrium/fastmotd/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public static class VERSIONS {

public static class MESSAGES {
public List<String> USAGE = List.of("<gold><bold>FastMOTD command usage:</bold></gold>", " <gold>/fastmotd info</gold>", " <gold>/fastmotd reload</gold>");
@RegisterPlaceholders("{MAINTENANCE_ENABLED}")
public List<String> INFO = List.of("<gold><bold>FastMOTD Info:</bold></gold>", " Maintenance status: {MAINTENANCE_ENABLED}");
public String YES = "<green>✓</green>";
public String NO = "<red>✕</red>";
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/elytrium/fastmotd/command/FastmotdCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.velocitypowered.api.command.CommandSource;
import net.elytrium.fastmotd.FastMOTD;
import net.elytrium.fastmotd.Settings;
import net.elytrium.serializer.placeholders.Placeholders;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.ComponentSerializer;

Expand All @@ -50,10 +49,12 @@ public static BrigadierCommand createBrigadierCommand(final FastMOTD plugin, fin
.then(BrigadierCommand.literalArgumentBuilder("info")
.requires(source -> source.hasPermission("fastmotd.info"))
.executes(context -> {
context.getSource().sendMessage(serializer.deserialize(Placeholders.replace(
infoString,
Settings.IMP.MAINTENANCE.MAINTENANCE_ENABLED ? Settings.IMP.MAIN.MESSAGES.YES : Settings.IMP.MAIN.MESSAGES.NO
)));
context.getSource().sendMessage(serializer.deserialize(infoString
.replace(
"{MAINTENANCE_ENABLED}",
Settings.IMP.MAINTENANCE.MAINTENANCE_ENABLED ? Settings.IMP.MAIN.MESSAGES.YES : Settings.IMP.MAIN.MESSAGES.NO
)
));
return Command.SINGLE_SUCCESS;
})
)
Expand Down

0 comments on commit 892c6ba

Please sign in to comment.