Code:
package me.olsyboy.spleef;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.configuration.file.YamlConfiguration;
public class Main extends JavaPlugin {
public void onEnable() {
loadConfiguration();
reloadConfig();
}
public void onDisable() {
saveDefaultConfig();
}
public void loadConfiguration() {
//See "Creating you're defaults"
getConfig().options().copyDefaults(true); // NOTE: You do not have to use "plugin." if the class extends the java plugin
//Save the config whenever you manipulate it
saveDefaultConfig();
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args, String gameName) {
if (cmd.getName().equalsIgnoreCase("spleef")) {
if (args[0].equalsIgnoreCase("setgame")) {
Bukkit.broadcastMessage(ChatColor.GREEN + "Message 2");
if (args.length == 2) {
gameName = args[1];
String path = "GamesLocations." + gameName;
getConfig().addDefault(path, "I did!");
getConfig().options().copyDefaults(true);
saveConfig();
}
return false;
}
}
return true;
}
}
Code:
name: Spleef
version: 1.0
author: olsyboy
main: me.olsyboy.spleef.Main
commands:
spleef:
description: The Spleef Command
permission: spleef.spleef
usage: Type /spleef to use the Spleef commands
It should do something on /spleef, but it just shows what I have put in plugin.yml!!
Please help!