The friendlyfire flag now works
This commit is contained in:
parent
8eec55e37e
commit
451d9570e4
@ -110,7 +110,7 @@ public class Factions extends EntityCollection<Faction>
|
|||||||
faction.setFlag(FFlag.MONSTERS, true);
|
faction.setFlag(FFlag.MONSTERS, true);
|
||||||
faction.setFlag(FFlag.EXPLOSIONS, true);
|
faction.setFlag(FFlag.EXPLOSIONS, true);
|
||||||
faction.setFlag(FFlag.FIRESPREAD, true);
|
faction.setFlag(FFlag.FIRESPREAD, true);
|
||||||
faction.setFlag(FFlag.LIGHTNING, true);
|
//faction.setFlag(FFlag.LIGHTNING, true);
|
||||||
faction.setFlag(FFlag.ENDERGRIEF, true);
|
faction.setFlag(FFlag.ENDERGRIEF, true);
|
||||||
|
|
||||||
faction.setPermittedRelations(FPerm.BUILD, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
faction.setPermittedRelations(FPerm.BUILD, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
||||||
@ -131,7 +131,7 @@ public class Factions extends EntityCollection<Faction>
|
|||||||
faction.setFlag(FFlag.MONSTERS, false);
|
faction.setFlag(FFlag.MONSTERS, false);
|
||||||
faction.setFlag(FFlag.EXPLOSIONS, false);
|
faction.setFlag(FFlag.EXPLOSIONS, false);
|
||||||
faction.setFlag(FFlag.FIRESPREAD, false);
|
faction.setFlag(FFlag.FIRESPREAD, false);
|
||||||
faction.setFlag(FFlag.LIGHTNING, false);
|
//faction.setFlag(FFlag.LIGHTNING, false);
|
||||||
faction.setFlag(FFlag.ENDERGRIEF, false);
|
faction.setFlag(FFlag.ENDERGRIEF, false);
|
||||||
|
|
||||||
faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
||||||
@ -151,7 +151,7 @@ public class Factions extends EntityCollection<Faction>
|
|||||||
faction.setFlag(FFlag.MONSTERS, true);
|
faction.setFlag(FFlag.MONSTERS, true);
|
||||||
faction.setFlag(FFlag.EXPLOSIONS, true);
|
faction.setFlag(FFlag.EXPLOSIONS, true);
|
||||||
faction.setFlag(FFlag.FIRESPREAD, true);
|
faction.setFlag(FFlag.FIRESPREAD, true);
|
||||||
faction.setFlag(FFlag.LIGHTNING, true);
|
//faction.setFlag(FFlag.LIGHTNING, true);
|
||||||
faction.setFlag(FFlag.ENDERGRIEF, true);
|
faction.setFlag(FFlag.ENDERGRIEF, true);
|
||||||
|
|
||||||
faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
|
||||||
|
@ -65,12 +65,6 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
fplayer.msg("<i>Your power is now <h>"+fplayer.getPowerRounded()+" / "+fplayer.getPowerMaxRounded());
|
fplayer.msg("<i>Your power is now <h>"+fplayer.getPowerRounded()+" / "+fplayer.getPowerMaxRounded());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Who can I hurt?
|
|
||||||
* I can never hurt members or allies.
|
|
||||||
* I can always hurt enemies.
|
|
||||||
* I can hurt neutrals as long as they are outside their own territory.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -146,7 +140,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
if (damager instanceof Player)
|
if (damager instanceof Player)
|
||||||
{
|
{
|
||||||
FPlayer attacker = FPlayers.i.get((Player)damager);
|
FPlayer attacker = FPlayers.i.get((Player)damager);
|
||||||
attacker.msg("<i>You can't hurt other players here.");
|
attacker.msg("<i>PVP is disabled in %s.", defLocFaction.describeTo(attacker));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return defLocFaction.getFlag(FFlag.MONSTERS);
|
return defLocFaction.getFlag(FFlag.MONSTERS);
|
||||||
@ -175,7 +169,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
// so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be?
|
// so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be?
|
||||||
if (locFaction.getFlag(FFlag.PVP) == false)
|
if (locFaction.getFlag(FFlag.PVP) == false)
|
||||||
{
|
{
|
||||||
attacker.msg("<i>You can't hurt other players here.");
|
attacker.msg("<i>PVP is disabled in %s.", locFaction.describeTo(attacker));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,15 +198,14 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
Rel relation = defendFaction.getRelationTo(attackFaction);
|
Rel relation = defendFaction.getRelationTo(attackFaction);
|
||||||
|
|
||||||
// Check the relation
|
// Check the relation
|
||||||
if (relation.isAtLeast(Conf.friendlyFireFromRel))
|
if (relation.isAtLeast(Conf.friendlyFireFromRel) && defLocFaction.getFlag(FFlag.FRIENDLYFIRE) == false)
|
||||||
{
|
{
|
||||||
attacker.msg("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());
|
attacker.msg("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ownTerritory = defender.isInOwnTerritory();
|
|
||||||
|
|
||||||
// You can not hurt neutrals in their own territory.
|
// You can not hurt neutrals in their own territory.
|
||||||
|
boolean ownTerritory = defender.isInOwnTerritory();
|
||||||
if (ownTerritory && relation == Rel.NEUTRAL)
|
if (ownTerritory && relation == Rel.NEUTRAL)
|
||||||
{
|
{
|
||||||
attacker.msg("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy.", defender.describeTo(attacker));
|
attacker.msg("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy.", defender.describeTo(attacker));
|
||||||
|
Loading…
Reference in New Issue
Block a user