mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Fix #52
This commit is contained in:
parent
43e6a04da1
commit
1cdc78dda3
@ -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.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
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.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
import io.github.dre2n.dungeonsxl.game.GameChest;
|
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.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GameSign;
|
import io.github.dre2n.dungeonsxl.global.GameSign;
|
||||||
import io.github.dre2n.dungeonsxl.global.GlobalProtection;
|
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.task.RespawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger;
|
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 java.util.ArrayList;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -376,29 +376,26 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
|
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
|
||||||
|
|
||||||
if (dPlayer.getCheckpoint() == null) {
|
Location respawn = dPlayer.getCheckpoint();
|
||||||
event.setRespawnLocation(dGroup.getGameWorld().getLocStart());
|
|
||||||
|
|
||||||
// Da einige Plugins einen anderen Respawn setzen wird
|
if (respawn == null) {
|
||||||
// ein Scheduler gestartet der den Player nach einer
|
respawn = dGroup.getGameWorld().getLocStart();
|
||||||
// Sekunde teleportiert.
|
}
|
||||||
new RespawnTask(player, dGroup.getGameWorld().getLocStart()).runTaskLater(plugin, 10L);
|
|
||||||
|
|
||||||
if (dPlayer.getWolf() != null) {
|
if (respawn == null) {
|
||||||
dPlayer.getWolf().teleport(dGroup.getGameWorld().getLocStart());
|
respawn = dGroup.getGameWorld().getLocLobby();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if (respawn == null) {
|
||||||
event.setRespawnLocation(dPlayer.getCheckpoint());
|
respawn = dGroup.getGameWorld().getWorld().getSpawnLocation();
|
||||||
|
}
|
||||||
|
|
||||||
// Da einige Plugins einen anderen Respawn setzen wird
|
// Because some plugins set another respawn point, DXL teleports a few ticks later.
|
||||||
// ein Scheduler gestartet der den Player nach einer
|
new RespawnTask(player, respawn).runTaskLater(plugin, 10);
|
||||||
// Sekunde teleportiert.
|
|
||||||
new RespawnTask(player, dPlayer.getCheckpoint()).runTaskLater(plugin, 10L);
|
|
||||||
|
|
||||||
if (dPlayer.getWolf() != null) {
|
// Don't forget Doge!
|
||||||
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
|
if (dPlayer.getWolf() != null) {
|
||||||
}
|
dPlayer.getWolf().teleport(respawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,11 +619,24 @@ public class DPlayer extends DGlobalPlayer {
|
|||||||
|
|
||||||
public void respawn() {
|
public void respawn() {
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
if (checkpoint == null) {
|
|
||||||
PlayerUtil.secureTeleport(getPlayer(), dGroup.getGameWorld().getLocStart());
|
Location respawn = checkpoint;
|
||||||
} else {
|
|
||||||
PlayerUtil.secureTeleport(getPlayer(), 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) {
|
if (wolf != null) {
|
||||||
wolf.teleport(getPlayer());
|
wolf.teleport(getPlayer());
|
||||||
}
|
}
|
||||||
@ -833,7 +846,7 @@ public class DPlayer extends DGlobalPlayer {
|
|||||||
|
|
||||||
public void update(boolean updateSecond) {
|
public void update(boolean updateSecond) {
|
||||||
boolean locationValid = true;
|
boolean locationValid = true;
|
||||||
Location teleportLocation = getPlayer().getLocation();
|
Location teleportLocation = player.getLocation();
|
||||||
boolean teleportWolf = false;
|
boolean teleportWolf = false;
|
||||||
boolean respawnInventory = false;
|
boolean respawnInventory = false;
|
||||||
boolean offline = false;
|
boolean offline = false;
|
||||||
@ -855,18 +868,27 @@ public class DPlayer extends DGlobalPlayer {
|
|||||||
teleportLocation = editWorld.getLobby();
|
teleportLocation = editWorld.getLobby();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (gameWorld != null) {
|
} else if (gameWorld != null) {
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
if (getCheckpoint() == null) {
|
|
||||||
|
teleportLocation = getCheckpoint();
|
||||||
|
|
||||||
|
if (teleportLocation == null) {
|
||||||
teleportLocation = dGroup.getGameWorld().getLocStart();
|
teleportLocation = dGroup.getGameWorld().getLocStart();
|
||||||
if (getWolf() != null) {
|
}
|
||||||
getWolf().teleport(dGroup.getGameWorld().getLocStart());
|
|
||||||
}
|
if (teleportLocation == null) {
|
||||||
} else {
|
teleportLocation = dGroup.getGameWorld().getLocLobby();
|
||||||
teleportLocation = getCheckpoint();
|
}
|
||||||
if (getWolf() != null) {
|
|
||||||
teleportWolf = true;
|
if (teleportLocation == null) {
|
||||||
}
|
teleportLocation = getWorld().getSpawnLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't forget Doge!
|
||||||
|
if (getWolf() != null) {
|
||||||
|
teleportWolf = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Respawn Items
|
// Respawn Items
|
||||||
@ -876,7 +898,8 @@ public class DPlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (gameWorld != null) {
|
} else if (gameWorld
|
||||||
|
!= null) {
|
||||||
// Update Wolf
|
// Update Wolf
|
||||||
if (getWolf() != null) {
|
if (getWolf() != null) {
|
||||||
if (getWolf().isDead()) {
|
if (getWolf().isDead()) {
|
||||||
@ -913,7 +936,7 @@ public class DPlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (teleportWolf) {
|
if (teleportWolf) {
|
||||||
getWolf().teleport(getCheckpoint());
|
getWolf().teleport(teleportLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (respawnInventory) {
|
if (respawnInventory) {
|
||||||
|
Loading…
Reference in New Issue
Block a user