Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
YellowPhoenix18 edited this page Apr 16, 2017 · 3 revisions

VersionAPI - Usage

To use VersionAPI you have to add the jar from Spigot to your Buildpath. After adding the jar you can add the Methods from this wiki to your source.

Default-Methods

getPing

Gets the ping of an connected player

//Player p = Player you want to ping
Player p = Bukkit.getPlayerExact("YellowPhoenix18");
//ping Player
int ping = VersionUtils.getPing(p);

InstantRespawn

Let a player instantly respawn if he is dead

//Player p = Player you want to respawn
Player p = Bukkit.getPlayerExact("YellowPhoenix18");
//respawn Player
VersionUtils.respawn(p);

SetMotd(Usefull for BungeeSigns)

Changes the Motd via Craftbukkit-Methods. Returns if no Data could be found null.

//motd as String
String motd = "§7New Motd for my server";
VersionUtils.setMotd(motd);

Custom Title

Sends a player a title on screen

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
//time in ticks for fadeIn
int fadeIn = 30;
//time in ticks for staying
int stay = 100;
//time in ticks for fadeOut
int fadeOut = 30;
//String title with the Title(null if you dont want to set it)
String title = "§7Cool Server";
//String subtitle with the SubTitle(null if you dont want to set it)
String subtitle = "§8IP: §cyellowphoenix18.de";
VersionUtils.sendTitle(p, fadeIn, stay, fadeOut, title, subtitle);

Custom ActionBar

Sends the player a ActionBar-Message

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
//String msg with Text you want to send
String msg = "§7Cool Server";
VersionUtils.sendActionBar(p, msg);

Send Tablist Header and Footer

Set the Tablist Header and Footer for a player

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
//String header with Text you want to send as Tablist-Header
String header = "§7Cool Server";
//String footer with Text you want to send as Tablist-Footer
String footer = "§6Buy Premium now";
VersionUtils.sendHeaderAndFooter(p, header, footer);

Hologram

To use the Hologram-Method you have to initiate a new Hologram with following Method, the Location will be used for the Location of the Hologram and each String in the String-Array contains a Hologram-Line:

Hologram holo = new Hologram(String[] Text, Location loc);

showPlayerTemp()

Shows the Hologram to a Player for a certain time.

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
// time in ticks for showing the Hologram
int time = 100;
holo.showPlayerTemp(p, time);

showAllTemp()

Shows the Hologram to all Players for a certain time.

// time in ticks for showing the Hologram
int time = 100;
holo.showAllTemp(time);

showPlayer()

Shows a Hologram to one Player

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
holo.showPlayer(p);

hidePlayer()

Hides a Hologram to one player

Player p = Bukkit.getPlayerExact("YellowPhoenix18");
holo.hidePlayer(p);

showAll()

Shows an Hologram to all Online-Players.

holo.showAll(p);

hideAll()

Hides an Hologram to all Online-Players.

holo.hideAll(p);