Spout overlay support is missing for the new relation coloring. Otherwise done.
This commit is contained in:
parent
89b53a577a
commit
e6d45a6aa2
@ -212,7 +212,7 @@ public class Board
|
||||
if (factionHere.isNone()) {
|
||||
row += ChatColor.GRAY+"-";
|
||||
} else if (factionHere.isSafeZone()) {
|
||||
row += ChatColor.GOLD+"+";
|
||||
row += Conf.colorPeaceful+"+";
|
||||
} else if (factionHere.isWarZone()) {
|
||||
row += ChatColor.DARK_RED+"+";
|
||||
} else if (
|
||||
@ -225,7 +225,7 @@ public class Board
|
||||
if (!fList.containsKey(factionHere.getTag()))
|
||||
fList.put(factionHere.getTag(), Conf.mapKeyChrs[chrIdx++]);
|
||||
char tag = fList.get(factionHere.getTag());
|
||||
row += factionHere.getRelationTo(faction).getColor() + "" + tag;
|
||||
row += factionHere.getColorTo(faction) + "" + tag;
|
||||
} else {
|
||||
row += ChatColor.GRAY+"-";
|
||||
}
|
||||
@ -243,9 +243,11 @@ public class Board
|
||||
ret.set(3, asciiCompass.get(2)+ret.get(3).substring(3*3));
|
||||
|
||||
// Add the faction key
|
||||
if (Conf.showMapFactionKey) {
|
||||
if (Conf.showMapFactionKey)
|
||||
{
|
||||
String fRow = "";
|
||||
for(String key : fList.keySet()) {
|
||||
for(String key : fList.keySet())
|
||||
{
|
||||
fRow += String.format("%s%s: %s ", ChatColor.GRAY, fList.get(key), key);
|
||||
}
|
||||
ret.add(fRow);
|
||||
|
@ -312,11 +312,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
||||
|
||||
public String getNameAndTitle(Faction faction)
|
||||
{
|
||||
return this.getRelationColor(faction)+this.getNameAndTitle();
|
||||
return this.getColorTo(faction)+this.getNameAndTitle();
|
||||
}
|
||||
public String getNameAndTitle(FPlayer fplayer)
|
||||
{
|
||||
return this.getRelationColor(fplayer)+this.getNameAndTitle();
|
||||
return this.getColorTo(fplayer)+this.getNameAndTitle();
|
||||
}
|
||||
|
||||
/*public String getNameAndTag(Faction faction)
|
||||
@ -372,11 +372,12 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
||||
|
||||
public String getChatTag(FPlayer fplayer)
|
||||
{
|
||||
if ( ! this.hasFaction()) {
|
||||
if ( ! this.hasFaction())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return this.getRelationTo(fplayer).getColor()+getChatTag();
|
||||
return this.getColorTo(fplayer)+getChatTag();
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
@ -413,9 +414,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getRelationColor(RelationParticipator rp)
|
||||
public ChatColor getColorTo(RelationParticipator rp)
|
||||
{
|
||||
return RelationUtil.getRelationColor(this, rp);
|
||||
return RelationUtil.getColorOfThatToMe(this, rp);
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
|
@ -68,14 +68,14 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
{
|
||||
return getTag();
|
||||
}
|
||||
return this.getTag(otherFaction.getRelationColor(this).toString());
|
||||
return this.getTag(otherFaction.getColorTo(this).toString());
|
||||
}
|
||||
public String getTag(FPlayer otherFplayer) {
|
||||
if (otherFplayer == null)
|
||||
{
|
||||
return getTag();
|
||||
}
|
||||
return this.getTag(otherFplayer.getRelationColor(this).toString());
|
||||
return this.getTag(this.getColorTo(otherFplayer).toString());
|
||||
}
|
||||
public void setTag(String str)
|
||||
{
|
||||
@ -216,9 +216,9 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getRelationColor(RelationParticipator rp)
|
||||
public ChatColor getColorTo(RelationParticipator rp)
|
||||
{
|
||||
return RelationUtil.getRelationColor(this, rp);
|
||||
return RelationUtil.getColorOfThatToMe(this, rp);
|
||||
}
|
||||
|
||||
public Relation getRelationWish(Faction otherFaction)
|
||||
@ -248,31 +248,38 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
public double getPower()
|
||||
{
|
||||
double ret = 0;
|
||||
for (FPlayer fplayer : this.getFPlayers()) {
|
||||
for (FPlayer fplayer : this.getFPlayers())
|
||||
{
|
||||
ret += fplayer.getPower();
|
||||
}
|
||||
if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax) {
|
||||
if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax)
|
||||
{
|
||||
ret = Conf.powerFactionMax;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public double getPowerMax() {
|
||||
public double getPowerMax()
|
||||
{
|
||||
double ret = 0;
|
||||
for (FPlayer fplayer : this.getFPlayers()) {
|
||||
for (FPlayer fplayer : this.getFPlayers())
|
||||
{
|
||||
ret += fplayer.getPowerMax();
|
||||
}
|
||||
if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax) {
|
||||
if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax)
|
||||
{
|
||||
ret = Conf.powerFactionMax;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getPowerRounded() {
|
||||
public int getPowerRounded()
|
||||
{
|
||||
return (int) Math.round(this.getPower());
|
||||
}
|
||||
|
||||
public int getPowerMaxRounded() {
|
||||
public int getPowerMaxRounded()
|
||||
{
|
||||
return (int) Math.round(this.getPowerMax());
|
||||
}
|
||||
|
||||
@ -280,11 +287,13 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
return Board.getFactionCoordCount(this);
|
||||
}
|
||||
|
||||
public int getLandRoundedInWorld(String worldName) {
|
||||
public int getLandRoundedInWorld(String worldName)
|
||||
{
|
||||
return Board.getFactionCoordCountInWorld(this, worldName);
|
||||
}
|
||||
|
||||
public boolean hasLandInflation() {
|
||||
public boolean hasLandInflation()
|
||||
{
|
||||
return this.getLandRounded() > this.getPowerRounded();
|
||||
}
|
||||
|
||||
@ -430,20 +439,6 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
// Mudd TODO
|
||||
//----------------------------------------------//
|
||||
|
||||
public ChatColor getRelationColor(Faction otherFaction)
|
||||
{
|
||||
return this.getRelationTo(otherFaction).getColor();
|
||||
}
|
||||
|
||||
public ChatColor getRelationColor(FPlayer fplayer)
|
||||
{
|
||||
return this.getRelationTo(fplayer).getColor();
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
// Ownership of specific claims
|
||||
//----------------------------------------------//
|
||||
@ -539,7 +534,8 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
public void removePlayerAsOwner(String playerName, FLocation loc)
|
||||
{
|
||||
Set<String> ownerData = claimOwnership.get(loc);
|
||||
if (ownerData == null) {
|
||||
if (ownerData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ownerData.remove(playerName.toLowerCase());
|
||||
|
@ -53,7 +53,7 @@ public class CmdPeaceful extends FCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "<i>\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class CmdTag extends FCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getRelationColor(faction)+oldtag, myFaction.getTag(faction));
|
||||
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction)+oldtag, myFaction.getTag(faction));
|
||||
}
|
||||
|
||||
if (Conf.spoutFactionTagsOverNames)
|
||||
|
@ -12,5 +12,5 @@ public interface RelationParticipator
|
||||
public Relation getRelationTo(RelationParticipator that);
|
||||
public Relation getRelationTo(RelationParticipator that, boolean ignorePeaceful);
|
||||
|
||||
public ChatColor getRelationColor(RelationParticipator to);
|
||||
public ChatColor getColorTo(RelationParticipator to);
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class SpoutMainListener extends SpoutListener
|
||||
updateTerritoryDisplay(me);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------//
|
||||
// Everything below this is handled in here to prevent errors on servers not running Spout
|
||||
//-----------------------------------------------------------------------------------------//
|
||||
|
@ -2,7 +2,8 @@ package com.massivecraft.factions.struct;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
public enum Role {
|
||||
public enum Role
|
||||
{
|
||||
ADMIN(2, "admin"),
|
||||
MODERATOR(1, "moderator"),
|
||||
NORMAL(0, "normal member");
|
||||
@ -10,30 +11,37 @@ public enum Role {
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private Role(final int value, final String nicename) {
|
||||
private Role(final int value, final String nicename)
|
||||
{
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Role role) {
|
||||
public boolean isAtLeast(Role role)
|
||||
{
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Role role) {
|
||||
public boolean isAtMost(Role role)
|
||||
{
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString()
|
||||
{
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
if (this == Role.ADMIN) {
|
||||
public String getPrefix()
|
||||
{
|
||||
if (this == Role.ADMIN)
|
||||
{
|
||||
return Conf.prefixAdmin;
|
||||
}
|
||||
|
||||
if (this == Role.MODERATOR) {
|
||||
if (this == Role.MODERATOR)
|
||||
{
|
||||
return Conf.prefixMod;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.iface.RelationParticipator;
|
||||
@ -53,7 +54,7 @@ public class RelationUtil
|
||||
ret = TextUtil.upperCaseFirst(ret);
|
||||
}
|
||||
|
||||
return "" + getRelationColor(me, that) + ret;
|
||||
return "" + getColorOfThatToMe(that, me) + ret;
|
||||
}
|
||||
|
||||
public static String describeThatToMe(RelationParticipator that, RelationParticipator me)
|
||||
@ -113,8 +114,12 @@ public class RelationUtil
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ChatColor getRelationColor(RelationParticipator me, RelationParticipator that)
|
||||
public static ChatColor getColorOfThatToMe(RelationParticipator that, RelationParticipator me)
|
||||
{
|
||||
if (getFaction(that) != null && getFaction(that).isPeaceful() && getFaction(that) != getFaction(me))
|
||||
{
|
||||
return Conf.colorPeaceful;
|
||||
}
|
||||
return getRelationTo(that, me).getColor();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user