Use messages game rule for hologram signs

This commit is contained in:
Daniel Saukel 2020-03-21 17:17:33 +01:00
parent 802871393b
commit ed10a03629

View File

@ -21,6 +21,7 @@ import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
import de.erethon.caliburn.item.ExItem; import de.erethon.caliburn.item.ExItem;
import de.erethon.commons.misc.NumberUtil; import de.erethon.commons.misc.NumberUtil;
import de.erethon.dungeonsxl.api.DungeonsAPI; import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.dungeon.GameRule;
import de.erethon.dungeonsxl.api.sign.Passive; import de.erethon.dungeonsxl.api.sign.Passive;
import de.erethon.dungeonsxl.api.world.InstanceWorld; import de.erethon.dungeonsxl.api.world.InstanceWorld;
import de.erethon.dungeonsxl.player.DPermission; import de.erethon.dungeonsxl.player.DPermission;
@ -63,7 +64,7 @@ public class HologramSign extends Passive {
@Override @Override
public boolean isSetToAir() { public boolean isSetToAir() {
return false; return true;
} }
@Override @Override
@ -77,7 +78,12 @@ public class HologramSign extends Passive {
@Override @Override
public void initialize() { public void initialize() {
String[] holoLines = getLine(1).split("/"); String text = getGameWorld().getDungeon().getRules().getState(GameRule.MESSAGES).get(NumberUtil.parseInt(getLine(1)));
if (text == null) {
markAsErroneous("Unknown message, ID: " + getLine(1));
return;
}
String[] holoLines = text.split("/");
Location location = getSign().getLocation(); Location location = getSign().getLocation();
location = location.add(0.5, NumberUtil.parseDouble(getLine(2)), 0.5); location = location.add(0.5, NumberUtil.parseDouble(getLine(2)), 0.5);