コード例 #1
0
	@EventHandler
	public void onSpleggGunClick(PlayerInteractEvent e) {
		SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer());

		if (player == null)
			return;
		if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK)
			return;
		if (!player.isActive())
			return;

		Game game = player.getGame();
		if (game.getGameState() != GameState.INGAME)
			return;
		if (!game.getFlag(FlagType.SPLEGG))
			return;
		if (player.getBukkitPlayer().getItemInHand().getType() != Material.DIAMOND_SPADE)
			return;

		// Launch egg
		player.getBukkitPlayer().launchProjectile(Egg.class);
		player.getBukkitPlayer().playSound(e.getPlayer().getLocation(), Sound.GHAST_FIREBALL, 0.4F, 2F);
	}
コード例 #2
0
	public boolean isIngame() {
		return game != null && game.hasPlayer(this) && game.getGameState() == GameState.INGAME;
	}