Initialising project
This commit is contained in:
		
							parent
							
								
									a850972224
								
							
						
					
					
						commit
						92718de5a9
					
				
							
								
								
									
										13
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								pom.xml
									
									
									
									
									
								
							@ -8,7 +8,11 @@
 | 
			
		||||
    <artifactId>LinkedBeaconTeleporters</artifactId>
 | 
			
		||||
    <version>1.0</version>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
        <author>Ruakij</author>
 | 
			
		||||
 | 
			
		||||
        <maven.compiler.source>11</maven.compiler.source>
 | 
			
		||||
        <maven.compiler.target>11</maven.compiler.target>
 | 
			
		||||
    </properties>
 | 
			
		||||
@ -29,4 +33,13 @@
 | 
			
		||||
        </dependency>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
    <build>
 | 
			
		||||
        <resources>
 | 
			
		||||
            <resource>
 | 
			
		||||
                <directory>src/main/resources</directory>
 | 
			
		||||
                <filtering>true</filtering>
 | 
			
		||||
            </resource>
 | 
			
		||||
        </resources>
 | 
			
		||||
    </build>
 | 
			
		||||
 | 
			
		||||
</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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								src/main/resources/plugin.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/main/resources/plugin.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
name: ${artifactId}
 | 
			
		||||
version: ${version}
 | 
			
		||||
author: ${author}
 | 
			
		||||
main: ${groupId}.${artifactId}.Main
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user