Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.Tommunity.Booster;
- import de.Tommunity.Main.Main;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.BlockBreakEvent;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.event.weather.WeatherChangeEvent;
- import org.bukkit.inventory.ItemStack;
- import java.io.File;
- public class Tynox implements Listener, CommandExecutor {
- @EventHandler
- public void onDay(WeatherChangeEvent e){
- e.setCancelled(true);
- }
- @EventHandler
- public void onJoin(PlayerJoinEvent e){
- Player p = (Player)e.getPlayer();
- FileConfiguration config = Main.getPlugin().getConfig();
- World world = Bukkit.getWorld(config.getString("Spawn.World"));
- double x = config.getDouble("Spawn.X");
- double y = config.getDouble("Spawn.Y");
- double z = config.getDouble("Spawn.Z");
- float yaw = (float) config.getDouble("Spawn.Yaw");
- float pitch = (float) config.getDouble("Spawn.Pitch");
- Location location = new Location(world, x, y, z, yaw, pitch);
- p.teleport(location);
- }
- @EventHandler
- public void onHight(PlayerMoveEvent e){
- Player p = e.getPlayer();
- if ((p.getLocation().getBlockY() >= -5
- && p.getLocation().getBlockY() <=-3 )) {
- p.damage(100);
- }
- }
- @EventHandler
- public void onDead(PlayerDeathEvent e){
- Player p = e.getEntity();
- if(p instanceof Player){
- p.sendMessage("§cDu bist gestoben!");
- p.spigot().respawn();
- //ItemRegister
- ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
- ItemStack leggins = new ItemStack(Material.LEATHER_LEGGINGS);
- ItemStack chest = new ItemStack(Material.CHAINMAIL_CHESTPLATE);
- ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
- ItemStack Rod = new ItemStack(Material.FISHING_ROD);
- ItemStack Snow = new ItemStack(Material.SNOW_BALL);
- Snow.setAmount(16);
- p.getInventory().addItem(Rod);
- p.getInventory().addItem(Snow);
- p.getInventory().setBoots(boots);
- p.getInventory().setLeggings(leggins);
- p.getInventory().setChestplate(chest);
- p.getInventory().setChestplate(helmet);
- }
- }
- @EventHandler
- public void onBreak(BlockBreakEvent e){
- e.setCancelled(true);
- }
- @Override
- public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) {
- Player p = (Player)cs;
- if(p.hasPermission("BlueNitrox.Setspawn")){
- File file = new File("plugins//Spawn", "Spawn.yml");
- FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- FileConfiguration config = Main.getPlugin().getConfig();
- config.set("Spawn.World", p.getWorld().getName());
- config.set("Spawn.X", p.getLocation().getX());
- config.set("Spawn.Y", p.getLocation().getY());
- config.set("Spawn.Z", p.getLocation().getZ());
- config.set("Spawn.Yaw", p.getLocation().getYaw());
- config.set("Spawn.Pitch", p.getLocation().getPitch());
- Main.getPlugin().saveConfig();
- }else {
- p.sendMessage("§cDazu hast du keine Rechte!");
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement