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