fardell24 ([personal profile] fardell24) wrote2015-08-08 01:18 pm

Digital and Interactive Games 2015 - Term 3, Session 8



Digital and Interactive Games 2015 – Term 3, Session 8
Config Tutorial

Today: - Default config.yml
– Reading config.yml
– Writing config.yml
– Create your own


Config.yml

load: STARTUP – needs to be the first line
configTutorial:
version: dragon
arena:
name:
world:
x: 123.0
y: 100.0
z: 123.0


if (!new File(getDataFolder(). “config.yml”).exists()) {
saveResource(“config.yml”, false)
}


string versionNumber;
string ArenaName;
string ArenaWorld;

versionNumber = getConfig().getString(“ConfigTutorial.versionNumber”);
System.out.println(versionNumber);


ArenaCommand

if(option.length == 0) return false);


ifoption[0].equalsIgnoreCase(“set”)) {
if (!sender instanceof Player) return false;

} else if (option[0] equalsIgnoreCase(“teleport”)) {

}

return false;


plugin.getConfig().set(“configTutorial.Arena.world”, player.getWorld.getName());

plugin.ArenaWorld = player.getWorld.getName();
plugin.ArenaX = player.getLocation.getX();

plugin.saveConfig()
result = true;

else if (option[0].equalsIgnoreCase(“teleport)) {
location loc = new (Bukkit.getWorld(plugin.ArenaWorld), plugin.ArenaX);

}
for (player p : Bukkit.getOnlinePlayers()) {
p.teleport(loc);
}


How to check
– command to run on the console
– options
– set Config() - set
– get – String
– Double
– Save config

ArenaCommand(ConfigTutorial p) {
plugin.p;
}


Boolean result = false;


• Teleport out
• Take some items off
• Set health to half or less
• Set off some effects


• chat.color when SendMessage

1200 → 1 minute


– option set → Write the current player location to the config.yml (for the arena)
– Teleport → teleport all online players to the arena.


Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting