Search in sources :

Example 11 with Trigger

use of io.github.wysohn.triggerreactor.core.manager.trigger.Trigger in project TriggerReactor by wysohn.

the class CommonFunctions method currentAreasAt.

/**
 * Get the name of area triggers containing the given location.
 *
 * @param location the location to check
 * @return array of AreaTrigger names. The array can be empty but never null.
 */
public String[] currentAreasAt(Location location) {
    AbstractAreaTriggerManager areaManager = plugin.getAreaManager();
    String[] names = areaManager.getAreas(LocationUtil.convertToSimpleLocation(location)).stream().map(Map.Entry::getValue).map(Trigger::getInfo).map(TriggerInfo::getTriggerName).toArray(String[]::new);
    return names;
}
Also used : AbstractAreaTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.area.AbstractAreaTriggerManager) AreaTrigger(io.github.wysohn.triggerreactor.core.manager.trigger.area.AreaTrigger) Trigger(io.github.wysohn.triggerreactor.core.manager.trigger.Trigger)

Example 12 with Trigger

use of io.github.wysohn.triggerreactor.core.manager.trigger.Trigger in project TriggerReactor by wysohn.

the class LocationBasedTriggerManager method showTriggerInfo.

protected void showTriggerInfo(ICommandSender sender, Block clicked) {
    Trigger trigger = getTriggerForLocation(LocationUtil.convertToSimpleLocation(clicked.getLocation()));
    if (trigger == null) {
        return;
    }
    sender.sendMessage("- - - - - - - - - - - - - -");
    sender.sendMessage("Trigger: " + getTriggerTypeName());
    sender.sendMessage("Block Type: " + clicked.getType().name());
    sender.sendMessage("Location: " + clicked.getWorld().getName() + "@" + clicked.getLocation().getBlockX() + "," + clicked.getLocation().getBlockY() + "," + clicked.getLocation().getBlockZ());
    sender.sendMessage("");
    sender.sendMessage("Script:");
    sender.sendMessage(trigger.getScript());
    sender.sendMessage("- - - - - - - - - - - - - -");
}
Also used : Trigger(io.github.wysohn.triggerreactor.core.manager.trigger.Trigger)

Example 13 with Trigger

use of io.github.wysohn.triggerreactor.core.manager.trigger.Trigger in project TriggerReactor by wysohn.

the class LocationBasedTriggerManager method showTriggerInfo.

@Override
protected void showTriggerInfo(ICommandSender sender, SimpleLocation sloc) {
    Trigger trigger = getTriggerForLocation(sloc);
    if (trigger == null) {
        return;
    }
    Location loc = LocationUtil.convertToBukkitLocation(sloc);
    Block clicked = loc.getBlock();
    sender.sendMessage("- - - - - - - - - - - - - -");
    sender.sendMessage("Trigger: " + getTriggerTypeName());
    sender.sendMessage("Block Type: " + clicked.getType().name());
    sender.sendMessage("Location: " + clicked.getWorld().getName() + "@" + clicked.getLocation().getBlockX() + "," + clicked.getLocation().getBlockY() + "," + clicked.getLocation().getBlockZ());
    sender.sendMessage("");
    sender.sendMessage("Script:");
    sender.sendMessage(trigger.getScript());
    sender.sendMessage("- - - - - - - - - - - - - -");
}
Also used : Trigger(io.github.wysohn.triggerreactor.core.manager.trigger.Trigger) Block(org.bukkit.block.Block) Location(org.bukkit.Location) SimpleLocation(io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation) SimpleChunkLocation(io.github.wysohn.triggerreactor.core.manager.location.SimpleChunkLocation)

Aggregations

Trigger (io.github.wysohn.triggerreactor.core.manager.trigger.Trigger)13 IPlayer (io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer)7 InventoryTrigger (io.github.wysohn.triggerreactor.core.manager.trigger.inventory.InventoryTrigger)7 SimpleLocation (io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation)5 Node (io.github.wysohn.triggerreactor.core.script.parser.Node)4 IInventory (io.github.wysohn.triggerreactor.core.bridge.IInventory)3 IEvent (io.github.wysohn.triggerreactor.core.bridge.event.IEvent)3 SimpleChunkLocation (io.github.wysohn.triggerreactor.core.manager.location.SimpleChunkLocation)3 ProcessInterrupter (io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.ProcessInterrupter)3 SpongePlayer (io.github.wysohn.triggerreactor.sponge.bridge.entity.SpongePlayer)3 DelegatedPlayer (io.github.wysohn.triggerreactor.sponge.tools.DelegatedPlayer)3 Player (org.bukkit.entity.Player)3 Player (org.spongepowered.api.entity.living.player.Player)3 AbstractAreaTriggerManager (io.github.wysohn.triggerreactor.core.manager.trigger.area.AbstractAreaTriggerManager)2 AreaTrigger (io.github.wysohn.triggerreactor.core.manager.trigger.area.AreaTrigger)2 TriggerReactorStartEvent (io.github.wysohn.triggerreactor.sponge.manager.event.TriggerReactorStartEvent)2 TriggerReactorStopEvent (io.github.wysohn.triggerreactor.sponge.manager.event.TriggerReactorStopEvent)2 Cancellable (org.bukkit.event.Cancellable)2 PlayerEvent (org.bukkit.event.player.PlayerEvent)2 ICommandSender (io.github.wysohn.triggerreactor.core.bridge.ICommandSender)1