Created
January 13, 2013 17:10
-
-
Save blha303/4525105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.coldguy101.bukkit.FFGessentials; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import org.bukkit.ChatColor; | |
import org.bukkit.Location; | |
import org.bukkit.Material; | |
import org.bukkit.World; | |
import org.bukkit.block.Block; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.Listener; | |
import org.bukkit.inventory.ItemStack; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class FFGmain extends JavaPlugin { | |
21public static Collection<String> joined = new HashSet<String>(); | |
public static HashMap<String, String> team = new HashMap<String, String>(); | |
public static Location spawn = null; | |
public static Location outspawn = null; | |
public static Collection<String> Pinfoblockers = new HashSet<String>(); | |
public static FFGmain plugin; | |
@Override | |
public void onEnable() { | |
Listener pplayerListener = new FFGPlayerListener(); | |
getServer().getPluginManager().registerEvents(pplayerListener, this); | |
} | |
@Override | |
public void onDisable() { | |
} | |
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { | |
Player player = (Player) sender; | |
if (cmd.getName().equalsIgnoreCase("setaspawn") && player.isOp()) { | |
spawn = player.getLocation(); | |
player.sendMessage(ChatColor.DARK_AQUA + "The Arena spawn has been set to your location"); | |
} else if (cmd.getName().equalsIgnoreCase("setaoutspawn") && player.isOp()) { | |
outspawn = player.getLocation(); | |
player.sendMessage(ChatColor.DARK_AQUA + "The Arena out spawn has been set to your location"); | |
} else if (cmd.getName().equalsIgnoreCase("ajoin") && player.hasPermission("FFG.*") && spawn != null) { | |
if (joined.contains(player.getName())) { | |
player.sendMessage(ChatColor.DARK_AQUA + "You are already in the arena"); | |
} else { | |
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD); | |
ItemStack ga = new ItemStack(Material.GOLDEN_APPLE, 20); | |
ItemStack h = new ItemStack(Material.IRON_HELMET); | |
ItemStack c = new ItemStack(Material.IRON_CHESTPLATE); | |
ItemStack l = new ItemStack(Material.IRON_LEGGINGS); | |
ItemStack b = new ItemStack(Material.IRON_BOOTS); | |
joined.add(player.getName()); | |
player.teleport(spawn); | |
player.sendMessage(ChatColor.DARK_AQUA + "You have just joined the deathmatch arena! To leave type /leave"); | |
player.getEquipment().clear(); | |
player.getEquipment().setBoots(b); | |
player.getEquipment().setChestplate(c); | |
player.getEquipment().setLeggings(l); | |
player.getEquipment().setHelmet(h); | |
player.getInventory().clear(); | |
player.getInventory().addItem(sword); | |
player.getInventory().addItem(ga); | |
} | |
} else if (cmd.getName().equalsIgnoreCase("aleave") && player.hasPermission("FFG.*") && outspawn != null) { | |
player.getInventory().clear(); | |
joined.remove(player.getName()); | |
player.teleport(outspawn); | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment