mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Minor code quality fixes in IslandCommand
This commit is contained in:
parent
43367300a4
commit
f14676f5c6
@ -2,18 +2,11 @@ package us.tastybento.bskyblock.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandCreateCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandGoCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandResetCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandResetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSethomeCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.*;
|
||||
import us.tastybento.bskyblock.commands.island.teams.IslandTeamCommand;
|
||||
|
||||
public class IslandCommand extends CompositeCommand {
|
||||
@ -39,25 +32,23 @@ public class IslandCommand extends CompositeCommand {
|
||||
new IslandSetnameCommand(this);
|
||||
new IslandResetnameCommand(this);
|
||||
new IslandSethomeCommand(this);
|
||||
new IslandSettingsCommand(this);
|
||||
// Team commands
|
||||
new IslandTeamCommand(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(User user, List<String> args) {
|
||||
// If this player does not have an island, create one
|
||||
if (!getPlugin().getIslands().hasIsland(user.getUniqueId())) {
|
||||
Optional<CompositeCommand> subCreate = getSubCommand("create");
|
||||
if (subCreate.isPresent()) {
|
||||
subCreate.get().execute(user, new ArrayList<>());
|
||||
}
|
||||
getSubCommand("create").ifPresent(createCmd -> execute(user, new ArrayList<>()));
|
||||
return true;
|
||||
}
|
||||
Optional<CompositeCommand> go = getSubCommand("go");
|
||||
// Otherwise, currently, just go home
|
||||
if (go.isPresent()) {
|
||||
go.get().execute(user, new ArrayList<>());
|
||||
}
|
||||
getSubCommand("go").ifPresent(goCmd -> execute(user, new ArrayList<>()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class IslandGoCommand extends CompositeCommand {
|
||||
|
||||
@ -24,6 +23,9 @@ public class IslandGoCommand extends CompositeCommand {
|
||||
super(islandCommand, "go", "home", "h");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermission(Constants.PERMPREFIX + "island.home");
|
||||
|
Loading…
Reference in New Issue
Block a user