Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

13 Commits

Repository files navigation

Badlion Client Timer API

This repository explains how to use Badlion Client Timer Api.

It allows the server to display timers in the Badlion Client. This plugin is an API and you need to call it from your own plugins for it to work.

Timer Mod Example

Installation

How to install the Badlion Client Timer API on your server.

Quick Installation

  1. Download the latest bukkit plugin from our releases : https://github.com/BadlionNetwork/BadlionClientTimerAPI/releases
  2. Place the downloaded plugin into your plugins directory on your server.
  3. Turn on the Bukkit server

API Usage

Below is an example plugin with the four different timers types implemented.

importnet.badlion.timers.api.Timer;
importnet.badlion.timers.api.TimerApi;
importorg.bukkit.Material;
importorg.bukkit.event.EventHandler;
importorg.bukkit.event.Listener;
importorg.bukkit.event.player.PlayerJoinEvent;
importorg.bukkit.event.player.PlayerQuitEvent;
importorg.bukkit.inventory.ItemStack;
importorg.bukkit.plugin.java.JavaPlugin;
importjava.util.concurrent.TimeUnit;
publicclassExamplePluginextendsJavaPluginimplementsListener {
privateTimerApitimerApi;
privateTimertickTimer; // 1 minute tick timerprivateTimerrepeatingTickTimer; // 1 minute repeating tick timerprivateTimertimeTimer; // 1 minute time timerprivateTimerrepeatingTimeTimer; // 1 minute repeating time timer@OverridepublicvoidonEnable() {
// Get the timer api instanccethis.timerApi = TimerApi.getInstance();
// Create the timersthis.tickTimer = this.timerApi.createTickTimer("Tick Timer", newItemStack(Material.IRON_INGOT), false, 1200L);
this.repeatingTickTimer = this.timerApi.createTickTimer("Repeating Tick Timer", newItemStack(Material.GOLD_INGOT), true, 1200L);
this.timeTimer = this.timerApi.createTimeTimer("Time Timer", newItemStack(Material.DIAMOND), false, 1L, TimeUnit.MINUTES);
this.repeatingTimeTimer = this.timerApi.createTimeTimer("Repeating Tick Timer", newItemStack(Material.EMERALD), true, 1L, TimeUnit.MINUTES);
// Register the listenerthis.getServer().getPluginManager().registerEvents(this, this);
}
@OverridepublicvoidonDisable() {
// Remove the timersthis.timerApi.removeTimer(this.tickTimer);
this.timerApi.removeTimer(this.repeatingTickTimer);
this.timerApi.removeTimer(this.timeTimer);
this.timerApi.removeTimer(this.repeatingTimeTimer);
}
@EventHandlerpublicvoidonLogin(PlayerJoinEventevent) {
// Add the player to the timersthis.tickTimer.addReceiver(event.getPlayer());
this.repeatingTickTimer.addReceiver(event.getPlayer());
this.timeTimer.addReceiver(event.getPlayer());
this.repeatingTimeTimer.addReceiver(event.getPlayer());
}
@EventHandlerpublicvoidonLogout(PlayerQuitEventevent) {
// Remove the player from the timersthis.tickTimer.removeReceiver(event.getPlayer());
this.repeatingTickTimer.removeReceiver(event.getPlayer());
this.timeTimer.removeReceiver(event.getPlayer());
this.repeatingTimeTimer.removeReceiver(event.getPlayer());
}
}

About

Badlion Client Timer API. This project has been moved to https://github.com/BadlionClient/BadlionClientModAPI.

Resources

Stars

11 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages