Guest User

Untitled

a guest
Jul 23rd, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package pl.test;
  2.  
  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.Listener;
  5. import org.bukkit.event.player.PlayerJoinEvent;
  6. import org.bukkit.plugin.java.JavaPlugin;
  7.  
  8. public class Main extends JavaPlugin implements Listener {
  9.  
  10. public void onJoined(PlayerJoinEvent e){
  11. Player p = e.getPlayer();
  12. if(!p.hasPlayedBefore()){
  13. getConfig().set("home." + p.getName() + ".X", p.getLocation().getX());
  14. getConfig().set("home." + p.getName() + ".Y", p.getLocation().getY());
  15. getConfig().set("home." + p.getName() + ".Z", p.getLocation().getZ());
  16. getConfig().set("home." + p.getName() + ".World", p.getLocation().getWorld());
  17. saveConfig();
  18. reloadConfig();
  19. }
  20. }
  21.  
  22. public void onEnable() {
  23. getServer().getPluginManager().registerEvents(this, this);
  24. getConfig().options().copyDefaults(true);
  25. saveConfig();
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment