Advertisement
Dobbermann2

Untitled

Aug 22nd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.43 KB | None | 0 0
  1. package com.Dobbermann2.BowButton;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Material;
  6. import org.bukkit.entity.EntityType;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.entity.ProjectileHitEvent;
  10.  
  11. public class Listeners implements Listener {
  12.     Main plugin;
  13.  
  14.     public Listeners(Main pl) {
  15.         plugin = pl;
  16.     }
  17.  
  18.     @EventHandler
  19.     public void onProjectileHit(ProjectileHitEvent e) {
  20.         if (plugin.jp.contains(e.getEntity().getShooter())) {
  21.             Bukkit.broadcastMessage(ChatColor.RED + "1");
  22.             if (e.getEntity().getType() == EntityType.ARROW) {
  23.                 Bukkit.broadcastMessage(ChatColor.RED + "2");
  24.                 if (e.getEntity().getLocation().getBlock().getType() == Material.WOOD_BUTTON) {
  25.                     Bukkit.broadcastMessage(ChatColor.RED + "3");
  26.                     if (plugin.jp.size() == 1) {
  27.                         if (e.getEntity().getShooter() == plugin.jp.get(0)) {
  28.                             plugin.jp
  29.                                     .get(0)
  30.                                     .getPlayer()
  31.                                     .sendMessage(
  32.                                             ChatColor.BLUE + "["
  33.                                                     + ChatColor.RED
  34.                                                     + "Bow Button"
  35.                                                     + ChatColor.BLUE + "]"
  36.                                                     + ChatColor.WHITE
  37.                                                     + "You know have "
  38.                                                     + plugin.points.get(0));
  39.                             plugin.points.put(plugin.jp.get(0), +1);
  40.                             if (plugin.points.get(plugin.jp.get(0)).equals(3)) {
  41.                                 ChatUtilities.broadcast(ChatColor.YELLOW
  42.                                         + plugin.jp.get(0).getName() + " "
  43.                                         + ChatColor.GREEN + "won the game");
  44.                                 plugin.Ending();
  45.                             }
  46.                         }
  47.                     }
  48.                     if (plugin.jp.size() == 1) {
  49.                         if (e.getEntity().getShooter() == plugin.jp.get(1)) {
  50.                             plugin.jp
  51.                                     .get(1)
  52.                                     .getPlayer()
  53.                                     .sendMessage(
  54.                                             ChatColor.BLUE + "["
  55.                                                     + ChatColor.RED
  56.                                                     + "Bow Button"
  57.                                                     + ChatColor.BLUE + "]"
  58.                                                     + ChatColor.WHITE
  59.                                                     + "You know have "
  60.                                                     + plugin.points.get(1));
  61.                             plugin.points.put(plugin.jp.get(1), +1);
  62.                             if (plugin.points.get(plugin.jp.get(1)).equals(3)) {
  63.                                 ChatUtilities.broadcast(ChatColor.YELLOW
  64.                                         + plugin.jp.get(0).getName() + " "
  65.                                         + ChatColor.GREEN + "won the game");
  66.                                 plugin.Ending();
  67.  
  68.                             }
  69.                         }
  70.                     }
  71.                     if (plugin.jp.size() == 1) {
  72.                         if (e.getEntity().getShooter() == plugin.jp.get(2)) {
  73.                             plugin.jp
  74.                                     .get(2)
  75.                                     .getPlayer()
  76.                                     .sendMessage(
  77.                                             ChatColor.BLUE + "["
  78.                                                     + ChatColor.RED
  79.                                                     + "Bow Button"
  80.                                                     + ChatColor.BLUE + "]"
  81.                                                     + ChatColor.WHITE
  82.                                                     + "You know have "
  83.                                                     + plugin.points.get(2));
  84.                             plugin.points.put(plugin.jp.get(2), +1);
  85.  
  86.                             if (plugin.points.get(plugin.jp.get(2)).equals(3)) {
  87.                                 ChatUtilities.broadcast(ChatColor.YELLOW
  88.                                         + plugin.jp.get(0).getName() + " "
  89.                                         + ChatColor.GREEN + "won the game");
  90.                                 plugin.Ending();
  91.                             }
  92.                         }
  93.                     }
  94.                     if (plugin.jp.size() == 1) {
  95.                         if (e.getEntity().getShooter() == plugin.jp.get(3)) {
  96.                             plugin.jp
  97.                                     .get(3)
  98.                                     .getPlayer()
  99.                                     .sendMessage(
  100.                                             ChatColor.BLUE + "["
  101.                                                     + ChatColor.RED
  102.                                                     + "Bow Button"
  103.                                                     + ChatColor.BLUE + "]"
  104.                                                     + ChatColor.WHITE
  105.                                                     + "You know have "
  106.                                                     + plugin.points.get(3));
  107.                             plugin.points.put(plugin.jp.get(3), +1);
  108.                             if (plugin.points.get(plugin.jp.get(3)).equals(3)) {
  109.                                 ChatUtilities.broadcast(ChatColor.YELLOW
  110.                                         + plugin.jp.get(0).getName() + " "
  111.                                         + ChatColor.GREEN + "won the game");
  112.                                 plugin.Ending();
  113.  
  114.                             }
  115.                         }
  116.                     }
  117.                     if (plugin.jp.size() == 1) {
  118.                         if (e.getEntity().getShooter() == plugin.jp.get(4)) {
  119.                             plugin.jp
  120.                                     .get(4)
  121.                                     .getPlayer()
  122.                                     .sendMessage(
  123.                                             ChatColor.BLUE + "["
  124.                                                     + ChatColor.RED
  125.                                                     + "Bow Button"
  126.                                                     + ChatColor.BLUE + "]"
  127.                                                     + ChatColor.WHITE
  128.                                                     + "You know have "
  129.                                                     + plugin.points.get(4));
  130.                             plugin.points.put(plugin.jp.get(4), +1);
  131.                             if (plugin.points.get(plugin.jp.get(4)).equals(3)) {
  132.                                 ChatUtilities.broadcast(ChatColor.YELLOW
  133.                                         + plugin.jp.get(0).getName() + " "
  134.                                         + ChatColor.GREEN + "won the game");
  135.                                 plugin.Ending();
  136.  
  137.                             }
  138.                         }
  139.                     }
  140.                     if (e.getEntity().getShooter() == null) {
  141.                         return;
  142.  
  143.                     }
  144.                 }
  145.  
  146.             }
  147.  
  148.         }
  149.  
  150.     }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement