Search in sources :

Example 1 with PlayerTag

use of com.denizenscript.denizen.objects.PlayerTag in project Denizen-For-Bukkit by DenizenScript.

the class PlayerEquipsArmorScriptEvent method armorChangeEvent.

@EventHandler
public void armorChangeEvent(PlayerArmorChangeEvent event) {
    if (EntityTag.isCitizensNPC(event.getPlayer())) {
        return;
    }
    if (simpleComparisonString(event.getOldItem()).equals(simpleComparisonString(event.getNewItem()))) {
        return;
    }
    newItem = new ItemTag(event.getNewItem());
    oldItem = new ItemTag(event.getOldItem());
    slot = event.getSlotType();
    player = new PlayerTag(event.getPlayer());
    fire(event);
}
Also used : PlayerTag(com.denizenscript.denizen.objects.PlayerTag) ItemTag(com.denizenscript.denizen.objects.ItemTag) EventHandler(org.bukkit.event.EventHandler)

Example 2 with PlayerTag

use of com.denizenscript.denizen.objects.PlayerTag in project Denizen-For-Bukkit by DenizenScript.

the class ServerListPingScriptEventPaperImpl method applyDetermination.

@Override
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
    String determination = determinationObj.toString();
    String lower = CoreUtilities.toLowerCase(determination);
    if (lower.startsWith("protocol_version:") && ArgumentHelper.matchesInteger(determination.substring("protocol_version:".length()))) {
        ((PaperServerListPingEvent) event).setProtocolVersion(Integer.parseInt(determination.substring("protocol_version:".length())));
        return true;
    } else if (lower.startsWith("version_name:")) {
        ((PaperServerListPingEvent) event).setVersion(determination.substring("version_name:".length()));
        return true;
    } else if (lower.startsWith("exclude_players:")) {
        HashSet<UUID> exclusions = new HashSet<>();
        for (PlayerTag player : ListTag.valueOf(determination.substring("exclude_players:".length()), getTagContext(path)).filter(PlayerTag.class, getTagContext(path))) {
            exclusions.add(player.getUUID());
        }
        Iterator<Player> players = ((PaperServerListPingEvent) event).iterator();
        while (players.hasNext()) {
            if (exclusions.contains(players.next().getUniqueId())) {
                players.remove();
            }
        }
        return true;
    }
    return super.applyDetermination(path, determinationObj);
}
Also used : Player(org.bukkit.entity.Player) PlayerTag(com.denizenscript.denizen.objects.PlayerTag) PaperServerListPingEvent(com.destroystokyo.paper.event.server.PaperServerListPingEvent) UUID(java.util.UUID) HashSet(java.util.HashSet)

Example 3 with PlayerTag

use of com.denizenscript.denizen.objects.PlayerTag in project Denizen-For-Bukkit by DenizenScript.

the class PlayerElytraBoostScriptEvent method onPlayerElytraBoost.

@EventHandler
public void onPlayerElytraBoost(PlayerElytraBoostEvent event) {
    firework = new ItemTag(event.getItemStack());
    player = new PlayerTag(event.getPlayer());
    this.event = event;
    fire(event);
}
Also used : PlayerTag(com.denizenscript.denizen.objects.PlayerTag) ItemTag(com.denizenscript.denizen.objects.ItemTag) EventHandler(org.bukkit.event.EventHandler)

Example 4 with PlayerTag

use of com.denizenscript.denizen.objects.PlayerTag in project Denizen-For-Bukkit by DenizenScript.

the class PlayerJumpsScriptEventPaperImpl method onPlayerJumps.

@EventHandler
public void onPlayerJumps(PlayerJumpEvent event) {
    if (EntityTag.isNPC(event.getPlayer())) {
        return;
    }
    location = new LocationTag(event.getFrom());
    player = new PlayerTag(event.getPlayer());
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) PlayerTag(com.denizenscript.denizen.objects.PlayerTag) EventHandler(org.bukkit.event.EventHandler)

Example 5 with PlayerTag

use of com.denizenscript.denizen.objects.PlayerTag in project Denizen-For-Bukkit by DenizenScript.

the class PlayerClosesInvScriptEvent method onPlayerClosesInv.

@EventHandler
public void onPlayerClosesInv(InventoryCloseEvent event) {
    if (EntityTag.isNPC(event.getPlayer())) {
        return;
    }
    inventory = InventoryTag.mirrorBukkitInventory(event.getInventory());
    player = new PlayerTag((Player) event.getPlayer());
    this.event = event;
    fire(event);
}
Also used : Player(org.bukkit.entity.Player) PlayerTag(com.denizenscript.denizen.objects.PlayerTag) EventHandler(org.bukkit.event.EventHandler)

Aggregations

PlayerTag (com.denizenscript.denizen.objects.PlayerTag)81 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)41 Player (org.bukkit.entity.Player)26 List (java.util.List)23 NPCTag (com.denizenscript.denizen.objects.NPCTag)22 EntityTag (com.denizenscript.denizen.objects.EntityTag)16 DurationTag (com.denizenscript.denizencore.objects.core.DurationTag)15 ListTag (com.denizenscript.denizencore.objects.core.ListTag)15 LocationTag (com.denizenscript.denizen.objects.LocationTag)14 ItemTag (com.denizenscript.denizen.objects.ItemTag)12 InvalidArgumentsException (com.denizenscript.denizencore.exceptions.InvalidArgumentsException)11 EventHandler (org.bukkit.event.EventHandler)11 BukkitTagContext (com.denizenscript.denizen.tags.BukkitTagContext)8 ScriptTag (com.denizenscript.denizencore.objects.core.ScriptTag)8 ScriptEntry (com.denizenscript.denizencore.scripts.ScriptEntry)8 MaterialTag (com.denizenscript.denizen.objects.MaterialTag)7 BukkitScriptEntryData (com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData)7 ObjectTag (com.denizenscript.denizencore.objects.ObjectTag)7 FakeEntity (com.denizenscript.denizen.utilities.entity.FakeEntity)6 Argument (com.denizenscript.denizencore.objects.Argument)6