Fixed a bug with the smoke effect for the faction home and one NPE.

This commit is contained in:
Olof Larsson 2011-10-13 22:49:41 +02:00
parent 88fe43d600
commit 618c5fceed
5 changed files with 11 additions and 12 deletions

@ -391,13 +391,13 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
@Override @Override
public String describeTo(RelationParticipator that, boolean ucfirst) public String describeTo(RelationParticipator that, boolean ucfirst)
{ {
return RelationUtil.describeThatToMe(that, this, ucfirst); return RelationUtil.describeThatToMe(this, that, ucfirst);
} }
@Override @Override
public String describeTo(RelationParticipator that) public String describeTo(RelationParticipator that)
{ {
return RelationUtil.describeThatToMe(that, this); return RelationUtil.describeThatToMe(this, that);
} }
@Override @Override

@ -131,9 +131,9 @@ public class CmdHome extends FCommand
{ {
List<Location> smokeLocations = new ArrayList<Location>(); List<Location> smokeLocations = new ArrayList<Location>();
smokeLocations.add(me.getLocation()); smokeLocations.add(me.getLocation());
smokeLocations.add(me.getLocation().add(0, 1, 0)); smokeLocations.add(me.getLocation().clone().add(0, 1, 0));
smokeLocations.add(myFaction.getHome()); smokeLocations.add(myFaction.getHome());
smokeLocations.add(myFaction.getHome().add(0, 1, 0)); smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness); SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
} }

@ -96,7 +96,7 @@ public class Econ
// Bypassing players can do any kind of transaction // Bypassing players can do any kind of transaction
if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true; if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true;
// Players with the any withdraw can to. // Players with the any withdraw can do.
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer)i).getPlayer())) return true; if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer)i).getPlayer())) return true;
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again. // You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.

@ -56,20 +56,17 @@ public class RelationUtil
return "" + getRelationColor(me, that) + ret; return "" + getRelationColor(me, that) + ret;
} }
public static String describeThatToMe(RelationParticipator that, public static String describeThatToMe(RelationParticipator that, RelationParticipator me)
RelationParticipator me)
{ {
return describeThatToMe(that, me, false); return describeThatToMe(that, me, false);
} }
public static Relation getRelationTo(RelationParticipator me, public static Relation getRelationTo(RelationParticipator me, RelationParticipator that)
RelationParticipator that)
{ {
return getRelationTo(that, me, false); return getRelationTo(that, me, false);
} }
public static Relation getRelationTo(RelationParticipator me, public static Relation getRelationTo(RelationParticipator me, RelationParticipator that, boolean ignorePeaceful)
RelationParticipator that, boolean ignorePeaceful)
{ {
Faction fthat = getFaction(that); Faction fthat = getFaction(that);
if (fthat == null) return Relation.NEUTRAL; // ERROR if (fthat == null) return Relation.NEUTRAL; // ERROR

@ -82,6 +82,8 @@ public class PermUtil {
*/ */
public boolean has (CommandSender me, String perm) public boolean has (CommandSender me, String perm)
{ {
if (me == null) return false;
if ( ! (me instanceof Player)) if ( ! (me instanceof Player))
{ {
return me.hasPermission(perm); return me.hasPermission(perm);
@ -108,7 +110,7 @@ public class PermUtil {
{ {
return true; return true;
} }
else if (informSenderIfNot) else if (informSenderIfNot && me != null)
{ {
me.sendMessage(this.getForbiddenMessage(perm)); me.sendMessage(this.getForbiddenMessage(perm));
} }