mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Fix errors
This commit is contained in:
parent
4d77d514fd
commit
f97649083a
@ -10,6 +10,7 @@ import dev.plex.rank.enums.Rank;
|
|||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -23,27 +24,34 @@ public class ToggleCMD extends PlexCommand
|
|||||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (isConsole(sender) || playerSender == null)
|
if (isConsole(sender) || playerSender == null)
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(PlexUtils.mmDeserialize("<gray>Available toggles:"));
|
sender.sendMessage(PlexUtils.mmDeserialize("<gray>Available toggles:"));
|
||||||
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Explosions " + status("explosions")));
|
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Explosions" + status("explosions")));
|
||||||
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Fluidspread " + status("fluidspread")));
|
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Fluidspread" + status("fluidspread")));
|
||||||
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Drops " + status("drops")));
|
sender.sendMessage(PlexUtils.mmDeserialize("<gray> - Drops" + status("drops")));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
switch (args[0].toLowerCase())
|
switch (args[0].toLowerCase())
|
||||||
{
|
{
|
||||||
case "explosions":
|
case "explosions" ->
|
||||||
{
|
{
|
||||||
toggle("explosions");
|
return toggle(sender, "explosions");
|
||||||
}
|
}
|
||||||
case "fluidspread":
|
case "fluidspread" ->
|
||||||
{
|
{
|
||||||
toggle("fluidspread");
|
return toggle(sender, "fluidspread");
|
||||||
}
|
}
|
||||||
case "drops":
|
case "drops" ->
|
||||||
{
|
{
|
||||||
toggle("drops");
|
return toggle(sender, "drops");
|
||||||
|
}
|
||||||
|
default ->
|
||||||
|
{
|
||||||
|
return messageComponent("invalidToggle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
new ToggleMenu().openInv(playerSender, 0);
|
new ToggleMenu().openInv(playerSender, 0);
|
||||||
return null;
|
return null;
|
||||||
@ -57,11 +65,12 @@ public class ToggleCMD extends PlexCommand
|
|||||||
|
|
||||||
private String status(String toggle)
|
private String status(String toggle)
|
||||||
{
|
{
|
||||||
return plugin.toggles.getBoolean(toggle) ? "(enabled)" : "(disabled)";
|
return plugin.toggles.getBoolean(toggle) ? " (enabled)" : " (disabled)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggle(String toggle)
|
private Component toggle(CommandSender sender, String toggle)
|
||||||
{
|
{
|
||||||
plugin.toggles.set(toggle, !plugin.getToggles().getBoolean(toggle));
|
plugin.toggles.set(toggle, !plugin.getToggles().getBoolean(toggle));
|
||||||
|
return Component.text("Toggled " + toggle + status(toggle)).color(NamedTextColor.GRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,3 +181,4 @@ noteNotFound: "<red>A note with this ID could not be found."
|
|||||||
removedNote: "<green>Removed note with ID: {0}"
|
removedNote: "<green>Removed note with ID: {0}"
|
||||||
# 0 - The number of notes cleared
|
# 0 - The number of notes cleared
|
||||||
clearedNotes: "<green>Cleared {0} notes."
|
clearedNotes: "<green>Cleared {0} notes."
|
||||||
|
invalidToggle: "<red>That is not a valid toggle."
|
Loading…
Reference in New Issue
Block a user