From 92718de5a9fb4f8f3c1a2cc005ac428ae5547002 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Sun, 9 May 2021 19:10:10 +0200 Subject: [PATCH] Initialising project --- pom.xml | 13 +++++ .../ruakij/LinkedBeaconTeleporters/Main.java | 54 +++++++++++++++++++ src/main/resources/plugin.yml | 4 ++ 3 files changed, 71 insertions(+) create mode 100644 src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/Main.java create mode 100644 src/main/resources/plugin.yml diff --git a/pom.xml b/pom.xml index b77b1e5..4af0f89 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,11 @@ LinkedBeaconTeleporters 1.0 + + + Ruakij + 11 11 @@ -29,4 +33,13 @@ + + + + src/main/resources + true + + + + \ No newline at end of file diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/Main.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/Main.java new file mode 100644 index 0000000..54ced32 --- /dev/null +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/Main.java @@ -0,0 +1,54 @@ +package eu.ruekov.ruakij.LinkedBeaconTeleporters; + +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +import java.io.File; + +public class Main extends JavaPlugin { + + public static Plugin plugin; + + public static FileConfiguration config; + public static FileConfiguration data; + + public void onEnable() { + + plugin = this; + + PluginManager pluginManager = Bukkit.getPluginManager(); + + + loadConfigs(); + + getLogger().info("Plugin activated"); + } + + public void onDisable() { + + getLogger().info("Plugin deactivated"); + } + + public void loadConfigs() { + // config.yml + this.saveDefaultConfig(); + config = this.getConfig(); + + // data.yml + try{ + File dataFile = new File("plugins/"+ plugin.getName() +"/data.yml"); + dataFile.createNewFile(); + data = YamlConfiguration.loadConfiguration( + dataFile + ); + }catch (Exception ex){ + getLogger().severe("Could not load/create data.yml!"); + ex.printStackTrace(); + Bukkit.getPluginManager().disablePlugin(this); + } + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..58eac98 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: ${artifactId} +version: ${version} +author: ${author} +main: ${groupId}.${artifactId}.Main \ No newline at end of file