This commit is contained in:
Tobias Ottenweller 2013-06-01 14:50:39 +02:00
parent fec999541e
commit b383ff89c6
3 changed files with 2 additions and 47 deletions

View File

@ -3,11 +3,8 @@ package de.craftinc.gates.listeners;
import java.util.Calendar;
import java.util.HashMap;
import de.craftinc.gates.util.TeleportRequest;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -73,17 +70,14 @@ public class PlayerMoveListener implements Listener
*/
private void teleportPlayer(Player p, Gate g)
{
Location playerLocation = p.getLocation();
Location exit = g.getExit();
Float newYaw = g.getExit().getYaw() - g.getLocation().getYaw() + playerLocation.getYaw();
Float newYaw = g.getExit().getYaw() - g.getLocation().getYaw() + p.getLocation().getYaw();
Location destLocation = new Location( g.getExit().getWorld(),
g.getExit().getX(),
g.getExit().getY(),
g.getExit().getZ(),
newYaw,
playerLocation.getPitch()
p.getLocation().getPitch()
);
p.teleport(destLocation);

View File

@ -1,8 +1,6 @@
package de.craftinc.gates.util;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
public class SimpleChunk
{

View File

@ -1,37 +0,0 @@
package de.craftinc.gates.util;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class TeleportRequest
{
private Player player;
private Location destination;
public TeleportRequest(Player player, Location destination)
{
if (player == null) {
throw new IllegalArgumentException("Player must not be null!");
}
if (destination == null) {
throw new IllegalArgumentException("Destination must not be null");
}
this.player = player;
this.destination = destination;
}
public Player getPlayer()
{
return player;
}
public Location getDestination()
{
return destination;
}
}