Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.test;
- import org.bukkit.entity.Player;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin implements Listener {
- public void onJoined(PlayerJoinEvent e){
- Player p = e.getPlayer();
- if(!p.hasPlayedBefore()){
- getConfig().set("home." + p.getName() + ".X", p.getLocation().getX());
- getConfig().set("home." + p.getName() + ".Y", p.getLocation().getY());
- getConfig().set("home." + p.getName() + ".Z", p.getLocation().getZ());
- getConfig().set("home." + p.getName() + ".World", p.getLocation().getWorld());
- saveConfig();
- reloadConfig();
- }
- }
- public void onEnable() {
- getServer().getPluginManager().registerEvents(this, this);
- getConfig().options().copyDefaults(true);
- saveConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment