Fix for PowerLossEvent Messages

This commit is contained in:
alkarin 2012-12-17 11:34:19 -06:00
parent 1f5dc830be
commit 6eb23a200e

View File

@ -1,14 +1,15 @@
package com.massivecraft.factions.listeners;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.text.MessageFormat;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Enderman;
@ -44,6 +45,8 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.event.PowerLossEvent;
import com.massivecraft.factions.listeners.FactionsBlockListener;
import com.massivecraft.factions.struct.FFlag;
import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.util.MiscUtil;
@ -81,7 +84,7 @@ public class FactionsEntityListener implements Listener
powerLossEvent.setCancelled(true);
}
else {
powerLossEvent.setMessage("<i>Your power is now <h>"+fplayer.getPowerRounded()+" / "+fplayer.getPowerMaxRounded());
powerLossEvent.setMessage("<i>Your power is now <h>%d / %d");
}
// call Event
Bukkit.getPluginManager().callEvent(powerLossEvent);
@ -90,7 +93,7 @@ public class FactionsEntityListener implements Listener
final String msg = powerLossEvent.getMessage();
if (msg != null && !msg.isEmpty())
{
fplayer.msg(msg);
fplayer.msg(msg,fplayer.getPowerRounded(),fplayer.getPowerMaxRounded());
}
// Call player onDeath if the event is not cancelled
if(!powerLossEvent.isCancelled())