This commit is contained in:
Daniel Saukel 2016-04-28 00:03:25 +02:00
parent 43e6a04da1
commit 1cdc78dda3
2 changed files with 56 additions and 36 deletions

View File

@ -22,12 +22,10 @@ import io.github.dre2n.dungeonsxl.config.MessageConfig;
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
import io.github.dre2n.dungeonsxl.game.GameChest;
import io.github.dre2n.dungeonsxl.world.GameWorld;
import io.github.dre2n.dungeonsxl.global.DPortal;
import io.github.dre2n.dungeonsxl.global.GameSign;
import io.github.dre2n.dungeonsxl.global.GlobalProtection;
@ -41,6 +39,8 @@ import io.github.dre2n.dungeonsxl.player.DSavePlayer;
import io.github.dre2n.dungeonsxl.task.RespawnTask;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger;
import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -376,29 +376,26 @@ public class PlayerListener implements Listener {
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
if (dPlayer.getCheckpoint() == null) {
event.setRespawnLocation(dGroup.getGameWorld().getLocStart());
Location respawn = dPlayer.getCheckpoint();
// Da einige Plugins einen anderen Respawn setzen wird
// ein Scheduler gestartet der den Player nach einer
// Sekunde teleportiert.
new RespawnTask(player, dGroup.getGameWorld().getLocStart()).runTaskLater(plugin, 10L);
if (respawn == null) {
respawn = dGroup.getGameWorld().getLocStart();
}
if (dPlayer.getWolf() != null) {
dPlayer.getWolf().teleport(dGroup.getGameWorld().getLocStart());
}
if (respawn == null) {
respawn = dGroup.getGameWorld().getLocLobby();
}
} else {
event.setRespawnLocation(dPlayer.getCheckpoint());
if (respawn == null) {
respawn = dGroup.getGameWorld().getWorld().getSpawnLocation();
}
// Da einige Plugins einen anderen Respawn setzen wird
// ein Scheduler gestartet der den Player nach einer
// Sekunde teleportiert.
new RespawnTask(player, dPlayer.getCheckpoint()).runTaskLater(plugin, 10L);
// Because some plugins set another respawn point, DXL teleports a few ticks later.
new RespawnTask(player, respawn).runTaskLater(plugin, 10);
if (dPlayer.getWolf() != null) {
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
}
// Don't forget Doge!
if (dPlayer.getWolf() != null) {
dPlayer.getWolf().teleport(respawn);
}
}
}

View File

@ -619,11 +619,24 @@ public class DPlayer extends DGlobalPlayer {
public void respawn() {
DGroup dGroup = DGroup.getByPlayer(getPlayer());
if (checkpoint == null) {
PlayerUtil.secureTeleport(getPlayer(), dGroup.getGameWorld().getLocStart());
} else {
PlayerUtil.secureTeleport(getPlayer(), checkpoint);
Location respawn = checkpoint;
if (respawn == null) {
respawn = dGroup.getGameWorld().getLocStart();
}
if (respawn == null) {
respawn = dGroup.getGameWorld().getLocLobby();
}
if (respawn == null) {
respawn = world.getSpawnLocation();
}
PlayerUtil.secureTeleport(getPlayer(), respawn);
// Don't forget Doge!
if (wolf != null) {
wolf.teleport(getPlayer());
}
@ -833,7 +846,7 @@ public class DPlayer extends DGlobalPlayer {
public void update(boolean updateSecond) {
boolean locationValid = true;
Location teleportLocation = getPlayer().getLocation();
Location teleportLocation = player.getLocation();
boolean teleportWolf = false;
boolean respawnInventory = false;
boolean offline = false;
@ -855,18 +868,27 @@ public class DPlayer extends DGlobalPlayer {
teleportLocation = editWorld.getLobby();
}
}
} else if (gameWorld != null) {
DGroup dGroup = DGroup.getByPlayer(getPlayer());
if (getCheckpoint() == null) {
teleportLocation = getCheckpoint();
if (teleportLocation == null) {
teleportLocation = dGroup.getGameWorld().getLocStart();
if (getWolf() != null) {
getWolf().teleport(dGroup.getGameWorld().getLocStart());
}
} else {
teleportLocation = getCheckpoint();
if (getWolf() != null) {
teleportWolf = true;
}
}
if (teleportLocation == null) {
teleportLocation = dGroup.getGameWorld().getLocLobby();
}
if (teleportLocation == null) {
teleportLocation = getWorld().getSpawnLocation();
}
// Don't forget Doge!
if (getWolf() != null) {
teleportWolf = true;
}
// Respawn Items
@ -876,7 +898,8 @@ public class DPlayer extends DGlobalPlayer {
}
}
} else if (gameWorld != null) {
} else if (gameWorld
!= null) {
// Update Wolf
if (getWolf() != null) {
if (getWolf().isDead()) {
@ -913,7 +936,7 @@ public class DPlayer extends DGlobalPlayer {
}
if (teleportWolf) {
getWolf().teleport(getCheckpoint());
getWolf().teleport(teleportLocation);
}
if (respawnInventory) {