@Override
  public void run(Server server, CommandSender sender, String commandLabel, String[] args)
      throws Exception {
    if (args.length < 1) {
      throw new NotEnoughArgumentsException();
    }

    if (server.matchPlayer(args[0]).isEmpty()) {
      ((CraftServer) server).getHandle().a(args[0]);
      sender.sendMessage(Util.format("playerBanned", args[0]));
    } else {
      final User player = ess.getUser(server.matchPlayer(args[0]).get(0));
      String banReason;
      if (args.length > 1) {
        banReason = getFinalArg(args, 1);
        player.setBanReason(commandLabel);
      } else {
        banReason = Util.i18n("defaultBanReason");
      }
      player.kickPlayer(banReason);
      ((CraftServer) server).getHandle().a(player.getName());
      sender.sendMessage(Util.format("playerBanned", player.getName()));
    }
    ess.loadBanList();
  }
示例#2
0
 /**
  * Handle the '/nocheatplus info' command.
  *
  * @param sender the sender
  * @param playerName the player name
  * @return true, if successful
  */
 private void handleInfoCommand(final CommandSender sender, final String playerName) {
   final Player player = Bukkit.getPlayer(playerName);
   if (player != null) {
     final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
     final TreeMap<Long, ViolationLevel> violations =
         ViolationHistory.getHistory(player).getViolationLevels();
     if (violations.size() > 0) {
       sender.sendMessage(TAG + "Displaying " + playerName + "'s violations...");
       for (final long time : violations.descendingKeySet()) {
         final ViolationLevel violationLevel = violations.get(time);
         final String[] parts = violationLevel.check.split("\\.");
         final String check = parts[parts.length - 1];
         final String parent = parts[parts.length - 2];
         final double VL = Math.round(violationLevel.VL);
         sender.sendMessage(
             TAG
                 + "["
                 + dateFormat.format(new Date(time))
                 + "] ("
                 + parent
                 + ".)"
                 + check
                 + " VL "
                 + VL);
       }
     } else
       sender.sendMessage(
           TAG + "Displaying " + playerName + "'s violations... nothing to display.");
   } else {
     sender.sendMessage(TAG + "404 Not Found");
     sender.sendMessage(TAG + "The requested player was not found on this server.");
   }
 }
示例#3
0
  @Override
  public boolean onCommand(
      CommandSender sender, Command command, String commandLabel, String[] args) {
    if (sender instanceof Player) {
      // Check if Player
      // If so, ignore command if player is not Op
      Player p = (Player) sender;
      if (!p.isOp()) {
        return true;
      }
    }

    if (command.getName().equalsIgnoreCase("vault-info")) {
      infoCommand(sender);
      return true;
    } else if (command.getName().equalsIgnoreCase("vault-convert")) {
      convertCommand(sender, args);
      return true;
    } else {
      // Show help
      sender.sendMessage("Vault Commands:");
      sender.sendMessage("  /vault-info - Displays information about Vault");
      sender.sendMessage(
          "  /vault-convert [economy1] [economy2] - Converts from one Economy to another");
      return true;
    }
  }
示例#4
0
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length > 1) {
     Player player = getPlayerUnsafe(args[0]);
     if (player == null) {
       sender.sendMessage(StaticVars.MESSAGE_PLAYER_NOT_FOUND);
     } else {
       StringBuilder sb = new StringBuilder();
       if (args[1].startsWith("/")) {
         sb.append(args[1].substring(1));
       } else {
         sb.append(args[1]);
       }
       for (int i = 2; i < args.length; i++) {
         sb.append(' ');
         sb.append(args[i]);
       }
       Bukkit.getServer().dispatchCommand(player, sb.toString());
       sender.sendMessage(StaticVars.MESSAGE_COMMAND_EXECUTED);
     }
     return true;
   } else {
     return false;
   }
 }
示例#5
0
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (args.length < 3) {
     sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
     return true;
   }
   com.exodon.hcf.faction.type.Faction faction =
       this.plugin.getFactionManager().getFaction(args[1]);
   if (faction != null) {
     sender.sendMessage(ChatColor.RED + "There is already a faction named " + args[1] + '.');
     return true;
   }
   String upperCase = args[2].toUpperCase();
   switch (upperCase) {
     case "CONQUEST":
       faction = new ConquestFaction(args[1]);
       break;
     case "KOTH":
       faction = new KothFaction(args[1]);
       break;
     default:
       sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
       return true;
   }
   this.plugin.getFactionManager().createFaction(faction, sender);
   sender.sendMessage(
       ChatColor.YELLOW
           + "Created event faction "
           + ChatColor.WHITE
           + faction.getDisplayName(sender)
           + ChatColor.YELLOW
           + " with type "
           + WordUtils.capitalizeFully(args[2])
           + '.');
   return true;
 }
示例#6
0
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
   if (cmd.getName().equalsIgnoreCase("staff")) {
     ArrayList<String> staff = new ArrayList<String>();
     String onlineStaff = "";
     for (Player player : plugin.getServer().getOnlinePlayers()) {
       if (player.hasPermission("stumcreport.staff")
           && plugin.getDuty(player.getName()).equals("on")) {
         staff.add(player.getDisplayName());
       }
     }
     if (staff.size() == 1) {
       onlineStaff = staff.get(0);
     } else if (staff.size() != 0) {
       for (int i = 0; i < staff.size(); i++) {
         if (i < staff.size() - 1) {
           onlineStaff += staff.get(i) + ", ";
         } else {
           onlineStaff += staff.get(staff.size() - 1);
         }
       }
     }
     if (onlineStaff.isEmpty()) {
       sender.sendMessage(ChatColor.GOLD + "No staff online.");
     } else {
       sender.sendMessage(ChatColor.GOLD + "Online staff: " + onlineStaff);
     }
     return true;
   }
   return false;
 }
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length != 1) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage("Player is not online.");
     return true;
   }
   if (FOPMR_Rank.isEqualOrHigher(FOPMR_Rank.getRank(player), FOPMR_Rank.getRank(sender))) {
     sender.sendMessage(
         "You can only block the commands of a player with lower clearance than yourself.");
     return true;
   }
   Bukkit.broadcastMessage(
       ChatColor.AQUA
           + sender.getName()
           + " - toggling command blockage for "
           + player.getName()
           + ".");
   try {
     FOPMR_DatabaseInterface.updateInTable(
         "UUID",
         player.getUniqueId().toString(),
         !(FOPMR_DatabaseInterface.getBooleanFromTable(
             "UUID", player.getUniqueId().toString(), "CMDBLOCK", "PLAYERS")),
         "CMDBLOCK",
         "PLAYERS");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
示例#8
0
 public boolean checkPermission(CommandSender sender, String permission) {
   if (!sender.hasPermission(permission)) {
     sender.sendMessage(ChatColor.RED + "You don't have permission for that command.");
     return false;
   }
   return true;
 }
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (!sender.hasPermission(GoldRushPerms.SCHEDULE)) {
      deny(sender);
      return true;
    }

    int taskID = Departure.getTaskID();
    BukkitScheduler s = Bukkit.getScheduler();

    if (args[0].equalsIgnoreCase("Start") && taskID == -1) {
      sender.sendMessage("Starting Train Cycle...");
      Departure.setTaskID(
          Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Departure(plugin), 100, 400));
      return true;
    } else if (taskID != 0) {
      sender.sendMessage("Train Cycle already started!");
      return true;
    } else if (args[0].equalsIgnoreCase("Stop")
        && (s.isCurrentlyRunning(taskID) || s.isQueued(taskID))) {
      sender.sendMessage("Stopping Train Cycle...");
      Bukkit.getScheduler().cancelTask(taskID);
      Departure.resetTaskID();
      return true;
    } else if (taskID == -1) {
      sender.sendMessage("Train Cycle is not running.");
      return true;
    }
    return false;
  }
示例#10
0
 public void returnMessage(CommandSender sender, String message) {
   if (sender instanceof Player) {
     sender.sendMessage(plugin.processColours(message));
   } else {
     sender.sendMessage(plugin.stripColours(message));
   }
 }
  private void sendGroupStrings(CommandSender cs, List<String> list, String groupHeader) {
    if (list == null || list.isEmpty()) {
      return;
    } else {
      boolean groupStart = false;
      String line = " ";
      Iterator<String> it = list.listIterator();
      Collections.sort(list);

      while (it.hasNext()) {
        String str = it.next();

        if (line.length() + (str.length() + COMMA.length() + 1) > 70) {
          if (!groupStart) {
            groupStart = true;
            cs.sendMessage(groupHeader + line.substring(0, line.length() - 2));
            line = " ";
          } else {
            cs.sendMessage(line.substring(0, line.length() - 2));
            line = " ";
          }
        }

        line += (str + COMMA + " ");
      }

      if (!line.isEmpty()) {
        if (!groupStart) {
          cs.sendMessage(groupHeader + line.substring(0, line.length() - 2));
        } else {
          cs.sendMessage(line.substring(0, line.length() - 2));
        }
      }
    }
  }
 @Override
 public boolean run(
     CommandSender sender,
     Player sender_p,
     Command cmd,
     String commandLabel,
     String[] args,
     boolean senderIsConsole) {
   boolean toggled = false;
   boolean enabled = true;
   for (Plugin p : TotalFreedomMod.server.getPluginManager().getPlugins()) {
     if (p.getName().equalsIgnoreCase("nyan")) {
       if (p.isEnabled()) {
         p.getPluginLoader().disablePlugin(p);
         enabled = false;
       } else {
         p.getPluginLoader().enablePlugin(p);
         enabled = true;
       }
       toggled = true;
     }
   }
   if (toggled) {
     if (!enabled) {
       TotalFreedomMod.server.broadcastMessage(
           ChatColor.RED + sender.getName() + " - Disabling Nyan Plugin");
     } else {
       TotalFreedomMod.server.broadcastMessage(
           ChatColor.GREEN + sender.getName() + " - Enabling Nyan Plugin");
     }
   }
   return true;
 }
示例#13
0
 @Override
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (label.equalsIgnoreCase("spawnmob")) {
     if (sender instanceof Player) {
       if (sender.hasPermission("entityscripter.spawn")) {
         if (args.length >= 1) {
           File f = new File(EntityScripter.plugin.getDataFolder() + "/mobs/" + args[0] + ".yml");
           if (f.exists()) {
             CodeInterpreter code = new CodeInterpreter(f);
             EntityBuilder builder = code.create();
             builder.setLocation(((Player) sender).getLocation());
             builder.spawn();
             code.resolveModule("properties", builder);
             builder.inject(builder.getEntity());
           } else
             Bukkit.broadcastMessage(
                 ChatColor.RED
                     + "[ERROR] Could not find mob file with name '"
                     + ChatColor.YELLOW
                     + args[0]
                     + ChatColor.RED
                     + "'.");
         } else {
           sender.sendMessage(ChatColor.RED + "Too few arguments. /spawnmob <mob file>");
         }
       } else {
         sender.sendMessage(ChatColor.RED + "You don't have permission to perform this command.");
       }
     } else {
       sender.sendMessage(ChatColor.RED + "The console is now allowed to run this command.");
     }
   }
   return true;
 }
示例#14
0
 /**
  * @param sender
  * @param args
  */
 @Override
 public void dispatch(CommandSender sender, String[] args) {
   if (args.length == 3) {
     String bot = args[1];
     String channelName = args[2];
     if (plugin.ircBots.containsKey(bot)) {
       if (plugin.ircBots.get(bot).opsList.containsKey(channelName)) {
         sender.sendMessage(
             ChatColor.DARK_PURPLE
                 + "-----[  "
                 + ChatColor.WHITE
                 + channelName
                 + ChatColor.DARK_PURPLE
                 + " - "
                 + ChatColor.WHITE
                 + "Auto Op Masks"
                 + ChatColor.DARK_PURPLE
                 + " ]-----");
         for (String userMask : plugin.ircBots.get(bot).opsList.get(channelName)) {
           sender.sendMessage(" - " + userMask);
         }
       } else {
         sender.sendMessage(plugin.invalidChannel.replace("%CHANNEL%", channelName));
       }
     } else {
       sender.sendMessage(plugin.invalidBotName.replace("%BOT%", bot));
     }
   } else {
     sender.sendMessage(fullUsage);
   }
 }
 private void showUsage(CommandSender sender, String arg) {
   String cmdName = arg.toLowerCase();
   Command cmd = aliasMap.get(cmdName);
   if (cmd != null && hasAccess(cmd, sender)) {
     String msg = I18nUtil.tr("\u00a77Usage: {0}", name) + " \u00a7e";
     msg += getShortDescription(sender, cmd);
     if (cmd.getUsage() != null && !cmd.getUsage().isEmpty()) {
       msg += "\u00a77" + cmd.getUsage();
     }
     sender.sendMessage(msg.split("\n"));
   } else if (cmdName.matches("[0-9]+")) {
     showUsage(sender, Integer.parseInt(cmdName));
   } else {
     List<String> cmds = filter(aliasMap.keySet(), cmdName);
     if (cmds.isEmpty()) {
       showUsage(sender, 1);
     } else {
       String msg = I18nUtil.tr("\u00a77Usage: {0}", getShortDescription(sender, this));
       Collections.sort(cmds);
       for (String key : cmds) {
         Command scmd = commandMap.get(key);
         if (scmd != null) {
           msg += "  " + getShortDescription(sender, scmd);
         }
       }
       sender.sendMessage(msg.split("\n"));
     }
   }
 }
示例#16
0
  public boolean convert(CommandSender sender) {
    if (instance.getServer().getPluginManager().getPlugin("xAuth") == null) {
      sender.sendMessage("[AuthMe] xAuth plugin not found");
      return false;
    }
    if (!(new File("./plugins/xAuth/xAuth.h2.db").exists())) {
      sender.sendMessage(
          "[AuthMe] xAuth H2 database not found, checking for MySQL or SQLite data...");
    }
    List<Integer> players = getXAuthPlayers();
    if (players == null || players.isEmpty()) {
      sender.sendMessage("[AuthMe] Error while import xAuthPlayers");
      return false;
    }

    sender.sendMessage("[AuthMe] Starting import...");
    for (int id : players) {
      String pl = getIdPlayer(id);
      String psw = getPassword(id);
      if (psw != null && !psw.isEmpty() && pl != null) {
        PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0);
        database.saveAuth(auth);
      }
    }
    sender.sendMessage("[AuthMe] Import done!");
    return true;
  }
示例#17
0
 public void displayCommandHelp(Command command, CommandSender sender) {
   sender.sendMessage(
       new StringBuilder().append("Command: ").append(command.getName()).toString());
   sender.sendMessage(
       new StringBuilder().append("Description: ").append(command.getDescription()).toString());
   sender.sendMessage(new StringBuilder().append("Usage: ").append(command.getUsage()).toString());
 }
示例#18
0
  private void printVersion(CommandSender sender) {
    PluginDescriptionFile desc = plugin.getDescription();

    sender.sendMessage(
        ChatColor.GREEN
            + desc.getName()
            + ChatColor.WHITE
            + " v"
            + ChatColor.GREEN
            + desc.getVersion());
    sender.sendMessage(
        ChatColor.WHITE
            + "Authors: "
            + ChatColor.GREEN
            + "dmulloy2"
            + ChatColor.WHITE
            + " and "
            + ChatColor.GREEN
            + "Comphenix");
    sender.sendMessage(
        ChatColor.WHITE
            + "Issues: "
            + ChatColor.GREEN
            + "https://github.com/dmulloy2/ProtocolLib/issues");
  }
示例#19
0
  public boolean onCommand(
      CommandSender sender, Command command, String commandLabel, String[] args) {
    if (args.length < 2) {
      return false; // you need an issue ID and at least one word of reasoning
    }

    int uid;
    try {
      uid = Integer.parseInt(args[0]);
    } catch (NumberFormatException ex) {
      sender.sendMessage(
          TidyPlugin.ERROR_COLOR + "\"" + args[0] + "\" isn't a valid issue ID number!");
      return true;
    }

    IssueReport issue = issueManager.getIssue(uid);
    if (issue == null) {
      sender.sendMessage(TidyPlugin.ERROR_COLOR + "Couldn't find issue #" + uid);
      return true;
    }

    String comment = "";
    for (int i = 1; i < args.length; i++) {
      comment = comment + args[i] + " ";
    }

    if (issue.markAsOpen(sender.getName(), comment)) {
      sender.sendMessage(TidyPlugin.NEUTRAL_COLOR + "Reopened issue #" + uid);
      return true;
    }

    sender.sendMessage(TidyPlugin.ERROR_COLOR + "Issue #" + uid + " isn't marked as resolved!");
    return true;
  }
示例#20
0
 public boolean run(CommandSender sender, String[] args) {
   for (Map.Entry<CommandBase, Method> e : map.entrySet()) {
     if (Util.hasString(args[0], e.getKey().getCommand())) {
       Method method = e.getValue();
       try {
         if (!(sender instanceof Player)
             || sender.hasPermission(
                 ((AddCommand) method.getAnnotation(AddCommand.class)).permission())) {
           return (boolean) method.invoke(method.getDeclaringClass().newInstance(), sender, args);
         } else {
           sender.sendMessage(
               ((AddCommand) method.getAnnotation(AddCommand.class)).permissionmessage());
           return true;
         }
       } catch (IllegalAccessException
           | IllegalArgumentException
           | InvocationTargetException
           | SecurityException
           | InstantiationException e1) {
         e1.printStackTrace();
         return false;
       }
     }
   }
   return false;
 }
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    boolean hasarg = false;
    Player p = null;
    if (args.length == 1) {
      hasarg = true;
      p = this.getServer().getPlayer(args[0]);
    }

    if (sender instanceof Player) {
      if (!((Player) sender).hasPermission("command.rmeffect")) {
        sender.sendMessage("You can't use this command.");
        return true;
      }
    }
    for (Player player : this.getServer().getOnlinePlayers()) {
      for (PotionEffect effect : player.getActivePotionEffects()) {
        if (hasarg && p != null) {
          p.removePotionEffect(effect.getType());
        } else {
          player.removePotionEffect(effect.getType());
        }
      }
    }
    getServer().dispatchCommand(sender, "effect night_vision all");
    sender.sendMessage("Effects removed.");

    return true;
  }
示例#22
0
  public boolean dispatch(CommandSender sender, Command command, String label, String[] args) {
    String input = label + " ";
    for (String s : args) {
      input += s + " ";
    }

    BaseCommand match = null;
    String[] trimmedArgs = null;
    StringBuilder identifier = new StringBuilder();

    for (BaseCommand cmd : commands.values()) {
      StringBuilder tmpIdentifier = new StringBuilder();
      String[] tmpArgs = cmd.validate(input, tmpIdentifier);
      if (tmpIdentifier.length() > identifier.length()) {
        identifier = tmpIdentifier;
        match = cmd;
        trimmedArgs = tmpArgs;
      }
    }

    if (match != null) {
      if (trimmedArgs == null || (trimmedArgs.length > 0 && trimmedArgs[0].equals("?"))) {
        sender.sendMessage("§cCommand:§e " + match.getName());
        sender.sendMessage("§cDescription:§e " + match.getDescription());
        sender.sendMessage("§cUsage:§e " + match.getUsage());
        List<String> notes = match.getNotes();
        for (String note : notes) {
          sender.sendMessage("§e" + note);
        }
      } else {
        match.execute(sender, trimmedArgs);
      }
    }
    return true;
  }
  @Override
  public boolean execute(
      SimplePVPToggle plugin, CommandSender sender, String commandLabel, String[] args) {
    final Localisation localisation = plugin.getLocalisation();

    if (args.length > 0) {
      final String path = "Server.Default";
      final boolean current = plugin.getConfig().getBoolean(path);

      final Boolean newValue = BooleanParser.parse(args[0], current);
      if (newValue == null) {
        sender.sendMessage(localisation.get(LocalisationEntry.ERR_SPECIFY_STATUS));
        return false;
      }

      plugin.getConfig().set(path, newValue.booleanValue());
      plugin.saveConfig();
      sender.sendMessage(
          localisation.get(
              LocalisationEntry.MSG_SERVER_PVP_SET,
              new Object[] {plugin.getConfig().getBoolean(path)}));

      for (Player p : plugin.getServer().getOnlinePlayers()) {
        TagUtils.refreshPlayer(p, new HashSet<>(p.getWorld().getPlayers()), plugin);
      }

      return true;
    } else {
      sender.sendMessage(localisation.get(LocalisationEntry.ERR_SPECIFY_STATUS));
      return false;
    }
  }
示例#24
0
 public static void addAttachment(
     CommandSender sender, String fileName, String name, String description) {
   if (inProgress(sender.getName())) {
     switch (getCurrentEmail(sender.getName())) {
       case "simple":
         LogHelper.showWarning("emailAttachmentNotAllowed", sender);
         return;
       case "multi":
         break;
       case "html":
         LogHelper.showWarning("emailAttachmentNotAllowed", sender);
         return;
       default:
         LogHelper.showWarning("emailNotInProgressEdit", sender);
         return;
     }
     MultiPartEmail email = multiEmail.get(sender.getName());
     EmailAttachment attachment = new EmailAttachment();
     attachment.setPath(
         CommandsEX.plugin.getDataFolder() + "Email Attachments" + File.separator + fileName);
     attachment.setName(name);
     attachment.setDescription(description);
     try {
       email.attach(attachment);
     } catch (EmailException e) {
       sendErrorMessage(sender, e);
       return;
     }
     LogHelper.showInfo("emailAttachmentSet", sender);
     multiEmail.put(sender.getName(), email);
   } else {
     LogHelper.showWarning("emailNotInProgressEdit", sender);
   }
 }
 @Override
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (command.getName() == "paint") {
     if (!(sender instanceof Player)) {
       sender.sendMessage("Painting will not work with a non-player!");
       return false;
     }
     Map<String, Canvas> cmap = paintings.get(sender.getName());
     if (cmap == null) {
       cmap = new HashMap<String, Canvas>();
       paintings.put(sender.getName(), cmap);
     }
     String canvasname = "";
     if (args.length != 0) {
       canvasname = args[0];
     }
     Canvas c = cmap.get(canvasname);
     if (c == null) {
       c = new Canvas();
       cmap.put(canvasname, c);
     }
     openCanvas((Player) sender, c);
   }
   return false;
 }
示例#26
0
 public static void setNonHtmlMessage(CommandSender sender, String[] args) {
   if (inProgress(sender.getName())) {
     switch (getCurrentEmail(sender.getName())) {
       case "simple":
         LogHelper.showWarning("emailNonHtmlNotAllowed", sender);
         return;
       case "multi":
         LogHelper.showWarning("emailNonHtmlNotAllowed", sender);
         return;
       case "html":
         break;
       default:
         LogHelper.showWarning("emailNotInProgressEdit", sender);
         return;
     }
     HtmlEmail email = htmlEmail.get(sender.getName());
     try {
       email.setMsg(Utils.implode(args, " "));
     } catch (EmailException e) {
       sendErrorMessage(sender, e);
       return;
     }
     LogHelper.showWarning("emailNonHtmlMessageSet", sender);
     htmlEmail.put(sender.getName(), email);
   } else {
     LogHelper.showWarning("emailNotInProgressEdit", sender);
   }
 }
示例#27
0
  @Override
  public boolean onCommand(CommandSender cmdSender, Command cmd, String label, String[] args) {

    cmdSender.sendMessage(
        ChatColor.GRAY + "There are " + plugin.playing.size() + " people playing");
    String s = (ChatColor.GRAY + "Red: " + ChatColor.WHITE);
    for (Player pl : plugin.redTeam) {
      s += pl.getName() + ", ";
    }
    cmdSender.sendMessage(s.substring(0, s.length() - 2));
    s = (ChatColor.GRAY + "Blue: " + ChatColor.WHITE);
    for (Player pl : plugin.blueTeam) {
      s += pl.getName() + ", ";
    }
    cmdSender.sendMessage(s.substring(0, s.length() - 2));
    s = (ChatColor.GRAY + "Green: " + ChatColor.WHITE);
    for (Player pl : plugin.greenTeam) {
      s += pl.getName() + ", ";
    }
    cmdSender.sendMessage(s.substring(0, s.length() - 2));
    s = (ChatColor.GRAY + "Orange: " + ChatColor.WHITE);
    for (Player pl : plugin.orangeTeam) {
      s += pl.getName() + ", ";
    }
    cmdSender.sendMessage(s.substring(0, s.length() - 2));
    return true;
  }
示例#28
0
	/**
	 * Used to get the time and inform
	 */
	private void getUsersTime(final CommandSender sender, final Collection<User> users)
	{
		if (users.size() > 1)
		{
			sender.sendMessage(_("pTimePlayers"));
		}

		for (User user : users)
		{
			if (user.getPlayerTimeOffset() == 0)
			{
				sender.sendMessage(_("pTimeNormal", user.getName()));
			}
			else
			{
				String time = DescParseTickFormat.format(user.getPlayerTime());
				if (!user.isPlayerTimeRelative())
				{
					sender.sendMessage(_("pTimeCurrentFixed", user.getName(), time));
				}
				else
				{
					sender.sendMessage(_("pTimeCurrent", user.getName(), time));
				}
			}
		}
	}
示例#29
0
  private boolean disableWorld(CommandSender sender, String worldName) {
    if (worldName == null) return false;

    for (World world : Bukkit.getWorlds()) {
      if (!world.getName().equalsIgnoreCase(worldName)) continue;

      if (settings == null) settings = new Settings();

      settings.worldsToUnload.remove(worldName);
      settings.worldsToDisable.add(worldName);

      Bukkit.getServer().unloadWorld(world, true);

      String msg = "NoPreload";
      msg = String.format("%s[%s]", ChatColor.DARK_AQUA, msg);
      msg = String.format("%s%s ", msg, ChatColor.WHITE);
      msg += worldName + " has been disabled.";
      sender.sendMessage(msg);

      return true;
    }

    String msg = "NoPreload";
    msg = String.format("%s[%s]", ChatColor.DARK_AQUA, msg);
    msg = String.format("%s%s ", msg, ChatColor.WHITE);
    msg += worldName + " does not appear to exist.";
    sender.sendMessage(msg);
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public void createWorldWithNotifications(String name, final CommandSender sender) {
    MultiverseWorld mvworld;
    if ((mvworld = this.getCore().getMVWorldManager().getMVWorld(name)) == null) {
      sender.sendMessage("That world doesn't exist...");
      return;
    }

    sender.sendMessage("Converting world '" + name + "' into an AdventureWorld...");

    // first write it to the config, then load

    this.config.set("adventure." + name + ".enabled", true);

    ConfigurationSection node = this.config.getConfigurationSection("adventure." + name);
    MVAdventureWorld mvawi = new MVAdventureWorld(mvworld, plugin, node);
    mvawi.scheduleWriteTemplate(
        new Callable<Void>() {
          public Void call() throws Exception {
            sender.sendMessage("Finished.");
            return null;
          }
        },
        null);
    this.adventureWorlds.put(name, mvawi);
  }