Ejemplo n.º 1
0
 public boolean disablePlugin(String name) {
   try {
     Server.getPluginManager().disablePlugin(Server.getPluginManager().getPlugin(name));
     return true;
   } catch (NullPointerException e) {
     return false;
   }
 }
Ejemplo n.º 2
0
  public List<String> getPluginFiles(String pluginName) {
    try {
      File dir = Server.getPluginManager().getPlugin(pluginName).getDataFolder();
      RecursiveDirLister d = new RecursiveDirLister(dir);

      return d.getFileListing();
    } catch (Exception e) {
      // e.printStackTrace();
      return new ArrayList<String>();
    }
  }
Ejemplo n.º 3
0
  public APIWrapperMethods(Server server) {
    bukget = new BukGetAPIMethods(server);
    jsonapi = new JSONAPIAPIMethods(server);
    permissions = new PermissionWrapper(server);

    if (server.getPluginManager().getPlugin("Vault") != null) {
      RegisteredServiceProvider<Economy> rsp =
          server.getServicesManager().getRegistration(Economy.class);
      if (rsp != null) {
        econ = rsp.getProvider();
      }
      RegisteredServiceProvider<Chat> rsp2 =
          server.getServicesManager().getRegistration(Chat.class);
      if (rsp2 != null) {
        chat = rsp2.getProvider();
      }
    }
  }
Ejemplo n.º 4
0
  @SuppressWarnings("unused")
  public void onEnable() {
    if (getConfig().contains("worlds")) {
      String w = getConfig().getString("worlds");
      for (String s : w.split(" ")) {
        worlds.add(s);
        System.out.println(s + " added!");
      }
    } else {
      getConfig().set("worlds", "");
      saveConfig();
    }

    current = worlds.get(0);

    if (getConfig().contains("min-to-start")) {
      int mts = getConfig().getInt("min-to-start");
      min = mts;
    } else {
      getConfig().set("min-to-start", "");
      saveConfig();
    }

    final PluginManager pm = getServer().getPluginManager();
    final Plugin plugin = pm.getPlugin("LogBlock");

    server = this.getServer();
    log = this.getLogger();

    server.getPluginManager().registerEvents(Listener, this);

    new File(path).mkdir();
    load();

    hardResetPlayers();
    tpAll(waiting);

    // cornucopia.getWorld().setAutoSave(false);

    CommandExec cmd = new CommandExec(this);
    this.getCommand("start").setExecutor(cmd);
    this.getCommand("sgstart").setExecutor(cmd);
    this.getCommand("end").setExecutor(cmd);
    this.getCommand("dm").setExecutor(cmd);
    this.getCommand("edit").setExecutor(cmd);
    this.getCommand("bet").setExecutor(cmd);
    this.getCommand("bets").setExecutor(cmd);
    this.getCommand("score").setExecutor(cmd);
    this.getCommand("to").setExecutor(cmd);
    this.getCommand("setWait").setExecutor(cmd);
    this.getCommand("setCorn").setExecutor(cmd);
    this.getCommand("force").setExecutor(cmd);
    this.getCommand("sg").setExecutor(cmd);
    this.getCommand("watch").setExecutor(cmd);
    this.getCommand("see").setExecutor(cmd);
    this.getCommand("spec").setExecutor(cmd);
    this.getCommand("setmin").setExecutor(cmd);
    this.getCommand("addworld").setExecutor(cmd);
    this.getCommand("delworld").setExecutor(cmd);
    this.getCommand("map").setExecutor(cmd);
    this.getCommand("show").setExecutor(cmd);
    this.getCommand("hide").setExecutor(cmd);
    this.getCommand("shop").setExecutor(cmd);
    this.getCommand("toshop").setExecutor(cmd);
    this.getCommand("setshop").setExecutor(cmd);
    this.getCommand("quit").setExecutor(cmd);
    this.getCommand("join").setExecutor(cmd);
    this.getCommand("clearshop").setExecutor(cmd);
    this.getCommand("buy").setExecutor(cmd);
    this.getCommand("redeem").setExecutor(cmd);
  }