Last active 1449761952

Revision ebe33394794ab4d1d80ffe1155dac57a10246ab6

gistfile1.java Raw
1package me.coldguy101.bukkit.FFGessentials;
2
3import java.util.Collection;
4
5import java.util.HashMap;
6
7import java.util.HashSet;
8
9import org.bukkit.ChatColor;
10
11import org.bukkit.Location;
12
13import org.bukkit.Material;
14
15import org.bukkit.World;
16
17import org.bukkit.block.Block;
18
19import org.bukkit.command.Command;
20
21import org.bukkit.command.CommandSender;
22
23import org.bukkit.entity.Player;
24
25import org.bukkit.event.Listener;
26
27import org.bukkit.inventory.ItemStack;
28
29import org.bukkit.plugin.java.JavaPlugin;
30
31public class FFGmain extends JavaPlugin {
32
3321public static Collection<String> joined = new HashSet<String>();
34 public static HashMap<String, String> team = new HashMap<String, String>();
35 public static Location spawn = null;
36 public static Location outspawn = null;
37 public static Collection<String> Pinfoblockers = new HashSet<String>();
38 public static FFGmain plugin;
39
40 @Override
41 public void onEnable() {
42 Listener pplayerListener = new FFGPlayerListener();
43 getServer().getPluginManager().registerEvents(pplayerListener, this);
44 }
45
46 @Override
47 public void onDisable() {
48
49 }
50
51 public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
52 Player player = (Player) sender;
53 if (cmd.getName().equalsIgnoreCase("setaspawn") && player.isOp()) {
54 spawn = player.getLocation();
55 player.sendMessage(ChatColor.DARK_AQUA + "The Arena spawn has been set to your location");
56 } else if (cmd.getName().equalsIgnoreCase("setaoutspawn") && player.isOp()) {
57 outspawn = player.getLocation();
58 player.sendMessage(ChatColor.DARK_AQUA + "The Arena out spawn has been set to your location");
59 } else if (cmd.getName().equalsIgnoreCase("ajoin") && player.hasPermission("FFG.*") && spawn != null) {
60 if (joined.contains(player.getName())) {
61 player.sendMessage(ChatColor.DARK_AQUA + "You are already in the arena");
62 } else {
63 ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
64 ItemStack ga = new ItemStack(Material.GOLDEN_APPLE, 20);
65 ItemStack h = new ItemStack(Material.IRON_HELMET);
66 ItemStack c = new ItemStack(Material.IRON_CHESTPLATE);
67 ItemStack l = new ItemStack(Material.IRON_LEGGINGS);
68 ItemStack b = new ItemStack(Material.IRON_BOOTS);
69 joined.add(player.getName());
70 player.teleport(spawn);
71 player.sendMessage(ChatColor.DARK_AQUA + "You have just joined the deathmatch arena! To leave type /leave");
72 player.getEquipment().clear();
73 player.getEquipment().setBoots(b);
74 player.getEquipment().setChestplate(c);
75 player.getEquipment().setLeggings(l);
76 player.getEquipment().setHelmet(h);
77 player.getInventory().clear();
78 player.getInventory().addItem(sword);
79 player.getInventory().addItem(ga);
80 }
81 } else if (cmd.getName().equalsIgnoreCase("aleave") && player.hasPermission("FFG.*") && outspawn != null) {
82 player.getInventory().clear();
83 joined.remove(player.getName());
84 player.teleport(outspawn);
85 }
86
87 return true;
88
89 }
90
91}