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)
- 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
@EventHandler
public void onJoin(PlayerJoinEvent event) {
HubAPI.initializeScoreboardPlayer(event.getPlayer(), "Scoreboard's Name", Arrays.asList("line 1", "line2", "line 3..."));
}
//The first line is the line 0
HubAPI.setScoreboardLine(player, 0, "This is the first line");
HubAPI.removeScoreboardLine(player, 0);
@EventHandler
public void onQuit(PlayerQuitEvent event) {
HubAPI.destroyScoreboard(event.getPlayer());
}
HubApi.cancelDamage/cancelAttack/cancelPlace/cancelBreak/cancelDrop/cancelPickup/cancelInventoryClick(player, true);
//true enable cancel and false disable (default -> false)
HubAPI.CancelALL(player, true);
HubAPI.setSpawn(location);
HubAPI.getSpawn(); //if the spawn has been never set, it will return the spawn location of the first world he find
HubaAPI.setHubCooldown(int); // in tick
HubaAPI.getHubCooldown(); //if the cooldown has been never set, it will return 0
HubAPI.teleportToSpawn(player);
@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/