Advertisement
Guest User

Untitled

a guest
Apr 26th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. package me.teams.aden;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5.  
  6. import org.bukkit.block.Block;
  7.  
  8. import org.bukkit.ChatColor;
  9. import org.bukkit.command.Command;
  10. import org.bukkit.command.CommandSender;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. public class main extends JavaPlugin {
  15.  
  16.     public final HashMap<Player, ArrayList<Block>> red = new HashMap<Player, ArrayList<Block>>();
  17.     public final HashMap<Player, ArrayList<Block>> blue = new HashMap<Player, ArrayList<Block>>();
  18.  
  19.     @Override
  20.     public void onEnable() {
  21.  
  22.         getLogger().info("Teams has been enabled!");
  23.     }
  24.  
  25.     @Override
  26.     public void onDisable() {
  27.         getLogger().info("Teams has been disabled!");
  28.     }
  29.  
  30.     public boolean onCommand(CommandSender sender, Command cmd, String label,
  31.             String[] args) {
  32.         if (cmd.getName().equalsIgnoreCase("join") && sender instanceof Player) {
  33.             Player player = (Player) sender;
  34.             if (args.length == 0) {
  35.                 player.sendMessage("You have not used the correct amount of args!");
  36.             }
  37.             if (args.length == 1) {
  38.                 if (args[0].equalsIgnoreCase("red")) {
  39.                     if (red.containsKey(player)) {
  40.                         player.sendMessage(ChatColor.RED
  41.                                 + "You are already in that team, Type /teamleave to leave!");
  42.                     }
  43.                     if (!red.containsKey(player)) {
  44.                         player.sendMessage(ChatColor.RED
  45.                                 + "You have joined team red!");
  46.                         red.put(player, null);
  47.  
  48.                     }
  49.                 }
  50.                 if (args[1].equalsIgnoreCase("blue")) {
  51.                     if (blue.containsKey(player)) {
  52.                         player.sendMessage(ChatColor.RED
  53.                                 + "You are already in that team, Type /teamleave to leave!");
  54.  
  55.                     }
  56.                     if (!blue.containsKey(player)) {
  57.                         player.sendMessage(ChatColor.BLUE
  58.                                 + "You have joined team blue!");
  59.                         blue.put(player, null);
  60.                     }
  61.                 }
  62.             }
  63.             if (cmd.getName().equalsIgnoreCase("whatteam")
  64.                     && sender instanceof Player) {
  65.                 if (red.containsKey(player)) {
  66.                     player.sendMessage(ChatColor.RED + "You are in team Red!");
  67.                 } else if (blue.containsKey(player)) {
  68.                     player.sendMessage(ChatColor.BLUE + "You are in team Blue!");
  69.                 } else
  70.                     player.sendMessage("You are in no teams!");
  71.             }
  72.         }
  73.         return false;
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement