Fix for PowerLossEvent Messages
This commit is contained in:
parent
1f5dc830be
commit
6eb23a200e
@ -1,14 +1,15 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Enderman;
|
import org.bukkit.entity.Enderman;
|
||||||
@ -44,6 +45,8 @@ import com.massivecraft.factions.FPlayer;
|
|||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.P;
|
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.FFlag;
|
||||||
import com.massivecraft.factions.struct.Rel;
|
import com.massivecraft.factions.struct.Rel;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
@ -81,7 +84,7 @@ public class FactionsEntityListener implements Listener
|
|||||||
powerLossEvent.setCancelled(true);
|
powerLossEvent.setCancelled(true);
|
||||||
}
|
}
|
||||||
else {
|
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
|
// call Event
|
||||||
Bukkit.getPluginManager().callEvent(powerLossEvent);
|
Bukkit.getPluginManager().callEvent(powerLossEvent);
|
||||||
@ -90,7 +93,7 @@ public class FactionsEntityListener implements Listener
|
|||||||
final String msg = powerLossEvent.getMessage();
|
final String msg = powerLossEvent.getMessage();
|
||||||
if (msg != null && !msg.isEmpty())
|
if (msg != null && !msg.isEmpty())
|
||||||
{
|
{
|
||||||
fplayer.msg(msg);
|
fplayer.msg(msg,fplayer.getPowerRounded(),fplayer.getPowerMaxRounded());
|
||||||
}
|
}
|
||||||
// Call player onDeath if the event is not cancelled
|
// Call player onDeath if the event is not cancelled
|
||||||
if(!powerLossEvent.isCancelled())
|
if(!powerLossEvent.isCancelled())
|
||||||
|
Loading…
Reference in New Issue
Block a user