Beispiel #1
0
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

    if (args.length == 0) return false;

    if (args[0].equalsIgnoreCase("version")) {
      if (!MiscUtil.hasCommandPerm(sender, "mchat.version")) return true;

      String cVersion = "&6MineCraft Version: &2" + plugin.pdfFile.getVersion();

      cVersion = cVersion.replaceFirst("-", "^*^&6Jenkins Build &5#&5: &2");
      cVersion = cVersion.replaceFirst("-", "^*^&6Release Version: &2");
      cVersion = cVersion.replaceFirst("_", "^*^&6Fix &5#&5: &2");

      String[] vArray = cVersion.split("\\^\\*\\^");

      MessageUtil.sendMessage(sender, "&6Full Version: &1" + plugin.pdfFile.getVersion());

      for (String string : vArray) MessageUtil.sendMessage(sender, string);

      return true;
    } else if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("r")) {
      if (args.length > 1)
        if (args[1].equalsIgnoreCase("config") || args[1].equalsIgnoreCase("co")) {
          if (!MiscUtil.hasCommandPerm(sender, "mchat.reload.config")) return true;

          ConfigUtil.initialize();
          MessageUtil.sendMessage(sender, "Config Reloaded.");
          return true;
        } else if (args[1].equalsIgnoreCase("locale") || args[1].equalsIgnoreCase("l")) {
          if (!MiscUtil.hasCommandPerm(sender, "mchat.reload.locale")) return true;

          LocaleUtil.initialize();
          MessageUtil.sendMessage(sender, "Locale Reloaded.");
          return true;
        } else if (args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("a")) {
          if (!MiscUtil.hasCommandPerm(sender, "mchat.reload.all")) return true;

          plugin.reloadConfigs();
          plugin.initializeConfigs();
          MessageUtil.sendMessage(sender, "All Config's Reloaded.");
          return true;
        }
    }

    return false;
  }
Beispiel #2
0
  private static void setupPlugins() {
    PluginManager pm = Bukkit.getServer().getPluginManager();
    Plugin pluginTest;

    pluginTest = pm.getPlugin("Vault");
    vaultB = pluginTest != null;
    if (vaultB) {
      MessageUtil.log(
          "[MChat] <Plugin> "
              + pluginTest.getDescription().getName()
              + " v"
              + pluginTest.getDescription().getVersion()
              + " hooked!.");

      RegisteredServiceProvider<Permission> permissionProvider =
          Bukkit.getServer().getServicesManager().getRegistration(Permission.class);

      if (permissionProvider != null) vPerm = permissionProvider.getProvider();

      vaultB = vPerm != null;
    }

    pluginTest = pm.getPlugin("PermissionsBukkit");
    pBukkitB = pluginTest != null;
    if (pBukkitB)
      MessageUtil.log(
          "[MChat] <Permissions> "
              + pluginTest.getDescription().getName()
              + " v"
              + pluginTest.getDescription().getVersion()
              + " hooked!.");

    pluginTest = pm.getPlugin("bPermissions");
    bPermB = pluginTest != null;
    if (bPermB)
      MessageUtil.log(
          "[MChat] <Permissions> "
              + pluginTest.getDescription().getName()
              + " v"
              + pluginTest.getDescription().getVersion()
              + " hooked!.");

    pluginTest = pm.getPlugin("PermissionsEx");
    pexB = pluginTest != null;
    if (pexB) {
      pexPermissions = PermissionsEx.getPermissionManager();
      MessageUtil.log(
          "[MChat] <Permissions> "
              + pluginTest.getDescription().getName()
              + " v"
              + pluginTest.getDescription().getVersion()
              + " hooked!.");
    }

    pluginTest = pm.getPlugin("GroupManager");
    gmB = pluginTest != null;
    if (gmB) {
      gmWH = ((GroupManager) pluginTest).getWorldsHolder();
      MessageUtil.log(
          "[MChat] <Permissions> "
              + pluginTest.getDescription().getName()
              + " v"
              + pluginTest.getDescription().getVersion()
              + " hooked!.");
    }

    if (!(vaultB || pBukkitB || bPermB || pexB || gmB))
      MessageUtil.log("[MChat] <Permissions> SuperPerms hooked!.");
  }