[personal profile] fardell24


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.

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

May 2025

S M T W T F S
     1 23
45 6 78910
11 12 13 141516 17
1819 2021 222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 23rd, 2025 12:03 am
Powered by Dreamwidth Studios