Search in sources :

Example 1 with FactionTag

use of com.denizenscript.depenizen.bukkit.objects.factions.FactionTag in project Depenizen by DenizenScript.

the class FactionsBridge method tagEvent.

public void tagEvent(ReplaceableTagEvent event) {
    Attribute attribute = event.getAttributes().fulfill(1);
    // -->
    if (attribute.startsWith("list_factions")) {
        ListTag factions = new ListTag();
        for (Faction f : FactionColl.get().getAll()) {
            factions.addObject(new FactionTag(f));
        }
        event.setReplacedObject(factions.getObjectAttribute(attribute.fulfill(1)));
    }
}
Also used : Attribute(com.denizenscript.denizencore.tags.Attribute) FactionTag(com.denizenscript.depenizen.bukkit.objects.factions.FactionTag) ListTag(com.denizenscript.denizencore.objects.core.ListTag) Faction(com.massivecraft.factions.entity.Faction)

Example 2 with FactionTag

use of com.denizenscript.depenizen.bukkit.objects.factions.FactionTag in project Depenizen by DenizenScript.

the class FactionsBridge method factionTagEvent.

public void factionTagEvent(ReplaceableTagEvent event) {
    Attribute attribute = event.getAttributes().fulfill(1);
    // <--[tag]
    // @attribute <faction[<name>]>
    // @returns FactionTag
    // @plugin Depenizen, Factions
    // @description
    // Returns the faction for the input name.
    // -->
    String nameOrId = attribute.getParam();
    Faction f = FactionColl.get().getByName(nameOrId);
    if (f == null && FactionColl.get().containsId(nameOrId)) {
        f = FactionColl.get().get(nameOrId);
    }
    if (f != null) {
        event.setReplacedObject(new FactionTag(f).getObjectAttribute(attribute.fulfill(1)));
    }
}
Also used : Attribute(com.denizenscript.denizencore.tags.Attribute) FactionTag(com.denizenscript.depenizen.bukkit.objects.factions.FactionTag) Faction(com.massivecraft.factions.entity.Faction)

Aggregations

Attribute (com.denizenscript.denizencore.tags.Attribute)2 FactionTag (com.denizenscript.depenizen.bukkit.objects.factions.FactionTag)2 Faction (com.massivecraft.factions.entity.Faction)2 ListTag (com.denizenscript.denizencore.objects.core.ListTag)1