本文整理汇总了Java中me.markeh.factionsframework.entities.Faction类的典型用法代码示例。如果您正苦于以下问题:Java Faction类的具体用法?Java Faction怎么用?Java Faction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Faction类属于me.markeh.factionsframework.entities包,在下文中一共展示了Faction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEventFactionsJoin
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@EventHandler
public void onEventFactionsJoin(com.massivecraft.factions.event.EventFactionsMembershipChange event) {
if (event.getReason() != MembershipChangeReason.JOIN) return;
Faction faction = Factions.getById(event.getNewFaction().getId());
FPlayer fplayer = null;
try {
fplayer = FPlayers.getById(this.getUSender(event).getId());
} catch (Exception e) {
e.printStackTrace();
}
EventFactionsJoin eventEventFactionsJoin = new EventFactionsJoin(faction, fplayer);
eventEventFactionsJoin.setCancelled(event.isCancelled());
eventEventFactionsJoin.call();
event.setCancelled(eventEventFactionsJoin.isCancelled());
}
示例2: onEventFactionsLeave
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
public void onEventFactionsLeave(com.massivecraft.factions.event.EventFactionsMembershipChange event) {
if (event.getReason() != MembershipChangeReason.KICK && event.getReason() != MembershipChangeReason.DISBAND && event.getReason() != MembershipChangeReason.LEAVE) return;
Faction faction = Factions.getById(this.getUSender(event).getFactionId());
FPlayer fplayer = FPlayers.getById(this.getUSender(event).getId());
LeaveReason reason = LeaveReason.Leave;
Boolean canCancel = true;
if (event.getReason() == MembershipChangeReason.KICK) reason = LeaveReason.Kicked;
if (event.getReason() == MembershipChangeReason.DISBAND) {
reason = LeaveReason.Disband;
canCancel = false;
}
EventFactionsLeave eventEventFactionsLeave = new EventFactionsLeave(faction, fplayer, reason, canCancel);
if (canCancel) eventEventFactionsLeave.setCancelled(event.isCancelled());
eventEventFactionsLeave.call();
if (canCancel) event.setCancelled(eventEventFactionsLeave.isCancelled());
}
示例3: getRelationTo
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object object) {
if (this.id == "@console") return Rel.NEUTRAL;
if (object instanceof Faction) {
object = FactionColls.get().get2(((Faction) object).getId());
}
if (object instanceof FPlayer) {
object = UPlayer.get(((FPlayer) object).getId());
}
if (object instanceof Player) {
object = UPlayer.get((Player) object);
}
return Factions_2_6.convertRelationship(this.uplayer.getRelationTo((RelationParticipator) object));
}
示例4: getClaimInformees
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
public static Set<UPlayer> getClaimInformees(UPlayer usender, com.massivecraft.factions.entity.Faction oldFaction, com.massivecraft.factions.entity.Faction newFaction, Object clazz) {
Set<UPlayer> ret = new HashSet<UPlayer>();
if (usender != null) ret.add(usender);
for (com.massivecraft.factions.entity.Faction faction : com.massivecraft.factions.entity.FactionColls.get().get2(usender).getColl().getAll()) {
if (faction == null) continue;
if (faction.isNone()) continue;
ret.addAll(getUPlayersIn(faction, clazz));
}
if (MConf.get().logLandClaims) {
ret.add(UPlayer.get(IdUtil.getConsole()));
}
return ret;
}
示例5: onEventFactionsLeave
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
public void onEventFactionsLeave(com.massivecraft.factions.event.EventFactionsMembershipChange event) {
if (event.getReason() != MembershipChangeReason.KICK && event.getReason() != MembershipChangeReason.DISBAND && event.getReason() != MembershipChangeReason.LEAVE) return;
Faction faction = Factions.getById(event.getMPlayer().getFactionId());
FPlayer fplayer = FPlayers.getById(event.getMPlayer().getId());
// Determine the reason
LeaveReason reason = LeaveReason.Leave;
Boolean canCancel = true;
if (event.getReason() == MembershipChangeReason.KICK) reason = LeaveReason.Kicked;
if (event.getReason() == MembershipChangeReason.DISBAND) {
reason = LeaveReason.Disband;
canCancel = false;
}
EventFactionsLeave eventEventFactionsLeave = new EventFactionsLeave(faction, fplayer, reason, canCancel);
if (canCancel) eventEventFactionsLeave.setCancelled(event.isCancelled());
eventEventFactionsLeave.call();
if (canCancel) event.setCancelled(eventEventFactionsLeave.isCancelled());
}
示例6: getRegion
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
public FactionsRegion getRegion(Player player) {
final FPlayer p = FPlayers.getBySender(player);
if (p == null) return FactionsRegion.NONE;
Faction factionAt = p.getFactionAt();
if (factionAt == null) return FactionsRegion.NONE;
if (factionAt.isNone()) return FactionsRegion.NONE;
if (factionAt.getId().equals(p.getFaction().getId())) return FactionsRegion.OWN;
if (factionAt.getId().equals(Factions.getWarZone(player.getWorld()).getId())) return FactionsRegion.WARZONE;
if (factionAt.getId().equals(Factions.getSafeZone(player.getWorld()).getId())) return FactionsRegion.SAFEZONE;
Rel rel = factionAt.getRelationTo(p.getFaction());
if (rel == Rel.ALLY) return FactionsRegion.ALLY;
if (rel == Rel.ENEMY) return FactionsRegion.ENEMY;
if (rel == Rel.TRUCE) return FactionsRegion.TRUCE;
if (rel == Rel.NEUTRAL) return FactionsRegion.NEUTRAL;
return FactionsRegion.NONE;
}
示例7: onEventFactionsLeave
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@EventHandler
public void onEventFactionsLeave(FPlayerLeaveEvent event) {
FPlayer fplayer = FPlayers.getById(event.getfPlayer().getId());
Faction faction = Factions.getById(event.getFaction().getId());
LeaveReason reason = LeaveReason.Leave;
Boolean canCancel = true;
if (event.getReason() == PlayerLeaveReason.KICKED) reason = LeaveReason.Kicked;
if (event.getReason() == PlayerLeaveReason.DISBAND) {
reason = LeaveReason.Disband;
canCancel = false;
}
EventFactionsLeave eventEventFactionsLeave = new EventFactionsLeave(faction, fplayer, reason, canCancel);
if (canCancel) eventEventFactionsLeave.setCancelled(event.isCancelled());
eventEventFactionsLeave.call();
if (canCancel) event.setCancelled(eventEventFactionsLeave.isCancelled());
}
示例8: mimicUnclaim
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
private Boolean mimicUnclaim(com.massivecraft.factions.FPlayer fplayer, com.massivecraft.factions.Faction faction, FLocation flocation) {
if (Econ.shouldBeUsed()) {
double refund = Econ.calculateClaimRefund(faction.getLandRounded());
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if ( ! Econ.modifyMoney(faction, refund, "to unclaim this land", "for unclaiming this land")) return false;
} else {
if ( ! Econ.modifyMoney(fplayer, refund, "to unclaim this land", "for unclaiming this land")) return false;
}
}
Board.getInstance().removeAt(flocation);
faction.msg("%s<i> unclaimed some land.", fplayer.describeTo(faction, true));
// Log if factions wants us to
if (Conf.logLandUnclaims) {
P.p.log(fplayer.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+faction.getTag());
}
return true;
}
示例9: getRelationTo
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object object) {
if (this.id == "@console") return Rel.NEUTRAL;
if (object instanceof Faction) {
object = com.massivecraft.factions.Factions.getInstance().getFactionById(((Faction) object).getId());
}
if (object instanceof FPlayer) {
object = com.massivecraft.factions.FPlayers.getInstance().getById(((FPlayer) object).getId());
}
if (object instanceof Player) {
object = com.massivecraft.factions.FPlayers.getInstance().getByPlayer(((Player) object));
}
Relation relation = this.factionsfplayer.getRelationTo((RelationParticipator) object);
return Factions_1_6.convertRelationship(relation);
}
示例10: onEventFactionsLeave
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@EventHandler
public void onEventFactionsLeave(FPlayerLeaveEvent event) {
FPlayer fplayer = FPlayers.getById(event.getFPlayer().getId());
Faction faction = Factions.getById(event.getFaction().getId());
LeaveReason reason = LeaveReason.Leave;
Boolean canCancel = true;
if (event.getReason() == PlayerLeaveReason.KICKED) reason = LeaveReason.Kicked;
if (event.getReason() == PlayerLeaveReason.DISBAND) {
reason = LeaveReason.Disband;
canCancel = false;
}
EventFactionsLeave eventEventFactionsLeave = new EventFactionsLeave(faction, fplayer, reason, canCancel);
if (canCancel) eventEventFactionsLeave.setCancelled(event.isCancelled());
eventEventFactionsLeave.call();
if (canCancel) event.setCancelled(eventEventFactionsLeave.isCancelled());
}
示例11: mimicUnclaim
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
private Boolean mimicUnclaim(com.massivecraft.factions.FPlayer fplayer, com.massivecraft.factions.Faction faction, FLocation flocation) {
if (Econ.shouldBeUsed()) {
double refund = Econ.calculateClaimRefund(faction.getLandRounded());
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if ( ! Econ.modifyMoney(faction, refund, "to unclaim this land", "for unclaiming this land")) return false;
} else {
if ( ! Econ.modifyMoney(fplayer, refund, "to unclaim this land", "for unclaiming this land")) return false;
}
}
Board.removeAt(flocation);
faction.msg("%s<i> unclaimed some land.", fplayer.describeTo(faction, true));
// Log if factions wants us to
if (Conf.logLandUnclaims) {
P.p.log(fplayer.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+faction.getTag());
}
return true;
}
示例12: getRelationTo
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object object) {
if (this.id == "@console") return Rel.NEUTRAL;
if (object instanceof Faction) {
object = com.massivecraft.factions.Factions.i.get(((Faction) object).getId());
}
if (object instanceof FPlayer) {
object = com.massivecraft.factions.FPlayers.i.get(((FPlayer) object).getId());
}
if (object instanceof Player) {
object = com.massivecraft.factions.FPlayers.i.get(((Player) object));
}
com.massivecraft.factions.struct.Rel relation = this.factionsfplayer.getRelationTo((RelationParticipator) object);
return Factions_1_8.convertRelationship(relation);
}
示例13: getRelationTo
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object comparing) {
// Convert our FactionsFramework Factions object to their object
if (comparing instanceof Faction) {
Faction faction = (Faction) comparing;
comparing = this.faction.getColl().get(faction.getId());
}
// Convert our FactionsFramework FPlayer object to their object
if (comparing instanceof FPlayer) {
FPlayer fplayer = (FPlayer) comparing;
comparing = MPlayer.get(fplayer.getId());
}
if (comparing instanceof RelationParticipator) {
Rel rel = Factions_2_8_6.convertRelationship(this.faction.getRelationTo((RelationParticipator) comparing));
return rel;
}
return null;
}
示例14: onEventFactionsDisband
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
public void onEventFactionsDisband(com.massivecraft.factions.event.EventFactionsDisband event) {
Faction faction = Factions.getById(event.getFactionId());
EventFactionsDisband eventFactionsDisband = new EventFactionsDisband(faction);
eventFactionsDisband.setCancelled(event.isCancelled());
eventFactionsDisband.call();
event.setCancelled(eventFactionsDisband.isCancelled());
}
示例15: getFactionSafeZone
import me.markeh.factionsframework.entities.Faction; //导入依赖的package包/类
@Override
public Faction getFactionSafeZone(World world) {
if (this.safezoneId == null) {
try {
this.safezoneId = (String) com.massivecraft.factions.Factions.class.getField("ID_SAFEZONE").get(this);
} catch (Exception e) {
e.printStackTrace();
}
}
return get(this.safezoneId);
}