Advertisement
RedixPvP

onJoin

Apr 28th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. @EventHandler
  2. public void onTeleport(PlayerJoinEvent e){
  3. Player p = e.getPlayer();
  4.  
  5.  
  6. File file = new File("plugins/Lobby", "lobby.yml");
  7. FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  8.  
  9. String str = "primepvp.lobby.";
  10.  
  11. try {
  12. World w = Bukkit.getWorld(cfg.getString(str + "world"));
  13. if (w == null) {
  14. p.sendMessage("§cUnknown World!");
  15. return;
  16. }
  17. double x = cfg.getDouble(str + "x");
  18. double y = cfg.getDouble(str + "y");
  19. double z = cfg.getDouble(str + "z");
  20. double yaw = cfg.getDouble(str + "yaw");
  21. double pitch = cfg.getDouble(str + "pitch");
  22. Location loc = new Location(w, x, y, z, (float)yaw, (float)pitch);
  23. p.teleport(loc);
  24. p.sendMessage(main.pr+"§eDu befindest dich nun in der Lobby.");
  25. } catch (Exception e) {
  26. p.sendMessage(main.pr+"§eSetze zuerst den Lobbypunkt!");
  27. }
  28.  
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement