Fix for /f permanent and /f peaceful commands giving an NPE if run from console

Fix for rare NPE when Spout territory info update is run and affected player disconnects at precisely that moment
Clarified "cannot attack neutral faction" messages to indicate enemy status is needed
Updated Bukkit lib to correspond with CB 1337
This commit is contained in:
Brettflan 2011-10-20 18:08:55 -05:00
parent ee654b761e
commit 38e128010c
5 changed files with 13 additions and 7 deletions

Binary file not shown.

View File

@ -49,11 +49,11 @@ public class CmdPeaceful extends FCommand
{
if (fplayer.getFaction() == faction)
{
fplayer.msg(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" your faction.");
fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+"<i> has "+change+" your faction.");
}
else
{
fplayer.msg(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
}
}

View File

@ -48,11 +48,11 @@ public class CmdPermanent extends FCommand
{
if (fplayer.getFaction() == faction)
{
fplayer.msg(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" your faction.");
fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+"<i> has "+change+" your faction.");
}
else
{
fplayer.msg(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
}
}
}

View File

@ -3,6 +3,8 @@ package com.massivecraft.factions.integration;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
@ -44,7 +46,11 @@ public class SpoutMainListener extends SpoutListener
public boolean updateTerritoryDisplay(FPlayer player)
{
SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
Player p = player.getPlayer();
if (p == null)
return false;
SpoutPlayer sPlayer = SpoutManager.getPlayer(p);
if (!sPlayer.isSpoutCraftEnabled() || (Conf.spoutTerritoryDisplaySize <= 0 && ! Conf.spoutTerritoryNoticeShow))
return false;

View File

@ -324,7 +324,7 @@ public class FactionsEntityListener extends EntityListener
// You can not hurt neutral factions
if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral())
{
attacker.sendMessage("You can't hurt neutral factions");
attacker.sendMessage("You can't hurt neutral factions. Declare them as an enemy.");
return false;
}
@ -346,7 +346,7 @@ public class FactionsEntityListener extends EntityListener
// You can not hurt neutrals in their own territory.
if (ownTerritory && relation.isNeutral())
{
attacker.sendMessage(p.txt.parse("<i>You can't hurt "+relation.getColor()+defender.getNameAndRelevant(attacker)+"<i> in their own territory."));
attacker.sendMessage(p.txt.parse("<i>You can't hurt "+relation.getColor()+defender.getNameAndRelevant(attacker)+"<i> in their own territory unless you declare them as an enemy."));
defender.sendMessage(p.txt.parse(attacker.getNameAndRelevant(defender)+"<i> tried to hurt you."));
return false;
}