changed findFactions() method to try matching faction tags before trying to match player names, instead of the other way around

This commit is contained in:
Brettflan 2011-08-03 21:49:11 -05:00
parent f9d39271c0
commit 2900bf372f
2 changed files with 8 additions and 8 deletions

View File

@ -208,7 +208,7 @@ public class Factions extends JavaPlugin {
Permissions = ((Permissions)test).getHandler(); Permissions = ((Permissions)test).getHandler();
Factions.log("Found and will use plugin "+((Permissions)test).getDescription().getFullName()); Factions.log("Found and will use plugin "+((Permissions)test).getDescription().getFullName());
} else { } else {
Factions.log("Permission system not detected, defaulting to OP"); Factions.log("Permissions plugin not detected, defaulting to Bukkit superperms system");
} }
} }

View File

@ -190,18 +190,18 @@ public class FBaseCommand {
public Faction findFaction(String factionName, boolean defaultToMine) { public Faction findFaction(String factionName, boolean defaultToMine) {
// First we search player names // First we search faction names
FPlayer fp = FPlayer.find(factionName);
if (fp != null) {
return fp.getFaction();
}
// Secondly we search faction names
Faction faction = Faction.findByTag(factionName); Faction faction = Faction.findByTag(factionName);
if (faction != null) { if (faction != null) {
return faction; return faction;
} }
// Next we search player names
FPlayer fp = FPlayer.find(factionName);
if (fp != null) {
return fp.getFaction();
}
if (defaultToMine && sender instanceof Player) { if (defaultToMine && sender instanceof Player) {
return me.getFaction(); return me.getFaction();
} }