package me.zachoooo.plugins.hitcounter; import java.io.PrintStream; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.util.config.Configuration; public class HitCounterPlayerListener extends PlayerListener { public Hitcounter plugin; public HitCounterPlayerListener(Hitcounter instance) { this.plugin = instance; } public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); this.plugin.hits += 1; this.plugin.config.setProperty(\"hits\", Integer.valueOf(this.plugin.hits)); this.plugin.config.save(); System.out.println(\"Hit Counter: \" + this.plugin.hits); if (this.plugin.oponly == 0) { if (this.plugin.chatcolor == 0) { event.getPlayer().sendMessage(ChatColor.BLACK + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 1) { event.getPlayer().sendMessage(ChatColor.DARK_BLUE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 2) { event.getPlayer().sendMessage(ChatColor.DARK_GREEN + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 3) { event.getPlayer().sendMessage(ChatColor.DARK_AQUA + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 4) { event.getPlayer().sendMessage(ChatColor.DARK_RED + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 5) { event.getPlayer().sendMessage(ChatColor.DARK_PURPLE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 6) { event.getPlayer().sendMessage(ChatColor.GOLD + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 7) { event.getPlayer().sendMessage(ChatColor.GRAY + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 8) { event.getPlayer().sendMessage(ChatColor.DARK_GRAY + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 9) { event.getPlayer().sendMessage(ChatColor.BLUE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 10) { event.getPlayer().sendMessage(ChatColor.GREEN + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 11) { event.getPlayer().sendMessage(ChatColor.AQUA + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 12) { event.getPlayer().sendMessage(ChatColor.RED + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 13) { event.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 14) { event.getPlayer().sendMessage(ChatColor.YELLOW + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 15) { event.getPlayer().sendMessage(ChatColor.WHITE + \"Hit Counter: \" + this.plugin.hits); } } else if (player.isOp()) { if (this.plugin.chatcolor == 0) { event.getPlayer().sendMessage(ChatColor.BLACK + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 1) { event.getPlayer().sendMessage(ChatColor.DARK_BLUE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 2) { event.getPlayer().sendMessage(ChatColor.DARK_GREEN + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 3) { event.getPlayer().sendMessage(ChatColor.DARK_AQUA + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 4) { event.getPlayer().sendMessage(ChatColor.DARK_RED + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 5) { event.getPlayer().sendMessage(ChatColor.DARK_PURPLE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 6) { event.getPlayer().sendMessage(ChatColor.GOLD + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 7) { event.getPlayer().sendMessage(ChatColor.GRAY + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 8) { event.getPlayer().sendMessage(ChatColor.DARK_GRAY + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 9) { event.getPlayer().sendMessage(ChatColor.BLUE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 10) { event.getPlayer().sendMessage(ChatColor.GREEN + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 11) { event.getPlayer().sendMessage(ChatColor.AQUA + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 12) { event.getPlayer().sendMessage(ChatColor.RED + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 13) { event.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 14) { event.getPlayer().sendMessage(ChatColor.YELLOW + \"Hit Counter: \" + this.plugin.hits); } if (this.plugin.chatcolor == 15) event.getPlayer().sendMessage(ChatColor.WHITE + \"Hit Counter: \" + this.plugin.hits); } } }