Initialising project

master
Ruakij 4 years ago
parent a850972224
commit 92718de5a9

@ -8,7 +8,11 @@
<artifactId>LinkedBeaconTeleporters</artifactId> <artifactId>LinkedBeaconTeleporters</artifactId>
<version>1.0</version> <version>1.0</version>
<properties> <properties>
<author>Ruakij</author>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
@ -29,4 +33,13 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project> </project>

@ -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);
}
}
}

@ -0,0 +1,4 @@
name: ${artifactId}
version: ${version}
author: ${author}
main: ${groupId}.${artifactId}.Main
Loading…
Cancel
Save