Giter Site home page Giter Site logo

hubapi's Introduction

HubAPI

It's a simple API for Minecraft (spigot) to simplify some actions in a Hub plugin (like the scoreboard)

If you want to propose a suggestion create a new issue with Suggestion in the title

To use it in your project, import the jar librairy (Maven come later)

TodoList :
  • Create simple action for the API
  • Create the github's repositories
  • Add somes protect action which can be enable or not with the api
  • Publish the first release
  • Waiting for proposals for more functionality

Note: To to use the api, place the .jar file of the api in your plugins folder (not release at this day because they are still bug and missing elements) Because events and Hub Location saving make appeal to the main class

Example:

Scoreboard

Initialize Scoreboard
@EventHandler
public void onJoin(PlayerJoinEvent event) {
    HubAPI.initializeScoreboardPlayer(event.getPlayer(), "Scoreboard's Name", Arrays.asList("line 1", "line2", "line 3..."));
}
Change Scoreboard's Line
//The first line is the line 0
HubAPI.setScoreboardLine(player, 0, "This is the first line");
Remove Scoreboard's Line
HubAPI.removeScoreboardLine(player, 0);
Destroy scoreboard for a player
@EventHandler
public void onQuit(PlayerQuitEvent event) {
    HubAPI.destroyScoreboard(event.getPlayer());
}

Cancel Event

Cancel one event
HubApi.cancelDamage/cancelAttack/cancelPlace/cancelBreak/cancelDrop/cancelPickup/cancelInventoryClick(player, true);
//true enable cancel and false disable (default -> false)
Cancel All Event
HubAPI.CancelALL(player, true);

Hub Spawn

Set Hub Spawn Location
HubAPI.setSpawn(location);
Get Hub Spawn Location
HubAPI.getSpawn(); //if the spawn has been never set, it will return the spawn location of the first world he find
Set Cooldown
HubaAPI.setHubCooldown(int); // in tick
Get Cooldown
HubaAPI.getHubCooldown(); //if the cooldown has been never set, it will return 0
Teleport Usin Cooldown And Hub Location
HubAPI.teleportToSpawn(player);

What you can do when a player join

@EventHandler
public void onJoin(PlayerQuitEvent event) {
    Player player = event.getPlayer();
    HubAPI.initializeScoreboardPlayer(player, "Hub", Arrays.asList("Online:", "Rank:", "Money:", "ip: www.example.com"));
    HubAPI.resetPlayer(player, GameMode.SURVIVAL);
    HubAPI.cancelAll(player, true);
    player.teleport(HubAPI.getSpawn());
}

The API include the ItemBuilder of NonameSL : https://www.spigotmc.org/threads/util-itembuilder-manage-items-easily.48397/

hubapi's People

Contributors

bebedlastreat avatar

Watchers

 avatar

hubapi's Issues

yes

this is a test

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.