Advertisement
jezzye13

Nature

Mar 26th, 2015 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1.     @EventHandler
  2.     public void onPlayerInteract(PlayerInteractEvent event) {
  3.         if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
  4.             Player player = event.getPlayer();
  5.             Game game = main.getGame();
  6.            
  7.             if (event.getItem().equals(red)) {
  8.                 if(game.isPlayerRed(player)) {
  9.                     player.sendMessage(ChatColor.WHITE+"You are already in "+ChatColor.RED+"Red");
  10.                 } else {
  11.                     if(game.isPlayerBlue(player)) {
  12.                         game.removeBluePlayer(player);
  13.                     }
  14.                     game.addRedPlayer(player);
  15.                     player.sendMessage(ChatColor.WHITE+"You joined "+ChatColor.RED+"Red");
  16.                 }
  17.             } else if (event.getItem().equals(blue)) {
  18.                 if(game.isPlayerBlue(player)) {
  19.                     player.sendMessage(ChatColor.WHITE+"You are already in "+ChatColor.BLUE+"Blue");
  20.                 } else {
  21.                     if(game.isPlayerRed(player)) {
  22.                         game.removeRedPlayer(player);
  23.                     }
  24.                     game.addBluePlayer(player);
  25.                     player.sendMessage(ChatColor.WHITE+"You joined "+ChatColor.BLUE+"Blue");
  26.                 }
  27.             }
  28.             game.updateScoreBoard();
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement