mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-26 04:35:43 +01:00
Merge pull request #2307 from BentoBoxWorld/2305_respawn_to_home
Change respawn point to the default home on the island. #2305
This commit is contained in:
commit
4ddb204fcf
@ -55,7 +55,7 @@ public class IslandRespawnListener extends FlagListener {
|
||||
*
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||
final UUID worldUUID = respawn.remove(e.getPlayer().getUniqueId());
|
||||
if (worldUUID == null) {
|
||||
@ -67,11 +67,11 @@ public class IslandRespawnListener extends FlagListener {
|
||||
return; // world no longer available
|
||||
}
|
||||
World w = Util.getWorld(world);
|
||||
|
||||
String ownerName = e.getPlayer().getName();
|
||||
if (w != null) {
|
||||
final Location respawnLocation = getIslands().getPrimaryIsland(world, e.getPlayer().getUniqueId())
|
||||
.getSpawnPoint(world.getEnvironment());
|
||||
if (respawnLocation != null) {
|
||||
final Location respawnLocation = getIslands().getHomeLocation(world, e.getPlayer().getUniqueId());
|
||||
if (respawnLocation != null && getIslands().isSafeLocation(respawnLocation)) {
|
||||
e.setRespawnLocation(respawnLocation);
|
||||
// Get the island owner name
|
||||
Island island = BentoBox.getInstance().getIslands().getIsland(w, User.getInstance(e.getPlayer()));
|
||||
|
@ -114,9 +114,10 @@ public class IslandRespawnListenerTest {
|
||||
when(iwm.getAddon(any())).thenReturn(opGma);
|
||||
safeLocation = mock(Location.class);
|
||||
when(safeLocation.getWorld()).thenReturn(world);
|
||||
when(island.getSpawnPoint(Environment.NORMAL)).thenReturn(safeLocation);
|
||||
when(im.getHomeLocation(eq(world), any(UUID.class))).thenReturn(safeLocation);
|
||||
when(im.getPrimaryIsland(any(), any())).thenReturn(island);
|
||||
when(im.hasIsland(any(), any(UUID.class))).thenReturn(true);
|
||||
when(im.isSafeLocation(safeLocation)).thenReturn(true);
|
||||
when(plugin.getIslands()).thenReturn(im);
|
||||
|
||||
// when(im.getSafeHomeLocation(any(), any(),
|
||||
|
Loading…
Reference in New Issue
Block a user