Code Monkey home page Code Monkey logo

signapi's Introduction

SignAPI jitpack

A simple sign API to make a players interact with signs.

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.

Requirements

All you need to run this is Spigot and ProtocolLib installed on your server (make sure you add it as depend in your plugin.yml)

Usage

As a dependency

You will need to install this thru Maven or something similar.

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

<dependency>
    <groupId>dev.pns</groupId>
    <artifactId>SignAPI</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>

How to use

Initilize the API with the following code:

public class Example extends JavaPlugin {
    private SignAPI signAPI;
    
    @Override
    public void onEnable() {
        signAPI = new SignAPI(this);
    }
}

When you want to use the API just call the method inside the api:

createGUI(List<String>, Interface<Player player, String[] lines>)

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:

SignGUI.open(Player);

Make sure you're using the SignGUI class which is returned by the createGUI method.

Example

Player player = (Player) sender;
SignGUI gui = api.createGUI(
        Arrays.asList("", "^^^^^^^^^^^^^^^","Enter the force", "amount above"),
        ((p, strings) -> {
            p.sendMessage("You entered: " + strings[0]);
        })
);
gui.open(player);

signapi's People

Contributors

pnsdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

artformgames

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.