Search in sources :

Example 6 with ConquerClaim

use of me.andrew28.addons.conquer.api.ConquerClaim in project Conquer by xXAndrew28Xx.

the class ExprFactionAtLocClaim method change.

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
    Object[] claimObjects = this.targets.getArray(e);
    if (claimObjects == null) {
        return;
    }
    for (Object claimObject : claimObjects) {
        if (claimObject == null) {
            continue;
        }
        ConquerClaim claim;
        if (claimObject instanceof ConquerClaim) {
            claim = (ConquerClaim) claimObject;
        } else if (claimObject instanceof Location) {
            claim = Conquer.getInstance().getFactions().getClaim((Location) claimObject);
        } else {
            continue;
        }
        claim.setTo(ClaimType.WILDERNESS);
    }
}
Also used : ConquerClaim(me.andrew28.addons.conquer.api.ConquerClaim) Location(org.bukkit.Location)

Example 7 with ConquerClaim

use of me.andrew28.addons.conquer.api.ConquerClaim 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();
        }
    }
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) FLocation(net.redstoneore.legacyfactions.FLocation) ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) Chunk(org.bukkit.Chunk) Map(java.util.Map) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) Faction(net.redstoneore.legacyfactions.entity.Faction) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ConquerClaim (me.andrew28.addons.conquer.api.ConquerClaim)6 ConquerFaction (me.andrew28.addons.conquer.api.ConquerFaction)5 Location (org.bukkit.Location)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 ClaimType (me.andrew28.addons.conquer.api.ClaimType)2 ConquerPlayer (me.andrew28.addons.conquer.api.ConquerPlayer)2 ConquerLandClaimEvent (me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent)2 EventHandler (org.bukkit.event.EventHandler)2 EventFactionsChunkChangeType (com.massivecraft.factions.event.EventFactionsChunkChangeType)1 EventFactionsChunksChange (com.massivecraft.factions.event.EventFactionsChunksChange)1 EventFactionsCreate (com.massivecraft.factions.event.EventFactionsCreate)1 EventFactionsDisband (com.massivecraft.factions.event.EventFactionsDisband)1 EventFactionsMembershipChange (com.massivecraft.factions.event.EventFactionsMembershipChange)1 EventFactionsPowerChange (com.massivecraft.factions.event.EventFactionsPowerChange)1 EventFactionsRelationChange (com.massivecraft.factions.event.EventFactionsRelationChange)1 PS (com.massivecraft.massivecore.ps.PS)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 EventForwarder (me.andrew28.addons.conquer.api.EventForwarder)1