Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.teams.aden;
- import java.util.ArrayList;
- import java.util.HashMap;
- import org.bukkit.block.Block;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class main extends JavaPlugin {
- public final HashMap<Player, ArrayList<Block>> red = new HashMap<Player, ArrayList<Block>>();
- public final HashMap<Player, ArrayList<Block>> blue = new HashMap<Player, ArrayList<Block>>();
- @Override
- public void onEnable() {
- getLogger().info("Teams has been enabled!");
- }
- @Override
- public void onDisable() {
- getLogger().info("Teams has been disabled!");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label,
- String[] args) {
- if (cmd.getName().equalsIgnoreCase("join") && sender instanceof Player) {
- Player player = (Player) sender;
- if (args.length == 0) {
- player.sendMessage("You have not used the correct amount of args!");
- }
- if (args.length == 1) {
- if (args[0].equalsIgnoreCase("red")) {
- if (red.containsKey(player)) {
- player.sendMessage(ChatColor.RED
- + "You are already in that team, Type /teamleave to leave!");
- }
- if (!red.containsKey(player)) {
- player.sendMessage(ChatColor.RED
- + "You have joined team red!");
- red.put(player, null);
- }
- }
- if (args[1].equalsIgnoreCase("blue")) {
- if (blue.containsKey(player)) {
- player.sendMessage(ChatColor.RED
- + "You are already in that team, Type /teamleave to leave!");
- }
- if (!blue.containsKey(player)) {
- player.sendMessage(ChatColor.BLUE
- + "You have joined team blue!");
- blue.put(player, null);
- }
- }
- }
- if (cmd.getName().equalsIgnoreCase("whatteam")
- && sender instanceof Player) {
- if (red.containsKey(player)) {
- player.sendMessage(ChatColor.RED + "You are in team Red!");
- } else if (blue.containsKey(player)) {
- player.sendMessage(ChatColor.BLUE + "You are in team Blue!");
- } else
- player.sendMessage("You are in no teams!");
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement