DungeonsXL/core/src/main/java/de/erethon/dungeonsxl/trigger/PresenceTrigger.java

52 lines
1.6 KiB
Java

/*
* Copyright (C) 2012-2023 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.trigger;
import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.trigger.LogicalExpression;
import de.erethon.dungeonsxl.api.trigger.TriggerListener;
import de.erethon.dungeonsxl.api.trigger.TriggerTypeKey;
/**
* @author Daniel Saukel
*/
public class PresenceTrigger extends DistanceTrigger {
public PresenceTrigger(DungeonsAPI api, TriggerListener owner, LogicalExpression expression, String value) {
super(api, owner, expression, value);
}
@Override
public char getKey() {
return TriggerTypeKey.PRESENCE;
}
@Override
public void onTrigger(boolean switching) {
setTriggered(true);
unregisterTrigger();
getListeners().clear();
getGameWorld().unregisterTrigger(this);
}
@Override
public void postTrigger() {
setTriggered(false);
}
}