-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Wertik/dev
1.4.0
- Loading branch information
Showing
19 changed files
with
216 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/space/devport/wertik/conditionaltext/commands/subcommands/ListSubCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package space.devport.wertik.conditionaltext.commands.subcommands; | ||
|
||
import org.bukkit.command.CommandSender; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import space.devport.dock.commands.struct.ArgumentRange; | ||
import space.devport.dock.commands.struct.CommandResult; | ||
import space.devport.dock.text.message.Message; | ||
import space.devport.wertik.conditionaltext.ConditionalTextPlugin; | ||
import space.devport.wertik.conditionaltext.commands.ConditionalTextSubCommand; | ||
import space.devport.wertik.conditionaltext.system.struct.Setting; | ||
|
||
import java.util.Map; | ||
|
||
public class ListSubCommand extends ConditionalTextSubCommand { | ||
|
||
public ListSubCommand(ConditionalTextPlugin plugin) { | ||
super(plugin, "list"); | ||
} | ||
|
||
@Override | ||
protected @NotNull CommandResult perform(@NotNull CommandSender sender, @NotNull String label, String[] args) { | ||
|
||
Map<String, Setting> settings = getPlugin().getSettingManager().getSettings(); | ||
|
||
if (settings.isEmpty()) { | ||
language.sendPrefixed(sender, "Commands.List.Empty"); | ||
return CommandResult.SUCCESS; | ||
} | ||
|
||
Message header = language.get("Commands.List.Header"); | ||
String format = language.get("Commands.List.Format").toString(); | ||
|
||
for (Map.Entry<String, Setting> entry : settings.entrySet()) { | ||
header.append(format.replace("%name%", entry.getKey()).replace("%rules%", String.valueOf(entry.getValue().getRules().size()))); | ||
} | ||
|
||
header.send(sender); | ||
return CommandResult.SUCCESS; | ||
} | ||
|
||
@Override | ||
public @Nullable String getDefaultUsage() { | ||
return "/%label% list"; | ||
} | ||
|
||
@Override | ||
public @Nullable String getDefaultDescription() { | ||
return "List loaded settings."; | ||
} | ||
|
||
@Override | ||
public @Nullable ArgumentRange getRange() { | ||
return new ArgumentRange(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.