50 lines
1.4 KiB
Java
50 lines
1.4 KiB
Java
package us.tastybento.bskyblock.commands.island;
|
|
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
|
import us.tastybento.bskyblock.api.user.User;
|
|
|
|
/**
|
|
* @author tastybento
|
|
*
|
|
*/
|
|
public class IslandResetnameCommand extends CompositeCommand {
|
|
|
|
public IslandResetnameCommand(CompositeCommand islandCommand) {
|
|
super(islandCommand, "resetname");
|
|
}
|
|
|
|
@Override
|
|
public void setup() {
|
|
setPermission("island.name");
|
|
setOnlyPlayer(true);
|
|
setDescription("commands.island.resetname.description");
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
|
|
*/
|
|
@Override
|
|
public boolean execute(User user, String label, List<String> args) {
|
|
UUID playerUUID = user.getUniqueId();
|
|
|
|
if (!getIslands().hasIsland(getWorld(), playerUUID)) {
|
|
user.sendMessage("general.errors.no-island");
|
|
return false;
|
|
}
|
|
|
|
if (!getIslands().isOwner(getWorld(), playerUUID)) {
|
|
user.sendMessage("general.errors.not-leader");
|
|
return false;
|
|
}
|
|
// Resets the island name
|
|
getIslands().getIsland(getWorld(), playerUUID).setName(null);
|
|
|
|
user.sendMessage("general.success");
|
|
return true;
|
|
}
|
|
|
|
}
|