Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.grzegorz2047.ml;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin {
- @Override
- public boolean onCommand(CommandSender sender, Command command,String label, String[] args) {
- if( !(sender instanceof Player) ){
- return false;
- }
- Player player = (Player) sender;
- if(label.equalsIgnoreCase("tepaj")){
- if(args.length == 1){
- String DoKogo = args[0];
- if(this.getServer().getPlayer(DoKogo).isOnline()){
- player.teleport(this.getServer().getPlayer(DoKogo));
- }
- else{
- player.sendMessage(ChatColor.RED + "Nie znaleziono gracz");
- }
- }
- }
- if(label.equalsIgnoreCase("wstworz")){
- if(args.length==1){
- String NazwaWarpu=args[0];
- Location loc;
- loc = player.getLocation();
- String World = loc.getWorld().getName();
- double x= loc.getX();
- double y = loc.getY();
- double z = loc.getZ();
- float yaw = loc.getYaw();
- float pitch = loc.getPitch();
- this.getConfig().set("warpy." + NazwaWarpu+ ".W", loc.getWorld().getName());
- this.getConfig().set("warpy." + NazwaWarpu+ ".X", loc.getX());
- this.getConfig().set("warpy." + NazwaWarpu+ ".Y", loc.getY());
- this.getConfig().set("warpy." + NazwaWarpu+ ".Z", loc.getZ());
- this.getConfig().set("warpy." + NazwaWarpu+ ".YA", loc.getYaw());
- this.getConfig().set("warpy." + NazwaWarpu+ ".P", loc.getPitch());
- }
- }
- if(label.equalsIgnoreCase("przenies")){
- if(args.length==1){
- String NazwaWarpu=args[0];
- Location loc;
- String World = this.getConfig().getString("warpy." + NazwaWarpu+ ".W");
- double x= this.getConfig().getDouble("warpy." + NazwaWarpu+ ".X");
- double y = this.getConfig().getDouble("warpy." + NazwaWarpu+ ".Y");
- double z = this.getConfig().getDouble("warpy." + NazwaWarpu+ ".Z");
- float yaw = (float) this.getConfig().getDouble("warpy." + NazwaWarpu+ ".YA");
- float pitch =(float) this.getConfig().getDouble("warpy." + NazwaWarpu+ ".P");
- loc = new Location(this.getServer().getWorld(World),x,y,z,yaw,pitch);
- player.teleport(loc);
- }
- }
- return false;
- }
- @Override
- public void onEnable() {
- System.out.println(this.getName() + " Stworzony przez grzegorz2047");
- saveDefaultConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment