package tk.royalcraf.royalcommands;

import java.util.logging.Logger;

import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerListener;

public class RoyalCommandsPlayerListener extends PlayerListener {

	public static RoyalCommands plugin;

	public RoyalCommandsPlayerListener(RoyalCommands instance) {
		plugin = instance;
	}

	Logger log = Logger.getLogger("Minecraft");

	public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {

		log.info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": "
				+ event.getMessage());

	}

}
@@ -46,29 +46,220 @@
 ava.
-util.logging.Logger;%0A
+io.BufferedWriter;%0Aimport java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.util.logging.Logger;%0A%0Aimport org.bukkit.configuration.file.FileConfiguration;%0Aimport org.bukkit.configuration.file.YamlConfiguration;
 %0Aimp
@@ -316,16 +316,64 @@
 sEvent;%0A
+import org.bukkit.event.player.PlayerJoinEvent;%0A
 import o
@@ -828,9 +828,1424 @@
 );%0A%0A%09%7D%0A%0A
+%09public void onPlayerJoin(PlayerJoinEvent event) %7B%0A%09%09File datafile = new File(plugin.getDataFolder() + %22/userdata/%22%0A%09%09%09%09+ event.getPlayer().getName() + %22.yml%22);%0A%09%09if (!datafile.exists()) %7B%0A%09%09%09log.info(%22%5BRoyalCommands%5D Creating userdata for user %22%0A%09%09%09%09%09+ event.getPlayer().getName() + %22.%22);%0A%09%09%09try %7B%0A%09%09%09%09datafile.createNewFile();%0A%09%09%09%09FileWriter fstream = new FileWriter(plugin.getDataFolder()%0A%09%09%09%09%09%09+ %22/userdata/%22 + event.getPlayer().getName() + %22.yml%22);%0A%09%09%09%09BufferedWriter out = new BufferedWriter(fstream);%0A%09%09%09%09out.write(%22name: %22 + event.getPlayer().getName() + %22%5Cn%22);%0A%09%09%09%09out.write(%22dispname: %22 + event.getPlayer().getDisplayName()%0A%09%09%09%09%09%09+ %22%5Cn%22);%0A%09%09%09%09%0A%09%09%09%09out.write(%22ip: %22 + event.getPlayer().getAddress().getAddress() + %22%5Cn%22);%0A%09%09%09%09out.close();%0A%09%09%09%09log.info(%22%5BRoyalCommands%5D Userdata creation finished.%22);%0A%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09log.severe(%22%5BRoyalCommands%5D Could not create userdata for user %22%0A%09%09%09%09%09%09+ event.getPlayer().getName() + %22!%22);%0A%09%09%09%09log.severe(e.getMessage());%0A%09%09%09%7D%0A%09%09%7D else %7B%0A%09%09%09log.info(%22%5BRoyalCommands%5D Updating the IP for %22 + event.getPlayer().getName() + %22.%22);%0A%09%09%09File p1confl = new File(plugin.getDataFolder()%0A%09%09%09%09%09+ %22/userdata/%22 + event.getPlayer().getName() + %22.yml%22);%0A%09%09%09FileConfiguration p1conf = YamlConfiguration%0A%09%09%09%09%09.loadConfiguration(p1confl);%0A%09%09%09p1conf.set(%22ip%22, event.getPlayer().getAddress().getAddress());%0A%09%09%09p1conf.set(%22dispname%22, event.getPlayer().getDisplayName());%0A%09%09%7D%0A%09%7D%0A%0A
 %7D

Create user data files and update them