Created
September 7, 2014 16:51
-
-
Save ucchyocean/13227c7900f3a2eda8f4 to your computer and use it in GitHub Desktop.
Locationをコンフィグからロードするサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestPlugin extends JavaPlugin implements Listener { | |
/** | |
* @see org.bukkit.plugin.java.JavaPlugin#onEnable() | |
*/ | |
@Override | |
public void onEnable() { | |
getConfig().addDefault("RED_1.world", "world"); | |
getConfig().addDefault("RED_1.x", 0); | |
getConfig().addDefault("RED_1.y", 65); | |
getConfig().addDefault("RED_1.z", 0); | |
getConfig().options().copyDefaults(true); | |
saveConfig(); | |
reloadConfig(); | |
String world = getConfig().getString("RED_1.world"); | |
int x = getConfig().getInt("RED_1.x"); | |
int y = getConfig().getInt("RED_1.y"); | |
int z = getConfig().getInt("RED_1.z"); | |
Location loc = new Location(getServer().getWorld(world), x, y, z); | |
System.out.println("debug : " + loc); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment