Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  2.  
  3. final Player p = (Player) sender;
  4.  
  5. if (!sender.hasPermission("spawn.spawn")) {
  6. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
  7. return true;
  8. }
  9. if (cmd.getName().equalsIgnoreCase("spawn")) {
  10. if (getConfig().getConfigurationSection("spawn") == null) {
  11. p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("No-Spawn-Message")));
  12. return true;
  13. }
  14. World w = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
  15. double x = getConfig().getDouble("spawn.x");
  16. double y = getConfig().getDouble("spawn.y");
  17. double z = getConfig().getDouble("spawn.z");
  18. float yaw = (float) getConfig().getDouble("spawn.yaw");
  19. float pitch = (float) getConfig().getDouble("spawn.pitch");
  20. final Location loc = new Location(w, x, y, z, yaw, pitch);
  21.  
  22. if (getConfig().getBoolean("Cancel-On-Move")) {
  23. if (!tasks.containsKey(p)) {
  24. tasks.put(p, new BukkitRunnable() {
  25. @Override
  26. public void run() {
  27. p.teleport(loc);
  28. p.sendMessage(ChatColor.translateAlternateColorCodes('&',
  29. SS.this.getConfig().getString("Spawn-Message")));
  30. if (SS.this.getConfig().getBoolean("Spawn-Effect")) {
  31. p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
  32. p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
  33. p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
  34. p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
  35. }
  36. tasks.remove(p);
  37. }
  38. }.runTaskLater(this, 20L * getConfig().getInt("Cooldown")));
  39. return true;
  40. }
  41. }
  42.  
  43. //Couple more commands after this//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement