mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-26 01:01:50 +01:00
Fixes infinite error with commit f14676f
.
The lambdas were missing the input argument to the execute method so were calling the parent's execute method.
This commit is contained in:
parent
382f195015
commit
25b4f674bb
@ -6,11 +6,13 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginIdentifiableCommand;
|
import org.bukkit.command.PluginIdentifiableCommand;
|
||||||
@ -271,16 +273,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
* @return CompositeCommand or null if none found
|
* @return CompositeCommand or null if none found
|
||||||
*/
|
*/
|
||||||
public Optional<CompositeCommand> getSubCommand(String label) {
|
public Optional<CompositeCommand> getSubCommand(String label) {
|
||||||
for (Map.Entry<String, CompositeCommand> entry : subCommands.entrySet()) {
|
if (subCommands.containsKey(label.toLowerCase())) {
|
||||||
if (entry.getKey().equalsIgnoreCase(label)) {
|
return Optional.ofNullable(subCommands.get(label));
|
||||||
return Optional.of(subCommands.get(label));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Try aliases
|
// Try aliases
|
||||||
for (Map.Entry<String, CompositeCommand> entry : subCommandAliases.entrySet()) {
|
if (subCommandAliases.containsKey(label.toLowerCase())) {
|
||||||
if (entry.getKey().equalsIgnoreCase(label)) {
|
return Optional.ofNullable(subCommandAliases.get(label));
|
||||||
return Optional.of(subCommandAliases.get(label));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,14 @@ import java.util.List;
|
|||||||
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.*;
|
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.IslandSettingsCommand;
|
||||||
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 {
|
||||||
@ -43,12 +50,14 @@ public class IslandCommand extends CompositeCommand {
|
|||||||
@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())) {
|
||||||
getSubCommand("create").ifPresent(createCmd -> execute(user, new ArrayList<>()));
|
getSubCommand("create").ifPresent(createCmd -> createCmd.execute(user, new ArrayList<>()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, currently, just go home
|
// Otherwise, currently, just go home
|
||||||
getSubCommand("go").ifPresent(goCmd -> execute(user, new ArrayList<>()));
|
getSubCommand("go").ifPresent(goCmd -> goCmd.execute(user, new ArrayList<>()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user