Skip to content

Commit b79d7d5

Browse files
Partially work on README for now.
1 parent ba9bdd8 commit b79d7d5

File tree

1 file changed

+17
-140
lines changed

1 file changed

+17
-140
lines changed

README.md

Lines changed: 17 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,33 @@
1-
# Woody
2-
### THIS IS BASED OFF TRIUMPH-GUI. SHOUT OUT TO TRIUMPHTEAM.
3-
triumph-gui: https://github.com/TriumphTeam/triumph-gui
1+
# Woody - High-performance, feature-rich (somewhat bloated) no BS menus library
2+
**README WIP** Left to do a few updates.
43

5-
No BS High-performance, Minimal and Safe Menus Library
4+
This is ~~full of stolen code and~~ based off [triumph-gui](https://github.com/TriumphTeam/triumph-gui)
65

76
If you need support, Check out the official discord server for help using my plugin/libraries [right here](https://discord.gg/Zj6KBS7UwX)
87

9-
## Why use menu libraries?
10-
Menu libraries have stuck around our community for a long time.
11-
12-
When making menus yourself you need to adjust it properly to these key features:
13-
- Performance
14-
- Safety
15-
- Proper code
16-
- Features
17-
- Way of usage
18-
19-
and whether you want to make something like a `Menu`, make your own library or "mini-library" for you or even just use raw spigot inventories,
20-
21-
You have to think of the key features and implement them properly, you also might need a lot of menus so that's a lot of events and boring stuff.
22-
23-
That's where menu libraries/frameworks come in and save the day.
24-
25-
You have menu libraries and you use one or some of them, and they tend to have this eyecandy syntax of making menus
26-
27-
you also seem to notice you don't write as much as you would when using the raw spigot inventories and handling all the events yourself and making 20 classes where one is for each inventory
28-
29-
It's all even handled in one singular event.
30-
31-
Some libraries **Such as InventoryFramework, triumph-gui, or mine** even provide other kinds of menus such as Paginated, and more variants of inventories that would be a pain to implement.
32-
33-
This is why you would want to use a menu library, to save the hassle of making your own raw inventories and events
34-
35-
## Why Woody? Why not triumph-gui? Why not InventoryFramework? Why not anything else?
36-
Woody is minimal, Woody is also feature rich, Woody is fast.
37-
triumph-gui is great, and especially IF which is amazing.
38-
39-
Now I don't know about OTHER frameworks, but Woody provides some special features such as:
40-
- Nice Support; everyone likes nice support, I have a lot of free time! (mostly, even if I try to have a life, and no I'm not obese)
41-
- MenuItem editing AFTER CREATION;
42-
I had this problem of trying to edit gui/menu items after creation in some libraries like triumph-gui and others
43-
When making this library I'd also been mentioned a couple times how frustrating it can get to edit a menu item
44-
after creation, even with a menu library, (triumph-gui v3.1.2 case) you need to:
45-
46-
Get the item stack from the gui item
47-
48-
Get the item meta from the item stack
49-
50-
Manually edit the item meta
51-
52-
Manually set the item meta
53-
54-
Update the item
55-
56-
For Gui it would look something like this:
57-
58-
```java
59-
GuiItem guiItem = gui.getGuiItem(20); // 20 just as an example
60-
ItemStack item = guiItem.getItemStack();
61-
ItemMeta meta = item.getItemMeta();
62-
// do what you want with the meta/item
63-
gui.updateItem(20, item);
64-
```
65-
66-
Horrendous! What is this? it may even look the same in raw spigot inventories! maybe slightly better, slightly worse.
67-
Here is the Woody way:
68-
69-
```java
70-
menu.getItem(20).editor() // edit.
71-
.done(); // when you execute ItemEditor#done() it will literally change the itemStack and action of that object.
72-
// on v1.3.4 and under you needed to set the item or update it but thats no longer the case.
73-
```
74-
Now you're going to likely write a lot less, have realistically the same performance impact and enjoy readable & concise code.
75-
76-
There can be a lot more too, other than these key features (for now), you might find it as a regular time-saving menu libraries
77-
78-
## Features, How to add, and Example Usage
79-
80-
### Key features (Including but not limited to):
81-
- Updating safely recreates all the items; leading to *EXPECTED* automatic updating.
82-
- Supports legacy versions **<1.13.2** (and that impacts performance ._.)
83-
- I don't have the worst support in the world (I try my best :D)
84-
- Actually fast and cares about performance
85-
- JVM friendly
86-
- Minimal
87-
- And more.
88-
89-
This library is hosted on Jitpack.
8+
Here's how to add Woody to your ~~bad~~ code:
909
```xml
9110
<repositories>
92-
<repository>
93-
<id>jitpack.io</id>
94-
<url>https://jitpack.io</url>
95-
</repository>
96-
...
11+
<repository>
12+
<groupId>com.github.coderFlameyosFlow.WoodyMenus</groupId>
13+
<artifactId>core</artifactId>
14+
<version>2.0.2</version>
15+
</repository>
9716
</repositories>
98-
99-
<dependency>
100-
<groupId>com.github.coderFlameyosFlow</groupId>
101-
<artifactId>WoodyMenus</artifactId>
102-
<version>LATEST</version>
103-
</dependency>
10417
```
105-
or gradle (kotlin) alternative:
106-
```kotlin
18+
19+
or the gradle kotlin edition: ~~guess your code isn't that bad after all~~
20+
```kt
10721
repositories {
108-
maven("https://jitpack.io/")
22+
maven("https://jitpack.io")
10923
}
11024

11125
dependencies {
112-
implementation("com.github.coderFlameyosFlow:WoodyMenus:LATEST")
26+
implementation("com.github.coderFlameyosFlow.WoodyMenus:core:2.0.2")
11327
}
11428
```
11529

116-
### CHANGE `LATEST` TO THE LATEST RELEASE.
117-
118-
Example usage:
30+
Adding states to your code to have dynamically changing values in your lore:
11931
```java
120-
import org.bukkit.plugin.java.JavaPlugin;
121-
122-
import me.flame.menus.menu.*;
123-
124-
public class MyPlugin extends JavaPlugin {
125-
private final Menu menu;
126-
127-
@Override
128-
public void onEnable() {
129-
Menus.init(this);
130-
menu = createExampleMenu();
131-
}
132-
133-
...
134-
135-
private Menu createExampleMenu() {
136-
Menu exampleMenu = Menus.menu()
137-
.title("&cExample Menu") // by default colorized
138-
.rows(6) // if you go above 6 or under 1 you'll get an IllegalArgumentException
139-
.create();
140-
exampleMenu.setClickAction(event -> { // InventoryClickEvent
141-
event.setCancelled(true);
142-
});
143-
144-
MenuItem item = ItemBuilder.of(Material.IRON_SWORD).buildItem(event -> {
145-
getLogger().info("An Iron Sword got Clicked!");
146-
}); // those args are optional you can execute .buildItem(), or even .build() if you want a normal ItemStack
147-
exampleMenu.addItem(item);
148-
exampleMenu.get(1) // Woody's indexes start from 0, this is #2, and yes this is an Optional<MenuItem>
149-
.filter(item -> item.getItemStack().getType() == Material.IRON_SWORD)
150-
.map(MenuItem::getUniqueId)
151-
.ifPresent(uuid -> getLogger().info(uuid.toString())); // man I love Optionals
152-
// there is also exampleMenu.getItem(1) which is nullable so it's better if you use kotlin but worse if you use java (mostly)
153-
return exampleMenu;
154-
}
155-
}
156-
```
32+
MenuItem item = ItemBuilder.of(Material.STONE)
33+
.lore()

0 commit comments

Comments
 (0)