use of com.massivecraft.factions.entity.MPlayer 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;
}
use of com.massivecraft.factions.entity.MPlayer 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);
}
use of com.massivecraft.factions.entity.MPlayer 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;
}
use of com.massivecraft.factions.entity.MPlayer 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;
}
use of com.massivecraft.factions.entity.MPlayer 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;
}
Aggregations