Advertisement
Guest User

Updated1

a guest
Jul 19th, 2013
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. package ked;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Color;
  9. import org.bukkit.Location;
  10. import org.bukkit.Material;
  11. import org.bukkit.World;
  12. import org.bukkit.entity.Entity;
  13. import org.bukkit.entity.EntityType;
  14. import org.bukkit.entity.Player;
  15. import org.bukkit.event.EventHandler;
  16. import org.bukkit.event.Listener;
  17. import org.bukkit.event.entity.PlayerDeathEvent;
  18. import org.bukkit.inventory.ItemStack;
  19.  
  20. import com.google.common.io.Files;
  21.  
  22. import de.kumpelblase2.remoteentities.EntityManager;
  23. import de.kumpelblase2.remoteentities.RemoteEntities;
  24. import de.kumpelblase2.remoteentities.api.RemoteEntity;
  25. import de.kumpelblase2.remoteentities.api.RemoteEntityType;
  26.  
  27. public class PlayerDeathListener implements Listener
  28. {
  29.  
  30. public String prefix = ChatColor.GOLD + "[" + ChatColor.ITALIC + ChatColor.BLUE + "Meep" + ChatColor.GRAY + "Ages" + ChatColor.RESET + ChatColor.GOLD + "]";
  31.  
  32. public static int BLUE_POINTS = 0;
  33. public static int RED_POINTS = 0;
  34. public static int MAX = 50;
  35. private MeepAges plugin;
  36.  
  37. public PlayerDeathListener(MeepAges plugin2) {
  38.  
  39. this.plugin = plugin2;
  40.  
  41. }
  42.  
  43. @EventHandler
  44. public void onPlayerDeath(PlayerDeathEvent event)
  45. {
  46. Player p = (Player) event.getEntity().getKiller();
  47. Player dead = event.getEntity();
  48. if(PlayerJoinListener.red.contains(p.getDisplayName()) &&
  49. PlayerJoinListener.red.contains(dead.getDisplayName()))
  50. {
  51. p.kickPlayer(prefix + "Killing your team mates is mean!");
  52. Bukkit.getServer().broadcastMessage(prefix + p.getDisplayName() + Color.RED +
  53. "Killed His Team Mate! -3 points For Red Team");
  54. RED_POINTS = RED_POINTS - 3;
  55. }
  56.  
  57. else
  58. {
  59. if(PlayerJoinListener.red.contains(p.getDisplayName()) &&
  60. PlayerJoinListener.blue.contains(dead))
  61. {
  62. RED_POINTS = RED_POINTS+1;
  63. }
  64. else
  65. {
  66. if(PlayerJoinListener.blue.contains(p.getDisplayName()) &&
  67. PlayerJoinListener.blue.contains(dead.getDisplayName()))
  68. {
  69. p.kickPlayer(prefix + "Killing your team mates is mean!");
  70. Bukkit.getServer().broadcastMessage(prefix + p.getDisplayName() + Color.RED +
  71. "Killed His Team Mate! -3 points For Blue Team");
  72. BLUE_POINTS = BLUE_POINTS - 3;
  73. }
  74. else
  75. {
  76. if(PlayerJoinListener.blue.contains(p.getDisplayName())
  77. && PlayerJoinListener.red.contains(dead.getDisplayName()))
  78. {
  79. BLUE_POINTS = BLUE_POINTS+1;
  80. }
  81. }
  82. }
  83. }
  84. if(RED_POINTS == MAX)
  85. {
  86. Entity redKing = event.getEntity().getWorld().spawnEntity(
  87. new Location(Bukkit.getWorld("world"), 58, 66.000, -546), EntityType.VILLAGER);
  88. Bukkit.getServer().broadcastMessage(prefix + Color.BLUE + "The King Has Spawned For Blue Team! Kill It!");
  89. if(redKing.isDead())
  90. {
  91. Bukkit.getServer().broadcastMessage(prefix + Color.RED + "Red Team Wins!");
  92. try {
  93. Thread.sleep(4000);
  94. } catch (InterruptedException e) {
  95. // TODO Auto-generated catch block
  96. e.printStackTrace();
  97. }
  98. copyFile.switchMap();
  99. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reload");
  100. }
  101. }
  102. else
  103. {
  104. if(BLUE_POINTS == MAX)
  105. {
  106. Entity blueKing = event.getEntity().getWorld().spawnEntity(
  107. new Location(Bukkit.getWorld("world"), 56, 66.000, -653), EntityType.VILLAGER);
  108. Bukkit.getServer().broadcastMessage(prefix + Color.BLUE + "The King Has Spawned For Blue Team! Kill It!");
  109. if(blueKing.isDead())
  110. {
  111. Bukkit.getServer().broadcastMessage(prefix + Color.RED + "Blue Team Wins!");
  112. try {
  113. Thread.sleep(4000);
  114. } catch (InterruptedException e) {
  115. // TODO Auto-generated catch block
  116. e.printStackTrace();
  117. }
  118. copyFile.switchMap();
  119. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reload");
  120. }
  121. }
  122. }
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement