Steven Smith revised this gist . Go to revision
1 file changed, 91 insertions
gistfile1.java(file created)
| @@ -0,0 +1,91 @@ | |||
| 1 | + | package me.coldguy101.bukkit.FFGessentials; | |
| 2 | + | ||
| 3 | + | import java.util.Collection; | |
| 4 | + | ||
| 5 | + | import java.util.HashMap; | |
| 6 | + | ||
| 7 | + | import java.util.HashSet; | |
| 8 | + | ||
| 9 | + | import org.bukkit.ChatColor; | |
| 10 | + | ||
| 11 | + | import org.bukkit.Location; | |
| 12 | + | ||
| 13 | + | import org.bukkit.Material; | |
| 14 | + | ||
| 15 | + | import org.bukkit.World; | |
| 16 | + | ||
| 17 | + | import org.bukkit.block.Block; | |
| 18 | + | ||
| 19 | + | import org.bukkit.command.Command; | |
| 20 | + | ||
| 21 | + | import org.bukkit.command.CommandSender; | |
| 22 | + | ||
| 23 | + | import org.bukkit.entity.Player; | |
| 24 | + | ||
| 25 | + | import org.bukkit.event.Listener; | |
| 26 | + | ||
| 27 | + | import org.bukkit.inventory.ItemStack; | |
| 28 | + | ||
| 29 | + | import org.bukkit.plugin.java.JavaPlugin; | |
| 30 | + | ||
| 31 | + | public class FFGmain extends JavaPlugin { | |
| 32 | + | ||
| 33 | + | 21public 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 | + | } | |
Newer
Older