Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Files;
- import java.io.File;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import Main.hauptklasse;
- public class Home implements CommandExecutor {
- public Home(hauptklasse hauptklasse) {
- }
- String path = "plugins//Core//User//Home//";
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if(!(sender instanceof Player)){
- Bukkit.getConsoleSender().sendMessage("§4Der Befehl §eHOME §4geht nur im Spiel!");
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("home")) {
- Player plr =(Player) sender;
- if(args.length == 0) {
- //Spieler hat folgendes eingegeben: /home
- return true;
- }
- if (args[0].equalsIgnoreCase(":")) {
- plr.sendMessage("xD");
- return true;
- } else if (! args[0].equalsIgnoreCase(":")) {
- File file = new File(path+plr.getUniqueId()+".yml");
- if (file.length() == 0) {
- plr.sendMessage("§c§lHome §8| §7Du hast keinen §cHome §7Point.");
- return true;
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- double x = cfg.getDouble("x");
- double y = cfg.getDouble("y");
- double z = cfg.getDouble("z");
- double yaw = cfg.getDouble("yaw");
- double pitch = cfg.getDouble("pitch");
- String worldname = cfg.getString("world");
- Location loc = new Location(Bukkit.getWorld(worldname), x, y, z);
- loc.setYaw((float) yaw);
- loc.setPitch((float) pitch);
- plr.teleport(loc);
- plr.sendMessage("§c§lHome §8| §7Du wurdest zu deinem §cHome §7teleportiert.");
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement