Add examples.

This commit is contained in:
filoghost 2014-06-09 15:49:35 +02:00
parent 915f1afbf9
commit 2c4c407330
3 changed files with 47 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

View File

@ -0,0 +1,5 @@
name: DeathHolograms
main: com.gmail.filoghost.test.DeathHolograms
version: 1.0
softdepend: [HolographicDisplays]

View File

@ -0,0 +1,42 @@
package com.gmail.filoghost.test;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
import com.gmail.filoghost.holograms.api.HolographicDisplaysAPI;
public class DeathHolograms extends JavaPlugin implements Listener {
public void onEnable() {
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) {
getLogger().severe("*** HolographicDisplays is not installed or not enabled. ***");
getLogger().severe("*** This plugin will be disabled. ***");
this.setEnabled(false);
return;
}
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
HolographicDisplaysAPI.createHologram(
this,
event.getEntity().getEyeLocation(),
ChatColor.RED + "Player " + ChatColor.GOLD + event.getEntity().getName() + ChatColor.RED + " died here!",
ChatColor.GRAY + "Time of death: " + new SimpleDateFormat("H:m").format(new Date())
);
}
}