Giter VIP home page Giter VIP logo

obliviate-invs's Introduction

obliviate-invs's People

Contributors

atilt avatar deichor avatar discordrpc avatar efekurbann avatar hakan-krgn avatar hamza-cskn avatar n2g7mutf8 avatar uiytt avatar underscore95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

obliviate-invs's Issues

Cannot move items from player inventory

If player has items in top part of his inventory (not hotbar) he cannot click on the nor move them, even when GUI has AdvancedSlots. So it makes them imposible to use

Can't use the library due to "java.lang.NoClassDefFoundError: mc/obliviate/inventory/Gui"

When I try to perform the command this is what i get:

[14:33:12] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'dsgames' in plugin DeathSwap v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1007) ~[paper-1.20.1.jar:git-Paper-163]
at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.20.1.jar:git-Paper-163]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[paper-1.20.1.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:324) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:308) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2354) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$21(ServerGamePacketListenerImpl.java:2314) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1339) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1316) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1309) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1287) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1175) ~[paper-1.20.1.jar:git-Paper-163]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-163]
at java.lang.Thread.run(Thread.java:1623) ~[?:?]
Caused by: java.lang.NoClassDefFoundError: mc/obliviate/inventory/Gui
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
at java.lang.ClassLoader.defineClass(ClassLoader.java:1013) ~[?:?]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:229) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:155) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at me.marretz.deathswap.commands.DsGamesCommand.onCommand(DsGamesCommand.java:21) ~[DeathSwap-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Caused by: java.lang.ClassNotFoundException: mc.obliviate.inventory.Gui
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
at java.lang.ClassLoader.defineClass(ClassLoader.java:1013) ~[?:?]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:229) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:155) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at me.marretz.deathswap.commands.DsGamesCommand.onCommand(DsGamesCommand.java:21) ~[DeathSwap-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more

I tried many times to clean and rebuild project dependecies but the issue still persist.
Hope you can help me because it's a really powerful lib.

How do I make gui filled with random items?

I use this code:

Material[] mats = Material.values();
Random ran = new Random();
Material rmats = mats[ran.nextInt(mats.length)];
fillGui(new ItemStack(rmats));

but it just fills gui with one random item, how do I fill all of the gui with random items?

Can't get Icon.onClick to work

Hi,
Been using your library for a plugin and struggling to get the onClick function to work and was wondering if you could lend me a hand. It seems to work when I define the icon while adding the item but can't wrap my head around why it isn't working for a pre defined icon.

Not working:
image

Working:
image

Error: NoClassDefFoundError

code:
`java
package org.timuzkas.megaboxclans;

import mc.obliviate.inventory.Gui;
import mc.obliviate.inventory.Icon;
import mc.obliviate.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.Configuration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.ItemStack;

import java.util.List;

public class mtitleGui extends Gui {

Megabox_clans plugin;

public String convertColors(String input) {
    // Convert "&" color codes
    String converted = ChatColor.translateAlternateColorCodes('&', input);

    // Convert hex color codes
    converted = converted.replaceAll("#([A-Fa-f0-9]{6})", ChatColor.COLOR_CHAR + "x$1");

    return converted;
}

public mtitleGui(Player player, Megabox_clans plugin) {
    super(player, "mtitle", "Титулы", 6);
    this.plugin = plugin;
}


@Override
public void onOpen(InventoryOpenEvent event) {
    for (int i = 0; i == 9; i++) {
        if (i == 5) {
            addItem(new Icon(Material.EMERALD).setName("Меню титулов").setLore("Специально для megabox"));
        } else {
            addItem(Material.GRAY_STAINED_GLASS_PANE);
        }
    }
    Icon info = new Icon(Material.PAPER).setName("Информация").appendLore("Титулы можно получать разными способами").appendLore("Получить от админов, купить").appendLore("Получить в розыгрыше").setAmount(1).hideFlags();
    addItem(10, info);
    for (int i = 0; i < 9; i++) {
        addItem(19 + i, Material.GRAY_STAINED_GLASS_PANE);
    }
    //--
    Configuration cf = plugin.getConfig();
    List titleslist = plugin.getConfig().getList("players." + player.getName() + ".titleslist");
    for (int i = 0; i < titleslist.size(); i++) {
        int finalI = i;
        addItem(28 + i, new Icon(Material.NAME_TAG).setName(convertColors(cf.getString("titles." + titleslist.get(i) + ".prefix"))).setLore("Клик чтобы установить").onClick(e -> {
            e.getWhoClicked().closeInventory();
            Player pl = Bukkit.getOfflinePlayer(e.getWhoClicked().getName()).getPlayer();
            pl.sendMessage(convertColors("&a&lТитул установлен!"));
            cf.set("players." + pl.getName() + ".set_title", titleslist.get(finalI));
        }));
    }
}

}
`
Pom.xml:

`


4.0.0

<groupId>org.timuzkas</groupId>
<artifactId>megabox-clans</artifactId>
<version>0.4</version>
<packaging>jar</packaging>

<name>megabox-clans</name>

<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                        <mainClass>org.timuzkas.megaboxclans.Megabox_clans</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<repositories>
    <repository>
        <id>papermc-repo</id>
        <url>https://repo.papermc.io/repository/maven-public/</url>
    </repository>
    <repository>
        <id>sonatype</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
    <repository>
        <id>placeholderapi</id>
        <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
    </repository>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
    <repository>
        <id>minebench-repo</id>
        <url>https://repo.minebench.de/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.destroystokyo.paper</groupId>
        <artifactId>paper-api</artifactId>
        <version>1.16.5-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.github.MilkBowl</groupId>
        <artifactId>VaultAPI</artifactId>
        <version>1.7</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.github.hamza-cskn.obliviate-invs</groupId>
        <artifactId>core</artifactId>
        <version>4.1.13</version>
    </dependency>

    <dependency>
        <groupId>me.clip</groupId>
        <artifactId>placeholderapi</artifactId>
        <version>2.11.3</version>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.10.1</version>
    </dependency>
</dependencies>

`

Add other types of GUIs such as hoppers

As it says in the title. Right now, if I understand correctly, you can only have the standard 9-slot inventory. It would be very cool if we could have additional GUI types, such as hoppers etc.

Would be great for smaller menus where you only have like 2/3 icons and don't need all nine slots.

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • If the request is needed due to an issue, I explained it.
  • I explained the purposes of the feature.
  • I did not assume that people already knew what I was doing.

Custom inventory types

Hi could it be possible to have access to the real custom type behind the inventory for example InventoryAnvil and so on using NMS?

error

Hi, I have this error while loading plugin, I only copy paste the code from wiki and have this error.
obrazek

Remove GSON shadowing

Why is the Gson library shadowed into the core module? This is unnecessary, and as a result, I can't use this library since other APIs like Paper or Spigot include as well but in the normal way.

Shift click on the gui

I create a simple gui with some random item that tp the player here is the problem :

Enregistrement.2023-09-14.182742.mp4

I don't know how but we got a ghost item and on gamemode creative sometime the item is really giving its not just a ghost item.
Really weird bug, did you have an idea ?

You can add me on discord for more discussion : lowcoyote

AdvancedSlot onPickup not working

I can't seem to get it to detect the "new" item in a slot, after picking up an item from it

It would be air in this case, but it still shows the "old" item -> If I pickup 32 diamonds from a slot, it still shows the 32 diamonds as the item.

How to close gui

Can I just use Gui#setClosed to close the openned gui when my plugin is disabling?

No AdvancedSlot

I'm trying to use advanced slots but it looks like they are not included in the latest version. Is there a version I can use with it included?

Maven Shade Error

Lobby-1.0.jar, UniversalScheduler-0.1.6.jar, core-4.2.0.jar, database-2.0.6.jar, mysql-connector-java-5.1.6.jar, obliviate-utils-2.0.6.jar, placeholder-2.0.6.jar, string-2.0.6.jar, vavr-0.10.4.jar, vavr-match-0.10.4.jar, version-detection-2.0.6.jar define 1 overlapping resource: 
  - META-INF/MANIFEST.MF
UniversalScheduler-0.1.6.jar, core-4.2.0.jar define 12 overlapping classes and resources: 
  - META-INF/maven/com.github.Anon8281/UniversalScheduler/pom.properties
  - META-INF/maven/com.github.Anon8281/UniversalScheduler/pom.xml
  - com.github.Anon8281.universalScheduler.UniversalRunnable
  - com.github.Anon8281.universalScheduler.UniversalScheduler
  - com.github.Anon8281.universalScheduler.bukkitScheduler.BukkitScheduledTask
  - com.github.Anon8281.universalScheduler.bukkitScheduler.BukkitScheduler
  - com.github.Anon8281.universalScheduler.foliaScheduler.FoliaScheduledTask
  - com.github.Anon8281.universalScheduler.foliaScheduler.FoliaScheduler
  - com.github.Anon8281.universalScheduler.paperScheduler.PaperScheduler
  - com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler
  - 2 more...
core-4.2.0.jar, database-2.0.6.jar define 8 overlapping classes: 
  - mc.obliviate.util.database.Database
  - mc.obliviate.util.database.ListSerializer
  - mc.obliviate.util.database.sql.ColumnValues
  - mc.obliviate.util.database.sql.MySQLProvider
  - mc.obliviate.util.database.sql.MySQLProvider$Credentials
  - mc.obliviate.util.database.sql.SQLDatabase
  - mc.obliviate.util.database.sql.SQLDriverProvider
  - mc.obliviate.util.database.sql.SQLiteProvider
core-4.2.0.jar, placeholder-2.0.6.jar define 2 overlapping classes: 
  - mc.obliviate.util.placeholder.InternalPlaceholder
  - mc.obliviate.util.placeholder.PlaceholderUtil
core-4.2.0.jar, string-2.0.6.jar define 1 overlapping classes: 
  - mc.obliviate.util.string.StringUtil
core-4.2.0.jar, version-detection-2.0.6.jar define 1 overlapping classes: 
  - mc.obliviate.util.versiondetection.ServerVersionController
maven-shade-plugin has detected that some class files are
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See http://maven.apache.org/plugins/maven-shade-plugin/

Icon does not properly update

Hey,

I have that weird bug where icons do not properly refresh. Here's a video: https://www.youtube.com/watch?v=pGFHW4Bn_WM&ab_channel=MD

And here's the part of the code that should update the icon:

public void update(){
        final Inventory inventory = getInventory();
        Icon yesNo1;
        Icon yesNo2;
        if(book1 != null) {
            yesNo1 = Constant.YES;
        }
        else{
          player.sendMessage("test");
          yesNo1 = Constant.NO;
        }
       
        addItem(yesNo1, 28);

The update() method is called when a player insert or takes an item in the advancedSlot upside the Yes/No Icon. Why does the icon only update at the next interaction ?

book1 == null if and only if the player takes the item in the corresponding advancedSlot.

I'm 100% sure the "else{ yesNo1 = Constant.NO" is called since the test msg is properly sent to the player: so it's the addItem(yesNo1, 28) that does not work as I expect.

Thanks in advance

[Request]

For the pagination manager can you make it possible to remove items, with a remove item method. So that I can add and remove items based on player clicks.

Add setItem Method

Add a method to set Items instead of adding them, since with the current AddItem method, the item cannot be removed. In the case of pagination, I would like the "Previous Page" button not to be displayed on the first page, or the "Next Page" button not be displayed on the last page, but with the AddItem method, it cannot be removed even if you use an if-statement to compare if it is the first page.

Example code:

import mc.obliviate.inventory.Gui;
import mc.obliviate.inventory.Icon;
import mc.obliviate.inventory.pagination.PaginationManager;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.ItemStack;



public class TestGui extends Gui {

    private final PaginationManager pagination = new PaginationManager(this);

    public TestGui(Player player) {
        super(player, "example-gui", "Title", 6);
    }



    @Override
    public void onOpen(InventoryOpenEvent event){
        this.pagination.registerPageSlotsBetween(0, (4 * 9) - 1);

        for (Material material : Material.values()) {
            this.pagination.addItem(new Icon(material));
        }

        fillRow(getIcon(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15), "&0"), 4);
        Icon nextPage = getIcon(new ItemStack(Material.PAPER), "&eNext Page");
        nextPage.onClick((e) -> {
            this.pagination.update();
            this.pagination.goNextPage();
        });
        Icon previousPage = getIcon(new ItemStack(Material.PAPER), "&ePrevious Page");
        previousPage.onClick((e) -> {
            this.pagination.update();
            this.pagination.goPreviousPage();
        });
        Icon lastPage = getIcon(new ItemStack(Material.BARRIER), "&cLast Page");
        lastPage.onClick((e) -> {
            this.pagination.update();
            this.pagination.goLastPage();
        });
        Icon firstPage = getIcon(new ItemStack(Material.EMERALD), "&aFirst Page");
        firstPage.onClick((e) -> {
            this.pagination.update();
            this.pagination.goFirstPage();
        });

        if(!this.pagination.isLastPage()){
            addItem(this.getLastSlot() - 1, lastPage);
            addItem(this.getLastSlot(), nextPage);
        }
        if(!this.pagination.isFirstPage()){
            addItem(this.getLastSlot() - 7, firstPage);
            addItem(this.getLastSlot() - 8, previousPage);
        }
        this.pagination.update();
    }

    private Icon getIcon(ItemStack itemStack, String name){
        return new Icon(itemStack).setName(ChatColor.translateAlternateColorCodes('&', name));
    }
}

image

Broken

API is broken. please fix.

Gui remembering items

I am trying to make gui that will remember the items player puts inside. When he closes it and opens again, the items will be still inside,
this is my code
image
I create new instance of ProcessMenuLib and save it to hashmap, so when i need to open it again, i will get it from that and call .open()

bot when i put items inside the gui, close it, and open it again, the items are all gone, even when putting them into advanced slot or unprotected slot

I was expecting that the items will stay inside the gui when i use the same instance of it

using 4.1.9 version

there is no console output

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • I explained the expected behavior.
  • I explained current behavior.
  • I shared console outputs or I said there is no output.
  • I did not assume that people already knew what I was doing.

[FEATURE REQUEST] Permissions for icons

`Test gui`:
  title: 'Test'
  row: 5
  icons:
    test-item:
      material: Dirt
      display-name: 'Abcd'
      slot: 0
      permission: testgui.vipbutton

item will be show in gui if player has permission

Pagination change page isn't working

I'm trying to do smth like this:
Icon next = new Icon(new ItemStack(Material.WHITE_BED)) .onClick((e) -> { this.pagination.goNextPage(); this.pagination.update() });
Pagination.update doesn't work twice, so I can't make item for changing pages
изображение

Is there any way to have a Dysfunctional Icon without the slot being predetermined?

I would like to have a cosmetic icon defined in the .yml files. However, the slot should not be predetermined as the item should only show up when it's purchased and in order of when it was purchased. I saw in the Wiki that these values have to be mandatory:

example-configurable-gui:
  title: 'Custom Title'
  row: 5
  icons:
    functional-test-icon:
      material: DIAMOND_BOOTS
      slot: 4

Is there any workaround for this?

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • I explained the expected behavior.
  • I explained current behavior.
  • I shared console outputs or I said there is no output.
  • I did not assume that people already knew what I was doing.

i cannot access the super methord

Explain the issue here.

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • [ i copied example code and on the public examplegui class ont he first line that siad 'super' it said [read below]] I explained the expected behavior.
  • I explained current behavior.
  • I shared console outputs or I said there is no output.
  • I did not assume that people already knew what I was doing.
    cannot access net.kyori.adventure.text.Component is the error. i didn't even import adventure but it still shows up.

itemstack issue

Everytime i click on the item or whenever the pagination gets updated the "test" lore keeps getting added in a loop that doenst stop.
Also the itemstack it returns is the one that gets modified and not the value "listing.item" by itself. This never happend with the old menu api i used

private fun calculateAndUpdateEntries() {
pagination.items.clear()

    for (listing in listings) {
        pagination.addItem(Icon(listing.item).appendLore("test").onClick {
            if (listing.createdBy == player.uniqueId) {
                //
            } else {
                //
            }
        })
    }

    pagination.update()
}

Differentiating between the two clicks

Hello guys,

I'd like to know if it's possible to create a difference between right-click and left-click in the GUI,
Isn't there a solution if I want to do 2 different actions in one block of the GUI ?

edit : I found how to do it 1 hour later but thank you guys u did a very good job

Folia Support

Will you add support for papermc/folia? If you plan to do so when will it be?

fillColumn is broken D:

So basically when filling a column in a 5 rowed gui using Gui#fillColumn it outputs this

java.lang.IndexOutOfBoundsException: Slot cannot be bigger than inventory size! [ 45 >= 45 ]

I tried from 0 to 8 same result, please look into it

Gui Component Titles

Could you make it so the GUI title uses Components rather than Strings which PaperAPI uses, as it allows for GUI fonts/ textures.

GuiIcon names and lores

Can the item names and lores for GuiIcons be automatically translated into colour codes?
At the moment, it becomes tedious having to translate colour codes on every single item, it would be easier for it to be included within the GuiIcon methods.

A new method

Its possible for you to make a method to update a slot or something like that?
Example like .onClick(event -> updateSlot(48)); this will update item in slot 48

Maven build error

when i click build, it show this error

cannot access net.kyori.adventure.text.Component

[BUG] Stackoverflow crash when reopening inventory

Explain the issue here.

I created an inventory that reopens itself if the closing reason is not "PLUGIN". The thing is that, when closing the inventory, instead of reopening itself, it throws a StackOverFlow error and crashes the server.

Server version: Paper 1.20.1

Code:

`
public class InventoryTurn extends Gui {

Game game;
GamePlayer gamePlayer;


public InventoryTurn(@NotNull GamePlayer gamePlayer, @NotNull Game game) {
    super(gamePlayer.getPlayer(), "turn-gui", "¿Qué harás?", 1);

    this.game = game;
    this.gamePlayer = gamePlayer;
}


@Override
public void onOpen(InventoryOpenEvent event) {
    fillGui(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE)
            .withName(" ")
            .build());


    addItem(4, new Icon(new ItemBuilder(Material.DIAMOND_SWORD)
            .withCustomModelData(1)
            .build()).onClick(e -> {
                player.closeInventory(InventoryCloseEvent.Reason.PLUGIN);

                new ShootGUI(gamePlayer, game).open();
    }));


    for(int i = 0; i < gamePlayer.getGamePerks().size(); i++) {
        GamePerk gamePerk = gamePlayer.getGamePerks().get(i);

        if(i >= 4) {
            addItem(i+1, new Icon(gamePerk.getIcon()).onClick(e -> {
                player.closeInventory(InventoryCloseEvent.Reason.PLUGIN);
                gamePerk.activatePerk();

                gamePlayer.removeGamePerk(gamePerk.getPerkType());
            }));
        } else {
            addItem(i, new Icon(gamePerk.getIcon()).onClick(e -> {
                player.closeInventory(InventoryCloseEvent.Reason.PLUGIN);
                gamePerk.activatePerk();

                gamePlayer.removeGamePerk(gamePerk.getPerkType());
            }));
        }
    }
}

@Override
public void onClose(InventoryCloseEvent event) {
    super.onClose(event);

    if(event.getReason() != InventoryCloseEvent.Reason.PLUGIN)  {
        open();
    }
}

}`

StackOverFlow output: https://pastebin.com/dHd6zWhA

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • I explained the expected behavior.
  • I explained current behavior.
  • I shared console outputs or I said there is no output.
  • I did not assume that people already knew what I was doing.

Add a "replaceIcon" method

It'd be helpful if we were able to switch the Icons while still in the GUI menu (such as when toggling settings). Could be done using something like this, maybe?

public void replaceIcon(GuiIcon oldIcon, GuiIcon newIcon) {
    for (Map.Entry<Integer, GuiIcon> entry : registeredIcons.entrySet()) {
        if (entry.getValue().equals(oldIcon)) {
            registeredIcons.put(entry.getKey(), newIcon);
            break;
        }
    }
}

Checklist

Ensure you've done everything in this list before submitting the issue. (Just put the 'X' char between brackets.)

  • If the request is needed due to an issue, I explained it.
  • I explained the purposes of the feature.
  • I did not assume that people already knew what I was doing.

auto update menu

Basically what im doing is updating every second the gui sending again the open() method using updateTask but it kind of glitches the whole gui. Is there any way to make it work as long as it automatically updates every second without glitching? Currently running folia 1.20.1 latest snapshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.