-
Notifications
You must be signed in to change notification settings - Fork 1
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.
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);
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);
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);
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);
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);
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);
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);
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);
Shows the Hologram to all Players for a certain time.
// time in ticks for showing the Hologram
int time = 100;
holo.showAllTemp(time);
Shows a Hologram to one Player
Player p = Bukkit.getPlayerExact("YellowPhoenix18");
holo.showPlayer(p);
Hides a Hologram to one player
Player p = Bukkit.getPlayerExact("YellowPhoenix18");
holo.hidePlayer(p);
Shows an Hologram to all Online-Players.
holo.showAll(p);
Hides an Hologram to all Online-Players.
holo.hideAll(p);