Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package fr.kavioz_z.cmd;
  2.  
  3. import org.bukkit.configuration.file.*;
  4. import org.bukkit.command.*;
  5. import org.bukkit.entity.*;
  6.  
  7. import fr.kavioz_z.main.*;
  8.  
  9. public class SetSpawn implements CommandExecutor
  10. {
  11. private FileConfiguration config;
  12. private Main pl;
  13.  
  14. public SetSpawn(final Main main) {
  15. this.pl = main;
  16. this.config = this.pl.getConfig();
  17. }
  18.  
  19. public boolean onCommand(final CommandSender commandSender, final Command command, final String label, final String[] args) {
  20. if (commandSender instanceof Player) {
  21. final Player p = (Player)commandSender;
  22. if (!p.hasPermission("practice.setspawn")) {
  23. return true;
  24. }
  25. p.sendMessage("§aThe spawn has been set");
  26. this.config.set("spawn.x", (Object)p.getLocation().getX());
  27. this.config.set("spawn.y", (Object)p.getLocation().getY());
  28. this.config.set("spawn.z", (Object)p.getLocation().getZ());
  29. this.config.set("spawn.World", (Object)p.getWorld().getName());
  30. this.pl.saveConfig();
  31. }
  32. return false;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement