Guest User

kod pluginu na warp grzegorz2047

a guest
Feb 24th, 2013
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.70 KB | None | 0 0
  1. package pl.grzegorz2047.ml;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Location;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class Main extends JavaPlugin {
  11.  
  12.         @Override
  13.         public boolean onCommand(CommandSender sender, Command command,String label, String[] args) {
  14.                 if( !(sender instanceof Player) ){
  15.                         return false;
  16.                 }
  17.                 Player player = (Player) sender;
  18.                 if(label.equalsIgnoreCase("tepaj")){
  19.                         if(args.length == 1){
  20.                                 String DoKogo = args[0];
  21.                                 if(this.getServer().getPlayer(DoKogo).isOnline()){
  22.                                         player.teleport(this.getServer().getPlayer(DoKogo));
  23.                                 }
  24.                                 else{
  25.                                         player.sendMessage(ChatColor.RED + "Nie znaleziono gracz");
  26.                                 }
  27.                         }
  28.                 }
  29.                 if(label.equalsIgnoreCase("wstworz")){
  30.                         if(args.length==1){
  31.                                 String NazwaWarpu=args[0];
  32.                                 Location loc;
  33.                                 loc = player.getLocation();
  34.                                 String World = loc.getWorld().getName();
  35.                                 double x= loc.getX();
  36.                                 double y = loc.getY();
  37.                                 double z = loc.getZ();
  38.                                 float yaw = loc.getYaw();
  39.                                 float pitch = loc.getPitch();
  40.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".W", loc.getWorld().getName());
  41.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".X", loc.getX());
  42.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".Y", loc.getY());
  43.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".Z", loc.getZ());
  44.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".YA", loc.getYaw());
  45.                                 this.getConfig().set("warpy." + NazwaWarpu+  ".P", loc.getPitch());
  46.                         }
  47.                 }
  48.                 if(label.equalsIgnoreCase("przenies")){
  49.                         if(args.length==1){
  50.                                 String NazwaWarpu=args[0];
  51.                                 Location loc;
  52.                                 String World = this.getConfig().getString("warpy." + NazwaWarpu+  ".W");
  53.                                 double x= this.getConfig().getDouble("warpy." + NazwaWarpu+  ".X");
  54.                                 double y = this.getConfig().getDouble("warpy." + NazwaWarpu+  ".Y");
  55.                                 double z = this.getConfig().getDouble("warpy." + NazwaWarpu+  ".Z");
  56.                                 float yaw = (float) this.getConfig().getDouble("warpy." + NazwaWarpu+  ".YA");
  57.                                 float pitch =(float) this.getConfig().getDouble("warpy." + NazwaWarpu+  ".P");
  58.                                 loc = new Location(this.getServer().getWorld(World),x,y,z,yaw,pitch);
  59.                                 player.teleport(loc);
  60.                         }
  61.                 }
  62.                
  63.                
  64.                 return false;
  65.         }
  66.  
  67.         @Override
  68.         public void onEnable() {
  69.                 System.out.println(this.getName() + " Stworzony przez grzegorz2047");
  70.                 saveDefaultConfig();
  71.         }
  72.        
  73.        
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment