Search in sources :

Example 1 with Trigger

use of au.com.mineauz.minigamesregions.triggers.Trigger in project Minigames by AddstarMC.

the class RegionEvents method itemPickupEvent.

@EventHandler(ignoreCancelled = true)
private void itemPickupEvent(PlayerPickupItemEvent event) {
    final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
    if (ply == null)
        return;
    if (ply.isInMinigame()) {
        final Trigger trig = Triggers.getTrigger("ITEM_PICKUP");
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

            @Override
            public void run() {
                if (!ply.isInMinigame()) {
                    return;
                }
                for (Node node : getRegionModule(ply.getMinigame()).getNodes()) {
                    node.execute(trig, ply);
                }
                for (Region region : getRegionModule(ply.getMinigame()).getRegions()) {
                    if (region.hasPlayer(ply)) {
                        region.execute(trig, ply);
                    }
                }
            }
        });
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) Trigger(au.com.mineauz.minigamesregions.triggers.Trigger) EventHandler(org.bukkit.event.EventHandler)

Example 2 with Trigger

use of au.com.mineauz.minigamesregions.triggers.Trigger in project Minigames by AddstarMC.

the class RegionEvents method itemPickupEvent.

@EventHandler(ignoreCancelled = true)
private void itemPickupEvent(PlayerDropItemEvent event) {
    final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
    if (ply.isInMinigame()) {
        final Trigger trig = Triggers.getTrigger("ITEM_DROP");
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, executeScriptObjects(ply, trig));
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) Trigger(au.com.mineauz.minigamesregions.triggers.Trigger) EventHandler(org.bukkit.event.EventHandler)

Example 3 with Trigger

use of au.com.mineauz.minigamesregions.triggers.Trigger in project Minigames by AddstarMC.

the class RegionEvents method itemPickupEvent.

@EventHandler(ignoreCancelled = true)
private void itemPickupEvent(EntityPickupItemEvent event) {
    if (!(event.getEntity() instanceof Player))
        return;
    final MinigamePlayer ply = pdata.getMinigamePlayer(((Player) event.getEntity()));
    if (ply.isInMinigame()) {
        final Trigger trig = Triggers.getTrigger("ITEM_PICKUP");
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, executeScriptObjects(ply, trig));
    }
}
Also used : Player(org.bukkit.entity.Player) MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) Trigger(au.com.mineauz.minigamesregions.triggers.Trigger) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Trigger (au.com.mineauz.minigamesregions.triggers.Trigger)3 EventHandler (org.bukkit.event.EventHandler)3 MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)2 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)1 Player (org.bukkit.entity.Player)1