Skip to content

Commit a6fabb8

Browse files
committed
Readme
1 parent 354c0c3 commit a6fabb8

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
SignAPI
1+
# SignAPI ![jitpack](https://img.shields.io/jitpack/v/github/PnsDev/SignAPI)
2+
A simple sign API to make a players interact with signs.
3+
4+
This project was made because I just wanted a simple sign API that I could quickly import into my projects thru JitPack. This has been tested on 1.17 but it should work older versions.
5+
6+
## Requirements
7+
All you need to run this is Spigot and [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/) installed on your server (make sure you add it as depend in your plugin.yml)
8+
9+
## Usage
10+
### As a dependency
11+
You will need to install this thru Maven or something similar.
12+
```xml
13+
<repository>
14+
<id>jitpack.io</id>
15+
<url>https://jitpack.io</url>
16+
</repository>
17+
18+
<dependency>
19+
<groupId>dev.pns</groupId>
20+
<artifactId>SignAPI</artifactId>
21+
<version>master-SNAPSHOT</version>
22+
</dependency>
23+
```
24+
25+
### How to use
26+
27+
Initilize the API with the following code:
28+
```java
29+
public class Example extends JavaPlugin {
30+
private SignAPI signAPI;
31+
32+
@Override
33+
public void onEnable() {
34+
signAPI = new SignAPI(this);
35+
}
36+
}
37+
```
38+
39+
When you want to use the API just call the method inside the api:
40+
41+
#### `createGUI(List<String>, Interface<Player player, String[] lines>)`
42+
43+
This takes a list of strings and an interface which will be called when the player exists the sign. Then you need to open the menu for a player. Here's how you can do that:
44+
45+
#### `SignGUI.open(Player);`
46+
47+
Make sure you're using the `SignGUI` class which is returned by the createGUI method.
48+
49+
### Example
50+
51+
```java
52+
Player player = (Player) sender;
53+
SignGUI gui = api.createGUI(
54+
Arrays.asList("", "^^^^^^^^^^^^^^^","Enter the force", "amount above"),
55+
((p, strings) -> {
56+
p.sendMessage("You entered: " + strings[0]);
57+
})
58+
);
59+
gui.open(player);
60+
```
61+
62+

0 commit comments

Comments
 (0)