Make types look nicer
This commit is contained in:
parent
c4bb41333a
commit
8ad812bea6
@ -6,10 +6,11 @@ import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.Colorized;
|
||||
import com.massivecraft.massivecore.Named;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
|
||||
|
||||
public enum Rel
|
||||
public enum Rel implements Colorized, Named
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// ENUM
|
||||
@ -18,35 +19,42 @@ public enum Rel
|
||||
ENEMY(
|
||||
"an enemy", "enemies", "an enemy faction", "enemy factions",
|
||||
"Enemy"
|
||||
),
|
||||
) { @Override public ChatColor getColor() { return MConf.get().colorEnemy; } },
|
||||
|
||||
NEUTRAL(
|
||||
"someone neutral to you", "those neutral to you", "a neutral faction", "neutral factions",
|
||||
"Neutral"
|
||||
),
|
||||
) { @Override public ChatColor getColor() { return MConf.get().colorNeutral; } },
|
||||
|
||||
TRUCE(
|
||||
"someone in truce with you", "those in truce with you", "a faction in truce", "factions in truce",
|
||||
"Truce"
|
||||
),
|
||||
) { @Override public ChatColor getColor() { return MConf.get().colorTruce; } },
|
||||
|
||||
ALLY(
|
||||
"an ally", "allies", "an allied faction", "allied factions",
|
||||
"Ally"
|
||||
),
|
||||
) { @Override public ChatColor getColor() { return MConf.get().colorAlly; } },
|
||||
|
||||
RECRUIT(
|
||||
"a recruit in your faction", "recruits in your faction", "", "",
|
||||
"Recruit"
|
||||
),
|
||||
) { @Override public String getPrefix() { return MConf.get().prefixRecruit; } },
|
||||
|
||||
MEMBER(
|
||||
"a member in your faction", "members in your faction", "your faction", "your factions",
|
||||
"Member"
|
||||
),
|
||||
OFFICER
|
||||
(
|
||||
) { @Override public String getPrefix() { return MConf.get().prefixMember; } },
|
||||
|
||||
OFFICER(
|
||||
"an officer in your faction", "officers in your faction", "", "",
|
||||
"Officer", "Moderator"
|
||||
),
|
||||
LEADER("your faction leader", "your faction leader", "", "",
|
||||
) { @Override public String getPrefix() { return MConf.get().prefixOfficer; } },
|
||||
|
||||
LEADER(
|
||||
"your faction leader", "your faction leader", "", "",
|
||||
"Leader", "Admin", "Owner"
|
||||
),
|
||||
) { @Override public String getPrefix() { return MConf.get().prefixLeader; } },
|
||||
|
||||
// END OF LIST
|
||||
;
|
||||
@ -71,13 +79,13 @@ public enum Rel
|
||||
|
||||
private final Set<String> names;
|
||||
public Set<String> getNames() { return this.names; }
|
||||
public String getName() { return this.getNames().iterator().next(); }
|
||||
@Override public String getName() { return this.getNames().iterator().next(); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private Rel(String descPlayerOne, String descPlayerMany, String descFactionOne, String descFactionMany, String... names)
|
||||
Rel(String descPlayerOne, String descPlayerMany, String descFactionOne, String descFactionMany, String... names)
|
||||
{
|
||||
this.descPlayerOne = descPlayerOne;
|
||||
this.descPlayerMany = descPlayerMany;
|
||||
@ -86,6 +94,16 @@ public enum Rel
|
||||
this.names = Collections.unmodifiableSet(new MassiveSet<String>(names));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return MConf.get().colorMember;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
@ -121,42 +139,8 @@ public enum Rel
|
||||
return this.isAtLeast(TRUCE);
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
if (this.isAtLeast(RECRUIT))
|
||||
return MConf.get().colorMember;
|
||||
else if (this == ALLY)
|
||||
return MConf.get().colorAlly;
|
||||
else if (this == NEUTRAL)
|
||||
return MConf.get().colorNeutral;
|
||||
else if (this == TRUCE)
|
||||
return MConf.get().colorTruce;
|
||||
else
|
||||
return MConf.get().colorEnemy;
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
if (this == LEADER)
|
||||
{
|
||||
return MConf.get().prefixLeader;
|
||||
}
|
||||
|
||||
if (this == OFFICER)
|
||||
{
|
||||
return MConf.get().prefixOfficer;
|
||||
}
|
||||
|
||||
if (this == MEMBER)
|
||||
{
|
||||
return MConf.get().prefixMember;
|
||||
}
|
||||
|
||||
if (this == RECRUIT)
|
||||
{
|
||||
return MConf.get().prefixRecruit;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -79,13 +79,16 @@ public class TypeFaction extends TypeAbstract<Faction>
|
||||
@Override
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
// Create
|
||||
Set<String> ret = new TreeSet<String>(ComparatorCaseInsensitive.get());
|
||||
|
||||
// Fill
|
||||
for (Faction faction : FactionColl.get().getAll())
|
||||
{
|
||||
ret.add(ChatColor.stripColor(faction.getName()));
|
||||
}
|
||||
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,21 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum EventFactionsChunkChangeType
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.Colorized;
|
||||
|
||||
public enum EventFactionsChunkChangeType implements Colorized
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// ENUM
|
||||
// -------------------------------------------- //
|
||||
|
||||
NONE("none", "none"),
|
||||
BUY("buy", "bought"),
|
||||
SELL("sell", "sold"),
|
||||
CONQUER("conquer", "conquered"),
|
||||
PILLAGE("pillage", "pillaged"),
|
||||
NONE("none", "none", ChatColor.WHITE),
|
||||
BUY("buy", "bought", ChatColor.GREEN),
|
||||
SELL("sell", "sold", ChatColor.GREEN),
|
||||
CONQUER("conquer", "conquered", ChatColor.DARK_GREEN),
|
||||
PILLAGE("pillage", "pillaged", ChatColor.RED),
|
||||
|
||||
// END OF LIST
|
||||
;
|
||||
@ -24,14 +27,27 @@ public enum EventFactionsChunkChangeType
|
||||
public final String now;
|
||||
public final String past;
|
||||
|
||||
public final ChatColor color;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
EventFactionsChunkChangeType(String now, String past)
|
||||
EventFactionsChunkChangeType(String now, String past, ChatColor color)
|
||||
{
|
||||
this.now = now;
|
||||
this.past = past;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user