public void updateDimension() { Player player = getPlayer().getPlayer(); if (player == null) return; Environment env = player.getWorld().getEnvironment(); String envString = "overworld"; if (env == Environment.NETHER) envString = "nether"; else if (env == Environment.THE_END) envString = "end"; PluginChannelUtils.messageSpectators("player", getName(), "dimension", envString); }
public void updateHealth() { Player player = getPlayer().getPlayer(); if (player == null) return; int newHealth = Math.max(0, player.getHealth()); if (newHealth != currentHealth) { PluginChannelUtils.messageSpectators("player", getName(), "hp", Integer.toString(newHealth)); this.player .getMatch() .getServer() .getPluginManager() .callEvent( new UhcHealthChangeEvent( this.player.getMatch(), this.player.getLocation(), player, newHealth)); currentHealth = newHealth; } }
public void updateArmor() { Player player = getPlayer().getPlayer(); if (player == null) return; int newArmor = ArmorPoints.fromPlayerInventory(player.getInventory()); if (newArmor != currentArmor) { PluginChannelUtils.messageSpectators( "player", getName(), "armor", Integer.toString(newArmor)); this.player .getMatch() .getServer() .getPluginManager() .callEvent( new UhcArmorChangeEvent( this.player.getMatch(), this.player.getLocation(), player, newArmor)); currentArmor = newArmor; } }
public void setIsOnline(boolean online) { PluginChannelUtils.messageSpectators("player", getName(), online ? "login" : "logout"); }
public void incrementShotsHit() { ++shotsHit; PluginChannelUtils.messageSpectators("player", getName(), "accuracy", getAccuracy()); }
public void addKill() { ++kills; PluginChannelUtils.messageSpectators( "player", this.getName(), "kills", Integer.toString(getKills())); }