mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-21 20:56:45 +01:00
Fix exceptions on EntityCombustByEntityEvent, EntityDamageByEntityEvent, PartyAutoKickTask if parties are disabled (#4976)
* Only run EntityListener#checkParties on EntityCombustByEntityEvent if Parties are enabled * Only run PartyAutoKickTask Task if Parties are enabled * Only run EntityListener#checkParties on EntityDamageByEntityEvent if Parties are enabled * Check if Parties are enabled before running inSameParty in CombatUtils#processCombatXP --------- Co-authored-by: Dieu <info@l4b.org>
This commit is contained in:
parent
cdc187b211
commit
7f9ed94d23
@ -259,7 +259,7 @@ public class EntityListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
||||
//Prevent players from setting fire to each other if they are in the same party
|
||||
if(event.getEntity() instanceof Player defender) {
|
||||
if(mcMMO.p.getPartyConfig().isPartyEnabled() && event.getEntity() instanceof Player defender) {
|
||||
|
||||
if(event.getCombuster() instanceof Projectile projectile) {
|
||||
if(projectile.getShooter() instanceof Player attacker) {
|
||||
@ -365,7 +365,7 @@ public class EntityListener implements Listener {
|
||||
if(attacker instanceof Projectile projectile) {
|
||||
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
||||
//Check for party friendly fire and cancel the event
|
||||
if (checkParties(event, defendingPlayer, attackingPlayer)) {
|
||||
if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -383,7 +383,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
} else if (attacker instanceof Player attackingPlayer){
|
||||
if (checkParties(event, defendingPlayer, attackingPlayer))
|
||||
if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -671,13 +671,14 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
// Automatically remove old members from parties
|
||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||
if(partyConfig.isPartyEnabled()) {
|
||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||
|
||||
if (kickIntervalTicks == 0) {
|
||||
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
}
|
||||
else if (kickIntervalTicks > 0) {
|
||||
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
if (kickIntervalTicks == 0) {
|
||||
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
} else if (kickIntervalTicks > 0) {
|
||||
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
}
|
||||
}
|
||||
|
||||
// Update power level tag scoreboards
|
||||
|
@ -741,7 +741,8 @@ public final class CombatUtils {
|
||||
XPGainReason xpGainReason;
|
||||
|
||||
if (target instanceof Player defender) {
|
||||
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || mcMMO.p.getPartyManager().inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
||||
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() ||
|
||||
(mcMMO.p.getPartyConfig().isPartyEnabled() && mcMMO.p.getPartyManager().inSameParty(mcMMOPlayer.getPlayer(), (Player) target))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user