mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
2.1.230
This commit is contained in:
parent
416c5383c9
commit
4d85f24d98
@ -1,5 +1,6 @@
|
|||||||
Version 2.1.230
|
Version 2.1.230
|
||||||
Fixed an error that could happen when mcMMO was saving when parties were disabled by party.yml
|
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
|
Version 2.1.229
|
||||||
Added new party.yml config, which lets admins disable the party system entirely without having to use permissions
|
Added new party.yml config, which lets admins disable the party system entirely without having to use permissions
|
||||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
||||||
import com.gmail.nossr50.metadata.MobMetadataService;
|
import com.gmail.nossr50.metadata.MobMetadataService;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
|
||||||
import com.gmail.nossr50.runnables.TravelingBlockMetaCleanup;
|
import com.gmail.nossr50.runnables.TravelingBlockMetaCleanup;
|
||||||
import com.gmail.nossr50.skills.archery.Archery;
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||||
@ -259,16 +258,16 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
||||||
//Prevent players from setting fire to each other if they are in the same party
|
//Prevent players from setting fire to each other if they are in the same party
|
||||||
if(mcMMO.p.getPartyConfig().isPartyEnabled() && event.getEntity() instanceof Player defender) {
|
if(event.getEntity() instanceof Player defender) {
|
||||||
|
|
||||||
if(event.getCombuster() instanceof Projectile projectile) {
|
if(event.getCombuster() instanceof Projectile projectile) {
|
||||||
if(projectile.getShooter() instanceof Player attacker) {
|
if(projectile.getShooter() instanceof Player attacker) {
|
||||||
if(checkParties(event, defender, attacker)) {
|
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(event.getCombuster() instanceof Player attacker) {
|
} else if(event.getCombuster() instanceof Player attacker) {
|
||||||
if(checkParties(event, defender, attacker)) {
|
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
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 the attacker is a Player or a projectile belonging to a player
|
||||||
if(attacker instanceof Projectile projectile) {
|
if(attacker instanceof Projectile projectile) {
|
||||||
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
||||||
//Check for party friendly fire and cancel the event
|
//Check for friendly fire and cancel the event
|
||||||
if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer)) {
|
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,7 +382,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (attacker instanceof Player attackingPlayer){
|
} else if (attacker instanceof Player attackingPlayer){
|
||||||
if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer))
|
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,14 +481,17 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) {
|
public boolean checkIfInPartyOrSamePlayer(Cancellable event, Player defendingPlayer, Player attackingPlayer) {
|
||||||
if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) {
|
// This check is probably necessary outside of the party system
|
||||||
|
if (defendingPlayer.equals(attackingPlayer)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to make sure we're not gaining XP or applying abilities
|
if(!pluginRef.isPartySystemEnabled()) {
|
||||||
// when we hit ourselves
|
return false;
|
||||||
if (defendingPlayer.equals(attackingPlayer)) {
|
}
|
||||||
|
|
||||||
|
if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user