/[projects]/miscJava/bukkit-minecraft-plugins/CreativeWorld/src/main/java/dk/thoerup/bukkit/creativeworld/CreativeMain.java
ViewVC logotype

Annotation of /miscJava/bukkit-minecraft-plugins/CreativeWorld/src/main/java/dk/thoerup/bukkit/creativeworld/CreativeMain.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2038 - (hide annotations) (download)
Tue Aug 6 09:52:58 2013 UTC (10 years, 10 months ago) by torben
File size: 1735 byte(s)
build against 1.6.2
1 torben 1657 package dk.thoerup.bukkit.creativeworld;
2    
3     import java.io.*;
4    
5     import org.bukkit.World;
6     import org.bukkit.WorldCreator;
7     import org.bukkit.plugin.java.JavaPlugin;
8     import org.bukkit.generator.ChunkGenerator;
9     import org.bukkit.event.entity.*;
10     import org.bukkit.plugin.*;
11    
12     import org.bukkit.configuration.*;
13     import org.bukkit.configuration.file.*;
14    
15    
16    
17    
18     public class CreativeMain extends JavaPlugin {
19    
20     YamlConfiguration config = new YamlConfiguration();
21    
22     File configFile;
23    
24     @Override
25     public void onEnable() {
26     configFile = new File( getDataFolder(), "default.yml");
27    
28     FileConfiguration config = getConfig();
29     try {
30     if (configFile.exists() ) {
31     config.load(configFile);
32     } else {
33     System.out.println( "CreativeWorld: config file not found" );
34     }
35     } catch(Exception e) {
36     System.out.println( "CreativeWorld error loading config : " + e.getMessage() );
37     e.printStackTrace();
38     return;
39     }
40    
41    
42     TeleportCommand tpcmd = new TeleportCommand(this);
43     getCommand("creative").setExecutor( tpcmd );
44     getCommand("survival").setExecutor( tpcmd );
45    
46     getCommand("gamemode").setExecutor( new GamemodeCommand() );
47    
48    
49     World creative = this.getServer().createWorld( WorldCreator.name("creative") );
50     creative.setPVP( false );
51    
52     WorldChanged worldChanged = new WorldChanged(this);
53    
54    
55     PluginManager pm = getServer().getPluginManager();
56 torben 1681 pm.registerEvents(worldChanged, this);
57 torben 1657
58 torben 2038 pm.registerEvents( new BlockEnderChests(this), this);
59 torben 1657
60 torben 2038
61 torben 1657 }
62    
63     public void onDisable() {
64     }
65    
66     public void saveConfig() {
67     FileConfiguration config = getConfig();
68    
69     try {
70     config.save( configFile);
71     } catch (IOException e) {
72     System.out.println( "CreativeWorld error saving config : " + e.getMessage() );
73     e.printStackTrace();
74     }
75     }
76    
77    
78    
79    
80    
81     }

  ViewVC Help
Powered by ViewVC 1.1.20