use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpOfFaction method get.
@Override
protected Location[] get(Event e) {
String name = this.name.getSingle(e);
ConquerFaction faction = this.faction.getSingle(e);
if (name == null || faction == null || faction.getWarps() == null) {
return null;
}
return new Location[] { faction.getWarps().get(name) };
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
String name = this.name.getSingle(e);
ConquerFaction faction = this.faction.getSingle(e);
if (name == null || faction == null || faction.getWarps() == null) {
return;
}
switch(mode) {
case SET:
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
faction.getWarps().put(name, (Location) delta[0]);
break;
case REMOVE:
case REMOVE_ALL:
case DELETE:
faction.getWarps().remove(name);
break;
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpPassword method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
String name = this.name.getSingle(e);
ConquerFaction faction = this.faction.getSingle(e);
if (name == null || faction == null) {
return;
}
switch(mode) {
case SET:
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
faction.setWarpPassword(name, (String) delta[0]);
break;
case REMOVE_ALL:
case RESET:
case DELETE:
faction.setWarpPassword(name, null);
break;
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction 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();
}
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class LFEventForwarder method onRelationChange.
@EventHandler
public void onRelationChange(EventFactionsRelation event) {
Relation oldRelation = plugin.translate(event.getOldRelation());
Relation newRelation = plugin.translate(event.getRelation());
ConquerFaction faction = LFFaction.get(plugin, event.getFaction());
ConquerFaction targetFaction = LFFaction.get(plugin, event.getTargetFaction());
ConquerFactionRelationEvent forwardEvent = new ConquerFactionRelationEvent(faction, targetFaction, oldRelation, newRelation);
callEvent(forwardEvent);
}
Aggregations