more variable renames for FPlayer --> UPlayer
This commit is contained in:
parent
19f9834210
commit
bc194efc9b
@ -194,11 +194,11 @@ public enum FPerm
|
|||||||
|
|
||||||
if (!ret && informIfNot && rpSubject instanceof UPlayer)
|
if (!ret && informIfNot && rpSubject instanceof UPlayer)
|
||||||
{
|
{
|
||||||
UPlayer fplayer = (UPlayer)rpSubject;
|
UPlayer uplayer = (UPlayer)rpSubject;
|
||||||
fplayer.msg(errorpattern, hostFaction.describeTo(fplayer, true), this.getDescription());
|
uplayer.msg(errorpattern, hostFaction.describeTo(uplayer, true), this.getDescription());
|
||||||
if (Perm.ADMIN.has(fplayer.getPlayer()))
|
if (Perm.ADMIN.has(uplayer.getPlayer()))
|
||||||
{
|
{
|
||||||
fplayer.msg("<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
uplayer.msg("<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -35,8 +35,8 @@ public class FactionEqualsPredictate implements Predictate<CommandSender>, Seria
|
|||||||
@Override
|
@Override
|
||||||
public boolean apply(CommandSender sender)
|
public boolean apply(CommandSender sender)
|
||||||
{
|
{
|
||||||
UPlayer fplayer = UPlayer.get(sender);
|
UPlayer uplayer = UPlayer.get(sender);
|
||||||
return this.factionId.equals(fplayer.getFactionId());
|
return this.factionId.equals(uplayer.getFactionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -86,7 +86,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
// INDEX
|
// INDEX
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void reindexFPlayers()
|
public void reindexUPlayers()
|
||||||
{
|
{
|
||||||
for (Faction faction : this.getAll())
|
for (Faction faction : this.getAll())
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ public class FactionColls extends Colls<FactionColl, Faction>
|
|||||||
{
|
{
|
||||||
for (FactionColl coll : this.getColls())
|
for (FactionColl coll : this.getColls())
|
||||||
{
|
{
|
||||||
coll.reindexFPlayers();
|
coll.reindexUPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,17 +94,17 @@ public class UPlayerColls extends Colls<UPlayerColl, UPlayer>
|
|||||||
|
|
||||||
// Read the file content through GSON.
|
// Read the file content through GSON.
|
||||||
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
|
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
|
||||||
Map<String, UPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
Map<String, UPlayer> id2uplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||||
|
|
||||||
// The Coll
|
// The Coll
|
||||||
UPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
UPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
||||||
|
|
||||||
// Set the data
|
// Set the data
|
||||||
for (Entry<String, UPlayer> entry : id2fplayer.entrySet())
|
for (Entry<String, UPlayer> entry : id2uplayer.entrySet())
|
||||||
{
|
{
|
||||||
String playerId = entry.getKey();
|
String playerId = entry.getKey();
|
||||||
UPlayer fplayer = entry.getValue();
|
UPlayer uplayer = entry.getValue();
|
||||||
coll.attach(fplayer, playerId);
|
coll.attach(uplayer, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark as migrated
|
// Mark as migrated
|
||||||
|
@ -20,8 +20,8 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final UPlayer fplayer;
|
private final UPlayer uplayer;
|
||||||
public UPlayer getFPlayer() { return this.fplayer; }
|
public UPlayer getUPlayer() { return this.uplayer; }
|
||||||
|
|
||||||
private final Faction faction;
|
private final Faction faction;
|
||||||
public Faction getFaction() { return this.faction; }
|
public Faction getFaction() { return this.faction; }
|
||||||
@ -34,10 +34,10 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventInvitedChange(CommandSender sender, UPlayer fplayer, Faction faction, boolean newInvited)
|
public FactionsEventInvitedChange(CommandSender sender, UPlayer uplayer, Faction faction, boolean newInvited)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.fplayer = fplayer;
|
this.uplayer = uplayer;
|
||||||
this.faction = faction;
|
this.faction = faction;
|
||||||
this.newInvited = newInvited;
|
this.newInvited = newInvited;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
|
|||||||
super.setCancelled(cancelled);
|
super.setCancelled(cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final UPlayer fplayer;
|
private final UPlayer uplayer;
|
||||||
public UPlayer getFPlayer() { return this.fplayer; }
|
public UPlayer getUPlayer() { return this.uplayer; }
|
||||||
|
|
||||||
private final Faction newFaction;
|
private final Faction newFaction;
|
||||||
public Faction getNewFaction() { return this.newFaction; }
|
public Faction getNewFaction() { return this.newFaction; }
|
||||||
@ -40,10 +40,10 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventMembershipChange(CommandSender sender, UPlayer fplayer, Faction newFaction, MembershipChangeReason reason)
|
public FactionsEventMembershipChange(CommandSender sender, UPlayer uplayer, Faction newFaction, MembershipChangeReason reason)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.fplayer = fplayer;
|
this.uplayer = uplayer;
|
||||||
this.newFaction = newFaction;
|
this.newFaction = newFaction;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final UPlayer fplayer;
|
private final UPlayer uplayer;
|
||||||
public UPlayer getFPlayer() { return this.fplayer; }
|
public UPlayer getUPlayer() { return this.uplayer; }
|
||||||
|
|
||||||
private final PowerChangeReason reason;
|
private final PowerChangeReason reason;
|
||||||
public PowerChangeReason getReason() { return this.reason; }
|
public PowerChangeReason getReason() { return this.reason; }
|
||||||
@ -33,10 +33,10 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventPowerChange(CommandSender sender, UPlayer fplayer, PowerChangeReason reason, double newPower)
|
public FactionsEventPowerChange(CommandSender sender, UPlayer uplayer, PowerChangeReason reason, double newPower)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.fplayer = fplayer;
|
this.uplayer = uplayer;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
this.newPower = newPower;
|
this.newPower = newPower;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final UPlayer fplayer;
|
private final UPlayer uplayer;
|
||||||
public UPlayer getFPlayer() { return this.fplayer; }
|
public UPlayer getUPlayer() { return this.uplayer; }
|
||||||
|
|
||||||
private String newTitle;
|
private String newTitle;
|
||||||
public String getNewTitle() { return this.newTitle; }
|
public String getNewTitle() { return this.newTitle; }
|
||||||
@ -30,10 +30,10 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventTitleChange(CommandSender sender, UPlayer fplayer, String newTitle)
|
public FactionsEventTitleChange(CommandSender sender, UPlayer uplayer, String newTitle)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.fplayer = fplayer;
|
this.uplayer = uplayer;
|
||||||
this.newTitle = newTitle;
|
this.newTitle = newTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +167,9 @@ public class Econ
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<UPlayer> getFplayers(EconomyParticipator ep)
|
public static Set<UPlayer> getUPlayers(EconomyParticipator ep)
|
||||||
{
|
{
|
||||||
Set<UPlayer> fplayers = new HashSet<UPlayer>();
|
Set<UPlayer> uplayers = new HashSet<UPlayer>();
|
||||||
|
|
||||||
if (ep == null)
|
if (ep == null)
|
||||||
{
|
{
|
||||||
@ -177,22 +177,22 @@ public class Econ
|
|||||||
}
|
}
|
||||||
else if (ep instanceof UPlayer)
|
else if (ep instanceof UPlayer)
|
||||||
{
|
{
|
||||||
fplayers.add((UPlayer)ep);
|
uplayers.add((UPlayer)ep);
|
||||||
}
|
}
|
||||||
else if (ep instanceof Faction)
|
else if (ep instanceof Faction)
|
||||||
{
|
{
|
||||||
fplayers.addAll(((Faction)ep).getUPlayers());
|
uplayers.addAll(((Faction)ep).getUPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
return fplayers;
|
return uplayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
|
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
|
||||||
{
|
{
|
||||||
Set<UPlayer> recipients = new HashSet<UPlayer>();
|
Set<UPlayer> recipients = new HashSet<UPlayer>();
|
||||||
recipients.addAll(getFplayers(invoker));
|
recipients.addAll(getUPlayers(invoker));
|
||||||
recipients.addAll(getFplayers(from));
|
recipients.addAll(getUPlayers(from));
|
||||||
recipients.addAll(getFplayers(to));
|
recipients.addAll(getUPlayers(to));
|
||||||
|
|
||||||
if (invoker == null)
|
if (invoker == null)
|
||||||
{
|
{
|
||||||
|
@ -72,9 +72,9 @@ public class SpoutFeatures
|
|||||||
|
|
||||||
for (Player player : fromPlayers)
|
for (Player player : fromPlayers)
|
||||||
{
|
{
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||||
Faction faction = fplayer.getFaction();
|
Faction faction = uplayer.getFaction();
|
||||||
|
|
||||||
String cape = faction.getCape();
|
String cape = faction.getCape();
|
||||||
if (cape == null)
|
if (cape == null)
|
||||||
@ -137,19 +137,19 @@ public class SpoutFeatures
|
|||||||
|
|
||||||
for (Player player : fromPlayers)
|
for (Player player : fromPlayers)
|
||||||
{
|
{
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||||
Faction faction = fplayer.getFaction();
|
Faction faction = uplayer.getFaction();
|
||||||
|
|
||||||
for (Player playerTo : toPlayers)
|
for (Player playerTo : toPlayers)
|
||||||
{
|
{
|
||||||
UPlayer fplayerTo = UPlayer.get(playerTo);
|
UPlayer uplayerTo = UPlayer.get(playerTo);
|
||||||
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
|
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
|
||||||
Faction factionTo = fplayerTo.getFaction();
|
Faction factionTo = uplayerTo.getFaction();
|
||||||
|
|
||||||
ChatColor relationColor = faction.getRelationTo(factionTo).getColor();
|
ChatColor relationColor = faction.getRelationTo(factionTo).getColor();
|
||||||
|
|
||||||
String title = generateTitle(player, fplayer, faction, relationColor);
|
String title = generateTitle(player, uplayer, faction, relationColor);
|
||||||
|
|
||||||
boolean skip = onlyIfDifferent && title.equals(splayer.getTitleFor(splayerTo));
|
boolean skip = onlyIfDifferent && title.equals(splayer.getTitleFor(splayerTo));
|
||||||
//Bukkit.getConsoleSender().sendMessage(P.p.txt.parse("<i>TITLE SKIP:<h>%s <i>FROM <h>%s <i>TO <h>%s <i>TITLE <h>%s", String.valueOf(skip), player.getDisplayName(), playerTo.getDisplayName(), title));
|
//Bukkit.getConsoleSender().sendMessage(P.p.txt.parse("<i>TITLE SKIP:<h>%s <i>FROM <h>%s <i>TO <h>%s <i>TITLE <h>%s", String.valueOf(skip), player.getDisplayName(), playerTo.getDisplayName(), title));
|
||||||
@ -178,7 +178,7 @@ public class SpoutFeatures
|
|||||||
}, 5);
|
}, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generateTitle(Player player, UPlayer fplayer, Faction faction, ChatColor relationColor)
|
public static String generateTitle(Player player, UPlayer uplayer, Faction faction, ChatColor relationColor)
|
||||||
{
|
{
|
||||||
String ret = null;
|
String ret = null;
|
||||||
|
|
||||||
@ -189,12 +189,12 @@ public class SpoutFeatures
|
|||||||
String addTag = "";
|
String addTag = "";
|
||||||
if (ConfServer.spoutFactionTagsOverNames)
|
if (ConfServer.spoutFactionTagsOverNames)
|
||||||
{
|
{
|
||||||
addTag += relationColor.toString() + fplayer.getRole().getPrefix() + faction.getTag();
|
addTag += relationColor.toString() + uplayer.getRole().getPrefix() + faction.getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfServer.spoutFactionTitlesOverNames && fplayer.hasTitle())
|
if (ConfServer.spoutFactionTitlesOverNames && uplayer.hasTitle())
|
||||||
{
|
{
|
||||||
addTag += (addTag.isEmpty() ? "" : " ") + fplayer.getTitle();
|
addTag += (addTag.isEmpty() ? "" : " ") + uplayer.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = addTag + "\n" + ret;
|
ret = addTag + "\n" + ret;
|
||||||
@ -222,8 +222,8 @@ public class SpoutFeatures
|
|||||||
}
|
}
|
||||||
else if (o instanceof UPlayer)
|
else if (o instanceof UPlayer)
|
||||||
{
|
{
|
||||||
UPlayer fplayer = (UPlayer)o;
|
UPlayer uplayer = (UPlayer)o;
|
||||||
Player player = fplayer.getPlayer();
|
Player player = uplayer.getPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
ret.add(player);
|
ret.add(player);
|
||||||
@ -252,14 +252,14 @@ public class SpoutFeatures
|
|||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
if (chunk == null)
|
if (chunk == null)
|
||||||
{
|
{
|
||||||
mainListener.updateTerritoryDisplay(fplayer, false);
|
mainListener.updateTerritoryDisplay(uplayer, false);
|
||||||
}
|
}
|
||||||
else if (fplayer.getCurrentChunk().equals(chunk))
|
else if (uplayer.getCurrentChunk().equals(chunk))
|
||||||
{
|
{
|
||||||
mainListener.updateTerritoryDisplay(fplayer, true);
|
mainListener.updateTerritoryDisplay(uplayer, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,10 +280,10 @@ public class SpoutFeatures
|
|||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
if (chunk == null || fplayer.getCurrentChunk().equals(chunk))
|
if (chunk == null || uplayer.getCurrentChunk().equals(chunk))
|
||||||
{
|
{
|
||||||
mainListener.updateAccessInfo(fplayer);
|
mainListener.updateAccessInfo(uplayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,65 +264,6 @@ public abstract class FactionsChannelAbstract implements Channel
|
|||||||
Herochat.logChat(msg);
|
Herochat.logChat(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
|
||||||
public void processChat(ChannelChatEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getSender().getPlayer();
|
|
||||||
|
|
||||||
String format = applyFormat(event.getFormat(), event.getBukkitFormat(), player);
|
|
||||||
|
|
||||||
Chatter sender = Herochat.getChatterManager().getChatter(player);
|
|
||||||
Set<Player> recipients = new HashSet<Player>(Arrays.asList(Bukkit.getOnlinePlayers()));
|
|
||||||
|
|
||||||
trimRecipients(recipients, sender);
|
|
||||||
if (!isMessageHeard(recipients, sender))
|
|
||||||
{
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herochat.getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Messaging.send(player, Herochat.getMessage("channel_alone"));
|
|
||||||
}
|
|
||||||
catch (MessageNotFoundException e)
|
|
||||||
{
|
|
||||||
Herochat.severe("Messages.properties is missing: channel_alone");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1L);
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer fplayer = FPlayers.i.get(player);
|
|
||||||
|
|
||||||
String formatWithoutColor = FactionsChatListener.parseTags(format, player, fplayer);
|
|
||||||
|
|
||||||
//String msg = String.format(format, player.getDisplayName(), event.getMessage());
|
|
||||||
|
|
||||||
|
|
||||||
for (Player recipient : recipients)
|
|
||||||
{
|
|
||||||
String finalFormat;
|
|
||||||
if ( ! Conf.chatParseTags || Conf.chatTagHandledByAnotherPlugin)
|
|
||||||
{
|
|
||||||
finalFormat = format;
|
|
||||||
}
|
|
||||||
else if (! Conf.chatParseTagsColored)
|
|
||||||
{
|
|
||||||
finalFormat = formatWithoutColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FPlayer frecipient = FPlayers.i.get(recipient);
|
|
||||||
finalFormat = FactionsChatListener.parseTags(format, player, fplayer, recipient, frecipient);
|
|
||||||
}
|
|
||||||
String msg = String.format(finalFormat, player.getDisplayName(), event.getMessage());
|
|
||||||
recipient.sendMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
Herochat.logChat(String.format(formatWithoutColor, player.getDisplayName(), event.getMessage()));
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public boolean isMessageHeard(Set<Player> recipients, Chatter sender)
|
public boolean isMessageHeard(Set<Player> recipients, Chatter sender)
|
||||||
{
|
{
|
||||||
if (!isLocal()) return true;
|
if (!isLocal()) return true;
|
||||||
|
@ -89,35 +89,35 @@ public class FactionsListenerMain implements Listener
|
|||||||
{
|
{
|
||||||
// If a player dies ...
|
// If a player dies ...
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
// ... and powerloss can happen here ...
|
// ... and powerloss can happen here ...
|
||||||
Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player));
|
Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player));
|
||||||
|
|
||||||
if (!faction.getFlag(FFlag.POWERLOSS))
|
if (!faction.getFlag(FFlag.POWERLOSS))
|
||||||
{
|
{
|
||||||
fplayer.msg("<i>You didn't lose any power since the territory you died in works that way.");
|
uplayer.msg("<i>You didn't lose any power since the territory you died in works that way.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MConf.get().worldsNoPowerLoss.contains(player.getWorld().getName()))
|
if (MConf.get().worldsNoPowerLoss.contains(player.getWorld().getName()))
|
||||||
{
|
{
|
||||||
fplayer.msg("<i>You didn't lose any power due to the world you died in.");
|
uplayer.msg("<i>You didn't lose any power due to the world you died in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... Event ...
|
// ... Event ...
|
||||||
double newPower = fplayer.getPower() + UConf.get(fplayer).powerPerDeath;
|
double newPower = uplayer.getPower() + UConf.get(uplayer).powerPerDeath;
|
||||||
FactionsEventPowerChange powerChangeEvent = new FactionsEventPowerChange(null, fplayer, PowerChangeReason.DEATH, newPower);
|
FactionsEventPowerChange powerChangeEvent = new FactionsEventPowerChange(null, uplayer, PowerChangeReason.DEATH, newPower);
|
||||||
powerChangeEvent.run();
|
powerChangeEvent.run();
|
||||||
if (powerChangeEvent.isCancelled()) return;
|
if (powerChangeEvent.isCancelled()) return;
|
||||||
newPower = powerChangeEvent.getNewPower();
|
newPower = powerChangeEvent.getNewPower();
|
||||||
|
|
||||||
// ... alter the power ...
|
// ... alter the power ...
|
||||||
fplayer.setPower(newPower);
|
uplayer.setPower(newPower);
|
||||||
|
|
||||||
// ... and inform the player.
|
// ... and inform the player.
|
||||||
fplayer.msg("<i>Your power is now <h>%d / %d", fplayer.getPowerRounded(), fplayer.getPowerMaxRounded());
|
uplayer.msg("<i>Your power is now <h>%d / %d", uplayer.getPowerRounded(), uplayer.getPowerMaxRounded());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -292,7 +292,7 @@ public class FactionsListenerMain implements Listener
|
|||||||
{
|
{
|
||||||
// If a player was kicked from the server ...
|
// If a player was kicked from the server ...
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
// ... and if the if player was banned (not just kicked) ...
|
// ... and if the if player was banned (not just kicked) ...
|
||||||
if (!event.getReason().equals("Banned by admin.")) return;
|
if (!event.getReason().equals("Banned by admin.")) return;
|
||||||
@ -301,12 +301,12 @@ public class FactionsListenerMain implements Listener
|
|||||||
if (!ConfServer.removePlayerDataWhenBanned) return;
|
if (!ConfServer.removePlayerDataWhenBanned) return;
|
||||||
|
|
||||||
// ... get rid of their stored info.
|
// ... get rid of their stored info.
|
||||||
if (fplayer.getRole() == Rel.LEADER)
|
if (uplayer.getRole() == Rel.LEADER)
|
||||||
{
|
{
|
||||||
fplayer.getFaction().promoteNewLeader();
|
uplayer.getFaction().promoteNewLeader();
|
||||||
}
|
}
|
||||||
fplayer.leave(false);
|
uplayer.leave(false);
|
||||||
fplayer.detach();
|
uplayer.detach();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,10 +331,10 @@ public class FactionsListenerMain implements Listener
|
|||||||
{
|
{
|
||||||
// If a player is trying to run a command ...
|
// If a player is trying to run a command ...
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
// ... and the player does not have adminmode ...
|
// ... and the player does not have adminmode ...
|
||||||
if (fplayer.isUsingAdminMode()) return;
|
if (uplayer.isUsingAdminMode()) return;
|
||||||
|
|
||||||
// ... clean up the command ...
|
// ... clean up the command ...
|
||||||
String command = event.getMessage();
|
String command = event.getMessage();
|
||||||
@ -342,26 +342,26 @@ public class FactionsListenerMain implements Listener
|
|||||||
command = command.toLowerCase();
|
command = command.toLowerCase();
|
||||||
command = command.trim();
|
command = command.trim();
|
||||||
|
|
||||||
if (fplayer.hasFaction() && fplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, ConfServer.permanentFactionMemberDenyCommands))
|
if (uplayer.hasFaction() && uplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, ConfServer.permanentFactionMemberDenyCommands))
|
||||||
{
|
{
|
||||||
fplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
|
uplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rel rel = fplayer.getRelationToLocation();
|
Rel rel = uplayer.getRelationToLocation();
|
||||||
if (BoardColls.get().getFactionAt(fplayer.getCurrentChunk()).isNone()) return;
|
if (BoardColls.get().getFactionAt(uplayer.getCurrentChunk()).isNone()) return;
|
||||||
|
|
||||||
if (rel == Rel.NEUTRAL && containsCommand(command, ConfServer.territoryNeutralDenyCommands))
|
if (rel == Rel.NEUTRAL && containsCommand(command, ConfServer.territoryNeutralDenyCommands))
|
||||||
{
|
{
|
||||||
fplayer.msg("<b>You can't use \"<h>/%s<b>\" in neutral territory.", command);
|
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in neutral territory.", command);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rel == Rel.ENEMY && containsCommand(command, ConfServer.territoryEnemyDenyCommands))
|
if (rel == Rel.ENEMY && containsCommand(command, ConfServer.territoryEnemyDenyCommands))
|
||||||
{
|
{
|
||||||
fplayer.msg("<b>You can't use \"<h>/%s<b>\" in enemy territory.", command);
|
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in enemy territory.", command);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,18 @@ public class TodoFactionsPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
// If a player is joining the server ...
|
// If a player is joining the server ...
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
// ... recalculate their power as if they were offline since last recalculation ...
|
// ... recalculate their power as if they were offline since last recalculation ...
|
||||||
fplayer.recalculatePower(false);
|
uplayer.recalculatePower(false);
|
||||||
|
|
||||||
// ... update the current chunk ...
|
// ... update the current chunk ...
|
||||||
fplayer.setCurrentChunk(PS.valueOf(event.getPlayer()));
|
uplayer.setCurrentChunk(PS.valueOf(event.getPlayer()));
|
||||||
|
|
||||||
// ... notify the player about where they are ...
|
// ... notify the player about where they are ...
|
||||||
if ( ! SpoutFeatures.updateTerritoryDisplay(fplayer))
|
if ( ! SpoutFeatures.updateTerritoryDisplay(uplayer))
|
||||||
{
|
{
|
||||||
fplayer.sendFactionHereMessage();
|
uplayer.sendFactionHereMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,14 +51,14 @@ public class TodoFactionsPlayerListener implements Listener
|
|||||||
public void onPlayerLeave(MCorePlayerLeaveEvent event)
|
public void onPlayerLeave(MCorePlayerLeaveEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
// Recalculate the power before the player leaves.
|
// Recalculate the power before the player leaves.
|
||||||
// This is required since we recalculate as if the player were offline when they log back in.
|
// This is required since we recalculate as if the player were offline when they log back in.
|
||||||
// TODO: When I setup universes I must do this for all universe instance of the player that logs off!
|
// TODO: When I setup universes I must do this for all universe instance of the player that logs off!
|
||||||
fplayer.recalculatePower(true);
|
uplayer.recalculatePower(true);
|
||||||
|
|
||||||
SpoutFeatures.playerDisconnect(fplayer);
|
SpoutFeatures.playerDisconnect(uplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@ -69,12 +69,12 @@ public class TodoFactionsPlayerListener implements Listener
|
|||||||
|
|
||||||
// ... update the stored current chunk ...
|
// ... update the stored current chunk ...
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
|
|
||||||
PS chunkFrom = fplayer.getCurrentChunk();
|
PS chunkFrom = uplayer.getCurrentChunk();
|
||||||
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
|
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
|
||||||
|
|
||||||
fplayer.setCurrentChunk(chunkTo);
|
uplayer.setCurrentChunk(chunkTo);
|
||||||
|
|
||||||
// ... TODO: assorted and uncleaned code below ...
|
// ... TODO: assorted and uncleaned code below ...
|
||||||
|
|
||||||
@ -84,29 +84,29 @@ public class TodoFactionsPlayerListener implements Listener
|
|||||||
boolean changedFaction = (BoardColls.get().getFactionAt(chunkFrom) != BoardColls.get().getFactionAt(chunkTo));
|
boolean changedFaction = (BoardColls.get().getFactionAt(chunkFrom) != BoardColls.get().getFactionAt(chunkTo));
|
||||||
|
|
||||||
// let Spout handle most of this if it's available
|
// let Spout handle most of this if it's available
|
||||||
boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(fplayer);
|
boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(uplayer);
|
||||||
|
|
||||||
if (fplayer.isMapAutoUpdating())
|
if (uplayer.isMapAutoUpdating())
|
||||||
{
|
{
|
||||||
fplayer.sendMessage(BoardColls.get().getMap(fplayer.getFaction(), chunkTo, player.getLocation().getYaw()));
|
uplayer.sendMessage(BoardColls.get().getMap(uplayer.getFaction(), chunkTo, player.getLocation().getYaw()));
|
||||||
}
|
}
|
||||||
else if (changedFaction && ! handledBySpout)
|
else if (changedFaction && ! handledBySpout)
|
||||||
{
|
{
|
||||||
fplayer.sendFactionHereMessage();
|
uplayer.sendFactionHereMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// show access info message if needed
|
// show access info message if needed
|
||||||
if ( ! handledBySpout && ! SpoutFeatures.updateAccessInfo(fplayer) && ! access.isDefault())
|
if ( ! handledBySpout && ! SpoutFeatures.updateAccessInfo(uplayer) && ! access.isDefault())
|
||||||
{
|
{
|
||||||
if (access.subjectHasAccess(fplayer))
|
if (access.subjectHasAccess(uplayer))
|
||||||
fplayer.msg("<g>You have access to this area.");
|
uplayer.msg("<g>You have access to this area.");
|
||||||
else if (access.subjectAccessIsRestricted(fplayer))
|
else if (access.subjectAccessIsRestricted(uplayer))
|
||||||
fplayer.msg("<b>This area has restricted access.");
|
uplayer.msg("<b>This area has restricted access.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fplayer.getAutoClaimFor() != null)
|
if (uplayer.getAutoClaimFor() != null)
|
||||||
{
|
{
|
||||||
fplayer.attemptClaim(fplayer.getAutoClaimFor(), PS.valueOf(event.getTo()), true);
|
uplayer.attemptClaim(uplayer.getAutoClaimFor(), PS.valueOf(event.getTo()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,10 +145,10 @@ public class TodoFactionsPlayerListener implements Listener
|
|||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||||
|
|
||||||
UPlayer fplayer = UPlayer.get(player);
|
UPlayer uplayer = UPlayer.get(player);
|
||||||
if (fplayer.isUsingAdminMode()) return true;
|
if (uplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
return FPerm.BUILD.has(fplayer, ps, !justCheck);
|
return FPerm.BUILD.has(uplayer, ps, !justCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
|
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
|
||||||
|
@ -40,18 +40,18 @@ public class RelationUtil
|
|||||||
}
|
}
|
||||||
else if (that instanceof UPlayer)
|
else if (that instanceof UPlayer)
|
||||||
{
|
{
|
||||||
UPlayer fplayerthat = (UPlayer) that;
|
UPlayer uplayerthat = (UPlayer) that;
|
||||||
if (that == me)
|
if (that == me)
|
||||||
{
|
{
|
||||||
ret = "you";
|
ret = "you";
|
||||||
}
|
}
|
||||||
else if (thatFaction == myFaction)
|
else if (thatFaction == myFaction)
|
||||||
{
|
{
|
||||||
ret = fplayerthat.getNameAndTitle();
|
ret = uplayerthat.getNameAndTitle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = fplayerthat.getNameAndTag();
|
ret = uplayerthat.getNameAndTag();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user