Search in sources :

Example 1 with ConquerLandClaimEvent

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

the class SFEventForwarder method onLandUnclaimEvent.

@EventHandler
public void onLandUnclaimEvent(LandUnclaimEvent event) {
    ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(SFClaim.get(plugin, event.getLocation()), false, SFFaction.get(plugin, event.getFaction()), SFPlayer.get(plugin, event.getfPlayer()));
    callEvent(forwardEvent);
    if (forwardEvent.isCancelled()) {
        event.setCancelled(true);
    }
}
Also used : ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) EventHandler(org.bukkit.event.EventHandler)

Example 2 with ConquerLandClaimEvent

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

the class SFEventForwarder method onLandClaim.

@EventHandler
public void onLandClaim(LandClaimEvent event) {
    ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(SFClaim.get(plugin, event.getLocation()), true, SFFaction.get(plugin, event.getFaction()), SFPlayer.get(plugin, event.getfPlayer()));
    callEvent(forwardEvent);
    if (forwardEvent.isCancelled()) {
        event.setCancelled(true);
    }
}
Also used : ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) EventHandler(org.bukkit.event.EventHandler)

Example 3 with ConquerLandClaimEvent

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

the class FUEventForwarder method onLandClaim.

@EventHandler
public void onLandClaim(LandClaimEvent event) {
    ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(FUClaim.get(plugin, event.getLocation()), true, FUFaction.get(plugin, event.getFaction()), FUPlayer.get(plugin, event.getfPlayer()));
    callEvent(forwardEvent);
    if (forwardEvent.isCancelled()) {
        event.setCancelled(true);
    }
}
Also used : ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) EventHandler(org.bukkit.event.EventHandler)

Example 4 with ConquerLandClaimEvent

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

the class MSEventForwarder method onClaimChange.

@EventHandler
public void onClaimChange(EventFactionsChunksChange event) {
    ConquerFaction faction = MSFaction.get(plugin, event.getNewFaction());
    ConquerPlayer player = MSPlayer.get(plugin, event.getMPlayer());
    Set<PS> chunks = event.getChunks();
    Map<PS, EventFactionsChunkChangeType> chunkTypeMap = event.getChunkType();
    // Check if it's an unclaim all
    if (chunks.size() == faction.getClaims().length && chunkTypeMap.values().stream().allMatch(type -> type == EventFactionsChunkChangeType.SELL)) {
        ConquerUnclaimAllEvent forwardEvent = new ConquerUnclaimAllEvent(faction, player);
        callEvent(forwardEvent);
        if (forwardEvent.isCancelled()) {
            event.setCancelled(true);
        }
    }
    for (PS chunk : chunks) {
        EventFactionsChunkChangeType type = chunkTypeMap.get(chunk);
        ConquerClaim claim = MSClaim.get(plugin, chunk);
        Event forwardEvent;
        switch(type) {
            case NONE:
                continue;
            case BUY:
                forwardEvent = new ConquerLandClaimEvent(claim, true, faction, player);
                break;
            case CONQUER:
            case PILLAGE:
                forwardEvent = new ConquerLandClaimEvent(claim, false, faction, player);
                break;
            default:
                return;
        }
        callEvent(forwardEvent);
        if (((Cancellable) forwardEvent).isCancelled()) {
            event.setCancelled(true);
            return;
        }
    }
}
Also used : EventForwarder(me.andrew28.addons.conquer.api.EventForwarder) Cancellable(org.bukkit.event.Cancellable) ConquerUnclaimAllEvent(me.andrew28.addons.conquer.api.events.ConquerUnclaimAllEvent) EventFactionsCreate(com.massivecraft.factions.event.EventFactionsCreate) EventFactionsRelationChange(com.massivecraft.factions.event.EventFactionsRelationChange) Event(org.bukkit.event.Event) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) EventHandler(org.bukkit.event.EventHandler) EventFactionsDisband(com.massivecraft.factions.event.EventFactionsDisband) ConquerClaim(me.andrew28.addons.conquer.api.ConquerClaim) Map(java.util.Map) EventFactionsMembershipChange(com.massivecraft.factions.event.EventFactionsMembershipChange) ConquerFactionLeaveEvent(me.andrew28.addons.conquer.api.events.ConquerFactionLeaveEvent) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerPowerLossEvent(me.andrew28.addons.conquer.api.events.ConquerPowerLossEvent) EventFactionsChunkChangeType(com.massivecraft.factions.event.EventFactionsChunkChangeType) ConquerFactionDisbandEvent(me.andrew28.addons.conquer.api.events.ConquerFactionDisbandEvent) Relation(me.andrew28.addons.conquer.api.Relation) PS(com.massivecraft.massivecore.ps.PS) ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) EventFactionsPowerChange(com.massivecraft.factions.event.EventFactionsPowerChange) Set(java.util.Set) ConquerFactionJoinEvent(me.andrew28.addons.conquer.api.events.ConquerFactionJoinEvent) EventFactionsChunksChange(com.massivecraft.factions.event.EventFactionsChunksChange) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) ConquerFactionCreateEvent(me.andrew28.addons.conquer.api.events.ConquerFactionCreateEvent) PS(com.massivecraft.massivecore.ps.PS) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) Cancellable(org.bukkit.event.Cancellable) ConquerUnclaimAllEvent(me.andrew28.addons.conquer.api.events.ConquerUnclaimAllEvent) Event(org.bukkit.event.Event) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) ConquerFactionLeaveEvent(me.andrew28.addons.conquer.api.events.ConquerFactionLeaveEvent) ConquerPowerLossEvent(me.andrew28.addons.conquer.api.events.ConquerPowerLossEvent) ConquerFactionDisbandEvent(me.andrew28.addons.conquer.api.events.ConquerFactionDisbandEvent) ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) ConquerFactionJoinEvent(me.andrew28.addons.conquer.api.events.ConquerFactionJoinEvent) ConquerFactionCreateEvent(me.andrew28.addons.conquer.api.events.ConquerFactionCreateEvent) ConquerUnclaimAllEvent(me.andrew28.addons.conquer.api.events.ConquerUnclaimAllEvent) ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) ConquerClaim(me.andrew28.addons.conquer.api.ConquerClaim) EventFactionsChunkChangeType(com.massivecraft.factions.event.EventFactionsChunkChangeType) EventHandler(org.bukkit.event.EventHandler)

Example 5 with ConquerLandClaimEvent

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

the class FOEventForwarder method onLandClaim.

@EventHandler
public void onLandClaim(LandClaimEvent event) {
    ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(FOClaim.get(plugin, event.getLocation()), true, FOFaction.get(plugin, event.getFaction()), FOPlayer.get(plugin, event.getFPlayer()));
    callEvent(forwardEvent);
    if (forwardEvent.isCancelled()) {
        event.setCancelled(true);
    }
}
Also used : ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ConquerLandClaimEvent (me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent)8 EventHandler (org.bukkit.event.EventHandler)8 Map (java.util.Map)2 ConquerFaction (me.andrew28.addons.conquer.api.ConquerFaction)2 ConquerPlayer (me.andrew28.addons.conquer.api.ConquerPlayer)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 Set (java.util.Set)1 ConquerClaim (me.andrew28.addons.conquer.api.ConquerClaim)1 EventForwarder (me.andrew28.addons.conquer.api.EventForwarder)1 Relation (me.andrew28.addons.conquer.api.Relation)1 ConquerFactionCreateEvent (me.andrew28.addons.conquer.api.events.ConquerFactionCreateEvent)1 ConquerFactionDisbandEvent (me.andrew28.addons.conquer.api.events.ConquerFactionDisbandEvent)1 ConquerFactionJoinEvent (me.andrew28.addons.conquer.api.events.ConquerFactionJoinEvent)1