You can now enable Party Friendly Fire

This commit is contained in:
nossr50 2019-01-21 15:43:54 -08:00
parent 11c8374f6c
commit 76ddcc4cf0
5 changed files with 18 additions and 9 deletions

View File

@ -79,6 +79,7 @@ Version 2.1.0
= (MySQL) When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process
= (Commands) '/mcMMO help' no longer displays the other/special commands category to players lacking permissions
+ (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default
+ (Party) You can now turn on Friendly Fire for parties in config.yml
! (Deaths) Fixed the bug where mob names would be replaced by hearts
! (Experience) The XP values of fish are now based on their rarity and have been drastically changed
! (Experience) Skills now start at level 1 (configurable in advanced.yml)

View File

@ -409,6 +409,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
/* PARTY SETTINGS */
public boolean getPartyFriendlyFire() { return config.getBoolean("Party.FriendlyFire", false);}
public int getPartyMaxSize() {return config.getInt("Party.MaxSize", -1); }
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.listeners;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.meta.OldName;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
@ -150,6 +151,8 @@ public class EntityListener implements Listener {
Player defendingPlayer = (Player) defender;
Player attackingPlayer = (Player) attacker;
if (event.getDamage(DamageModifier.ABSORPTION) > 0) {
//If friendly fire is off don't allow players to hurt one another
if(!Config.getInstance().getPartyFriendlyFire())
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
event.setCancelled(true);
return;
@ -219,6 +222,8 @@ public class EntityListener implements Listener {
return;
}
//Party Friendly Fire
if(!Config.getInstance().getPartyFriendlyFire())
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
event.setCancelled(true);
return;

View File

@ -453,7 +453,7 @@ public final class CombatUtils {
XPGainReason xpGainReason;
if (target instanceof Player) {
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) {
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
return;
}

View File

@ -237,6 +237,8 @@ Items:
# Settings for Parties
###
Party:
# Enable Hurting other players in the same party
FriendlyFire: false
# Maximum size for a party, -1 for infinite
MaxSize: -1
# Amount of time (in hours) to wait between automatically kicking old party members