Advertisement
Guest User

ftjh

a guest
Feb 12th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. package me.byGinoGames44.Comandos;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import me.byGinoGames44.MultiSets;
  6. import net.md_5.bungee.api.ChatColor;
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.Location;
  9. import org.bukkit.World;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandExecutor;
  12. import org.bukkit.command.CommandSender;
  13. import org.bukkit.configuration.InvalidConfigurationException;
  14. import org.bukkit.configuration.file.FileConfiguration;
  15. import org.bukkit.entity.Player;
  16. import static org.spigotmc.SpigotConfig.config;
  17.  
  18. public class spawn implements CommandExecutor {
  19. public spawn(MultiSets main) {
  20.  
  21. File configyml = new File("plugins/MultiSets", "config.yml");
  22. FileConfiguration config = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(configyml);
  23.  
  24. }
  25.  
  26. /**
  27. *
  28. * @param spawn
  29. * @param cmd
  30. * @param label
  31. * @param args
  32. * @return
  33. */
  34. @Override
  35. public boolean onCommand(CommandSender spawn, Command cmd, String label, String[] args) {
  36. if (cmd.getName().equalsIgnoreCase("spawn"))
  37. {
  38. if (!spawn.hasPermission("ms.user"))
  39. {
  40. Player p = (Player)spawn;
  41. p.sendMessage(ChatColor.GREEN + "No tienes permiso para ejecutar este comando!");
  42. }
  43. if (spawn.hasPermission("ms.user"))
  44. {
  45. Player p = (Player)spawn;
  46. World w = Bukkit.getServer().getWorld(config.getString("world"));
  47. double x = config.getDouble("x");
  48. double y = config.getDouble("y");
  49. double z = config.getDouble("z");
  50. Location Spawn = new Location(w, x, y, z);
  51. Spawn.setPitch((float)config.getDouble("pitch"));
  52. Spawn.setYaw((float)config.getDouble("yaw"));
  53. p.teleport(Spawn);
  54. p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("&2Te as teletransportado al Spawn")));
  55. File configyml = null;
  56.  
  57. try {
  58. config.save(configyml);
  59. } catch (IOException e) {
  60. }
  61. try {
  62. config.load(configyml);
  63. } catch (IOException e) {
  64. } catch (InvalidConfigurationException e) {
  65. }
  66. }
  67. }
  68. return false;
  69. }
  70.  
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement