Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Askingg.Reflex;
- import java.io.File;
- import org.bukkit.ChatColor;
- import org.bukkit.entity.LivingEntity;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.scheduler.BukkitRunnable;
- public class Main extends JavaPlugin {
- public String prefix = (ChatColor.RED + "Reflex " + ChatColor.DARK_GRAY + "- " + ChatColor.WHITE);
- private FileControl fc;
- private Commands commands;
- public void onEnable() {
- fc = new FileControl(new File(getDataFolder(), "config.yml"));
- getServer().getConsoleSender().sendMessage(prefix + "Plugin Successfully Enabled");
- getServer().getPluginManager().registerEvents(new Monsters(), this);
- commands = new Commands(this);
- getCommand(commands.cmd1).setExecutor(commands);
- getCommand(commands.cmd2).setExecutor(commands);
- getCommand(commands.cmd3).setExecutor(commands);
- getCommand(commands.cmd4).setExecutor(commands);
- runnable();
- registerConfig();
- saveDefaultConfig();
- }
- public void onDisable() {
- getServer().getConsoleSender().sendMessage(prefix + "Plugin Successfully Disabled");
- }
- public FileControl getFileControl() {
- return this.fc;
- }
- public void runnable() {
- new BukkitRunnable() {
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- for (LivingEntity e : getServer().getWorld("world").getLivingEntities()) {
- e.setCustomName(e.getType() + "" + ChatColor.DARK_GRAY + " (" + ChatColor.RED + e.getHealth()
- + ChatColor.DARK_GRAY + " / " + ChatColor.RED + e.getMaxHealth() + ChatColor.DARK_GRAY
- + ")");
- e.setCustomNameVisible(true);
- }
- }
- }.runTaskTimerAsynchronously((Plugin) this, 0, 10);
- }
- private void registerConfig() {
- getConfig().options().copyDefaults(true);
- saveConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement