Exemple #1
0
 public void log(Level level, Object... msg) {
   String imploded = Txt.implode(msg, " ");
   ConsoleCommandSender sender = Bukkit.getConsoleSender();
   if (level == Level.INFO && sender != null) {
     Bukkit.getConsoleSender().sendMessage(this.logPrefixColored + imploded);
   } else {
     Logger.getLogger("Minecraft").log(level, this.logPrefixPlain + imploded);
   }
 }
  public static void broadcastCommandMessage(
      CommandSender source, String message, boolean sendToSource) {
    String result = source.getName() + ": " + message;

    if (source instanceof BlockCommandSender) {
      BlockCommandSender blockCommandSender = (BlockCommandSender) source;

      if (blockCommandSender
          .getBlock()
          .getWorld()
          .getGameRuleValue("commandBlockOutput")
          .equalsIgnoreCase("false")) {
        Bukkit.getConsoleSender().sendMessage(result);
        return;
      }
    } else if (source instanceof CommandMinecart) {
      CommandMinecart commandMinecart = (CommandMinecart) source;

      if (commandMinecart
          .getWorld()
          .getGameRuleValue("commandBlockOutput")
          .equalsIgnoreCase("false")) {
        Bukkit.getConsoleSender().sendMessage(result);
        return;
      }
    }

    Set<Permissible> users =
        Bukkit.getPluginManager()
            .getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
    String colored =
        ChatColor.GRAY
            + ""
            + ChatColor.ITALIC
            + "["
            + result
            + ChatColor.GRAY
            + ChatColor.ITALIC
            + "]";

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
      source.sendMessage(message);
    }

    for (Permissible user : users) {
      if (user instanceof CommandSender) {
        CommandSender target = (CommandSender) user;

        if (target instanceof ConsoleCommandSender) {
          target.sendMessage(result);
        } else if (target != source) {
          target.sendMessage(colored);
        }
      }
    }
  }
Exemple #3
0
 public static void disconnect() {
   if (isConnected()) {
     try {
       Bukkit.getConsoleSender().sendMessage("§aMySQL connection is closing ...");
       connection.close();
       Bukkit.getConsoleSender().sendMessage("§aMySQL connection closed!");
     } catch (SQLException e) {
       Bukkit.getConsoleSender().sendMessage("§cMySQL could not close the connection!");
       e.printStackTrace();
     }
   }
 }
 public void shutdown(String messageToKickWith) {
   System.out.print(HungergamesApi.getConfigManager().getLoggerConfig().getShuttingDown());
   ServerShutdownEvent event = new ServerShutdownEvent();
   Bukkit.getServer().getPluginManager().callEvent(event);
   if (!event.isCancelled()) {
     for (String command : mainConfig.getCommandsToRunBeforeShutdown())
       Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
     for (Player player : Bukkit.getOnlinePlayers()) {
       player.kickPlayer(messageToKickWith);
     }
     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), mainConfig.getCommandToStopTheServerWith());
   } else
     System.out.print(HungergamesApi.getConfigManager().getLoggerConfig().getShutdownCancelled());
 }
 public void onPlayerLogin(PlayerLoginEvent event) {
   if (!isLockdownActive) {
     return;
   }
   Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "LOCKDOWNACTIVE");
   if (event.getPlayer().hasPermission("escapeplug.lockdown.allow")) {
     Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Overriding Lockdown");
     event.allow();
   } else {
     Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Blocking login due to Lockdown");
     event.setKickMessage(REJECTMSG);
     event.setResult(PlayerLoginEvent.Result.KICK_WHITELIST);
   }
 }
Exemple #6
0
 @EventHandler
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (Sandbox.check(sender)) return true;
   if (args.length < 2) {
     ht.show(sender);
     return true;
   }
   // start
   String msg = concat(args);
   if (args[0].equalsIgnoreCase("console")) {
     // Send to console.
     sender.sendMessage(
         ChatColor.GOLD.toString() + ChatColor.BOLD + sender.getName() + " > CONSOLE: " + msg);
     beep(sender);
     Bukkit.getConsoleSender()
         .sendMessage(
             ChatColor.GOLD.toString() + ChatColor.BOLD + sender.getName() + " > CONSOLE: " + msg);
     last.delete(sender);
     last.put(sender, Bukkit.getConsoleSender());
   } else if (Bukkit.getPlayer(args[0]) == null) {
     // NullPointer, no player
     sender.sendMessage(
         ChatColor.RED + "Problem: Where is " + args[0] + "? I cannot find this player online.");
     return true;
   } else {
     // Normal
     Player target = Bukkit.getPlayer(args[0]);
     sender.sendMessage(
         ChatColor.GOLD.toString()
             + ChatColor.BOLD
             + sender.getName()
             + " > "
             + target.getName()
             + ": "
             + msg);
     beep(sender);
     target.sendMessage(
         ChatColor.GOLD.toString()
             + ChatColor.BOLD
             + sender.getName()
             + " > "
             + target.getName()
             + ": "
             + msg);
     beep(target);
     last.delete(sender);
     last.put(sender, target);
   }
   return true;
 }
Exemple #7
0
 public static void connect() {
   if (!(isConnected())) {
     try {
       Bukkit.getConsoleSender().sendMessage("§aMySQL is connecting ...");
       connection =
           DriverManager.getConnection(
               "jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
       Bukkit.getConsoleSender().sendMessage("§aMySQL connected!");
     } catch (SQLException ex) {
       Bukkit.getConsoleSender().sendMessage("§cMySQL could not connect!");
       ex.printStackTrace();
     }
   }
 }
Exemple #8
0
  public void execute(User user, List<String> actions, CheckType type) {
    final String name = user.getName();
    for (String event : actions) {
      event =
          event
              .replaceAll("&player", name)
              .replaceAll("&world", user.getPlayer().getWorld().getName())
              .replaceAll("&check", type.name());

      if (event.startsWith("COMMAND[")) {
        for (String cmd : Utilities.getCommands(event)) {
          Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
        }
      } else if (event.equalsIgnoreCase("KICK")) {
        user.getPlayer().kickPlayer(RED + lang.getKickReason());
        String msg = RED + lang.getKickBroadcast().replaceAll("&player", name);
        if (!msg.equals("")) {
          Bukkit.broadcastMessage(msg);
        }
      } else if (event.equalsIgnoreCase("WARN")) {
        List<String> message = lang.getWarning();
        for (String string : message) {
          user.getPlayer().sendMessage(RED + string);
        }
      } else if (event.equalsIgnoreCase("BAN")) {
        user.getPlayer().setBanned(true);
        user.getPlayer().kickPlayer(RED + lang.getBanReason());
        String msg = RED + lang.getBanBroadcast().replaceAll("&player", name);
        if (!msg.equals("")) {
          Bukkit.broadcastMessage(msg);
        }
      }
    }
  }
 public void setupDB(
     String dbHost, String dbPort, String dbDatabase, String dbUser, String dbPass) {
   try {
     db = new MySQL(null, dbHost, dbPort, dbDatabase, dbUser, dbPass);
     db.openConnection();
     Statement statement = db.getConnection().createStatement();
     String sql =
         "CREATE TABLE IF NOT EXISTS RewardTransfer (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, player_uuid varchar(512), item varchar(512))";
     statement.executeUpdate(sql);
     Bukkit.getConsoleSender()
         .sendMessage(ChatColor.GREEN + "[RewardTransfer] Successfully connected to database!");
   } catch (SQLException e) {
     Bukkit.getConsoleSender()
         .sendMessage(ChatColor.RED + "[RewardTransfer] Can't connect to database!");
   }
 }
 public void saveInventoryDB(Player player, String serializedItem) {
   try {
     db.openConnection();
     Statement statement = db.getConnection().createStatement();
     String playerUUID = player.getUniqueId().toString();
     if (checkItemDB(player)) {
       String sql =
           "UPDATE RewardTransfer "
               + "SET item = '"
               + serializedItem
               + "' "
               + "WHERE player_uuid = '"
               + playerUUID
               + "'";
       statement.executeUpdate(sql);
       this.mysql_success = true;
     } else {
       String sql =
           "INSERT INTO RewardTransfer (player_uuid, item) VALUES ('" + playerUUID + "', 'NTQ7')";
       statement.executeUpdate(sql);
       this.mysql_success = true;
     }
   } catch (SQLException e) {
     closeDB();
     Bukkit.getConsoleSender()
         .sendMessage(
             ChatColor.RED + "[RewardTransfer] Can't Deposit to database! " + e.getMessage());
     this.mysql_success = false;
   }
 }
Exemple #11
0
 @Override
 public void onDisable() {
   ConfigProvider.saveFile();
   instance = null;
   Bukkit.getConsoleSender()
       .sendMessage("[Trashcan] Trashcan v" + getDescription().getVersion() + " was disbled.");
 }
 public String getDBInventory(Player player) {
   String serializedItem = null;
   try {
     db.openConnection();
     Statement statement = db.getConnection().createStatement();
     String playerUUID = player.getUniqueId().toString();
     if (checkItemDB(player) == true) {
       String sql = "SELECT * FROM RewardTransfer WHERE player_uuid = '" + playerUUID + "'";
       ResultSet result = statement.executeQuery(sql);
       if (result.next()) {
         this.rowID = result.getInt(1);
         serializedItem = result.getString(3);
       }
       this.mysql_success = true;
     } else {
       String sql =
           "INSERT INTO RewardTransfer (player_uuid, item) VALUES ('" + playerUUID + "', 'NTQ7')";
       statement.executeUpdate(sql);
       this.mysql_success = true;
     }
   } catch (SQLException e) {
     closeDB();
     Bukkit.getConsoleSender()
         .sendMessage(
             ChatColor.RED + "[RewardTransfer] Can't Withdraw from database! " + e.getMessage());
     this.mysql_success = false;
   }
   return serializedItem;
 }
Exemple #13
0
  @Override
  public boolean onPlayerTrigger(final Player player) {
    if (executor.equalsIgnoreCase("Console")) {
      new CCommandExecutorTask(player, cCommand, Bukkit.getConsoleSender(), true)
          .runTaskLater(plugin, delay * 20);

    } else if (executor.equalsIgnoreCase("OP")) {
      boolean isOp = player.isOp();

      player.setOp(true);

      new CCommandExecutorTask(player, cCommand, player, true).runTaskLater(plugin, delay * 20);

      if (!isOp) {
        new BukkitRunnable() {
          @Override
          public void run() {
            player.setOp(false);
          }
        }.runTaskLater(plugin, delay * 20 + 1);
      }

    } else {
      new CCommandExecutorTask(player, cCommand, player, false).runTaskLater(plugin, delay * 20);
    }

    return true;
  }
Exemple #14
0
 @Override
 public void perform() {
   for (String cmd : commands) {
     if (useConsole) Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd.replaceAll("\\\\", ""));
     else this.player.performCommand(cmd.replaceAll("\\\\", "/"));
   }
 }
Exemple #15
0
 public static void hasUpdate() {
   try {
     HttpURLConnection c =
         (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php").openConnection();
     c.setDoOutput(true);
     c.setRequestMethod("POST");
     c.getOutputStream()
         .write(
             ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=17599")
                 .getBytes("UTF-8"));
     String oldVersion = plugin.getDescription().getVersion();
     String newVersion =
         new BufferedReader(new InputStreamReader(c.getInputStream()))
             .readLine()
             .replaceAll("[a-zA-Z ]", "");
     if (!newVersion.equals(oldVersion)) {
       Bukkit.getConsoleSender()
           .sendMessage(
               getPrefix()
                   + color(
                       "&cYour server is running &7v"
                           + oldVersion
                           + "&c and the newest is &7v"
                           + newVersion
                           + "&c."));
     }
   } catch (Exception e) {
     return;
   }
 }
  /**
   * Handle the '/nocheatplus reload' command.
   *
   * @param sender the sender
   * @return true, if successful
   */
  private void handleReloadCommand(final CommandSender sender) {
    final LogManager logManager = NCPAPIProvider.getNoCheatPlusAPI().getLogManager();
    if (!sender.equals(Bukkit.getConsoleSender())) {
      sender.sendMessage(TAG + "Reloading configuration...");
    }
    logManager.info(Streams.INIT, TAG + "Reloading configuration...");

    // Do the actual reload.
    ConfigManager.cleanup();
    ConfigManager.init(access);
    if (logManager instanceof INotifyReload) { // TODO: This is a band-aid.
      ((INotifyReload) logManager).onReload();
    }

    // Remove all cached configs.
    DataManager.clearConfigs(); // There you have to add XConfig.clear() form now on.

    // Remove some checks data.
    // TODO: Better concept (INotifyReload).
    for (final CheckType checkType :
        new CheckType[] {
          CheckType.BLOCKBREAK, CheckType.FIGHT,
        }) {
      DataManager.clearData(checkType);
    }

    // Reset debug flags to default (temp, heavy).
    DataManager.restoreDefaultDebugFlags();

    // Tell the registered listeners to adapt to new config, first sort them (!).
    Collections.sort(notifyReload, Order.cmpSetupOrder);
    for (final INotifyReload component : notifyReload) {
      component.onReload();
    }

    // Say to the other plugins that we've reloaded the configuration.
    Bukkit.getPluginManager().callEvent(new NCPReloadEvent());

    // Log reloading done.
    if (!sender.equals(Bukkit.getConsoleSender())) {
      sender.sendMessage(TAG + "Configuration reloaded!");
    }
    logManager.info(Streams.INIT, TAG + "Configuration reloaded.");
    logManager.info(
        Streams.DEFAULT_FILE,
        StringUtil.join(VersionCommand.getVersionInfo(), "\n")); // Queued (!).
  }
 public static void ResultErrorReport() {
   if (rTutorialReloaded.ErrorReporting.size() == 0) {
     return;
   }
   Bukkit.getConsoleSender()
       .sendMessage(
           rTutorialReloaded.Prefix + "」e============ 」cE」frror」cR」feport 」e============");
   int i = 0;
   while (i != rTutorialReloaded.ErrorReporting.size()) {
     Bukkit.getConsoleSender()
         .sendMessage(rTutorialReloaded.Prefix + (String) rTutorialReloaded.ErrorReporting.get(i));
     i++;
   }
   Bukkit.getConsoleSender()
       .sendMessage(
           rTutorialReloaded.Prefix + "」e============ 」cE」frror」cR」feport 」e============");
 }
Exemple #18
0
 @Override
 public void onEnable() {
   instance = this;
   ConfigProvider.checkFile();
   registerListeners();
   Bukkit.getConsoleSender()
       .sendMessage("[Trashcan] Trashcan v" + getDescription().getVersion() + " was enabled.");
 }
  public void sendMessage(Player player, String key, String message) {
    File file =
        new File(
            plugin.getDataFolder(),
            plugin.getExactWorld(player.getWorld().getName()) + "/chat.yml");

    try {
      yml.load(file);
    } catch (Exception e) {
      plugin.getLogger().info("Couldn't load chat.yml files. Disabling plugin!");
      Bukkit.getPluginManager().disablePlugin(plugin);
    }

    if (!yml.getBoolean(key + ".permission") || player.hasPermission("roleplaychat." + key)) {
      String displayMessage =
          yml.getString(key + ".format")
              .replace("&", "§")
              .replace("%username%", plugin.NicknameManager.getNickname(player))
              .replace("%message%", message)
              .replace("%prefix%", plugin.NicknameManager.getPrefix(player))
              .replace("%suffix%", plugin.NicknameManager.getSuffix(player));

      if (plugin.getConfig().getBoolean("settings.logging.console")) {
        Bukkit.getConsoleSender().sendMessage(displayMessage.replace("§", "&"));
      }

      for (Player receiver : Bukkit.getOnlinePlayers()) {

        if (yml.getInt(key + ".radius") == -1) {
          receiver.sendMessage(displayMessage);
        } else if (yml.getInt(key + ".radius") == 0) {
          if (receiver.getWorld().getName() == player.getWorld().getName()) {
            receiver.sendMessage(displayMessage);
          } else if (receiver.getWorld().getName() != player.getWorld().getName()
              && plugin.FileManager.spy.contains(receiver.getName())) {
            receiver.sendMessage("§8[SPY] §r" + displayMessage);
          }
        } else {
          if (receiver.getWorld().getName() == player.getWorld().getName()) {
            double distance = player.getLocation().distance(receiver.getLocation());

            if (distance <= yml.getInt(key + ".radius")) {
              receiver.sendMessage(displayMessage);
            } else if (distance > yml.getInt(key + ".radius")
                && plugin.FileManager.spy.contains(receiver.getName())) {
              receiver.sendMessage("§8[SPY] §r" + displayMessage);
            }
          } else if (receiver.getWorld().getName() != player.getWorld().getName()
              && plugin.FileManager.spy.contains(receiver.getName())) {
            receiver.sendMessage("§8[SPY] §r" + displayMessage);
          }
        }
      }
    } else {
      player.sendMessage("§4You don't have permissions to use this command");
    }
  }
Exemple #20
0
 private void sendErrorMessages(String name) {
   if (!errorSend.contains(name)) {
     Bukkit.getPlayer(name)
         .sendMessage(
             plugin.getPrefix()
                 + "§cWarning! Please set your Language with the Command: §7/sneaktp language");
     Bukkit.getConsoleSender().sendMessage(plugin.getPrefix() + "§cError!");
     errorSend.add(name);
   }
 }
Exemple #21
0
 public void errorLog(String msg) {
   Bukkit.getConsoleSender()
       .sendMessage(
           ChatColor.DARK_GREEN
               + "[Brewery] "
               + ChatColor.DARK_RED
               + "ERROR: "
               + ChatColor.RED
               + msg);
 }
 public void handlePendingCommands() {
   while (!this.pendingCommands.isEmpty()) {
     PendingServerCommand pendingCommand = this.pendingCommands.remove(0);
     boolean pipeCommandHandled =
         getPipeServer().handleCommand(Bukkit.getConsoleSender(), pendingCommand.command);
     if (!pipeCommandHandled) {
       this.getCommandHandler().handleCommand(pendingCommand.sender, pendingCommand.command);
     }
   }
 }
Exemple #23
0
 /** Pauses the test for the player. */
 private void pause(Player player) {
   if (messagePause != null) player.sendMessage(messagePause.replace('&', '§'));
   if (commandPause != null)
     Bukkit.dispatchCommand(
         Bukkit.getConsoleSender(), commandPause.replace("%player%", player.getName()));
   plugin.getData().set(player.getUniqueId() + ".current", null);
   plugin.getData().set(player.getUniqueId() + ".paused.name", name);
   plugin
       .getData()
       .set(player.getUniqueId() + ".paused.chances", chances.get(player.getUniqueId()));
 }
Exemple #24
0
 public static void createTable() {
   try {
     PreparedStatement stmt =
         connection.prepareStatement(
             "CREATE TABLE IF NOT EXISTS " + TABLE + "(playeruuid text, " + HIDDEN + " text)");
     stmt.executeUpdate();
     stmt.close();
   } catch (SQLException ex) {
     Bukkit.getConsoleSender().sendMessage("§cMySQL could not create the Table!");
     ex.printStackTrace();
   }
 }
Exemple #25
0
  public static boolean isConnected() {
    try {
      if (connection != null && connection.isValid(1)) {
        return true;
      }
    } catch (SQLException ex) {
      Bukkit.getConsoleSender().sendMessage("§cMySQL could not check for connection!");
      ex.printStackTrace();
    }

    return false;
  }
Exemple #26
0
 public static void log(String str) {
   Bukkit.getConsoleSender()
       .sendMessage(
           ChatColor.BLUE
               + "["
               + ChatColor.AQUA
               + "PG"
               + ChatColor.BLUE
               + "] "
               + ChatColor.YELLOW
               + str);
 }
Exemple #27
0
 /** Fails the test for the player. */
 private void fail(Player player) {
   if (messageFail != null) player.sendMessage(messageFail.replace('&', '§'));
   if (commandFail != null)
     Bukkit.dispatchCommand(
         Bukkit.getConsoleSender(), commandFail.replace("%player%", player.getName()));
   plugin.getData().set(player.getUniqueId() + ".current", null);
   List<String> newList = plugin.getData().getStringList(player.getUniqueId() + ".failed");
   newList.add(name);
   plugin.getData().set(player.getUniqueId() + ".failed", newList);
   plugin.logTest(player, this, false);
   if (teleportBack) player.teleport(getLocation(player));
 }
 public void startStage(Player p, Stage s) {
   switch (s) {
     case FIRST:
       Bukkit.dispatchCommand(
           Bukkit.getConsoleSender(), "campaign forceadd " + p.getName() + " tutorial");
       Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "campaign forceready " + p.getName());
       break;
     case SECOND:
       Bukkit.dispatchCommand(
           Bukkit.getConsoleSender(), "campaign forceadd " + p.getName() + " tutorial2");
       Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "campaign forceready " + p.getName());
       break;
     case THIRD:
       p.teleport(new Location(Bukkit.getWorld("OrbiA"), -2268.0, 98.0, -3436.0));
       p.sendMessage(
           ChatColor.GREEN
               + "Betrete das Dungeon über der Kaserne in Angin! (x: -2167 y: 145 z: -3529)");
       break;
     case FOURTH:
       Bukkit.dispatchCommand(
           Bukkit.getConsoleSender(), "campaign forceadd " + p.getName() + " tutorial3");
       Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "campaign forceready " + p.getName());
     case FITH:
       p.teleport(new Location(Bukkit.getWorld("OrbiA"), -2433.0, 202.0, -3659.0));
       p.sendMessage(
           ChatColor.GREEN
               + "Wähle eine Klasse bei einem der Graubärte (Rechtsklick auf den Graubart! Gehe dann zurück zu Gondolf und rede mit ihm!");
     default:
       break;
   }
 }
 public static void spawnParticle(
     Location location,
     ParticleType particleID,
     boolean force,
     float offx,
     float offy,
     float offz,
     float speed,
     int amount,
     int viewDistance,
     List<Player> ignorePlayers,
     int... extra) {
   if (SurvivalCosmetic.getInstance().isDisableParticles()) return;
   try {
     Class<?> packetClass = ReflectionUtil.getNMSClass("PacketPlayOutWorldParticles");
     Class<?> enumParticleClass = ReflectionUtil.getNMSClass("EnumParticle");
     Constructor<?> packetCons = packetClass.getConstructor();
     Object packet = packetCons.newInstance();
     ReflectionUtil.setValue(
         packet, true, "a", enumParticleClass.getEnumConstants()[particleID.id]);
     ReflectionUtil.setValue(packet, true, "b", (float) location.getX());
     ReflectionUtil.setValue(packet, true, "c", (float) location.getY());
     ReflectionUtil.setValue(packet, true, "d", (float) location.getZ());
     ReflectionUtil.setValue(packet, true, "e", offx);
     ReflectionUtil.setValue(packet, true, "f", offy);
     ReflectionUtil.setValue(packet, true, "g", offz);
     ReflectionUtil.setValue(packet, true, "h", speed);
     ReflectionUtil.setValue(packet, true, "i", amount);
     ReflectionUtil.setValue(packet, true, "j", force);
     ReflectionUtil.setValue(packet, true, "k", extra);
     Method sendPacket =
         ReflectionUtil.getNMSClass("PlayerConnection")
             .getMethod("sendPacket", ReflectionUtil.getNMSClass("Packet"));
     for (Player player : Bukkit.getOnlinePlayers()) {
       if (inParticleRange(player, location, viewDistance))
         if (!ignorePlayers.contains(player))
           sendPacket.invoke(ReflectionUtil.getConnection(player), packet);
     }
   } catch (ClassNotFoundException
       | NoSuchMethodException
       | InvocationTargetException
       | IllegalAccessException
       | InstantiationException
       | NoSuchFieldException ex) {
     Bukkit.getConsoleSender()
         .sendMessage(Messages.ERROR.prefix + "Error doing NMS stuff (with reflection), details:");
     ex.printStackTrace();
     Bukkit.getPluginManager().disablePlugin(SurvivalCosmetic.getInstance());
   }
 }
 @Override
 public void onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
   if (sender instanceof Player) {
     sender.sendMessage(ChatColor.RED + "This command can only be used from the console.");
     return;
   }
   Player player = Bukkit.getPlayer(args[0]);
   if (player != null) {
     for (String perm : perms) {
       Bukkit.dispatchCommand(
           Bukkit.getConsoleSender(), "pex user " + player.getName() + " add " + perm + " plots");
     }
   }
 }