mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -04:00
perbuild/pervisit +-name now matches
This commit is contained in:
parent
69a6ae0927
commit
e473598c92
@ -54,6 +54,10 @@ namespace MCGalaxy.Commands.World {
|
||||
if (name == "") {
|
||||
Player.Message(p, "You must provide a player name to {0}.", mode); return;
|
||||
}
|
||||
if (!Formatter.ValidName(p, name, "player")) return;
|
||||
name = PlayerInfo.FindMatchesPreferOnline(p, name);
|
||||
if (name == null) return;
|
||||
|
||||
if (p != null && name.CaselessEq(p.name)) {
|
||||
Player.Message(p, "You cannot {0} yourself.", mode); return;
|
||||
}
|
||||
|
@ -55,9 +55,7 @@ namespace MCGalaxy {
|
||||
|
||||
public static string FindMapMatches(Player pl, string name, out int matches) {
|
||||
matches = 0;
|
||||
if (!Player.ValidName(name)) {
|
||||
Player.Message(pl, "\"{0}\" is not a valid level name.", name); return null;
|
||||
}
|
||||
if (!Formatter.ValidName(pl, name, "level")) return null;
|
||||
|
||||
string[] files = Directory.GetFiles("levels", "*.lvl");
|
||||
string map = Matcher.Find<string>(pl, name, out matches, files,
|
||||
|
@ -59,9 +59,7 @@ namespace MCGalaxy {
|
||||
public static Player FindMatches(Player pl, string name,
|
||||
out int matches, bool onlyCanSee = true) {
|
||||
matches = 0;
|
||||
if (!Player.ValidName(name)) {
|
||||
Player.Message(pl, "\"{0}\" is not a valid player name.", name); return null;
|
||||
}
|
||||
if (!Formatter.ValidName(pl, name, "player")) return null;
|
||||
|
||||
return Matcher.Find<Player>(pl, name, out matches, Online.Items,
|
||||
p => Entities.CanSee(pl, p) || !onlyCanSee,
|
||||
@ -69,9 +67,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public static string FindMatchesPreferOnline(Player p, string name) {
|
||||
if (!Player.ValidName(name)) {
|
||||
Player.Message(p, "\"{0}\" is not a valid player name.", name); return null;
|
||||
}
|
||||
if (!Formatter.ValidName(p, name, "player")) return null;
|
||||
int matches = 0;
|
||||
Player target = FindMatches(p, name, out matches);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user