mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Improved CommandsManager to use CompositeCommand
This removes the requirement for addons to cast to CompositeCommand when getting commands from the CommandsManager. Removed unused imports.
This commit is contained in:
parent
4aaf559704
commit
80c2f4178d
@ -7,8 +7,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
package us.tastybento.bskyblock.database.objects;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,6 +1,10 @@
|
||||
package us.tastybento.bskyblock.database.objects;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -4,15 +4,16 @@ import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
|
||||
public final class CommandsManager {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private HashMap<String, Command> commands = new HashMap<>();
|
||||
private HashMap<String, CompositeCommand> commands = new HashMap<>();
|
||||
|
||||
public void registerCommand(Command command) {
|
||||
public void registerCommand(CompositeCommand command) {
|
||||
if (DEBUG) {
|
||||
Bukkit.getLogger().info("DEBUG: registering command - " + command.getLabel());
|
||||
}
|
||||
@ -29,7 +30,7 @@ public final class CommandsManager {
|
||||
}
|
||||
}
|
||||
|
||||
public Command getCommand(String command) {
|
||||
public CompositeCommand getCommand(String command) {
|
||||
return commands.get(command);
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,12 @@ package us.tastybento.bskyblock.managers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
Loading…
Reference in New Issue
Block a user