/** * Called when a {@link Player} switches to flying * * @param player the {@link Player} to switch */ public static void performSwitchToFly(Player player) { if (player.hasPermission("hawk.fly")) { if (HawkConfiguration.consume_item()) { if (!player.getInventory().contains(HawkConfiguration.getConsume_Item())) { return; } } flyingPlayers.put(player.getName(), new HawkPlayerStatus()); player.sendMessage( ChatColor.BLUE + PREFIX + ChatColor.WHITE + HawkConfiguration.getMessage_Fly()); } }
public void onEnable() { log = getLogger(); log.setFilter(this); HawkConfiguration.loadConfiguration(this); HawkPlayerListener player_listener = new HawkPlayerListener(); HawkEntityListener entity_listener = new HawkEntityListener(); getServer().getPluginManager().registerEvents(player_listener, this); getServer().getPluginManager().registerEvents(entity_listener, this); getServer().getScheduler().scheduleSyncRepeatingTask(this, new HawkTask(this), 1, 1); toLogger("loaded " + getDescription().getFullName()); }
/** * Called when a {@link Player} lands * * @param player to force to walk again */ public static void performSwitchToLand(Player player) { flyingPlayers.remove(player.getName()); dmgImmunePlayers.add(player.getName()); player.sendMessage( ChatColor.BLUE + Hawk.PREFIX + ChatColor.WHITE + HawkConfiguration.getMessage_Land()); }
/** * Called when a {@link Player} switches to hovering * * @param player the {@link Player} to switch * @param status the {@link HawkPlayerStatus} of this player */ public static void performSwitchToHover(Player player, HawkPlayerStatus status) { status.setState(Flystate.HOVER); dmgImmunePlayers.remove(player.getName()); player.sendMessage( ChatColor.BLUE + PREFIX + ChatColor.WHITE + HawkConfiguration.getMessage_Hover()); }