Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ked;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Color;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.inventory.ItemStack;
- import com.google.common.io.Files;
- import de.kumpelblase2.remoteentities.EntityManager;
- import de.kumpelblase2.remoteentities.RemoteEntities;
- import de.kumpelblase2.remoteentities.api.RemoteEntity;
- import de.kumpelblase2.remoteentities.api.RemoteEntityType;
- public class PlayerDeathListener implements Listener
- {
- public String prefix = ChatColor.GOLD + "[" + ChatColor.ITALIC + ChatColor.BLUE + "Meep" + ChatColor.GRAY + "Ages" + ChatColor.RESET + ChatColor.GOLD + "]";
- public static int BLUE_POINTS = 0;
- public static int RED_POINTS = 0;
- public static int MAX = 50;
- private MeepAges plugin;
- public PlayerDeathListener(MeepAges plugin2) {
- this.plugin = plugin2;
- }
- @EventHandler
- public void onPlayerDeath(PlayerDeathEvent event)
- {
- Player p = (Player) event.getEntity().getKiller();
- Player dead = event.getEntity();
- if(PlayerJoinListener.red.contains(p.getDisplayName()) &&
- PlayerJoinListener.red.contains(dead.getDisplayName()))
- {
- p.kickPlayer(prefix + "Killing your team mates is mean!");
- Bukkit.getServer().broadcastMessage(prefix + p.getDisplayName() + Color.RED +
- "Killed His Team Mate! -3 points For Red Team");
- RED_POINTS = RED_POINTS - 3;
- }
- else
- {
- if(PlayerJoinListener.red.contains(p.getDisplayName()) &&
- PlayerJoinListener.blue.contains(dead))
- {
- RED_POINTS = RED_POINTS+1;
- }
- else
- {
- if(PlayerJoinListener.blue.contains(p.getDisplayName()) &&
- PlayerJoinListener.blue.contains(dead.getDisplayName()))
- {
- p.kickPlayer(prefix + "Killing your team mates is mean!");
- Bukkit.getServer().broadcastMessage(prefix + p.getDisplayName() + Color.RED +
- "Killed His Team Mate! -3 points For Blue Team");
- BLUE_POINTS = BLUE_POINTS - 3;
- }
- else
- {
- if(PlayerJoinListener.blue.contains(p.getDisplayName())
- && PlayerJoinListener.red.contains(dead.getDisplayName()))
- {
- BLUE_POINTS = BLUE_POINTS+1;
- }
- }
- }
- }
- if(RED_POINTS == MAX)
- {
- Bukkit.getWorld("world").spawnEntity(
- new Location(Bukkit.getWorld("world"), 58, 66.000, -546), EntityType.VILLAGER);
- Bukkit.getServer().broadcastMessage(prefix + Color.BLUE + "The King Has Spawned For Blue Team! Kill It!");
- if(!(EntityType.VILLAGER.isAlive()))
- {
- if(RED_POINTS == MAX && RED_POINTS > BLUE_POINTS)
- {
- Bukkit.getServer().broadcastMessage(prefix + Color.RED + "Red Team Wins!");
- try {
- Thread.sleep(4000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- copyFile.switchMap();
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reload");
- }
- }
- }
- else
- {
- if(BLUE_POINTS == MAX)
- {
- Bukkit.getWorld("world").spawnEntity(
- new Location(Bukkit.getWorld("world"), 56, 66.000, -653), EntityType.VILLAGER);
- Bukkit.getServer().broadcastMessage(prefix + Color.BLUE + "The King Has Spawned For Blue Team! Kill It!");
- if(!(EntityType.VILLAGER.isAlive()))
- {
- if(BLUE_POINTS == MAX && BLUE_POINTS> RED_POINTS)
- {
- Bukkit.getServer().broadcastMessage(prefix + Color.RED + "Blue Team Wins!");
- try {
- Thread.sleep(4000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- copyFile.switchMap();
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reload");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement