A helper for creating inventories in minecraft with greater ease and flexibility in order to promote integration with objects

Overview

InventoryHelper

Um auxiliar para criação de inventários no minecraft com maior facilidade e flexibilidade afim de promover integração com objetos.

Recursos

  • Criação de inventários paginados.
  • Flexbilidade com objetos.
  • Ações individuais para cada item.
  • Propiedades para cada inventário.

Download

jitpack Downloads

Versão mais recente: Release

Maven

<repositories>
    <repository>
        <id>jitpack.ioid>
        <url>https://jitpack.iourl>
    repository>
repositories>

<dependencies>
    <dependency>
        <groupId>com.github.SrBlecaute01groupId>
        <artifactId>InventoryHelperartifactId>
        <version>${VERSION}version>
    dependency>
dependencies>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.SrBlecaute01:InventoryHelper:1.0'
}

Começando

Após adicionar o repositório ao seu projeto com maven ou gradle o InventoryHelper precisa ser ativado para o registro dos eventos.

public class SimpleInventoryExample extends JavaPlugin {

    @Override
    public void onEnable() {
        // enable inventory helper
        InventoryHelper.enable(this);
    }
}

Após isso o InventoryBuilder já pode ser utilizado. Caso o helper não seja iniciado corretamente, ao iniciar uma instância do InventoryBuilder ele lançará o InventoryBuilderException devido ao não registro do helper.

Exemplo da construção de um inventário simples

{ player.closeInventory(); player.sendMessage("§eYou clicked in item ;)."); }).build(player); } public ItemStack getItem() { ItemStack itemStack = new ItemStack(Material.DIAMOND); ItemMeta meta = itemStack.getItemMeta(); meta.setDisplayName("§eClick"); itemStack.setItemMeta(meta); return itemStack; } }">
public class SimpleInventoryExample extends JavaPlugin implements Listener {

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();

        new InventoryBuilder<>("Custom inventory", 3)
                .withItem(13, getItem(), click -> {
                    player.closeInventory();
                    player.sendMessage("§eYou clicked in item ;).");

                }).build(player);
    }

    public ItemStack getItem() {
        ItemStack itemStack = new ItemStack(Material.DIAMOND);
        ItemMeta meta = itemStack.getItemMeta();
        meta.setDisplayName("§eClick");

        itemStack.setItemMeta(meta);

        return itemStack;
    }
}

Você pode ver mais exemplos como esse clicando aqui.

You might also like...

An efficient map viewer for Minecraft seed in a nice GUI with utilities without ever needing to install Minecraft.

An efficient map viewer for  Minecraft seed in a nice GUI with utilities without ever needing to install Minecraft.

To download it head to the Releases section. To run it: either double click it on it if you have the Java Runtime (JRE) or use the command line (shift

Dec 24, 2022

A free mixin-based injection hacked-client for Minecraft using Minecraft Forge.

Custom LiquidBounce 1.8.9 build that aims to improve original visuals and bypasses, along with built-in ViaVersion to help you change from 1.8 to 1.17.1 without creating any other version branch.

Jan 2, 2023

Minecraft Utility Mod for the latest release of Minecraft developed by Cypphi.

Minecraft Utility Mod for the latest release of Minecraft developed by Cypphi.

Minecraft Utility Mod for the latest release of Minecraft developed by Cypphi.

Jan 1, 2023

Play snake, in minecraft. This is a crude, horibly made snake in minecraft game. Requires PaperMC 1.18.2.

MinecraftSnake Play snake, in minecraft. This is a crude, horibly made snake in minecraft game. Requires PaperMC 1.18.2. Installation: Create a paperm

Sep 30, 2022

This minecraft plugin adds @a, @p, and @r to EssentialsX Commands! Works with command block and console aswell!

EssentialsX-Target-Selectors This minecraft plugin adds @a, @p, and @r to EssentialsX Commands! Works with command block and console aswell! Usage: Ju

Dec 7, 2022

🗺️ Minecraft map editor and mod

A Minecraft Map Editor... that runs in-game! With selections, schematics, copy and paste, brushes, and scripting! Use it in creative, survival in sing

Jan 1, 2023

A fast, customizable and compatible open source server for Minecraft: Java Edition

A fast, customizable and compatible open source server for Minecraft: Java Edition

Glowstone A fast, customizable and compatible open source server for Minecraft: Java Edition. Introduction Glowstone is a lightweight, from scratch, o

Dec 31, 2022

A library that provide informations for minecraft servers (players, maxplayers and motd)

MinecraftServerInformations MinecraftServerInformation is a java library for retrieving informations about Minecraft Servers. Installation Download th

Sep 11, 2022

A Minecraft Mod for Fabric which aims to make Block Entity rendering faster and more customizable with almost no compromises.

A Minecraft Mod for Fabric which aims to make Block Entity rendering faster and more customizable with almost no compromises.

Enhanced Block Entities EBE is a 100% client side mod for Minecraft on the Fabric mod loader which aims to increase the performance of block entity re

Dec 30, 2022
Comments
  • Inventory Update Item

    Inventory Update Item

    This ain't an issue but it's a feature suggestion.

    I couldn't find any type of method to update the item and still keeping his click, or even change it.

    enhancement 
    opened by M0rais 1
Releases(1.5.0)
  • 1.5.0(Aug 29, 2022)

    Overview

    With the arrival of the last version (1.4.0), introducing inventory and pagination settings, the buttons were broken, supporting only the use of the discontinued versions and it was necessary to think of a new way to integrate them with the new inventory settings.

    The most important classes for this release are:

    Okay, this isn't a pretty inventory, but it works. Ignore the oscillations, it occurs due to my computer.

    Button Creation

    Inventory buttons are a handy way to perform pre-configured actions, like the actions of swiping and back to the inventories page.

    Buttons can be created in the following way:

    Button.of(buttonType, slot, itemStack);
    Button.of(buttonType, slot, itemStack, alwaysShow);
    

    NOTE: The alwaysShow option will always show the button regardless of whether or not it is valid for that inventory. A practical example would be when the inventory is on the home page, normally one would not have a back button, but if this option is active it will always show and not check if that inventory can return to the page or not.

    Defining Buttons

    The buttons can be defined directly in the builder, as global buttons, or in the pages configuration itself.

    Global buttons

    Global buttons, as said before, are buttons created directly in the builder itself as in the example below:

    InventoryBuilder.of(inventoryConfiguration)
        .withButton(Button.of(ButtonType.PREVIOUS_PAGE, slot, item))
        .withButton(Button.of(ButtonType.NEXT_PAGE, slot, item))
    

    The use of these buttons is only appropriate when you are working with several page settings and need to update all of them with the same button, as in the example below:

    InventoryBuilder.of(inventoryConfiguration)
        .withItems(configuration1, items1)
        .withItems(configuration2, items2)
        .withButton(Button.of(ButtonType.PREVIOUS_PAGE, slot, item))
        .withButton(Button.of(ButtonType.NEXT_PAGE, slot, item))
    

    NOTE: If you do not use multiple page configurations in your inventory, do not use the global buttons.

    Global buttons need to check all formats in the inventory to see if they meet the requirement and can be put in the inventory if the always show option is false. These checks although relatively quick can be dropped when using the buttons within the page settings.

    Page Setup Buttons

    The use of these buttons is highly recommended when you do not need to refresh every page of the inventory. They are more efficient because they update only the items that are set for that pagination, and you don't need to check the other formats and validate them, as in the example above with the buttons next to the armor.

    These types of buttons can be defined directly in PaginatedConfiguration:

    PaginatedConfiguration.builder("#4")
        .button(Button.of(ButtonType.PREVIOUS_PAGE, slot, item))
        .button(Button.of(ButtonType.NEXT_PAGE, slot, item))
    

    NOTE: When working with the global buttons along with the pagination buttons themselves, as in the image shown above, the global buttons must always be visible. The global buttons perform checks in all formats, and to make them work together properly would require recursive methods, which would make updating them inefficient. One of the goals of this project is to make it easy and efficient to create inventories, so I have chosen not to do this. Always showing the global buttons in these cases ensures that all the buttons work correctly without the need for multiple checks.

    Resources

    • Added the buttons.

    Changes

    • Added discontinued methods for the old ButtonType.

    Removed

    • Removed discontinued methods.
    • Removed old examples.

    All changes: https://github.com/SrBlecaute01/InventoryHelper/compare/1.4.1...1.5.0

    Installation

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.5.0</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.5.0'
    }
    
    Source code(tar.gz)
    Source code(zip)
    inventory-helper-1.5.0.jar(74.00 KB)
  • 1.4.1(Jul 28, 2022)

    Overview

    This release fixes the equals and hashcode methods of the paginated inventory formats. Its importance is given by the fact that InventoryBuilder uses the Set collection to remove duplicate formats that occasionally occur for some reason.

    Paginations with the same number of objects inferred that they were the same, and for that reason removed from the collection like this.

    .withObjects(iconConfiguration, icons, null)
    .withObjects(dropConfiguration, drops, null);
    

    These collections had the same number of objects and therefore were removed and only one was defined in the inventory.

    Bug fix

    • Fixed equals and hashcode of paginated inventories.

    Changes

    • Changed name of SlotValidator to SlotInvalidator.

    All changes: https://github.com/SrBlecaute01/InventoryHelper/compare/1.4.0...1.4.1

    Installation

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.4.1</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.4.1'
    }
    
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Jul 13, 2022)

    Visão geral

    Nessa versão foi adicionado métodos para a atualização dos inventários, sem a necessidade de recriá-los ou reabri-los para os jogadores, poupando recursos e tempo. As classes mais importantes são:

    • InventoryConfiguration
    • PaginatedConfiguration
    • Updatable
    • UpdateHandler
    • InventoryUpdater

    Configuração do inventário

    Com o intuito de deixar compatível para a adição de novos recursos foi adicionado o InventoryConfiguration. Nessa versão apenas poderá ser configurado o nome e a quantidade de linhas.

    InventoryConfiguration configuration = InventoryConfiguration.builder("§cTitle", 6).build();
    InventoryBuilder<Icon> builder = new InventoryBuilder<Icon>(configuration);
    

    Obs: As cores já são automaticamente convertidas.

    Configuração das páginas

    Os métodos que utilizam listas de objetos agora necessitam do PaginatedConfiguration, que será utilizado para realizar verificações quando o inventário estiver sendo formatado.

    PaginatedConfiguration paginated = PaginatedConfiguration.builder("#id")
            .validator(slot -> (slot > 16 && slot < 19) || (slot > 25 && slot < 28)) // Validação do slot
            .size(21) // Quantidade de objetos na página
            .start(10) // Slot em que os itens começarão a serem postos (includente).
            .end(35) // Slot até onde os itens serão postos (excludente).
            .build(); 
    
    builder.withObjects(paginated, icons, click -> {
        click.updateObjects(newIcons);
        click.sendMessage("Atualizando inventário");
    });
    
    

    Caso queira atualizar uma específica página, você pode passar como parâmetro o identificador da página.

    click.updateObjects("#id", newIcons);
    

    Atualizações baseadas no tempo

    Um dos novos recursos adicionados foi permitir a atualização dos inventários a partir de tempos configurados.

    As atualizações são realizadas em asynchronously e somente a cada 1 segundo, então tome cuidado quando ficar alguma ação que seja necessário sua execução na main-thread.

    builder.withUpdate(1, updater -> {
        updater.updateObjects("id", newIcons);
        updater.updateItem(49, randomItem);
    })
    

    Recursos

    Mudanças

    • Adicionado tratamento de erros na execução do clique.
    • Adicionado novos métodos no InventoryEvent
    • Removido a função para verificação dos slots e adicionado o SlotValidator
    • Adicionado métodos descontinuados

    Contribuidores

    • Feature/updater by @SrBlecaute01 in https://github.com/SrBlecaute01/InventoryHelper/pull/5

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.3.1...1.4.0

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.4.0</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.4.0'
    }
    
    Source code(tar.gz)
    Source code(zip)
    inventory-helper-1.4.0.jar(64.66 KB)
  • 1.3.1(May 1, 2022)

    Mudanças

    • Ignorado slots duplicados no InventoryBuilder.

    Correções

    • Corrigido a exclusão do slot 0 dos inventários por @M0rais

    Removido

    N/A

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.3.0...1.3.1

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.3.1</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.3.1'
    }
    
    Source code(tar.gz)
    Source code(zip)
    InventoryHelper-1.3.1.jar(31.15 KB)
  • 1.3.0(Mar 13, 2022)

    Recursos

    • Adicionado o evento ObjectClickEvent para cliques em objetos.
    • Adicionado o callback ObjectCallback para cliques em objetos.
    • Adicionado novos métodos para definir itens a partir de arrays e coleções.

    Mudanças

    • Arrumado a compilação das classes de testes.
    • Decontinuado o método ItemClickEvent#getObject

    Removido

    N/A

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.2.1...1.3.0

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.3.0</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.3.0'
    }
    
    Source code(tar.gz)
    Source code(zip)
    InventoryHelper-1.3.0.jar(31.91 KB)
  • 1.2.1(Feb 24, 2022)

    Mudanças

    • Arrumado slot nos inventários paginados

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.2.0...1.2.1

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.2.1</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.2.1'
    }
    
    Source code(tar.gz)
    Source code(zip)
    InventoryHelper-1.2.1.jar(32.51 KB)
  • 1.2.0(Jan 19, 2022)

    Novos Recursos

    • Adicionado anotações para prevenir objetos nulos.

    Mudanças

    • Arrumado erro que impedia o registro do InventoryHelper
    • Arrumado o slot de saída do InventoryBuilder
    • Removido arquivos de exemplos da compilação.

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.1...1.2.0

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.2.0</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.2.0'
    }
    
    Source code(tar.gz)
    Source code(zip)
    InventoryHelper-1.2.0.jar(29.14 KB)
  • 1.1(Jan 18, 2022)

    Suporte

    • Adicionado suporte ao ItemCallback.

    Mudanças

    • Renomeado InventoryClick para InventoryEvent
    • Adicionado método para obter as propriedades do inventário no InventoryEvent

    Todas as mudanças: https://github.com/SrBlecaute01/InventoryHelper/compare/1.0...1.1

    Instalação

    Maven

    <dependency>
        <groupId>com.github.SrBlecaute01</groupId>
        <artifactId>InventoryHelper</artifactId>
        <version>1.1</version>
    </dependency>
    

    Gradle

    dependencies {
        implementation 'com.github.SrBlecaute01:InventoryHelper:1.1'
    }
    
    Source code(tar.gz)
    Source code(zip)
    InventoryHelper-1.1.jar(29.14 KB)
  • 1.0(Jan 18, 2022)

Owner
SrBlecaute
SrBlecaute
SrBlecaute
A Minecraft server proxy with unparalleled server support, scalability, and flexibility

Velocity A Minecraft server proxy with unparalleled server support, scalability, and flexibility. Velocity is licensed under the GPLv3 license. Goals

PaperMC 1.2k Jan 8, 2023
Checks items in inventories to see if they were duped as part of the Crystal Hollows Dupe Event in Hypixel Skyblock.

Checks items in inventories to see if they were duped as part of the Crystal Hollows Dupe Event in Hypixel Skyblock.

null 5 Dec 19, 2022
It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java.

Java-terminal-game It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java. The ga

Baistan Tashkulov 0 Jan 20, 2022
eWordle: an extended version of Wordle with full-featured helper.

eWordle An extended version of Wordle (Mini Project of EBU4201) with full-featured helper. How to Play Guess the Wordle word in tries just one more th

Mingchun 6 Jun 11, 2022
Creates high-resolution isometric screenshots of Minecraft's game objects

Isometric Renders Overview Isometric Renders allows you to take isometric screenshots, or rather, create renders of game objects like parts of world,

glisco 74 Dec 18, 2022
A Minecraft Mod i have been creating during and for my Facharbeit about Game-Modifications

TitanoMod-1.18.1 A Minecraft Mod i have been creating during and for my Facharbeit about Game-Modifications About The Project Built With FabricMC Mixi

null 1 Mar 30, 2022
Spigot Plugin for creating light shows/concerts in Minecraft

Spigot Plugin for creating light shows/concerts in Minecraft. It works by simulating ingame effects like guardian and beacon beams.

null 38 Dec 16, 2022
☁️ Simple Extension for SuperiorSkyblock2 plugin. After creating the island, a custom mob will spawn.

☁️ Simple Extension for SuperiorSkyblock2 plugin. After creating the island, a custom mob will spawn.

Norbert Dejlich 1 Mar 10, 2022
Small mod for Minecraft Forge 1.16.5 that sends messages of in-game events to a channel in your Discord server. This mod also enables cross-chatting between Minecraft and Discord.

DiscordSync Small mod for Minecraft Forge 1.16.5 that sends messages of in-game events to a channel in your Discord server. This mod also enables cros

AeonLucid 4 Dec 20, 2022
A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge.

A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge. Originally designed as a MCP Client (called Tephra), it is now being ported t

Peanut 130 Jan 1, 2023