Closed GustavHaavik closed 4 years ago
Yes, ^^ there is some same logics but usage is a little bit different. Usage examples are here; https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/file/provider/ListMenuProvider.java https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/file/MenuFile.java#L110 these may help but I will make usage examples ASAP.
aaah. okay, I will be implementing this instead of the other tomorrow then. It also seems like this is more up to date.
alright, ^^ if you find any bug just open it. I should fix it cuz I'm using the library too :DD
I am not sure how I would do this, you can see here how I do it currently with Kube's version https://github.com/MinusKube/SmartInvs/issues/147
is it happening with this library?
No with the MinusKube's
Havent tried with this yet, unsure how :/
alright try that and share the result, im not sure about minuskube's library
I am still not sure on how to use this library
It's almost the same as minus's lib. there are just a few changes in creating/showing pages. Just look at these classes; https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/file/provider/ListMenuProvider.java https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/file/MenuFile.java#L110 https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/FakePlayerAPI.java#L41 https://github.com/spigotplugins/fakeplayer/blob/master/fakeplayer/src/main/java/io/github/portlek/fakeplayer/FakePlayerAPI.java#L53
Can you give an example on how to create an inventory. It is honestly too much
Page.build(
FakePlayer.getAPI().inventory,
yourClassWhichImplementsInventoryProvided)
.row(6)
.title(this.title.build());
page.open(player);
Should I create some instance of the api, and how would I do that?
What is FakePlayer.getAPI().inventory
I cannot initalize FakePlayerAPI
private FakePlayerAPI fakePlayerAPI = new FakePlayerAPI(this);
It's my plugin, not library stuff.
what should I put instead of FakePlayer.getAPI().inventory
It depends on your plugin. Can you share your plugin repository? I can't understand how you can't do that.
I am trying to create a menu from config
this is what I have got
Page MENU = Page.build( new BasicSmartInventory(plugin), )
What should I put in the class that implements InventoryProvided
Do like that;
private static YourPluginClass instance;
private SmartInventory inventory;
@Override
public onEnable() {
instance = this;
inventory = new BasicSmartInventory(plugin);
inventory.init();
}
public SmartInventory getInventory() {
return this.inventory;
}
public static YourPluginClass getInstance() {
return instance;
}
Another class;
public void openTheMenu(Player player) {
Page.build(YourPluginClass.getInstance().getInventory(),
new YourInventoryProvidedClass(elements/other stuff))
.open(player);
}
public final class YourInventoryProvidedClass implements InventoryProvided {
@Override
public void init(InventoryContents contensts) {
}
}
the inventory provided class is the same as minus's lib.
Cant I create all menus on server load and store them in a list for later use, to prevent creating the inventory everytime a player opens the inventory
nvm
you can store.
Map<String, Page> pages = new HashMap<>();
onEnable() {
pages.put("the-page-key", Page.build(...., ....).methods().othermethods());
}
and then when you want to open the menu just pages.get("the-page-key").open(player);
Does this also have like a parent option, so I can set a parent page?
How do I get the player who opens the menu
Oh nvm
How do I make clickable items
use Icon class
What is the difference between Icon.cancel(itemstack)
and Icon.from(itemstack)
just look the class, you will understand https://github.com/portlek/SmartInventory/blob/master/src/main/java/io/github/portlek/smartinventory/Icon.java
How would I go about making a back button, so it returns to a parent menu?
probably I removed that feature, and I will add it to the feature.
The title explains it :)