示例#1
0
  private void createSpellCollection() {
    if (myConfig.isSpellCollectionEnabled()) {
      try {
        File file = new File(FilePath.spellCollection);
        if (!file.exists()) file.createNewFile();

        fc.copyFile(FilePath.spellCollection, "SpellCollection.jar");

      } catch (IOException e) {
        getLogger().warning("Failed to create SpellCollection.jar!");
      }
    }
  }
示例#2
0
  public boolean createMIC(final Player player) {
    final File micFile = new File(FilePath.mic);
    if (micFile.exists() && micFile.length() != 0) return false;
    if (!myConfig.isMICDisabled())
      try {
        micFile.createNewFile();
        fc.copyFile(FilePath.mic, "MIC.jar");
        if (player != null)
          player.sendMessage(ChatColor.GOLD + "Created MIC.jar in your Config folder!");
      } catch (IOException e) {
        if (player != null) player.sendMessage(ChatColor.GOLD + "Something went wrong..!");
      }

    return true;
  }
示例#3
0
 private void mkdir() {
   for (Field f : FilePath.class.getFields()) {
     try {
       String value = (String) f.get(this);
       String[] split = value.split("/");
       String name = split[split.length - 1];
       File file = new File(value);
       if (!value.equals(FilePath.mic))
         if (!file.exists()) {
           if (value.endsWith("/")) {
             file.mkdir();
           } else {
             if (value.equals(FilePath.mic)) continue;
             if (value.equals(FilePath.spellCollection)) continue;
             file.createNewFile();
             fc.copyFile(value, name);
           }
         }
     } catch (IllegalArgumentException | IllegalAccessException | IOException e) {
       e.printStackTrace();
     }
   }
 }