mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 00:58:04 +01:00
Debug
This commit is contained in:
parent
2d75a92700
commit
02e528cdc7
@ -5,6 +5,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.MyCommand;
|
||||
import world.bentobox.bentobox.api.configuration.BSBConfig;
|
||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
|
||||
@ -64,6 +65,7 @@ public class BentoBox extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
|
||||
// Not loaded
|
||||
isLoaded = false;
|
||||
// Store the current millis time so we can tell how many ms it took for BSB to fully load.
|
||||
@ -72,7 +74,6 @@ public class BentoBox extends JavaPlugin {
|
||||
// Save the default config from config.yml
|
||||
saveDefaultConfig();
|
||||
setInstance(this);
|
||||
|
||||
// Load Flags
|
||||
flagsManager = new FlagsManager(instance);
|
||||
|
||||
@ -99,11 +100,13 @@ public class BentoBox extends JavaPlugin {
|
||||
|
||||
// Set up command manager
|
||||
commandsManager = new CommandsManager();
|
||||
new MyCommand(); // Tab Complete works in-game and in console
|
||||
getServer().getScheduler().runTask(this, () -> new MyCommand()); // Tab complete does not work in-game, only console
|
||||
|
||||
// These items have to be loaded when the server has done 1 tick.
|
||||
// Note Worlds are not loaded this early, so any Locations or World reference will be null
|
||||
// at this point. Therefore, the 1 tick scheduler is required.
|
||||
getServer().getScheduler().runTask(this, () -> {
|
||||
//getServer().getScheduler().runTask(this, () -> {
|
||||
// Create the world if it does not exist
|
||||
islandWorldManager = new IslandWorldManager(instance);
|
||||
// Load schems manager
|
||||
@ -142,8 +145,11 @@ public class BentoBox extends JavaPlugin {
|
||||
|
||||
// Fire plugin ready event
|
||||
Bukkit.getServer().getPluginManager().callEvent(new BentoBoxReadyEvent());
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* @param aliases - aliases
|
||||
*/
|
||||
public CompositeCommand(Addon addon, String label, String... aliases) {
|
||||
super(label);
|
||||
super(label, "", "", Arrays.asList(aliases));
|
||||
this.addon = addon;
|
||||
this.topLabel = label;
|
||||
this.plugin = BentoBox.getInstance();
|
||||
@ -144,7 +144,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* @param aliases - aliases for this subcommand
|
||||
*/
|
||||
public CompositeCommand(CompositeCommand parent, String label, String... aliases) {
|
||||
super(label);
|
||||
super(label, "", "", Arrays.asList(aliases));
|
||||
this.topLabel = parent.getTopLabel();
|
||||
this.plugin = BentoBox.getInstance();
|
||||
this.parent = parent;
|
||||
@ -478,6 +478,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) {
|
||||
Bukkit.getLogger().info("DEBUG tab complete called");
|
||||
List<String> options = new ArrayList<>();
|
||||
// Get command object based on args entered so far
|
||||
CompositeCommand cmd = getCommandFromArgs(args);
|
||||
|
@ -16,6 +16,7 @@ public class CommandsManager {
|
||||
public void registerCommand(CompositeCommand command) {
|
||||
commands.put(command.getLabel(), command);
|
||||
// Use reflection to obtain the commandMap method in Bukkit's server. It used to be visible, but isn't anymore.
|
||||
|
||||
try{
|
||||
Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
commandMapField.setAccessible(true);
|
||||
|
Loading…
Reference in New Issue
Block a user