Skip to content

Instantly share code, notes, and snippets.

@Neverboosted
Created June 12, 2019 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neverboosted/a1791e1c7997c9b615d3b7392627319d to your computer and use it in GitHub Desktop.
Save Neverboosted/a1791e1c7997c9b615d3b7392627319d to your computer and use it in GitHub Desktop.
SetHomeCommand
package de.fly.main.commands;
import de.fly.main.Main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SethomeCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("sethome")) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (args.length == 0) {
p.sendMessage("§b[REDz] §cFalscher Syntax : §7/sethome (Name)");
return false;
}
if (args.length == 1) {
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".world", p.getLocation().getWorld().getName());
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".x", p.getLocation().getX());
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".y", p.getLocation().getY());
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".z", p.getLocation().getZ());
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".pitch", p.getEyeLocation().getPitch());
Main.getInstance().getConfig().set("home." + p.getUniqueId().toString() + "." + args[0] + ".yaw", p.getEyeLocation().getYaw());
Main.getInstance().saveConfig();
p.sendMessage("§b[REDz] §7Du hast erfolgreich den Home §7 " + args[0] + " §7 Gesetzt");
return false;
}
if (args.length >= 2) {
p.sendMessage("§b[REDz] §cFalscher Syntax : §7/sethome (Name)");
return false;
}
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment