use of io.github.wysohn.triggerreactor.core.manager.location.SimpleChunkLocation in project TriggerReactor by wysohn.
the class AbstractAreaTriggerManager method deleteArea.
/**
* Try to remove Area Trigger by given name
* @param name
* @return false if can't find any Area Trigger with the name; true if deleted.
*/
public boolean deleteArea(String name) {
AreaTrigger trigger = nameMapper.get(name);
if (trigger == null)
return false;
for (SimpleChunkLocation scloc : Area.getAllChunkLocations(trigger.area)) {
Map<Area, AreaTrigger> map = areaTriggers.get(scloc);
map.remove(trigger.area);
}
deleteInfo(trigger);
nameMapper.remove(name);
return true;
}
use of io.github.wysohn.triggerreactor.core.manager.location.SimpleChunkLocation in project TriggerReactor by wysohn.
the class AbstractAreaTriggerManager method deleteArea.
/**
* Try to remove Area Trigger at given location.
* @param location
* @return false if no area found at location; true if deleted
*/
public boolean deleteArea(SimpleLocation sloc) {
Entry<Area, AreaTrigger> areaEntry = getAreaForLocation(sloc);
if (areaEntry == null)
return false;
AreaTrigger trigger = areaEntry.getValue();
for (SimpleChunkLocation scloc : Area.getAllChunkLocations(areaEntry.getKey())) {
Map<Area, AreaTrigger> map = areaTriggers.get(scloc);
map.remove(areaEntry.getKey());
}
deleteInfo(nameMapper.remove(trigger.getTriggerName()));
return true;
}
Aggregations