From 618c5fceedf893f5a10fa1377114c4e27bb7e950 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 13 Oct 2011 22:49:41 +0200 Subject: [PATCH] Fixed a bug with the smoke effect for the faction home and one NPE. --- src/com/massivecraft/factions/FPlayer.java | 4 ++-- src/com/massivecraft/factions/cmd/CmdHome.java | 4 ++-- src/com/massivecraft/factions/integration/Econ.java | 2 +- src/com/massivecraft/factions/util/RelationUtil.java | 9 +++------ src/com/massivecraft/factions/zcore/util/PermUtil.java | 4 +++- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index f6dffee7..e9c753ba 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -391,13 +391,13 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator @Override public String describeTo(RelationParticipator that, boolean ucfirst) { - return RelationUtil.describeThatToMe(that, this, ucfirst); + return RelationUtil.describeThatToMe(this, that, ucfirst); } @Override public String describeTo(RelationParticipator that) { - return RelationUtil.describeThatToMe(that, this); + return RelationUtil.describeThatToMe(this, that); } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdHome.java b/src/com/massivecraft/factions/cmd/CmdHome.java index 9236ffa8..6f6034cf 100644 --- a/src/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/com/massivecraft/factions/cmd/CmdHome.java @@ -131,9 +131,9 @@ public class CmdHome extends FCommand { List smokeLocations = new ArrayList(); 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().add(0, 1, 0)); + smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0)); SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness); } diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 6130373c..5e3e5eb8 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -96,7 +96,7 @@ public class Econ // Bypassing players can do any kind of transaction 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; // You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again. diff --git a/src/com/massivecraft/factions/util/RelationUtil.java b/src/com/massivecraft/factions/util/RelationUtil.java index 089b7470..6b1ae58e 100644 --- a/src/com/massivecraft/factions/util/RelationUtil.java +++ b/src/com/massivecraft/factions/util/RelationUtil.java @@ -56,20 +56,17 @@ public class RelationUtil return "" + getRelationColor(me, that) + ret; } - public static String describeThatToMe(RelationParticipator that, - RelationParticipator me) + public static String describeThatToMe(RelationParticipator that, RelationParticipator me) { return describeThatToMe(that, me, false); } - public static Relation getRelationTo(RelationParticipator me, - RelationParticipator that) + public static Relation getRelationTo(RelationParticipator me, RelationParticipator that) { return getRelationTo(that, me, false); } - public static Relation getRelationTo(RelationParticipator me, - RelationParticipator that, boolean ignorePeaceful) + public static Relation getRelationTo(RelationParticipator me, RelationParticipator that, boolean ignorePeaceful) { Faction fthat = getFaction(that); if (fthat == null) return Relation.NEUTRAL; // ERROR diff --git a/src/com/massivecraft/factions/zcore/util/PermUtil.java b/src/com/massivecraft/factions/zcore/util/PermUtil.java index 1f1fb3d9..72e05d46 100644 --- a/src/com/massivecraft/factions/zcore/util/PermUtil.java +++ b/src/com/massivecraft/factions/zcore/util/PermUtil.java @@ -82,6 +82,8 @@ public class PermUtil { */ public boolean has (CommandSender me, String perm) { + if (me == null) return false; + if ( ! (me instanceof Player)) { return me.hasPermission(perm); @@ -108,7 +110,7 @@ public class PermUtil { { return true; } - else if (informSenderIfNot) + else if (informSenderIfNot && me != null) { me.sendMessage(this.getForbiddenMessage(perm)); }