Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.universxlgenie.classserver.commands;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- 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 java.io.File;
- public class HomeCommand implements CommandExecutor {
- File file = new File("plugins/Info", "homes.yml");
- FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
- @Override
- public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) {
- if(commandSender instanceof Player){
- Player player = (Player) commandSender;
- if(configuration.contains(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.World" )){
- World world = Bukkit.getWorld(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.World");
- double x = configuration.getDouble(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.X");
- double y = configuration.getDouble(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.Y");
- double z = configuration.getDouble(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.Z");
- float yaw = (float) configuration.getDouble(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.Yaw");
- float pitch = (float) configuration.getDouble(player.getUniqueId().toString() + " . " + args[0] + " . " + "Home.Pitch");
- Location loc = new Location(world, x, y, z, yaw, pitch);
- player.teleport(loc);
- player.sendMessage("§aDu wurdest zu deinem Home " + args[0] + " §ateleportiert.");
- } else{
- player.sendMessage("§cDas Home gibt es nicht");
- }
- } else{
- commandSender.sendMessage("Du musst ein Spieler sein um diesen Command ausführen zu können.");
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement