Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. package de.Tommunity.Booster;
  2.  
  3. import de.Tommunity.Main.Main;
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.Location;
  6. import org.bukkit.Material;
  7. import org.bukkit.World;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandExecutor;
  10. import org.bukkit.command.CommandSender;
  11. import org.bukkit.configuration.file.FileConfiguration;
  12. import org.bukkit.configuration.file.YamlConfiguration;
  13. import org.bukkit.entity.Player;
  14. import org.bukkit.event.EventHandler;
  15. import org.bukkit.event.Listener;
  16. import org.bukkit.event.block.BlockBreakEvent;
  17. import org.bukkit.event.entity.PlayerDeathEvent;
  18. import org.bukkit.event.player.PlayerJoinEvent;
  19. import org.bukkit.event.player.PlayerMoveEvent;
  20. import org.bukkit.event.weather.WeatherChangeEvent;
  21. import org.bukkit.inventory.ItemStack;
  22.  
  23. import java.io.File;
  24.  
  25. public class Tynox implements Listener, CommandExecutor {
  26.  
  27. @EventHandler
  28. public void onDay(WeatherChangeEvent e){
  29. e.setCancelled(true);
  30. }
  31.  
  32. @EventHandler
  33. public void onJoin(PlayerJoinEvent e){
  34. Player p = (Player)e.getPlayer();
  35.  
  36. FileConfiguration config = Main.getPlugin().getConfig();
  37. World world = Bukkit.getWorld(config.getString("Spawn.World"));
  38. double x = config.getDouble("Spawn.X");
  39. double y = config.getDouble("Spawn.Y");
  40. double z = config.getDouble("Spawn.Z");
  41. float yaw = (float) config.getDouble("Spawn.Yaw");
  42. float pitch = (float) config.getDouble("Spawn.Pitch");
  43. Location location = new Location(world, x, y, z, yaw, pitch);
  44. p.teleport(location);
  45.  
  46.  
  47. }
  48.  
  49. @EventHandler
  50. public void onHight(PlayerMoveEvent e){
  51. Player p = e.getPlayer();
  52. if ((p.getLocation().getBlockY() >= -5
  53. && p.getLocation().getBlockY() <=-3 )) {
  54. p.damage(100);
  55. }
  56. }
  57.  
  58. @EventHandler
  59. public void onDead(PlayerDeathEvent e){
  60. Player p = e.getEntity();
  61. if(p instanceof Player){
  62. p.sendMessage("§cDu bist gestoben!");
  63. p.spigot().respawn();
  64.  
  65. //ItemRegister
  66. ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
  67. ItemStack leggins = new ItemStack(Material.LEATHER_LEGGINGS);
  68. ItemStack chest = new ItemStack(Material.CHAINMAIL_CHESTPLATE);
  69. ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
  70.  
  71. ItemStack Rod = new ItemStack(Material.FISHING_ROD);
  72. ItemStack Snow = new ItemStack(Material.SNOW_BALL);
  73. Snow.setAmount(16);
  74.  
  75. p.getInventory().addItem(Rod);
  76. p.getInventory().addItem(Snow);
  77.  
  78. p.getInventory().setBoots(boots);
  79. p.getInventory().setLeggings(leggins);
  80. p.getInventory().setChestplate(chest);
  81. p.getInventory().setChestplate(helmet);
  82.  
  83. }
  84. }
  85.  
  86. @EventHandler
  87. public void onBreak(BlockBreakEvent e){
  88. e.setCancelled(true);
  89. }
  90.  
  91. @Override
  92. public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) {
  93. Player p = (Player)cs;
  94. if(p.hasPermission("BlueNitrox.Setspawn")){
  95.  
  96. File file = new File("plugins//Spawn", "Spawn.yml");
  97. FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  98.  
  99. FileConfiguration config = Main.getPlugin().getConfig();
  100. config.set("Spawn.World", p.getWorld().getName());
  101. config.set("Spawn.X", p.getLocation().getX());
  102. config.set("Spawn.Y", p.getLocation().getY());
  103. config.set("Spawn.Z", p.getLocation().getZ());
  104. config.set("Spawn.Yaw", p.getLocation().getYaw());
  105. config.set("Spawn.Pitch", p.getLocation().getPitch());
  106. Main.getPlugin().saveConfig();
  107.  
  108. }else {
  109. p.sendMessage("§cDazu hast du keine Rechte!");
  110. }
  111. return false;
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement