use of me.andrew28.addons.conquer.api.ConquerPlayer in project Conquer by xXAndrew28Xx.
the class ExprMembersOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
ConquerPlayer player = (ConquerPlayer) delta[0];
// Just use the first faction because generally people only use one faction in this syntax
ConquerFaction[] factions = this.factions.getArray(e);
if (factions.length == 0) {
return;
}
ConquerFaction faction = factions[0];
if (faction == null) {
return;
}
if (mode == Changer.ChangeMode.ADD) {
faction.addMember(player);
} else if (mode == Changer.ChangeMode.REMOVE) {
faction.removeMember(player);
}
}
use of me.andrew28.addons.conquer.api.ConquerPlayer in project Conquer by xXAndrew28Xx.
the class ExprPlayerLastActivity method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerPlayer player = getExpr().getSingle(e);
if (player == null || delta == null || delta.length == 0 || delta[0] == null) {
return;
}
player.setLastActivity(new java.util.Date(((Date) delta[0]).getTimestamp()));
}
use of me.andrew28.addons.conquer.api.ConquerPlayer in project Conquer by xXAndrew28Xx.
the class ExprTitleOfPlayer method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerPlayer[] players = getExpr().getArray(e);
if (players == null) {
return;
}
String title = "";
if (mode == Changer.ChangeMode.SET) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
title = (String) delta[0];
}
for (ConquerPlayer player : players) {
if (player == null) {
continue;
}
player.setTitle(title);
}
}
use of me.andrew28.addons.conquer.api.ConquerPlayer in project Conquer by xXAndrew28Xx.
the class ExprPlayerRole method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerPlayer[] players = getExpr().getArray(e);
if (players == null) {
return;
}
ConquerPlayer.Role role = ConquerPlayer.Role.NORMAL;
if (mode == Changer.ChangeMode.SET) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
role = (ConquerPlayer.Role) delta[0];
}
for (ConquerPlayer player : players) {
if (player == null) {
continue;
}
player.setRole(role);
}
}
use of me.andrew28.addons.conquer.api.ConquerPlayer in project Conquer by xXAndrew28Xx.
the class LFEventForwarder method onLandChange.
@EventHandler
public void onLandChange(EventFactionsLandChange event) {
boolean claiming = event.getCause() == EventFactionsLandChange.LandChangeCause.Claim;
ConquerPlayer player = LFPlayer.get(plugin, event.getFPlayer());
Iterator<Map.Entry<FLocation, Faction>> iterator = event.getTransactions().entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<FLocation, Faction> entry = iterator.next();
ConquerClaim<Chunk> claim = LFClaim.get(plugin, entry.getKey());
ConquerFaction faction = LFFaction.get(plugin, entry.getValue());
ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(claim, claiming, faction, player);
callEvent(forwardEvent);
if (forwardEvent.isCancelled()) {
iterator.remove();
}
}
}
Aggregations