From 32624e03398d3b0f81e67b9af6bd2590f31d0cc8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sun, 23 Oct 2011 02:43:25 +0200 Subject: [PATCH] Fixing a string format error and possibly solving a money rights issue --- src/com/massivecraft/factions/integration/Econ.java | 12 ++++++------ .../factions/listeners/FactionsEntityListener.java | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 09a70b1d..342bb2a3 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -86,11 +86,11 @@ public class Econ public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you) { - Faction fInvoker = RelationUtil.getFaction(i); - Faction fFrom = RelationUtil.getFaction(you); + Faction fI = RelationUtil.getFaction(i); + Faction fYou = RelationUtil.getFaction(you); // This is a system invoker. Accept it. - if (fInvoker == null) return true; + if (fI == null) return true; // Bypassing players can do any kind of transaction if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true; @@ -104,10 +104,10 @@ public class Econ // A faction can always transfer away the money of it's members and its own money... // This will however probably never happen as a faction does not have free will. // Ohh by the way... Yes it could. For daily rent to the faction. - if (i == fInvoker && fInvoker == fFrom) return true; + if (i == fI && fI == fYou) return true; - // If you are part of the same faction as from and members can withdraw or you are at least moderator... then it is ok. - if (fInvoker == fFrom && (Conf.bankMembersCanWithdraw || ((FPlayer)i).getRole().value >= Role.MODERATOR.value)) return true; + // Factions can be controlled by members that are moderators... or any member if any member can withdraw. + if (you instanceof Faction && fI == fYou && (Conf.bankMembersCanWithdraw || ((FPlayer)i).getRole().value >= Role.MODERATOR.value)) return true; // Otherwise you may not! ;,,; i.msg("%s lack permission to controll %s's money.", i.describeTo(i, true), you.describeTo(i)); diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index ec959d66..b30bd91b 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.listeners; import java.text.MessageFormat; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; @@ -362,7 +361,7 @@ public class FactionsEntityListener extends EntityListener // Send message String perc = MessageFormat.format("{0,number,#%}", (Conf.territoryShieldFactor)); // TODO does this display correctly?? - defender.msg("Enemy damage reduced by "+ChatColor.RED+perc+"."); + defender.msg("Enemy damage reduced by %s.", perc); } return true;