Search in sources :

Example 6 with Faction

use of com.massivecraft.factions.entity.Faction in project UltimateChat by FabioZumbi12.

the class UCFactionsHook method formatFac.

@Override
public String formatFac(String text, Player sender, Object receiver) {
    MPlayer mp = MPlayer.get(sender.getUniqueId());
    if (!mp.getFaction().isNone()) {
        Faction fac = mp.getFaction();
        text = text.replace("{fac-id}", fac.getId()).replace("{fac-name}", fac.getName());
        if (fac.hasMotd()) {
            text = text.replace("{fac-motd}", fac.getMotd());
        }
        if (fac.hasDescription()) {
            text = text.replace("{fac-description}", fac.getDescription());
        }
        if (receiver instanceof Player) {
            MPlayer recmp = MPlayer.get(((Player) receiver).getUniqueId());
            text = text.replace("{fac-relation-name}", fac.getName(recmp)).replace("{fac-relation-color}", fac.getColorTo(recmp).toString());
        }
    }
    return text;
}
Also used : Player(org.bukkit.entity.Player) MPlayer(com.massivecraft.factions.entity.MPlayer) MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Example 7 with Faction

use of com.massivecraft.factions.entity.Faction in project UltimateChat by FabioZumbi12.

the class UCFactionsHook method formatFac.

public static String formatFac(String text, Player sender, Object receiver) {
    MPlayer mp = MPlayer.get(sender.getUniqueId());
    if (!mp.getFaction().isNone()) {
        Faction fac = mp.getFaction();
        text = text.replace("{fac-id}", fac.getId()).replace("{fac-name}", fac.getName());
        if (fac.hasMotd()) {
            text = text.replace("{fac-motd}", fac.getMotd());
        }
        if (fac.hasDescription()) {
            text = text.replace("{fac-description}", fac.getDescription());
        }
        if (receiver instanceof Player) {
            MPlayer recmp = MPlayer.get(((Player) receiver).getUniqueId());
            text = text.replace("{fac-relation-name}", fac.getName(recmp)).replace("{fac-relation-color}", fac.getColorTo(recmp).toString());
        }
    }
    return text;
}
Also used : Player(org.bukkit.entity.Player) MPlayer(com.massivecraft.factions.entity.MPlayer) MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Example 8 with Faction

use of com.massivecraft.factions.entity.Faction 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

Faction (com.massivecraft.factions.entity.Faction)8 MPlayer (com.massivecraft.factions.entity.MPlayer)5 Player (org.bukkit.entity.Player)3 Attribute (com.denizenscript.denizencore.tags.Attribute)2 FactionTag (com.denizenscript.depenizen.bukkit.objects.factions.FactionTag)2 ListTag (com.denizenscript.denizencore.objects.core.ListTag)1 Board (com.massivecraft.factions.Board)1 FLocation (com.massivecraft.factions.FLocation)1 FPlayer (com.massivecraft.factions.FPlayer)1 FPlayers (com.massivecraft.factions.FPlayers)1