本文整理汇总了Java中com.massivecraft.factions.FPlayer类的典型用法代码示例。如果您正苦于以下问题:Java FPlayer类的具体用法?Java FPlayer怎么用?Java FPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FPlayer类属于com.massivecraft.factions包,在下文中一共展示了FPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public void process(@NotNull final Message message, @NotNull final PipelineContext context) {
final FactionsMagic fm = this.factionsHook.getFactionsMagic();
if (message.isCancelled() || fm == null) return;
if (!(message.getChannel() instanceof ConfigChannel)) return;
final ConfigChannel channel = (ConfigChannel) message.getChannel();
final boolean self = channel.getNode().getNode("factions").getNode("self").getBoolean(false);
if (!self) return; // TODO: All, relationships
final Player player = message.getSender().getPlayer();
if (player == null) return;
final FPlayer fp = fm.getFPlayers().getByPlayer(player);
// Get the Faction ID
final String factionID = fp.getFaction().getId();
// Get a list of recipients that also have that Faction ID
final Set<Player> keep = message.getRecipients().stream()
.filter(member -> factionID.equals(fm.getFPlayers().getByPlayer(member).getFaction().getId()))
.collect(Collectors.toSet());
// Retain that list
message.getRecipients().retainAll(keep);
}
示例2: registerOldFactions
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
private void registerOldFactions() {
register("power")
.scoreSupply(player -> getFPlayer(player)
.map(FPlayer::getPowerRounded)
.orElse(-1));
register("f_power")
.scoreSupply(player -> getOldFaction(player)
.map(com.massivecraft.factions.Faction::getPowerRounded)
.orElse(-1));
register("members")
.scoreSupply(player -> getOldFaction(player)
.map(com.massivecraft.factions.Faction::getFPlayers)
.map(Collection::size)
.orElse(-1));
register("members_online")
.scoreSupply(player -> getOldFaction(player)
.map(com.massivecraft.factions.Faction::getFPlayers)
.map(Collection::size)
.orElse(-1));
}
示例3: getPlayerTitle
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public String getPlayerTitle(Object player) {
String title = null;
if (player instanceof Player)
{
title = ((FPlayer) FPlayers.i.get((Player) player)).getTitle();
} else if (player instanceof String)
{
title = ((FPlayer) FPlayers.i.get((String) player)).getTitle();
}
if (title.contains("no title set")) {
return "";
}
return title;
}
示例4: getPlayerRank
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public MyRel getPlayerRank(Object player) {
Rel role = null;
if (player instanceof Player)
{
role = ((FPlayer) FPlayers.i.get((Player) player)).getRole();
} else if (player instanceof String)
{
role = ((FPlayer) FPlayers.i.get((String) player)).getRole();
}
if (role.equals(Rel.LEADER)) {
return MyRel.LEADER;
} else if (role.equals(Rel.OFFICER)) {
return MyRel.OFFICER;
} else if (role.equals(Rel.MEMBER)) {
return MyRel.MEMBER;
} else if (role.equals(Rel.RECRUIT)) {
return MyRel.RECRUIT;
} else {
return MyRel.NEUTRAL;
}
}
示例5: onPowerLoss
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@EventHandler
public void onPowerLoss(PowerLossEvent event) {
if (!config.isPatchesDisablePowerLoss()) {
return;
}
FPlayer player = event.getfPlayer();
Storage storage = Storage.get(player.getPlayer());
Object value = storage.get("matchDeath");
if (value != null) {
event.setMessage("");
event.setCancelled(true);
}
}
示例6: process
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public void process(@NotNull final Message message, @NotNull final PipelineContext context) {
final FactionsMagic fm = this.factionsHook.getFactionsMagic();
if (message.isCancelled() || fm == null) return;
final Player player = message.getSender().getPlayer();
if (player == null) return;
final FPlayer fp = fm.getFPlayers().getByPlayer(player);
// Add FactionsMagic to allow for easy access to general Factions methods
context.getCustomVariables().put("factionsMagic", fm);
// Add FPlayer as a convenience
context.getCustomVariables().put("fplayer", fp);
// Add the faction as a convenience
context.getCustomVariables().put("faction", fp.getFaction());
}
示例7: getFactionName
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public String getFactionName(Object player) {
if (player instanceof Player)
{
return ((FPlayer) FPlayers.i.get((Player) player)).getFaction().getTag();
} else if (player instanceof String)
{
return ((FPlayer) FPlayers.i.get((String) player)).getFaction().getTag();
}
else
{
return null;
}
}
示例8: getFactionID
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public String getFactionID(Object player) {
if (player instanceof Player)
{
return ((FPlayer) FPlayers.i.get((Player) player)).getFaction().getId();
} else if (player instanceof String)
{
return ((FPlayer) FPlayers.i.get((Player) player)).getFaction().getId();
}
else
{
return null;
}
}
示例9: getRelationship
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public MyRel getRelationship(Object player1, Object player2) {
FPlayer fSenderPlayer = FPlayers.getInstance().getByPlayer(player1);
Faction SenderFaction = fSenderPlayer.getFaction();
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player2);
Relation rel = SenderFaction.getRelationTo(fplayer);
if (fSenderPlayer.getFactionId().equals(fplayer.getFactionId())) {
return MyRel.MEMBER;
}
if (rel == Relation.NEUTRAL) {
return MyRel.NEUTRAL;
}
if (rel == Relation.ALLY) {
return MyRel.ALLY;
}
if (rel == Relation.ENEMY) {
return MyRel.ENEMY;
}
if (rel == Relation.MEMBER) {
return MyRel.MEMBER;
}
if (hasTruce() && rel == Relation.TRUCE) {
return MyRel.TRUCE;
}
return null;
}
示例10: getRelationship
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public MyRel getRelationship(Object player1, Object player2) {
FPlayer fSenderPlayer = FPlayers.getInstance().getByPlayer(player1);
Faction SenderFaction = fSenderPlayer.getFaction();
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player2);
Relation rel = SenderFaction.getRelationTo(fplayer);
if (fSenderPlayer.getFactionId().equals(fplayer.getFactionId()))
{
return MyRel.MEMBER;
}
if (rel == Relation.NEUTRAL)
{
return MyRel.NEUTRAL;
}
if (rel == Relation.ALLY)
{
return MyRel.ALLY;
}
if (rel == Relation.ENEMY)
{
return MyRel.ENEMY;
}
if (rel == Relation.MEMBER)
{
return MyRel.MEMBER;
}
return null;
}
示例11: canUseChest
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
public boolean canUseChest(Player p, FPlayer f, Sign s) {
if(f.getRole().equals(Role.ADMIN)||f.getRole().equals(Role.MODERATOR)) return true;
String IGN = p.getName();
if(s.getLine(0).equals(color("&a[Subclaim]"))) {
if(s.getLine(1).indexOf(IGN)!=-1||s.getLine(2).indexOf(IGN)!=-1||s.getLine(3).indexOf(IGN)!=-1) return true;
return false;
}
return true;
}
示例12: getRelation
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public ChatColor getRelation(Player player, String factionId) {
FPlayer fplayer = FPlayers.i.get(player);
Faction faction = Factions.i.get(factionId);
return fplayer.getFaction().getRelationTo(faction).getColor();
}
示例13: getOwnerName
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
@Override
public String getOwnerName(String factionId) {
FPlayer owner = Factions.i.get(factionId).getFPlayerLeader();
return owner == null ? null : owner.getName();
}
示例14: getFPlayer
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
private Optional<FPlayer> getFPlayer(Player player) {
return Optional.ofNullable(FPlayers.getInstance().getByPlayer(player));
}
示例15: getOldFaction
import com.massivecraft.factions.FPlayer; //导入依赖的package包/类
private Optional<com.massivecraft.factions.Faction> getOldFaction(Player player) {
return getFPlayer(player).map(FPlayer::getFaction);
}