Search in sources :

Example 1 with Faction

use of com.massivecraft.factions.entity.Faction in project WildLoaders by BG-Software-LLC.

the class ClaimsProvider_MassiveFactions method hasClaimAccess.

@Override
public boolean hasClaimAccess(UUID player, Chunk chunk) {
    MPlayer mPlayer = MPlayer.get(player);
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(chunk));
    return !faction.getId().equals(Factions.ID_NONE) && faction.getMPlayers().contains(mPlayer);
}
Also used : MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Example 2 with Faction

use of com.massivecraft.factions.entity.Faction in project SilkSpawners by timbru31.

the class SilkSpawnersPlayerListener method checkIfFactionsPermitsBlockInteractions.

public boolean checkIfFactionsPermitsBlockInteractions(final Player player, final Block block) {
    if (plugin.config.getBoolean("factionsSupport", false) && su.isPluginEnabled("Factions")) {
        try {
            final MPlayer mp = MPlayer.get(player);
            final Faction blockFaction = BoardColl.get().getFactionAt(PS.valueOf(block.getLocation()));
            if (!blockFaction.isNone() && !mp.isInOwnTerritory()) {
                su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
                return false;
            }
        } catch (@SuppressWarnings("unused") final NoClassDefFoundError e) {
            // Try for legacy 1.6 factions, e.g. FactionsUUID
            final FPlayers fPlayers = FPlayers.getInstance();
            final FPlayer fPlayer = fPlayers.getByPlayer(player);
            final Board board = Board.getInstance();
            final com.massivecraft.factions.Faction blockFaction = board.getFactionAt(new FLocation(block.getLocation()));
            if (!blockFaction.isWilderness() && !fPlayer.isInOwnTerritory()) {
                su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
                return false;
            }
        }
    }
    return true;
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) FPlayers(com.massivecraft.factions.FPlayers) Board(com.massivecraft.factions.Board) FLocation(com.massivecraft.factions.FLocation) MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Example 3 with Faction

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

use of com.massivecraft.factions.entity.Faction in project Conquer by xXAndrew28Xx.

the class MSClaim method setTo.

@Override
public void setTo(ClaimType type) {
    Faction faction;
    switch(type) {
        case WILDERNESS:
            faction = factionColl.getNone();
            break;
        case SAFE_ZONE:
            faction = factionColl.getSafezone();
            break;
        case WAR_ZONE:
            faction = factionColl.getWarzone();
            break;
        default:
            return;
    }
    boardColl.setFactionAt(ps, faction);
}
Also used : Faction(com.massivecraft.factions.entity.Faction)

Example 5 with Faction

use of com.massivecraft.factions.entity.Faction in project Sentinel by mcmonkey4eva.

the class SentinelFactions method isTarget.

@Override
public boolean isTarget(LivingEntity ent, String prefix, String value) {
    try {
        if (prefix.equals("factions") && ent instanceof Player) {
            Faction faction = FactionColl.get().getByName(value);
            for (MPlayer pl : faction.getMPlayers()) {
                if (pl.getPlayer() != null && pl.getPlayer().getUniqueId() != null && pl.getPlayer().getUniqueId().equals(ent.getUniqueId())) {
                    return true;
                }
            }
        } else if (prefix.equals("factionsenemy") && ent instanceof Player) {
            Faction faction = FactionColl.get().getByName(value);
            Faction plf = MPlayer.get(((Player) ent).getUniqueId()).getFaction();
            if (faction.getRelationTo(plf).equals(Rel.ENEMY)) {
                return true;
            }
        } else if (prefix.equals("factionsally") && ent instanceof Player) {
            Faction faction = FactionColl.get().getByName(value);
            Faction plf = MPlayer.get(((Player) ent).getUniqueId()).getFaction();
            if (faction.getRelationTo(plf).equals(Rel.ALLY)) {
                return true;
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return false;
}
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)

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