Ejemplo n.º 1
0
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (args.length > 0) {
      if (args[0].equalsIgnoreCase("reload")) {
        if (!FOPMR_Rank.isAdmin(sender)) {
          sender.sendMessage(ChatColor.RED + "Only admins can reload the FOPM: R config.");
          return true;
        }
        FreedomOpModRemastered.plugin.reloadConfig();
        FOPMR_DatabaseInterface.closeConnection(FOPMR_DatabaseInterface.getConnection());
      }
      return true;
    }
    sender.sendMessage(ChatColor.GREEN + "This is the FreedomOpMod Remastered!");
    sender.sendMessage(CUtils_Methods.randomChatColour() + "an all new form of All-Op management.");
    sender.sendMessage(
        CUtils_Methods.colour(
            "&-Created in the likes of the TFM but with more "
                + CUtils_Methods.randomChatColour()
                + "flexibility&- by "
                + CUtils_Methods.randomChatColour()
                + "Camzie99&-!"));

    return true;
  }
Ejemplo n.º 2
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length < 2) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage(ChatColor.RED + "The player you listed: " + args[0] + " is not online...");
     return true;
   }
   try {
     String message = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
     FOPMR_DatabaseInterface.updateInTable(
         "UUID", player.getUniqueId().toString(), message, "LOGIN", "PLAYERS");
     sender.sendMessage(
         ChatColor.GREEN
             + "Set "
             + player.getName()
             + "'s login message to \""
             + CUtils_Methods.colour(message)
             + "\".");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Ejemplo n.º 3
0
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length == 0) {
     return false;
   }
   if (!(sender instanceof Player)) {
     sender.sendMessage("This can only be used in-game.");
     return true;
   }
   Player player = (Player) sender;
   String nick = StringUtils.join(args, " ");
   int standard = 0;
   for (char Char : nick.toCharArray()) {
     if (standard >= 3) {
       continue;
     } else if (Char >= 'a' && Char <= 'z') {
       standard++;
     } else if (Char >= 'A' && Char <= 'Z') {
       standard++;
     } else if (Char >= '0' && Char <= '9') {
       standard++;
     } else {
       standard = 0;
     }
   }
   if (standard < 3) {
     sender.sendMessage(
         ChatColor.RED + "Your nick must have at least 3 alphanumeric characters consecutively.");
     return true;
   }
   player.sendMessage(
       ChatColor.GREEN
           + "Setting nick to "
           + CUtils_Methods.colour(StringUtils.join(args, " "))
           + ChatColor.GREEN
           + ".");
   try {
     Connection c = FOPMR_DatabaseInterface.getConnection();
     PreparedStatement statement =
         c.prepareStatement("UPDATE PLAYERS SET NICK = ? WHERE UUID = ?");
     statement.setString(1, nick + "&r");
     statement.setString(2, player.getUniqueId().toString());
     statement.executeUpdate();
     FOPMR_Rank.nicks.put(player.getName(), nick + "&r");
     c.commit();
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Ejemplo n.º 4
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length != 1) {
     return false;
   }
   if (!FreedomOpModRemastered.configs.getWorlds().getConfig().contains(args[0])) {
     sender.sendMessage(
         ChatColor.RED + "The world does not exist or is not a custom FOPM: R world.");
     return true;
   }
   if (Bukkit.getWorld(args[0]) != null) {
     CUtils_Methods.unloadWorld(Bukkit.getWorld(args[0]));
   }
   FreedomOpModRemastered.configs.getWorlds().getConfig().set(args[0], null);
   FreedomOpModRemastered.configs.getWorlds().saveConfig();
   return true;
 }
 public static void wipeFlatlands() {
   final World flatlands = Bukkit.getWorld("flatlands");
   for (Player player : flatlands.getPlayers()) {
     player.setOp(false);
     player.setWhitelisted(false);
   }
   Bukkit.getServer().setWhitelist(true);
   CUtils_Methods.unloadWorld(flatlands);
   new BukkitRunnable() {
     @Override
     public void run() {
       CUtils_Methods.deleteWorld(flatlands.getWorldFolder());
       Bukkit.getServer().setWhitelist(false);
     }
   }.runTaskLater(FreedomOpModRemastered.plugin, 20L * 5L);
   createNewWorld("flatlands", new FOPMR_FlatGenerator(), Rank.OP);
 }
 @Override
 public boolean execute(CommandSender sender, String commandLabel, String[] args) {
   if (exe != null) {
     if (!FOPMR_Rank.isEqualOrHigher(FOPMR_Rank.getRank(sender), rank)) {
       sender.sendMessage(
           ChatColor.RED
               + "You must be "
               + CUtils_Methods.aOrAn(rank.name)
               + " "
               + rank.name
               + " to use this command.");
       return true;
     }
     if (!exe.onCommand(sender, this, commandLabel, args)) {
       sender.sendMessage(this.usageMessage.replaceAll("<command>", command));
       return false;
     }
     return true;
   }
   return false;
 }
 public static void unloadWorlds() {
   for (World world : worlds.keySet()) {
     CUtils_Methods.unloadWorld(world);
   }
 }