mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-07 19:30:48 +01:00
Use attached block for r triggers on wall signs; resolves #792
This commit is contained in:
parent
4de94822b2
commit
98f9f2c8de
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package de.erethon.dungeonsxl.trigger;
|
||||
|
||||
import de.erethon.caliburn.category.Category;
|
||||
import de.erethon.commons.misc.BlockUtil;
|
||||
import de.erethon.dungeonsxl.api.sign.Deactivatable;
|
||||
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
||||
import de.erethon.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||
@ -78,8 +80,15 @@ public class RedstoneTrigger extends Trigger {
|
||||
|
||||
/* Statics */
|
||||
public static RedstoneTrigger getOrCreate(Sign sign, DGameWorld gameWorld) {
|
||||
Block rtBlock = sign.getBlock();
|
||||
if (rtBlock != null) {
|
||||
Block rtBlock;
|
||||
if (Category.WALL_SIGNS.containsBlock(sign.getBlock())) {
|
||||
rtBlock = BlockUtil.getAttachedBlock(sign.getBlock());
|
||||
} else {
|
||||
rtBlock = sign.getBlock();
|
||||
}
|
||||
if (rtBlock == null) {
|
||||
return null;
|
||||
}
|
||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.REDSTONE)) {
|
||||
RedstoneTrigger trigger = (RedstoneTrigger) uncasted;
|
||||
if (trigger.rtBlock.equals(rtBlock)) {
|
||||
@ -88,8 +97,6 @@ public class RedstoneTrigger extends Trigger {
|
||||
}
|
||||
return new RedstoneTrigger(rtBlock);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void updateAll(DGameWorld gameWorld) {
|
||||
for (Trigger trigger : gameWorld.getTriggers(TriggerTypeDefault.REDSTONE)) {
|
||||
|
Loading…
Reference in New Issue
Block a user