Advertisement
Guest User

Untitled

a guest
May 11th, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. package de.lenic.onix.warps;
  2.  
  3. import com.flowpowered.math.vector.Vector3d;
  4. import de.lenic.onix.Onix;
  5. import org.spongepowered.api.entity.Entity;
  6. import org.spongepowered.api.world.Location;
  7. import org.spongepowered.api.world.extent.Extent;
  8.  
  9. import java.util.Optional;
  10. import java.util.UUID;
  11.  
  12. public class WarpPoint {
  13.  
  14.     private String name;
  15.     private Location loc;
  16.     private Vector3d vector;
  17.  
  18.     // Constructor
  19.     public WarpPoint(String name, UUID uuid, double block_x, double block_y, double block_z, Vector3d vector){
  20.         this.name = name;
  21.         this.loc = new Location(Onix.game.getServer().getWorld(uuid).get(), block_x, block_y, block_z);
  22.         this.vector = vector;
  23.     }
  24.  
  25.  
  26.     // Get | Set name
  27.     public String getName(){
  28.         return this.name;
  29.     }
  30.     public void setName(String name){
  31.         this.name = name;
  32.     }
  33.  
  34.     // Get | Set world
  35.     public Optional<Extent> getExtent(){
  36.         return Optional.of(this.loc.getExtent());
  37.     }
  38.     public void setExtent(Extent extent){
  39.         this.loc.setExtent(extent);
  40.     }
  41.  
  42.     // Get | Set location
  43.     public Location getLocation(){
  44.         return this.loc;
  45.     }
  46.     public void setLocation(Location loc){
  47.         this.loc = loc;
  48.     }
  49.  
  50.  
  51.     // Warp player to warp point
  52.     public void warpPlayer(Entity entity){
  53.         entity.setLocationAndRotationSafely(this.loc, this.vector);
  54.     }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement