Improving the faction tag matching
This commit is contained in:
parent
75cd9b5e18
commit
7ebed6db9c
@ -188,7 +188,7 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
|
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Relation and relation colors TODO
|
// Relation and relation colors
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -298,7 +298,7 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Fplayers
|
// FPlayers
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
public ArrayList<FPlayer> getFPlayers()
|
public ArrayList<FPlayer> getFPlayers()
|
||||||
@ -347,12 +347,15 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<FPlayer> getFPlayersWhereRole(Role role) {
|
public ArrayList<FPlayer> getFPlayersWhereRole(Role role)
|
||||||
|
{
|
||||||
ArrayList<FPlayer> ret = new ArrayList<FPlayer>();
|
ArrayList<FPlayer> ret = new ArrayList<FPlayer>();
|
||||||
if ( ! this.isNormal()) return ret;
|
if ( ! this.isNormal()) return ret;
|
||||||
|
|
||||||
for (FPlayer fplayer : FPlayers.i.get()) {
|
for (FPlayer fplayer : FPlayers.i.get())
|
||||||
if (fplayer.getFaction() == this && fplayer.getRole() == role) {
|
{
|
||||||
|
if (fplayer.getFaction() == this && fplayer.getRole() == role)
|
||||||
|
{
|
||||||
ret.add(fplayer);
|
ret.add(fplayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,8 +223,19 @@ public abstract class FCommand extends MCommand<P>
|
|||||||
|
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
// First we match faction tags
|
Faction faction = null;
|
||||||
Faction faction = Factions.i.getBestTagMatch(name);
|
|
||||||
|
// First we try an exact match
|
||||||
|
if (faction == null)
|
||||||
|
{
|
||||||
|
faction = Factions.i.getByTag(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next we match faction tags
|
||||||
|
if (faction == null)
|
||||||
|
{
|
||||||
|
faction = Factions.i.getBestTagMatch(name);
|
||||||
|
}
|
||||||
|
|
||||||
// Next we match player names
|
// Next we match player names
|
||||||
if (faction == null)
|
if (faction == null)
|
||||||
|
@ -53,6 +53,7 @@ public class MiscUtil
|
|||||||
String ret = "";
|
String ret = "";
|
||||||
|
|
||||||
str = ChatColor.stripColor(str);
|
str = ChatColor.stripColor(str);
|
||||||
|
str = str.toLowerCase();
|
||||||
|
|
||||||
for (char c : str.toCharArray())
|
for (char c : str.toCharArray())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user