Advertisement
thegarfish

Untitled

Sep 8th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. package me.thegarfish.siege;
  2.  
  3. import java.util.ArrayList;
  4.  
  5.  
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.plugin.PluginDescriptionFile;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13.  
  14.  
  15.  
  16. public class Main extends JavaPlugin{
  17.  
  18. public ArrayList<String> redteam = new ArrayList<String>();
  19. public ArrayList<String> blueteam = new ArrayList<String>();
  20.  
  21. public void onDisable() {
  22. PluginDescriptionFile pdfFile = getDescription();
  23. System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " has been disabled!" );
  24. getServer().getPluginManager().registerEvents(new DamageListener(this), this);
  25. }
  26.  
  27. public void onEnable() {
  28. PluginDescriptionFile pdfFile = getDescription();
  29. System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
  30.  
  31. }
  32.  
  33. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  34.  
  35. if (sender instanceof Player) {
  36.  
  37. Player player = (Player) sender;
  38. if(cmd.getName().equalsIgnoreCase("join")){
  39. if(args.length == 1){
  40. if(args[0].equalsIgnoreCase("red")){
  41.  
  42. redteam.add(player.getName());
  43. sender.sendMessage(ChatColor.AQUA + "[Siege] " + ChatColor.RED + "You have joined the Red team!");
  44.  
  45. }else{
  46.  
  47. if(args[0].equalsIgnoreCase("blue")){
  48.  
  49. blueteam.add(player.getName());
  50. sender.sendMessage(ChatColor.AQUA + "[Siege] " + ChatColor.RED + "You have joined the Blue team!");
  51.  
  52. }
  53. }
  54. }else{
  55. sender.sendMessage(ChatColor.AQUA + "[Siege] " + ChatColor.RED + "Usage: /join red; /join blue");
  56. }
  57. }
  58.  
  59. }
  60. if(cmd.getName().equalsIgnoreCase("Check")) {
  61. if(args.length == 1) {
  62. if(args[0].equalsIgnoreCase("red")) {
  63. System.out.println(redteam.toString());
  64. }else{
  65.  
  66. if(args[0].equalsIgnoreCase("blue")) {
  67. System.out.println(blueteam.toString());
  68. }
  69. }
  70.  
  71. }
  72. }
  73. return false;
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement