mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fix Dungeon#containsFloor() for SFDs. Resolves #751
This commit is contained in:
parent
ff1c46a848
commit
05fbb76e79
@ -159,7 +159,11 @@ public interface Dungeon {
|
|||||||
* @return true if the floor is either in the floors list or the start / end floor.
|
* @return true if the floor is either in the floors list or the start / end floor.
|
||||||
*/
|
*/
|
||||||
default boolean containsFloor(ResourceWorld resource) {
|
default boolean containsFloor(ResourceWorld resource) {
|
||||||
|
if (isMultiFloor()) {
|
||||||
return getFloors().contains(resource) || getStartFloor().equals(resource) || getEndFloor().equals(resource);
|
return getFloors().contains(resource) || getStartFloor().equals(resource) || getEndFloor().equals(resource);
|
||||||
|
} else {
|
||||||
|
return getMap().equals(resource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
package de.erethon.dungeonsxl.api.sign;
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
import de.erethon.dungeonsxl.api.Trigger;
|
|
||||||
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -16,7 +16,6 @@ package de.erethon.dungeonsxl.api.sign;
|
|||||||
|
|
||||||
import de.erethon.commons.player.PlayerCollection;
|
import de.erethon.commons.player.PlayerCollection;
|
||||||
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
import de.erethon.dungeonsxl.api.Trigger;
|
|
||||||
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -67,6 +67,9 @@ public class DDungeon implements Dungeon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DungeonConfig getConfig() {
|
public DungeonConfig getConfig() {
|
||||||
|
if (!isMultiFloor()) {
|
||||||
|
throw new IllegalStateException("Tried to access the dungeon config of a single floor dungeon");
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,23 +95,23 @@ public class DDungeon implements Dungeon {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStartFloor(ResourceWorld startFloor) {
|
public void setStartFloor(ResourceWorld startFloor) {
|
||||||
config.setStartFloor(startFloor);
|
getConfig().setStartFloor(startFloor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceWorld getEndFloor() {
|
public ResourceWorld getEndFloor() {
|
||||||
return config.getEndFloor();
|
return getConfig().getEndFloor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEndFloor(ResourceWorld endFloor) {
|
public void setEndFloor(ResourceWorld endFloor) {
|
||||||
config.setEndFloor(endFloor);
|
getConfig().setEndFloor(endFloor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ResourceWorld> getFloors() {
|
public List<ResourceWorld> getFloors() {
|
||||||
if (isMultiFloor()) {
|
if (isMultiFloor()) {
|
||||||
return config.getFloors();
|
return getConfig().getFloors();
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<>(Arrays.asList(map));
|
return new ArrayList<>(Arrays.asList(map));
|
||||||
}
|
}
|
||||||
@ -116,42 +119,42 @@ public class DDungeon implements Dungeon {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addFloor(ResourceWorld resource) {
|
public void addFloor(ResourceWorld resource) {
|
||||||
config.addFloor(resource);
|
getConfig().addFloor(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeFloor(ResourceWorld resource) {
|
public void removeFloor(ResourceWorld resource) {
|
||||||
config.removeFloor(resource);
|
getConfig().removeFloor(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFloorCount() {
|
public int getFloorCount() {
|
||||||
return config.getFloorCount();
|
return getConfig().getFloorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFloorCount(int floorCount) {
|
public void setFloorCount(int floorCount) {
|
||||||
config.setFloorCount(floorCount);
|
getConfig().setFloorCount(floorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getRemoveWhenPlayed() {
|
public boolean getRemoveWhenPlayed() {
|
||||||
return config.getRemoveWhenPlayed();
|
return getConfig().getRemoveWhenPlayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoveWhenPlayed(boolean removeWhenPlayed) {
|
public void setRemoveWhenPlayed(boolean removeWhenPlayed) {
|
||||||
config.setRemoveWhenPlayed(removeWhenPlayed);
|
getConfig().setRemoveWhenPlayed(removeWhenPlayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameRuleContainer getOverrideValues() {
|
public GameRuleContainer getOverrideValues() {
|
||||||
return config.getOverrideValues();
|
return getConfig().getOverrideValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameRuleContainer getDefaultValues() {
|
public GameRuleContainer getDefaultValues() {
|
||||||
return config.getDefaultValues();
|
return getConfig().getDefaultValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -191,7 +194,7 @@ public class DDungeon implements Dungeon {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return config.getStartFloor() != null && config.getEndFloor() != null;
|
return getConfig().getStartFloor() != null && getConfig().getEndFloor() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
|
Loading…
Reference in New Issue
Block a user