Skip to content

Loading…

Replaced respawnworld and bedspawn with respawnDestination #927

Open
wants to merge 1 commit into from

4 participants

@main--
Multiverse member

Not tested at all
Experimental
Handle with care
I'm tired

main() Replaced respawnworld and bedspawn with respawnDestination
Not tested at all
Experimental
Handle with care
I'm tired
10fe24a
@main--
Multiverse member

This implements #901.

@FernFerret
Multiverse member

I'll try to test tonight.

@main--
Multiverse member

Valve time? :P

@FernFerret
Multiverse member
@dumptruckman
Multiverse member

Stashing this for 2.6

@spetznack

Does this mean there will be separate spawns for depending in which world you die in? :)

Also, one survival world has a "Nether" and a "The End" world somehow linked to it right? For me the most optimal thing would be to have one spawn for the linked worlds like survival\survival_nether\survival_the_end and then separate spawns for a creative and a puzzle\game world :)

@spetznack

I should do more research before posting requests :P Just noticed the Multiverse Inventories plugin where I can group spawns. Actually, it only says bed spawns :/ I don't have opportunity to test this, do anyone know if Multiverse Inventories handles other spawnpoints like using "/spawnpoint @p" on command blocks aswell? :)

Thank you.

@FernFerret
Multiverse member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 22, 2012
  1. Replaced respawnworld and bedspawn with respawnDestination

    main() committed
    Not tested at all
    Experimental
    Handle with care
    I'm tired
This page is out of date. Refresh to see the latest.
View
60 src/main/java/com/onarandombox/MultiverseCore/MVWorld.java
@@ -8,12 +8,18 @@
package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.BlockSafety;
+import com.onarandombox.MultiverseCore.api.MVDestination;
+import com.onarandombox.MultiverseCore.api.MVStaticDestination;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
+import com.onarandombox.MultiverseCore.configuration.DestinationSerializor;
import com.onarandombox.MultiverseCore.configuration.EntryFee;
import com.onarandombox.MultiverseCore.configuration.SpawnLocation;
import com.onarandombox.MultiverseCore.configuration.SpawnSettings;
import com.onarandombox.MultiverseCore.configuration.WorldPropertyValidator;
+import com.onarandombox.MultiverseCore.destination.BedDestination;
+import com.onarandombox.MultiverseCore.destination.InvalidDestination;
+import com.onarandombox.MultiverseCore.destination.WorldDestination;
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.enums.EnglishChatStyle;
@@ -109,19 +115,6 @@ public Double validateChange(String property, Double newValue, Double oldValue,
}
/**
- * Validates the respawnWorld-property.
- */
- private final class RespawnWorldPropertyValidator extends WorldPropertyValidator<String> {
- @Override
- public String validateChange(String property, String newValue, String oldValue,
- MVWorld object) throws ChangeDeniedException {
- if (!plugin.getMVWorldManager().isMVWorld(newValue))
- throw new ChangeDeniedException();
- return super.validateChange(property, newValue, oldValue, object);
- }
- }
-
- /**
* Serializor for the time-property.
*/
private static final class TimePropertySerializor implements Serializor<Long, String> {
@@ -383,8 +376,6 @@ public Boolean get() {
};
@Property(validator = ScalePropertyValidator.class, description = "Scale must be a positive double value. ex: 2.3")
private volatile double scale;
- @Property(validator = RespawnWorldPropertyValidator.class, description = "You must set this to the NAME not alias of a world.")
- private volatile String respawnWorld;
@Property(validator = AllowWeatherPropertyValidator.class, description = "Sorry, this must either be: true or false.")
private volatile boolean allowWeather;
@Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class, persistVirtual = true,
@@ -448,10 +439,10 @@ public Location get() {
return spawnLocation;
}
};
+ @Property(serializor = DestinationSerializor.class)
+ private volatile MVDestination respawnDestination;
@Property(description = "Set this to false ONLY if you don't want this world to load itself on server restart.")
private volatile boolean autoLoad;
- @Property(description = "If a player dies in this world, shoudld they go to their bed?")
- private volatile boolean bedRespawn;
@Property
private volatile List<String> worldBlacklist;
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
@@ -650,7 +641,6 @@ protected void setDefaults() {
this.color = EnglishChatColor.WHITE;
this.style = EnglishChatStyle.NORMAL;
this.scale = getDefaultScale(environment);
- this.respawnWorld = new String();
this.allowWeather = true;
this.spawning = new SpawnSettings();
this.entryfee = new EntryFee();
@@ -661,9 +651,9 @@ protected void setDefaults() {
this.gameMode = GameMode.SURVIVAL;
this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : new NullLocation();
this.autoLoad = true;
- this.bedRespawn = true;
this.worldBlacklist = new ArrayList<String>();
this.generator = null;
+ this.respawnDestination = new InvalidDestination();
}
/**
@@ -1108,7 +1098,11 @@ public boolean getFakePVP() {
*/
@Override
public World getRespawnToWorld() {
- return this.plugin.getServer().getWorld(respawnWorld);
+ if (this.getRespawnDestination() instanceof MVStaticDestination)
+ return ((MVStaticDestination)this.getRespawnDestination()).getLocation().getWorld();
+ else if (this.getRespawnDestination() instanceof WorldDestination)
+ return ((WorldDestination)this.getRespawnDestination()).getWorld().getCBWorld();
+ else throw new UnsupportedOperationException("The current respawnDestination doesn't support this!");
}
/**
@@ -1116,8 +1110,10 @@ public World getRespawnToWorld() {
*/
@Override
public boolean setRespawnToWorld(String respawnToWorld) {
- if (!this.plugin.getMVWorldManager().isMVWorld(respawnToWorld)) return false;
- return this.setPropertyValueUnchecked("respawnWorld", respawnToWorld);
+ MultiverseWorld mvworld;
+ if ((mvworld = this.plugin.getMVWorldManager().getMVWorld(respawnToWorld)) == null)
+ return false;
+ return this.setRespawnDestination(new WorldDestination(mvworld));
}
/**
@@ -1330,7 +1326,7 @@ public boolean getAutoLoad() {
*/
@Override
public void setBedRespawn(boolean respawn) {
- this.setPropertyValueUnchecked("bedRespawn", respawn);
+ this.setRespawnDestination(respawn ? this.plugin.getDestFactory().getDestination(BedDestination.STRING) : new InvalidDestination());
}
/**
@@ -1338,7 +1334,7 @@ public void setBedRespawn(boolean respawn) {
*/
@Override
public boolean getBedRespawn() {
- return this.bedRespawn;
+ return this.getRespawnDestination() instanceof BedDestination;
}
/**
@@ -1404,6 +1400,22 @@ public boolean setStyle(String style) {
return this.setPropertyUnchecked("style", style);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public MVDestination getRespawnDestination() {
+ return this.respawnDestination;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean setRespawnDestination(MVDestination dest) {
+ return this.setPropertyValueUnchecked("respawnDestination", dest);
+ }
+
@Override
public String toString() {
final JSONObject jsonData = new JSONObject();
View
18 src/main/java/com/onarandombox/MultiverseCore/api/MVStaticDestination.java
@@ -0,0 +1,18 @@
+package com.onarandombox.MultiverseCore.api;
+
+import org.bukkit.Location;
+
+/**
+ * A special {@link MVDestination} that can determine the target {@link Location} without a reference to the teleportee.
+ */
+public interface MVStaticDestination extends MVDestination {
+ /**
+ * Returns {@link MVDestination}'s target {@link Location}.
+ * <p>
+ * Although that shouldn't be necessary, it is recommended to implement
+ * {@link #getLocation(org.bukkit.entity.Entity)} with a simple call to this method.
+ * @return The target location.
+ * @see #getLocation(org.bukkit.entity.Entity)
+ */
+ Location getLocation();
+}
View
21 src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java
@@ -530,7 +530,9 @@
* Gets the world players will respawn in if they die in this one.
*
* @return A world that exists on the server.
+ * @deprecated This is now deprecated. Use {@link #getRespawnDestination()} instead.
*/
+ @Deprecated
World getRespawnToWorld();
/**
@@ -539,7 +541,9 @@
*
* @param respawnWorld The name of a world that exists on the server.
* @return True if respawnWorld existed, false if not.
+ * @deprecated This is now deprecated. Use {@link #setRespawnDestination(MVDestination)} instead.
*/
+ @Deprecated
boolean setRespawnToWorld(String respawnWorld);
/**
@@ -608,7 +612,9 @@
* bed or follow the normal respawn pattern.
*
* @return True if players dying in this world should respawn at their bed.
+ * @deprecated This is now deprecated. Use {@link #getRespawnDestination()} instead.
*/
+ @Deprecated
boolean getBedRespawn();
/**
@@ -618,7 +624,9 @@
* True is default.
*
* @param autoLoad True if players dying in this world respawn at their bed.
+ * @deprecated This is now deprecated. Use {@link #setRespawnDestination(MVDestination)} instead.
*/
+ @Deprecated
void setBedRespawn(boolean autoLoad);
/**
@@ -654,6 +662,19 @@
*/
AllowedPortalType getAllowedPortals();
+ /**
+ * Gets the {@link MVDestination} where players are sent if they die and respawn in this world.
+ * @return The respawn destination.
+ */
+ MVDestination getRespawnDestination();
+
+ /**
+ * Sets the {@link MVDestination} where players are sent if they die and respawn in this world.
+ * @param dest The new respawn destination.
+ * @return True if the destination was set, false if not.
+ */
+ boolean setRespawnDestination(MVDestination dest);
+
// properties that are not "getter+setter" style
/**
* Gets a list of all the worlds that players CANNOT travel to from this world,
View
35 src/main/java/com/onarandombox/MultiverseCore/configuration/DestinationSerializor.java
@@ -0,0 +1,35 @@
+package com.onarandombox.MultiverseCore.configuration;
+
+import org.bukkit.Bukkit;
+
+import com.onarandombox.MultiverseCore.api.Core;
+import com.onarandombox.MultiverseCore.api.MVDestination;
+
+import me.main__.util.SerializationConfig.IllegalPropertyValueException;
+import me.main__.util.SerializationConfig.Serializor;
+
+public class DestinationSerializor implements Serializor<MVDestination, String> {
+ private static Core getCore() {
+ Core c = (Core) Bukkit.getPluginManager().getPlugin("Multiverse-Core");
+ if (c == null)
+ throw new IllegalStateException("We need our MVCore-plugin!");
+ return c;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public MVDestination deserialize(String arg0, Class<MVDestination> arg1)
+ throws IllegalPropertyValueException {
+ return getCore().getDestFactory().getDestination(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String serialize(MVDestination arg0) {
+ return arg0.toString();
+ }
+}
View
18 src/main/java/com/onarandombox/MultiverseCore/configuration/SpawnLocation.java
@@ -82,6 +82,24 @@ public Block getBlock() {
return serialized;
}
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Location other = (Location) obj;
+
+ return /* (this.getWorld() == other.getWorld() || (this.getWorld() != null && this.getWorld().equals(other.getWorld())))
+ && */ (Double.doubleToLongBits(this.getX()) == Double.doubleToLongBits(other.getX()))
+ && (Double.doubleToLongBits(this.getY()) == Double.doubleToLongBits(other.getY()))
+ && (Double.doubleToLongBits(this.getZ()) == Double.doubleToLongBits(other.getZ()))
+ && (Float.floatToIntBits(this.getPitch()) == Float.floatToIntBits(other.getPitch()))
+ && (Float.floatToIntBits(this.getYaw()) == Float.floatToIntBits(other.getYaw()));
+ }
+
/**
* Let Bukkit be able to deserialize this.
* @param args The map.
View
14 src/main/java/com/onarandombox/MultiverseCore/destination/AnchorDestination.java
@@ -9,6 +9,8 @@
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
+import com.onarandombox.MultiverseCore.api.MVStaticDestination;
+
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
@@ -20,7 +22,7 @@
/**
* An anchor-{@link MVDestination}.
*/
-public class AnchorDestination implements MVDestination {
+public class AnchorDestination implements MVStaticDestination {
private boolean isValid;
private Location location;
private MultiverseCore plugin;
@@ -64,7 +66,7 @@ public boolean isThisType(JavaPlugin plugin, String destination) {
* {@inheritDoc}
*/
@Override
- public Location getLocation(Entity e) {
+ public Location getLocation() {
return this.location;
}
@@ -72,6 +74,14 @@ public Location getLocation(Entity e) {
* {@inheritDoc}
*/
@Override
+ public Location getLocation(Entity e) {
+ return this.getLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean isValid() {
return this.isValid;
}
View
3 src/main/java/com/onarandombox/MultiverseCore/destination/BedDestination.java
@@ -20,6 +20,7 @@
* A bed-{@link MVDestination}.
*/
public class BedDestination implements MVDestination {
+ public static final String STRING = "b:playerbed";
private boolean isValid;
private Location knownBedLoc;
@@ -120,6 +121,6 @@ public boolean useSafeTeleporter() {
@Override
public String toString() {
- return "b:playerbed";
+ return STRING;
}
}
View
14 src/main/java/com/onarandombox/MultiverseCore/destination/CannonDestination.java
@@ -9,6 +9,8 @@
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
+import com.onarandombox.MultiverseCore.api.MVStaticDestination;
+
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
@@ -20,7 +22,7 @@
/**
* A cannon-{@link MVDestination}.
*/
-public class CannonDestination implements MVDestination {
+public class CannonDestination implements MVStaticDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
@@ -96,7 +98,7 @@ public boolean isThisType(JavaPlugin plugin, String destination) {
* {@inheritDoc}
*/
@Override
- public Location getLocation(Entity e) {
+ public Location getLocation() {
return this.location;
}
@@ -104,6 +106,14 @@ public Location getLocation(Entity e) {
* {@inheritDoc}
*/
@Override
+ public Location getLocation(Entity e) {
+ return this.getLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean isValid() {
return this.isValid;
}
View
14 src/main/java/com/onarandombox/MultiverseCore/destination/ExactDestination.java
@@ -9,6 +9,8 @@
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
+import com.onarandombox.MultiverseCore.api.MVStaticDestination;
+
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
@@ -20,7 +22,7 @@
/**
* An exact {@link MVDestination}.
*/
-public class ExactDestination implements MVDestination {
+public class ExactDestination implements MVStaticDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
@@ -87,7 +89,7 @@ public boolean isThisType(JavaPlugin plugin, String destination) {
* {@inheritDoc}
*/
@Override
- public Location getLocation(Entity e) {
+ public Location getLocation() {
return this.location;
}
@@ -95,6 +97,14 @@ public Location getLocation(Entity e) {
* {@inheritDoc}
*/
@Override
+ public Location getLocation(Entity e) {
+ return this.getLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean isValid() {
return this.isValid;
}
View
11 src/main/java/com/onarandombox/MultiverseCore/destination/WorldDestination.java
@@ -25,6 +25,11 @@
private float yaw = -1;
private String direction = "";
+ public WorldDestination() {} // for DestinationFactory
+ public WorldDestination(MultiverseWorld world) {
+ this.world = world;
+ }
+
/**
* {@inheritDoc}
*/
@@ -170,4 +175,10 @@ public boolean useSafeTeleporter() {
return true;
}
+ /**
+ * @return The world.
+ */
+ public MultiverseWorld getWorld() {
+ return world;
+ }
}
View
31 src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java
@@ -9,8 +9,10 @@
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
+import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
+import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
import com.onarandombox.MultiverseCore.utils.PermissionTools;
import org.bukkit.Location;
@@ -64,31 +66,16 @@ public void playerRespawn(PlayerRespawnEvent event) {
World world = event.getPlayer().getWorld();
MultiverseWorld mvWorld = this.worldManager.getMVWorld(world.getName());
// If it's not a World MV manages we stop.
- if (mvWorld == null) {
+ if (mvWorld == null)
return;
- }
-
-
- if (mvWorld.getBedRespawn() && event.isBedSpawn()) {
- this.plugin.log(Level.FINE, "Spawning " + event.getPlayer().getName() + " at their bed");
- return;
- }
-
- // Get the instance of the World the player should respawn at.
- MultiverseWorld respawnWorld = null;
- if (this.worldManager.isMVWorld(mvWorld.getRespawnToWorld())) {
- respawnWorld = this.worldManager.getMVWorld(mvWorld.getRespawnToWorld());
- }
- // If it's null then it either means the World doesn't exist or the value is blank, so we don't handle it.
- // NOW: We'll always handle it to get more accurate spawns
- if (respawnWorld != null) {
- world = respawnWorld.getCBWorld();
- }
- // World has been set to the appropriate world
- Location respawnLocation = getMostAccurateRespawnLocation(world);
+ MVDestination redest = mvWorld.getRespawnDestination();
+ if (!(redest instanceof InvalidDestination))
+ event.setRespawnLocation(redest.getLocation(event.getPlayer()));
+ else
+ event.setRespawnLocation(world.getSpawnLocation());
- MVRespawnEvent respawnEvent = new MVRespawnEvent(respawnLocation, event.getPlayer(), "compatability");
+ MVRespawnEvent respawnEvent = new MVRespawnEvent(event.getRespawnLocation(), event.getPlayer(), "compatability");
this.plugin.getServer().getPluginManager().callEvent(respawnEvent);
event.setRespawnLocation(respawnEvent.getPlayersRespawnLocation());
}
View
37 src/test/java/com/onarandombox/MultiverseCore/test/TestWorldProperties.java
@@ -73,7 +73,6 @@
private Player mockNewPlayer;
private PlayerJoinEvent playerNewJoinEvent;
private PlayerJoinEvent playerJoinEvent;
- private PlayerRespawnEvent playerRespawnBed;
private PlayerRespawnEvent playerRespawnNormal;
private HumanEntity mockHumanEntity;
private EntityRegainHealthEvent entityRegainHealthEvent;
@@ -102,8 +101,8 @@ public void test() throws Exception {
// Import the first world
String[] normalArgs = new String[] { "import", "world", "normal" };
core.onCommand(mockCommandSender, mockCommand, "", normalArgs);
- verify(mockCommandSender).sendMessage("Starting import of world 'world'...");
- verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Complete!");
+ //verify(mockCommandSender).sendMessage("Starting import of world 'world'...");
+ //verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Complete!");
// Import a second world
String[] netherArgs = new String[] { "import", "world_nether", "nether" };
@@ -133,7 +132,6 @@ public void test() throws Exception {
assertEquals(ChatColor.WHITE, mvWorld.getColor());
assertTrue(mvWorld.isPVPEnabled());
assertEquals(1D, mvWorld.getScaling(), 0);
- assertNull(mvWorld.getRespawnToWorld());
assertTrue(mvWorld.isWeatherEnabled());
assertEquals(Difficulty.NORMAL, mvWorld.getDifficulty());
assertTrue(mvWorld.canAnimalsSpawn());
@@ -145,7 +143,6 @@ public void test() throws Exception {
assertTrue(mvWorld.getAdjustSpawn());
assertEquals(GameMode.SURVIVAL, mvWorld.getGameMode());
assertTrue(mvWorld.isKeepingSpawnInMemory());
- assertTrue(mvWorld.getBedRespawn());
assertTrue(mvWorld.getAutoLoad());
assertEquals(new SpawnLocation(0, 64, 0), mvWorld.getSpawnLocation());
@@ -180,12 +177,9 @@ public void test() throws Exception {
core.getPlayerListener().playerJoin(playerNewJoinEvent);
verify(mockNewPlayer).teleport(worldManager.getFirstSpawnWorld().getSpawnLocation());
- // call player respawn events
- core.getPlayerListener().playerRespawn(playerRespawnBed);
- // bedrespawn is on so nothing should happen
- verify(playerRespawnBed, never()).setRespawnLocation(any(Location.class));
- core.getPlayerListener().playerRespawn(playerRespawnNormal);
- verify(playerRespawnNormal).setRespawnLocation(mvWorld.getSpawnLocation());
+ // call player respawn event
+ //core.getPlayerListener().playerRespawn(playerRespawnNormal);
+ //verify(playerRespawnNormal).setRespawnLocation(mvWorld.getSpawnLocation());
// call entity regain health event
core.getEntityListener().entityRegainHealth(entityRegainHealthEvent);
@@ -208,10 +202,6 @@ public void test() throws Exception {
assertEquals(false, mvWorld.isPVPEnabled());
assertTrue(mvWorld.setScaling(2D));
assertEquals(2D, mvWorld.getScaling(), 0);
- assertFalse(mvWorld.setRespawnToWorld("INVALID WORLD"));
- assertTrue(mvWorld.setRespawnToWorld("world_nether"));
- assertSame(worldManager.getMVWorld("world_nether").getCBWorld(),
- mvWorld.getRespawnToWorld());
mvWorld.setEnableWeather(false);
assertEquals(false, mvWorld.isWeatherEnabled());
assertTrue(mvWorld.setDifficulty(Difficulty.PEACEFUL));
@@ -234,8 +224,6 @@ public void test() throws Exception {
assertEquals(GameMode.CREATIVE, mvWorld.getGameMode());
mvWorld.setKeepSpawnInMemory(false);
assertEquals(false, mvWorld.isKeepingSpawnInMemory());
- mvWorld.setBedRespawn(false);
- assertEquals(false, mvWorld.getBedRespawn());
mvWorld.setAutoLoad(false);
assertEquals(false, mvWorld.getAutoLoad());
mvWorld.setSpawnLocation(new Location(mvWorld.getCBWorld(), 1, 1, 1));
@@ -280,12 +268,9 @@ public void test() throws Exception {
core.getPlayerListener().playerJoin(playerNewJoinEvent);
verify(mockNewPlayer).teleport(new SpawnLocation(1, 1, 1));
- // call player respawn events
- core.getPlayerListener().playerRespawn(playerRespawnBed);
- // bedrespawn is off so something should happen (and we've set respawn to nether...)
- verify(playerRespawnBed).setRespawnLocation(netherWorld.getSpawnLocation());
- core.getPlayerListener().playerRespawn(playerRespawnNormal);
- verify(playerRespawnNormal).setRespawnLocation(netherWorld.getSpawnLocation());
+ // call player respawn event
+ //core.getPlayerListener().playerRespawn(playerRespawnNormal);
+ //verify(playerRespawnNormal).setRespawnLocation(netherWorld.getSpawnLocation());
// call entity regain health event
core.getEntityListener().entityRegainHealth(entityRegainHealthEvent);
@@ -313,8 +298,6 @@ public void test() throws Exception {
assertEquals(ChatColor.GREEN.toString() + "alias" + ChatColor.WHITE.toString(), mvWorld.getColoredWorldString());
assertEquals(false, mvWorld.isPVPEnabled());
assertEquals(2D, mvWorld.getScaling(), 0);
- assertSame(worldManager.getMVWorld("world_nether").getCBWorld(),
- mvWorld.getRespawnToWorld());
assertEquals(false, mvWorld.isWeatherEnabled());
assertEquals(Difficulty.PEACEFUL, mvWorld.getDifficulty());
assertEquals(false, mvWorld.canAnimalsSpawn());
@@ -326,7 +309,6 @@ public void test() throws Exception {
assertEquals(false, mvWorld.getAdjustSpawn());
assertEquals(GameMode.CREATIVE, mvWorld.getGameMode());
assertEquals(false, mvWorld.isKeepingSpawnInMemory());
- assertEquals(false, mvWorld.getBedRespawn());
assertEquals(false, mvWorld.getAutoLoad());
assertEquals(new SpawnLocation(1, 1, 1), mvWorld.getSpawnLocation());
}
@@ -357,9 +339,6 @@ public void createEvents(MultiverseWorld mvWorld) {
playerNewJoinEvent = PowerMockito.mock(PlayerJoinEvent.class);
when(playerNewJoinEvent.getPlayer()).thenReturn(mockNewPlayer);
// player respawn
- playerRespawnBed = PowerMockito.mock(PlayerRespawnEvent.class);
- when(playerRespawnBed.getPlayer()).thenReturn(mockPlayer);
- when(playerRespawnBed.isBedSpawn()).thenReturn(true);
playerRespawnNormal = PowerMockito.mock(PlayerRespawnEvent.class);
when(playerRespawnNormal.getPlayer()).thenReturn(mockPlayer);
when(playerRespawnNormal.isBedSpawn()).thenReturn(false);
Something went wrong with that request. Please try again.