@EventHandler()
 public void onPJoin(PlayerJoinEvent e) {
   Player p = e.getPlayer();
   if (plugin.newVersion == null) return;
   if (!plugin.newVersion.contains(plugin.version)
       && !plugin.version.contains("pre")
       && plugin.isAuthorized(p, "rcmds.updates")) {
     String newV = plugin.newVersion.split("RoyalCommands")[1].trim().substring(1);
     p.sendMessage(
         ChatColor.BLUE
             + "RoyalCommands "
             + ChatColor.GRAY
             + "v"
             + newV
             + ChatColor.BLUE
             + " is out! You are running "
             + ChatColor.GRAY
             + "v"
             + plugin.version
             + ChatColor.BLUE
             + ".");
     p.sendMessage(
         ChatColor.BLUE
             + "Get the new version at "
             + ChatColor.DARK_AQUA
             + "http://dev.bukkit.org/server-mods/royalcommands"
             + ChatColor.BLUE
             + ".");
   }
 }
 @EventHandler(priority = EventPriority.HIGH)
 public void onPlayerJoin(PlayerJoinEvent event) {
   File datafile =
       new File(
           plugin.getDataFolder()
               + File.separator
               + "userdata"
               + File.separator
               + event.getPlayer().getName().toLowerCase()
               + ".yml");
   if (!datafile.exists()) {
     log.info("[RoyalCommands] Creating userdata for user " + event.getPlayer().getName() + ".");
     try {
       FileConfiguration out = YamlConfiguration.loadConfiguration(datafile);
       out.set("name", event.getPlayer().getName());
       String dispname = event.getPlayer().getDisplayName();
       if (dispname == null || dispname.equals("")) dispname = event.getPlayer().getName();
       out.set("dispname", dispname);
       out.set("ip", event.getPlayer().getAddress().getAddress().toString().replace("/", ""));
       out.set("banreason", "");
       out.set("allow-tp", true);
       out.save(datafile);
       log.info("[RoyalCommands] Userdata creation finished.");
     } catch (Exception e) {
       log.severe(
           "[RoyalCommands] Could not create userdata for user "
               + event.getPlayer().getName()
               + "!");
       e.printStackTrace();
     }
     if (plugin.useWelcome) {
       String welcomemessage = plugin.welcomeMessage;
       welcomemessage = welcomemessage.replace("{name}", event.getPlayer().getName());
       String dispname = event.getPlayer().getDisplayName();
       if (dispname == null || dispname.equals("")) dispname = event.getPlayer().getName();
       welcomemessage = welcomemessage.replace("{dispname}", dispname);
       welcomemessage = welcomemessage.replace("{world}", event.getPlayer().getWorld().getName());
       plugin.getServer().broadcastMessage(welcomemessage);
     }
     if (plugin.stsNew)
       event.getPlayer().teleport(event.getPlayer().getWorld().getSpawnLocation());
   } else {
     log.info("[RoyalCommands] Updating the IP for " + event.getPlayer().getName() + ".");
     String playerip = event.getPlayer().getAddress().getAddress().toString();
     playerip = playerip.replace("/", "");
     PConfManager.setPValString(event.getPlayer(), playerip, "ip");
   }
   if (plugin.motdLogin) CmdMotd.showMotd(event.getPlayer());
   if (plugin.sendToSpawn) {
     if (plugin.stsBack) CmdBack.backdb.put(event.getPlayer(), event.getPlayer().getLocation());
     event.getPlayer().teleport(event.getPlayer().getWorld().getSpawnLocation());
   }
 }