Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package net.prosavage.factionsx.core
import com.cryptomorin.xseries.XMaterial
import net.prosavage.factionsx.event.FPlayerFactionLeaveEvent
import net.prosavage.factionsx.event.FPlayerFactionPreLeaveEvent
import net.prosavage.factionsx.event.FactionRelationChangeEvent
import net.prosavage.factionsx.manager.*
import net.prosavage.factionsx.manager.FactionManager.forceRelation
import net.prosavage.factionsx.persist.Message
Expand Down Expand Up @@ -530,6 +531,8 @@ data class Faction(val id: Long, var tag: String, val factionRoles: FactionRoles

this.message(Message.relationNotifOrigin, toFactionTag, relationPrefix, tagReplacement)
faction.message(Message.relationNotif, this.tag, relationPrefix, tagReplacement)

Bukkit.getPluginManager().callEvent(FactionRelationChangeEvent(this, faction, currentRelation, relation))
}

internal fun sendRelationRequest(faction: Faction, relation: Relation): Relation? {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.prosavage.factionsx.event

import net.prosavage.factionsx.core.Faction
import net.prosavage.factionsx.util.Relation
import org.bukkit.event.Event
import org.bukkit.event.HandlerList

class FactionRelationChangeEvent(
val faction: Faction,
val factionTo: Faction,
val oldRelation: Relation,
val newRelation: Relation
) : Event(false) {

override fun getHandlers(): HandlerList = handlerList

companion object {
@JvmStatic
val handlerList = HandlerList()
}
}