Skip to content

Commit

Permalink
Update BetterPvP.java
Browse files Browse the repository at this point in the history
  • Loading branch information
staFF6773 authored Mar 31, 2024
1 parent 3333158 commit a2b001e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main/java/io/github/sstudiosdev/BetterPvP.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

/**
* Main class of the BetterPvP plugin.
*/
Expand Down Expand Up @@ -41,6 +46,20 @@ public void onEnable() {

// Display information in the console
displayConsoleInfo();

// Copy Apache-2.0 license file from resources to plugin folder
try {
File licenseFile = new File(getDataFolder(), "Apache-2.0 license");
if (!licenseFile.exists()) {
InputStream inputStream = getResource("Apache-2.0 license");
Files.copy(inputStream, licenseFile.toPath());
getLogger().info("License file 'Apache-2.0' loaded successfully.");
} else {
getLogger().info("License file 'Apache-2.0' already exists.");
}
} catch (IOException e) {
getLogger().warning("Failed to load license file 'Apache-2.0'. Reason: " + e.getMessage());
}
}

/**
Expand All @@ -67,7 +86,7 @@ private void loadConfiguration() {
mainConfig = new Config(this, "config");
mainConfig.load();

// Obtener prefijo desde la configuración
// Get prefix from configuration
prefix = mainConfig.getString("prefix");
}

Expand Down

0 comments on commit a2b001e

Please sign in to comment.