Ejemplo n.º 1
0
 public static CommandMap getCommandMap() {
   try {
     if (Bukkit.getServer() instanceof CraftServer) {
       final Field f = CraftServer.class.getDeclaredField("commandMap");
       f.setAccessible(true);
       return (CommandMap) f.get(Bukkit.getServer());
     }
   } catch (final SecurityException e) {
     Log.err("You will need to disable the security manager to use dynamic commands");
   } catch (final Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Ejemplo n.º 2
0
  public boolean setConfig(File file) {
    this.file = file;
    if (!file.exists()) {
      try {
        file.createNewFile();
      } catch (IOException e) {
        Log.err("Couldn't create the config file=" + file);
        e.printStackTrace();
        return false;
      }
    }

    config = new YamlConfiguration();
    try {
      config.load(file);
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }