Skip to content

1.1

Choose a tag to compare

@MrJetby MrJetby released this 06 Apr 13:14
· 40 commits to master since this release
  • Added lockEmptySlots method to AdvancedGui which allows cancelling clicks on unregistered slots.
  • Added updateItem(ItemWrapper) method to AdvancedGui which allows updating an item in the GUI.
  • Fixed [actionbar] action.
  • Added replacements in actions, usage example:
ActionExecute.run(ActionContext.of(player)
  .replace("{player}", "MrJetby"), "[message] Hello {player}");

Commands:

  • Full documentation here: wiki.jetby.space
  • Convenient registration of any command as well as easy sub-command creation.

Usage example:

public class TestCommand extends AdvancedCommand {
    public TestCommand(JavaPlugin plugin) {
        super("test_command", plugin);
    }
    @Override
    public boolean onExecute(CommandSender sender, Command command, String label, String[] args) {
        sender.sendMessage("Success");
        return true;
    }
    @Override
    public List<String> onTab(CommandSender sender, Command command, String label, String[] args) {
        return List.of("help");
    }
    @SubCommand("test")
    @PlayerOnly
    public void test(Player player) {
        player.sendMessage("Test argument successfully works");
    }
}

Usage example (sub-command):

    @SubCommand("reload")
    @Permission("libb.command.reload")
    public void reload(CommandSender sender) {
        try {
            long start = System.currentTimeMillis();
            plugin.guisConfiguration.unregisterGuiCommands();
            plugin.guisConfiguration.load();
            for (Player p : Bukkit.getOnlinePlayers()) {
                Inventory topInventory = p.getOpenInventory().getTopInventory();
                if (!(topInventory instanceof AdvancedGui)) continue;
                p.closeInventory();
            }
            sender.sendMessage(Libb.MINI_MESSAGE.deserialize("<green>Libb reloaded in "+(System.currentTimeMillis()-start)+" ms."));
        } catch (Exception e) {
            sender.sendMessage(Libb.MINI_MESSAGE.deserialize("<red>Reload error, check the console."));
            e.printStackTrace();
        }
    }

Command registration (example):

new LibbCommand(this).register();

More information: wiki.jetby.space