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