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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1681 - (show annotations) (download)
Wed Jan 25 22:03:19 2012 UTC (12 years, 3 months ago) by torben
File size: 1678 byte(s)
use new bukkit event api
1 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 pm.registerEvents(worldChanged, this);
57
58
59 }
60
61 public void onDisable() {
62 }
63
64 public void saveConfig() {
65 FileConfiguration config = getConfig();
66
67 try {
68 config.save( configFile);
69 } catch (IOException e) {
70 System.out.println( "CreativeWorld error saving config : " + e.getMessage() );
71 e.printStackTrace();
72 }
73 }
74
75
76
77
78
79 }

  ViewVC Help
Powered by ViewVC 1.1.20