Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) {
- if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
- Player player = event.getPlayer();
- Game game = main.getGame();
- if (event.getItem().equals(red)) {
- if(game.isPlayerRed(player)) {
- player.sendMessage(ChatColor.WHITE+"You are already in "+ChatColor.RED+"Red");
- } else {
- if(game.isPlayerBlue(player)) {
- game.removeBluePlayer(player);
- }
- game.addRedPlayer(player);
- player.sendMessage(ChatColor.WHITE+"You joined "+ChatColor.RED+"Red");
- }
- } else if (event.getItem().equals(blue)) {
- if(game.isPlayerBlue(player)) {
- player.sendMessage(ChatColor.WHITE+"You are already in "+ChatColor.BLUE+"Blue");
- } else {
- if(game.isPlayerRed(player)) {
- game.removeRedPlayer(player);
- }
- game.addBluePlayer(player);
- player.sendMessage(ChatColor.WHITE+"You joined "+ChatColor.BLUE+"Blue");
- }
- }
- game.updateScoreBoard();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement