mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
How did this happen? We're smarter than this!
This commit is contained in:
parent
d0042949fc
commit
53cd13b0ec
@ -169,6 +169,25 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
|
|||||||
public DungeonSign createDungeonSign(Sign sign, String[] lines) {
|
public DungeonSign createDungeonSign(Sign sign, String[] lines) {
|
||||||
DungeonSign dSign = super.createDungeonSign(sign, lines);
|
DungeonSign dSign = super.createDungeonSign(sign, lines);
|
||||||
|
|
||||||
|
String[] triggerTypes = lines[3].replaceAll("\\s", "").split(",");
|
||||||
|
for (String triggerString : triggerTypes) {
|
||||||
|
if (triggerString.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = triggerString.substring(0, 1);
|
||||||
|
String value = null;
|
||||||
|
if (triggerString.length() > 1) {
|
||||||
|
value = triggerString.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Trigger trigger = Trigger.getOrCreate(plugin, id, value, dSign);
|
||||||
|
if (trigger != null) {
|
||||||
|
trigger.addListener(dSign);
|
||||||
|
dSign.addTrigger(trigger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dSign.isOnDungeonInit()) {
|
if (dSign.isOnDungeonInit()) {
|
||||||
dSign.initialize();
|
dSign.initialize();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import de.erethon.dungeonsxl.api.player.InstancePlayer;
|
|||||||
import de.erethon.dungeonsxl.api.player.PlayerCache;
|
import de.erethon.dungeonsxl.api.player.PlayerCache;
|
||||||
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
||||||
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
import de.erethon.dungeonsxl.trigger.Trigger;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -118,26 +117,6 @@ public abstract class DInstanceWorld implements InstanceWorld {
|
|||||||
Constructor constructor = clss.getConstructor(DungeonsAPI.class, Sign.class, String[].class, InstanceWorld.class);
|
Constructor constructor = clss.getConstructor(DungeonsAPI.class, Sign.class, String[].class, InstanceWorld.class);
|
||||||
DungeonSign dSign = (DungeonSign) constructor.newInstance(plugin, sign, lines, this);
|
DungeonSign dSign = (DungeonSign) constructor.newInstance(plugin, sign, lines, this);
|
||||||
signs.put(sign.getBlock(), dSign);
|
signs.put(sign.getBlock(), dSign);
|
||||||
|
|
||||||
String[] triggerTypes = lines[3].replaceAll("\\s", "").split(",");
|
|
||||||
for (String triggerString : triggerTypes) {
|
|
||||||
if (triggerString.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String id = triggerString.substring(0, 1);
|
|
||||||
String value = null;
|
|
||||||
if (triggerString.length() > 1) {
|
|
||||||
value = triggerString.substring(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Trigger trigger = Trigger.getOrCreate(plugin, id, value, dSign);
|
|
||||||
if (trigger != null) {
|
|
||||||
trigger.addListener(dSign);
|
|
||||||
dSign.addTrigger(trigger);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dSign;
|
return dSign;
|
||||||
|
|
||||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
|
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
|
||||||
|
Loading…
Reference in New Issue
Block a user