Skip to content

Instantly share code, notes, and snippets.

@ucchyocean
Created September 7, 2014 16:51
Show Gist options
  • Save ucchyocean/13227c7900f3a2eda8f4 to your computer and use it in GitHub Desktop.
Save ucchyocean/13227c7900f3a2eda8f4 to your computer and use it in GitHub Desktop.
Locationをコンフィグからロードするサンプル
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