mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-02 22:47:43 +01:00
Fixed help and usage descriptions.
Known issue - the help shown when doing a parent help is not using the child's custom help class for usage/description.
This commit is contained in:
parent
239cf50709
commit
f22065fd2c
@ -34,82 +34,92 @@ commands:
|
|||||||
about: "display this help page"
|
about: "display this help page"
|
||||||
admin:
|
admin:
|
||||||
version:
|
version:
|
||||||
usage: "display %bsb_plugin_name% and addons versions"
|
description: "display %bsb_plugin_name% and addons versions"
|
||||||
setrange:
|
setrange:
|
||||||
range-updated: "Island range updated to [number]"
|
range-updated: "Island range updated to [number]"
|
||||||
island:
|
island:
|
||||||
about:
|
about:
|
||||||
usage: "display info about %bsb_plugin_name%"
|
description: "display info about %bsb_plugin_name%"
|
||||||
go:
|
go:
|
||||||
usage: "teleport you to your island"
|
usage: "<home number>"
|
||||||
|
description: "teleport you to your island"
|
||||||
spawn:
|
spawn:
|
||||||
usage: "teleport you to the spawn"
|
description: "teleport you to the spawn"
|
||||||
create:
|
create:
|
||||||
usage: "create an island"
|
description: "create an island"
|
||||||
unable-create-island: "Your island could not be generated, please contact an administrator."
|
unable-create-island: "Your island could not be generated, please contact an administrator."
|
||||||
info:
|
info:
|
||||||
usage: "display info about your island"
|
description: "display info about your island"
|
||||||
reset:
|
reset:
|
||||||
usage: "restart your island and remove the old one"
|
description: "restart your island and remove the old one"
|
||||||
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
|
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
|
||||||
sethome:
|
sethome:
|
||||||
usage: "set your teleport point for /island"
|
description: "set your teleport point for /island"
|
||||||
must-be-on-your-island: "You must be on your island to set home!"
|
must-be-on-your-island: "You must be on your island to set home!"
|
||||||
num-homes: "Homes can be 1 to [max]."
|
num-homes: "Homes can be 1 to [max]."
|
||||||
home-set: "Your island home has been set to your current location."
|
home-set: "Your island home has been set to your current location."
|
||||||
|
usage: "<home number>"
|
||||||
setname:
|
setname:
|
||||||
usage: "set a name for your island"
|
description: "set a name for your island"
|
||||||
name-too-short: "Too short. Minimum size is [length] characters."
|
name-too-short: "Too short. Minimum size is [length] characters."
|
||||||
name-too-long: "Too long. Maximum size is [length] characters."
|
name-too-long: "Too long. Maximum size is [length] characters."
|
||||||
|
usage: "<name>"
|
||||||
resetname:
|
resetname:
|
||||||
usage: "reset your island name"
|
description: "reset your island name"
|
||||||
team:
|
team:
|
||||||
usage: "manage your team"
|
description: "manage your team"
|
||||||
info:
|
info:
|
||||||
usage: "display detailed info about your team"
|
description: "display detailed info about your team"
|
||||||
invite:
|
invite:
|
||||||
usage: "invite a player to join your island"
|
description: "invite a player to join your island"
|
||||||
errors:
|
errors:
|
||||||
island-is-full: "Your island is full, you can't invite anyone else."
|
island-is-full: "Your island is full, you can't invite anyone else."
|
||||||
none-invited-you: "No one invited you :c."
|
none-invited-you: "No one invited you :c."
|
||||||
you-already-are-in-team: "You are already on a team!"
|
you-already-are-in-team: "You are already on a team!"
|
||||||
invalid-invite: "That invite is no longer valid, sorry."
|
invalid-invite: "That invite is no longer valid, sorry."
|
||||||
|
usage: "<player>"
|
||||||
you-can-invite: "You can invite [number] more players."
|
you-can-invite: "You can invite [number] more players."
|
||||||
accept:
|
accept:
|
||||||
usage: "accept an invitation"
|
description: "accept an invitation"
|
||||||
you-joined-island: "You have joined an island! Use /[label] team info to see the other members."
|
you-joined-island: "You have joined an island! Use /[label] team info to see the other members."
|
||||||
name-joined-your-island: "[name] has joined your island!"
|
name-joined-your-island: "[name] has joined your island!"
|
||||||
reject:
|
reject:
|
||||||
usage: "reject an invitation"
|
description: "reject an invitation"
|
||||||
you-rejected-invite: "You have rejected the invitation to join an island."
|
you-rejected-invite: "You have rejected the invitation to join an island."
|
||||||
name-rejected-your-invite: "[name] has rejected your island invite!"
|
name-rejected-your-invite: "[name] has rejected your island invite!"
|
||||||
cancel:
|
cancel:
|
||||||
usage: "cancel the pending invite to join your island"
|
description: "cancel the pending invite to join your island"
|
||||||
leave:
|
leave:
|
||||||
usage: "leave your island"
|
description: "leave your island"
|
||||||
kick:
|
kick:
|
||||||
usage: "remove a member from your island"
|
description: "remove a member from your island"
|
||||||
|
usage: "<player>"
|
||||||
promote:
|
promote:
|
||||||
usage: "promote a player on your island to another rank"
|
description: "promote a player on your island to another rank"
|
||||||
|
usage: "<player>"
|
||||||
setowner:
|
setowner:
|
||||||
usage: "transfer your island ownership to a member"
|
description: "transfer your island ownership to a member"
|
||||||
errors:
|
errors:
|
||||||
cant-transfer-to-yourself: "You can't transfer ownership to yourself! Well, in facts, you could have been able to do so... But we don't want you to do so. 'Cause it's bad."
|
cant-transfer-to-yourself: "You can't transfer ownership to yourself! Well, in facts, you could have been able to do so... But we don't want you to do so. 'Cause it's bad."
|
||||||
target-is-not-member: "That player is not part of your island team!"
|
target-is-not-member: "That player is not part of your island team!"
|
||||||
name-is-the-owner: "[name] is now the island owner!"
|
name-is-the-owner: "[name] is now the island owner!"
|
||||||
|
usage: "<player>"
|
||||||
you-are-the-owner: "You are now the island owner!"
|
you-are-the-owner: "You are now the island owner!"
|
||||||
ban:
|
ban:
|
||||||
usage: "ban a player from your island"
|
description: "ban a player from your island"
|
||||||
|
usage: "<player>"
|
||||||
unban:
|
unban:
|
||||||
usage: "unban a player from your island"
|
description: "unban a player from your island"
|
||||||
|
usage: "<player>"
|
||||||
banlist:
|
banlist:
|
||||||
usage: "list banned players"
|
description: "list banned players"
|
||||||
lock:
|
lock:
|
||||||
usage: "lock/unlock your island so visitors cannot enter it"
|
description: "lock/unlock your island so visitors cannot enter it"
|
||||||
settings:
|
settings:
|
||||||
usage: "display island settings"
|
description: "display island settings"
|
||||||
language:
|
language:
|
||||||
usage: "select language"
|
description: "select language"
|
||||||
|
usage: "<language>"
|
||||||
|
|
||||||
protection:
|
protection:
|
||||||
flags:
|
flags:
|
||||||
|
@ -71,9 +71,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
this.setAliases(new ArrayList<>(Arrays.asList(aliases)));
|
this.setAliases(new ArrayList<>(Arrays.asList(aliases)));
|
||||||
this.subCommands = new LinkedHashMap<>();
|
this.subCommands = new LinkedHashMap<>();
|
||||||
setUsage("");
|
setUsage("");
|
||||||
if (!label.equals("help"))
|
setDescription("");
|
||||||
new DefaultHelpCommand(this);
|
|
||||||
this.setup();
|
this.setup();
|
||||||
|
// If this command does not define its own help class, then use the default help command
|
||||||
|
if (!this.getSubCommand("help").isPresent() && !label.equals("help"))
|
||||||
|
new DefaultHelpCommand(this);
|
||||||
|
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Bukkit.getLogger().info("DEBUG: registering command " + label);
|
Bukkit.getLogger().info("DEBUG: registering command " + label);
|
||||||
}
|
}
|
||||||
@ -155,7 +158,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
Bukkit.getLogger().info("DEBUG: This command has subcommands");
|
Bukkit.getLogger().info("DEBUG: This command has subcommands");
|
||||||
if (subCommand.hasSubCommand(args[i])) {
|
if (subCommand.hasSubCommand(args[i])) {
|
||||||
// Step down one
|
// Step down one
|
||||||
subCommand = subCommand.getSubCommand(args[i]);
|
subCommand = subCommand.getSubCommand(args[i]).get();
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Bukkit.getLogger().info("DEBUG: Moved to " + subCommand.getLabel());
|
Bukkit.getLogger().info("DEBUG: Moved to " + subCommand.getLabel());
|
||||||
} else {
|
} else {
|
||||||
@ -229,12 +232,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
* @param label - command label or alias
|
* @param label - command label or alias
|
||||||
* @return CompositeCommand or null if none found
|
* @return CompositeCommand or null if none found
|
||||||
*/
|
*/
|
||||||
public CompositeCommand getSubCommand(String label) {
|
public Optional<CompositeCommand> getSubCommand(String label) {
|
||||||
for (Map.Entry<String, CompositeCommand> entry : subCommands.entrySet()) {
|
for (Map.Entry<String, CompositeCommand> entry : subCommands.entrySet()) {
|
||||||
if (entry.getKey().equalsIgnoreCase(label)) return subCommands.get(label);
|
if (entry.getKey().equalsIgnoreCase(label)) return Optional.of(subCommands.get(label));
|
||||||
else if (entry.getValue().getAliases().contains(label)) return subCommands.get(entry.getValue().getLabel());
|
else if (entry.getValue().getAliases().contains(label)) return Optional.of(subCommands.get(entry.getValue().getLabel()));
|
||||||
}
|
}
|
||||||
return null;
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package us.tastybento.bskyblock.api.commands;
|
package us.tastybento.bskyblock.api.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,29 +20,35 @@ public class DefaultHelpCommand extends CompositeCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, List<String> args) {
|
public boolean execute(User user, List<String> args) {
|
||||||
|
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
// Show the top level help
|
// Show the top level help
|
||||||
if (user.isPlayer()) {
|
if (user.isPlayer()) {
|
||||||
// Player. Check perms
|
// Player. Check perms
|
||||||
if (user.hasPermission(parent.getPermission()) && user.hasPermission(parent.getPermission())) {
|
if (user.hasPermission(parent.getPermission())) {
|
||||||
user.sendMessage(parent.getUsage());
|
user.sendMessage((parent.getUsage().isEmpty() ? "" : parent.getUsage() + " ") + parent.getDescription());
|
||||||
|
} else {
|
||||||
|
user.sendMessage("errors.no-permission");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!parent.isOnlyPlayer() && !parent.isOnlyPlayer()) {
|
|
||||||
|
} else if (!parent.isOnlyPlayer()) {
|
||||||
// Console. Only show if it is a console command
|
// Console. Only show if it is a console command
|
||||||
user.sendMessage(parent.getUsage());
|
user.sendMessage((parent.getUsage().isEmpty() ? "" : parent.getUsage() + " ") + parent.getDescription());
|
||||||
}
|
}
|
||||||
// Run through any subcommands
|
// Run through any subcommands
|
||||||
for (CompositeCommand subCommand : parent.getSubCommands().values()) {
|
for (CompositeCommand subCommand : parent.getSubCommands().values()) {
|
||||||
// Ignore the help command
|
// Ignore the help command
|
||||||
if (!subCommand.getLabel().equals("help")) {
|
if (!subCommand.getLabel().equals("help")) {
|
||||||
|
String usage = subCommand.getUsage();
|
||||||
|
String desc = subCommand.getDescription();
|
||||||
if (user.isPlayer()) {
|
if (user.isPlayer()) {
|
||||||
// Player. Check perms
|
// Player. Check perms
|
||||||
if (user.hasPermission(parent.getPermission()) && user.hasPermission(subCommand.getPermission())) {
|
if (user.hasPermission(parent.getPermission()) && user.hasPermission(subCommand.getPermission())) {
|
||||||
user.sendMessage(subCommand.getUsage());
|
user.sendMessage((usage.isEmpty() ? "" : usage + " ") + desc);
|
||||||
}
|
}
|
||||||
} else if (!subCommand.isOnlyPlayer()) {
|
} else if (!subCommand.isOnlyPlayer()) {
|
||||||
// Console
|
user.sendMessage((usage.isEmpty() ? "" : usage + " ") + desc);
|
||||||
user.sendMessage(subCommand.getUsage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class AdminCommand extends CompositeCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, List<String> args) {
|
public boolean execute(User user, List<String> args) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,10 @@ public class IslandCommand extends CompositeCommand {
|
|||||||
public boolean execute(User user, List<String> args) {
|
public boolean execute(User user, List<String> args) {
|
||||||
user.sendLegacyMessage("You successfully did /is !");
|
user.sendLegacyMessage("You successfully did /is !");
|
||||||
if (!getPlugin().getIslands().hasIsland(user.getUniqueId())) {
|
if (!getPlugin().getIslands().hasIsland(user.getUniqueId())) {
|
||||||
return this.getSubCommand("create").execute(user, args);
|
return this.getSubCommand("create").get().execute(user, args);
|
||||||
}
|
}
|
||||||
// Currently, just go home
|
// Currently, just go home
|
||||||
return this.getSubCommand("go").execute(user, args);
|
return this.getSubCommand("go").get().execute(user, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class IslandAboutCommand extends CompositeCommand {
|
|||||||
*/
|
*/
|
||||||
public IslandAboutCommand(CompositeCommand islandCommand) {
|
public IslandAboutCommand(CompositeCommand islandCommand) {
|
||||||
super(islandCommand, "about", "ab");
|
super(islandCommand, "about", "ab");
|
||||||
this.setUsage("commands.island.about.usage");
|
this.setDescription("commands.island.about.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +23,7 @@ public class IslandCreateCommand extends CompositeCommand {
|
|||||||
super(islandCommand, "create", "auto");
|
super(islandCommand, "create", "auto");
|
||||||
this.setPermission(Settings.PERMPREFIX + "island.create");
|
this.setPermission(Settings.PERMPREFIX + "island.create");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.create.usage");
|
this.setDescription("commands.island.create.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -25,6 +25,12 @@ public class IslandGoCommand extends CompositeCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.home");
|
this.setPermission(Settings.PERMPREFIX + "island.home");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.go.usage");
|
this.setUsage("commands.island.go.usage");
|
||||||
|
this.setDescription("commands.island.go.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
new IslandMultiHomeHelp(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package us.tastybento.bskyblock.commands.island;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||||
|
import us.tastybento.bskyblock.api.commands.User;
|
||||||
|
import us.tastybento.bskyblock.config.Settings;
|
||||||
|
import us.tastybento.bskyblock.util.Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a customer help for the /island go and /island sethome commands. It overrides the default help sub command.
|
||||||
|
* The number of homes can change depending on the player's permissions and config.yml settings.
|
||||||
|
* @author ben
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IslandMultiHomeHelp extends CompositeCommand {
|
||||||
|
|
||||||
|
private CompositeCommand parent;
|
||||||
|
|
||||||
|
public IslandMultiHomeHelp(CompositeCommand parent) {
|
||||||
|
super(parent, "help");
|
||||||
|
this.parent = parent;
|
||||||
|
this.setOnlyPlayer(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, List<String> args) {
|
||||||
|
if (user.isPlayer()) {
|
||||||
|
user.sendLegacyMessage("DEBUG: Custom help");
|
||||||
|
// Player. Check perms
|
||||||
|
if (user.hasPermission(parent.getPermission())) {
|
||||||
|
int maxHomes = Util.getPermValue(user.getPlayer(), Settings.PERMPREFIX + "island.maxhomes", Settings.maxHomes);
|
||||||
|
if (maxHomes > 1) {
|
||||||
|
user.sendMessage((parent.getUsage().isEmpty() ? "" : parent.getUsage() + " ") + parent.getDescription());
|
||||||
|
} else {
|
||||||
|
user.sendMessage(parent.getDescription());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
user.sendMessage("errors.no-permission");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ public class IslandResetCommand extends CompositeCommand {
|
|||||||
super(islandCommand, "reset", "restart");
|
super(islandCommand, "reset", "restart");
|
||||||
this.setPermission(Settings.PERMPREFIX + "island.create");
|
this.setPermission(Settings.PERMPREFIX + "island.create");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.reset.usage");
|
this.setDescription("commands.island.reset.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,7 @@ public class IslandResetnameCommand extends CompositeCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.name");
|
this.setPermission(Settings.PERMPREFIX + "island.name");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.resetname.usage");
|
this.setUsage("commands.island.resetname.usage");
|
||||||
|
this.setDescription("commands.island.resetname.description");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,12 @@ public class IslandSethomeCommand extends CompositeCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.sethome");
|
this.setPermission(Settings.PERMPREFIX + "island.sethome");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.sethome.usage");
|
this.setUsage("commands.island.sethome.usage");
|
||||||
|
this.setDescription("commands.island.sethome.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
new IslandMultiHomeHelp(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,7 @@ public class IslandSetnameCommand extends CompositeCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.name");
|
this.setPermission(Settings.PERMPREFIX + "island.name");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.setname.usage");
|
this.setUsage("commands.island.setname.usage");
|
||||||
|
this.setDescription("commands.island.setname.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -22,7 +22,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
|
|||||||
super(islandCommand, "team");
|
super(islandCommand, "team");
|
||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.team.usage");
|
this.setDescription("commands.island.team.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.team.invite.accept.usage");
|
this.setUsage("commands.island.team.invite.accept.usage");
|
||||||
|
this.setDescription("commands.island.team.invite.accept.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,6 +25,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.team.invite.usage");
|
this.setUsage("commands.island.team.invite.usage");
|
||||||
|
this.setDescription("commands.island.team.invite.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,6 +16,7 @@ public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.team.invite.reject.usage");
|
this.setUsage("commands.island.team.invite.reject.usage");
|
||||||
|
this.setDescription("commands.island.team.invite.reject.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("command.island.team.leave.usage");
|
this.setUsage("command.island.team.leave.usage");
|
||||||
|
this.setDescription("commands.island.team.leave.description");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("island.team.promote.usage");
|
this.setUsage("island.team.promote.usage");
|
||||||
|
this.setDescription("commands.island.team.promote.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
|
|||||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||||
this.setOnlyPlayer(true);
|
this.setOnlyPlayer(true);
|
||||||
this.setUsage("commands.island.team.setowner.usage");
|
this.setUsage("commands.island.team.setowner.usage");
|
||||||
|
this.setDescription("commands.island.team.setowner.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,10 +91,10 @@ public class TestBSkyBlock {
|
|||||||
assertEquals(Settings.PERMPREFIX + "default.permission", testCommand.getPermission());
|
assertEquals(Settings.PERMPREFIX + "default.permission", testCommand.getPermission());
|
||||||
// Check commands and aliases match to correct class
|
// Check commands and aliases match to correct class
|
||||||
for (Entry<String, CompositeCommand> command : testCommand.getSubCommands().entrySet()) {
|
for (Entry<String, CompositeCommand> command : testCommand.getSubCommands().entrySet()) {
|
||||||
assertEquals(testCommand.getSubCommand(command.getKey()), command.getValue());
|
assertEquals(testCommand.getSubCommand(command.getKey()), Optional.of(command.getValue()));
|
||||||
// Check aliases
|
// Check aliases
|
||||||
for (String alias : command.getValue().getAliases()) {
|
for (String alias : command.getValue().getAliases()) {
|
||||||
assertEquals(testCommand.getSubCommand(alias), command.getValue());
|
assertEquals(testCommand.getSubCommand(alias), Optional.of(command.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] args = {""};
|
String[] args = {""};
|
||||||
@ -107,11 +107,11 @@ public class TestBSkyBlock {
|
|||||||
args[0] = "sub1";
|
args[0] = "sub1";
|
||||||
assertEquals(Arrays.asList(), testCommand.tabComplete(player, "test", args));
|
assertEquals(Arrays.asList(), testCommand.tabComplete(player, "test", args));
|
||||||
String[] args2 = {"sub2",""};
|
String[] args2 = {"sub2",""};
|
||||||
assertEquals(Arrays.asList("help", "subsub"), testCommand.tabComplete(player, "test", args2));
|
assertEquals(Arrays.asList("subsub", "help"), testCommand.tabComplete(player, "test", args2));
|
||||||
args2[1] = "s";
|
args2[1] = "s";
|
||||||
assertEquals(Arrays.asList("subsub"), testCommand.tabComplete(player, "test", args2));
|
assertEquals(Arrays.asList("subsub"), testCommand.tabComplete(player, "test", args2));
|
||||||
String[] args3 = {"sub2","subsub", ""};
|
String[] args3 = {"sub2","subsub", ""};
|
||||||
assertEquals(Arrays.asList("help", "subsubsub"), testCommand.tabComplete(player, "test", args3));
|
assertEquals(Arrays.asList("subsubsub", "help"), testCommand.tabComplete(player, "test", args3));
|
||||||
// Test for overridden tabcomplete
|
// Test for overridden tabcomplete
|
||||||
assertEquals(Arrays.asList(new String[] {"Florian", "Ben", "Bill", "Ted", "help"}),
|
assertEquals(Arrays.asList(new String[] {"Florian", "Ben", "Bill", "Ted", "help"}),
|
||||||
testCommand.tabComplete(player, "test", new String[] {"sub2", "subsub", "subsubsub", ""}));
|
testCommand.tabComplete(player, "test", new String[] {"sub2", "subsub", "subsubsub", ""}));
|
||||||
|
Loading…
Reference in New Issue
Block a user