Merge branch 'mcMMO-Dev:master' into patch-1

This commit is contained in:
Mangchi__ 2024-02-23 13:25:22 +09:00 committed by GitHub
commit 28e6ad8812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 19 deletions

View File

@ -1,3 +1,7 @@
Version 2.1.230
Fixed an error that could happen when mcMMO was saving when parties were disabled by party.yml (thanks IAISI & L4BORG)
Fixed several exceptions when checking PVP damage when parties were disabled by party.yml (thanks IAISI & L4BORG)
Version 2.1.229
Added new party.yml config, which lets admins disable the party system entirely without having to use permissions
Fixed error caused by missing API in McMMOEntityDamageByRuptureEvent

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.229</version>
<version>2.1.230</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -9,7 +9,6 @@ import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metadata.MobMetaFlagType;
import com.gmail.nossr50.metadata.MobMetadataService;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.TravelingBlockMetaCleanup;
import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.skills.mining.BlastMining;
@ -263,12 +262,12 @@ public class EntityListener implements Listener {
if(event.getCombuster() instanceof Projectile projectile) {
if(projectile.getShooter() instanceof Player attacker) {
if(checkParties(event, defender, attacker)) {
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
event.setCancelled(true);
}
}
} else if(event.getCombuster() instanceof Player attacker) {
if(checkParties(event, defender, attacker)) {
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
event.setCancelled(true);
}
}
@ -364,8 +363,8 @@ public class EntityListener implements Listener {
//If the attacker is a Player or a projectile belonging to a player
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)) {
//Check for friendly fire and cancel the event
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer)) {
return;
}
}
@ -383,7 +382,7 @@ public class EntityListener implements Listener {
}
}
} else if (attacker instanceof Player attackingPlayer){
if (checkParties(event, defendingPlayer, attackingPlayer))
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer))
return;
}
}
@ -482,14 +481,17 @@ public class EntityListener implements Listener {
}
}
public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) {
if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) {
public boolean checkIfInPartyOrSamePlayer(Cancellable event, Player defendingPlayer, Player attackingPlayer) {
// This check is probably necessary outside of the party system
if (defendingPlayer.equals(attackingPlayer)) {
return true;
}
// We want to make sure we're not gaining XP or applying abilities
// when we hit ourselves
if (defendingPlayer.equals(attackingPlayer)) {
if(!pluginRef.isPartySystemEnabled()) {
return false;
}
if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) {
return true;
}

View File

@ -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

View File

@ -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;
}