mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Added IslandInfoCommand
#361 * Added IslandInfoCommand : "/is info" or "/is who". This is basically a copy/paste from AdminInfoCommand, and it uses the same methods. * Updated en-US locale accordingly
This commit is contained in:
parent
4169ae9f16
commit
b88e93a61c
@ -0,0 +1,56 @@
|
||||
package world.bentobox.bentobox.api.commands.island;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Poslovitch
|
||||
*/
|
||||
public class IslandInfoCommand extends CompositeCommand {
|
||||
|
||||
public IslandInfoCommand(CompositeCommand parent) {
|
||||
super(parent, "info", "who");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission("island.info");
|
||||
setOnlyPlayer(false);
|
||||
setParametersHelp("commands.island.info.parameters");
|
||||
setDescription("commands.island.info.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
if (args.size() > 1 || (args.isEmpty() && !user.isPlayer())) {
|
||||
// Show help
|
||||
showHelp(this, user);
|
||||
return false;
|
||||
}
|
||||
// If there are no args, then the player wants info on the island at this location
|
||||
if (args.isEmpty()) {
|
||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.showInfo(getPlugin(), user, getWorld())).orElse(false)) {
|
||||
user.sendMessage("commands.admin.info.no-island");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
user.sendMessage("general.errors.player-has-no-island");
|
||||
return false;
|
||||
}
|
||||
// Show info for this player
|
||||
getIslands().getIsland(getWorld(), targetUUID).showInfo(getPlugin(), user, getWorld());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -245,7 +245,8 @@ commands:
|
||||
creating-island: "&aCreating your island..."
|
||||
pick-world: "&cPick a world from [worlds]."
|
||||
info:
|
||||
description: "display info about your island"
|
||||
description: "display info about your island or the player's island"
|
||||
parameters: "<player>"
|
||||
reset:
|
||||
description: "restart your island and remove the old one"
|
||||
must-remove-members: "&cYou must remove all members from your island before you can restart it (/island team kick <player>)."
|
||||
|
Loading…
Reference in New Issue
Block a user