mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-08 22:59:29 -04:00
Fix shortcuts for /goto (and others) not working, also fix /goto being case sensitive.
This commit is contained in:
parent
45a4f526f0
commit
2be85a4f9e
@ -372,20 +372,17 @@ namespace MCGalaxy
|
||||
return x >= 0 && y >= 0 && z >= 0 && x < Width && y < Height && z < Length;
|
||||
}
|
||||
|
||||
public static Level Find(string levelName)
|
||||
{
|
||||
Level tempLevel = null;
|
||||
bool returnNull = false;
|
||||
|
||||
foreach (Level level in Server.levels)
|
||||
{
|
||||
if (level.name.ToLower() == levelName) return level;
|
||||
else { continue; }
|
||||
if (tempLevel == null) tempLevel = level;
|
||||
else returnNull = true;
|
||||
public static Level Find(string name) {
|
||||
name = name.ToLower();
|
||||
Level match = null; int matches = 0;
|
||||
|
||||
foreach (Level level in Server.levels) {
|
||||
if (level.name.ToLower() == name) return level;
|
||||
if (level.name.ToLower().Contains(name)) {
|
||||
match = level; matches++;
|
||||
}
|
||||
}
|
||||
|
||||
return returnNull ? null : tempLevel;
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
|
||||
public static Level FindExact(string levelName)
|
||||
|
@ -2693,43 +2693,37 @@ catch { }*/
|
||||
public static bool Exists(byte id) {
|
||||
foreach ( Player p in players ) { if ( p.id == id ) { return true; } } return false;
|
||||
}
|
||||
|
||||
public static Player Find(string name) {
|
||||
List<Player> tempList = new List<Player>();
|
||||
tempList.AddRange(players);
|
||||
Player tempPlayer = null; bool returnNull = false;
|
||||
Player match = null; int matches = 0;
|
||||
name = name.ToLower();
|
||||
|
||||
foreach ( Player p in tempList ) {
|
||||
if ( p.name.ToLower() == name.ToLower() ) return p;
|
||||
if ( p.name.ToLower().IndexOf(name.ToLower()) != -1 ) {
|
||||
if ( tempPlayer == null ) tempPlayer = p;
|
||||
else returnNull = true;
|
||||
foreach (Player p in tempList) {
|
||||
if (p.name.ToLower() == name) return p;
|
||||
if (p.name.ToLower().Contains(name)) {
|
||||
match = p; matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( returnNull ) return null;
|
||||
if ( tempPlayer != null ) return tempPlayer;
|
||||
return null;
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
public static Player FindNick(string nick)
|
||||
{
|
||||
|
||||
public static Player FindNick(string nick) {
|
||||
List<Player> tempList = new List<Player>();
|
||||
tempList.AddRange(players);
|
||||
Player tempPlayer = null; bool returnNull = false;
|
||||
Player match = null; int matches = 0;
|
||||
nick = nick.ToLower();
|
||||
|
||||
foreach (Player p in tempList)
|
||||
{
|
||||
if (p.DisplayName.ToLower() == nick.ToLower()) return p;
|
||||
if (p.DisplayName.ToLower().IndexOf(nick.ToLower()) != -1)
|
||||
{
|
||||
if (tempPlayer == null) tempPlayer = p;
|
||||
else returnNull = true;
|
||||
foreach (Player p in tempList) {
|
||||
if (p.DisplayName.ToLower() == nick) return p;
|
||||
if (p.DisplayName.ToLower().Contains(nick)) {
|
||||
match = p; matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnNull) return null;
|
||||
if (tempPlayer != null) return tempPlayer;
|
||||
return null;
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
|
||||
public static Group GetGroup(string name) {
|
||||
return Group.findPlayerGroup(name);
|
||||
}
|
||||
|
@ -442,23 +442,17 @@ namespace MCGalaxy
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
public static PlayerBot Find(string name)
|
||||
{
|
||||
PlayerBot tempPlayer = null; bool returnNull = false;
|
||||
public static PlayerBot Find(string name) {
|
||||
PlayerBot match = null; int matches = 0;
|
||||
name = name.ToLower();
|
||||
|
||||
foreach (PlayerBot pB in PlayerBot.playerbots)
|
||||
{
|
||||
if (pB.name.ToLower() == name.ToLower()) return pB;
|
||||
if (pB.name.ToLower().IndexOf(name.ToLower()) != -1)
|
||||
{
|
||||
if (tempPlayer == null) tempPlayer = pB;
|
||||
else returnNull = true;
|
||||
foreach (PlayerBot pB in PlayerBot.playerbots) {
|
||||
if (pB.name.ToLower() == name) return pB;
|
||||
if (pB.name.ToLower().Contains(name)) {
|
||||
match = pB; matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnNull) return null;
|
||||
if (tempPlayer != null) return tempPlayer;
|
||||
return null;
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
|
||||
public static bool ValidName(string name)
|
||||
|
@ -96,22 +96,16 @@ namespace MCGalaxy
|
||||
{
|
||||
List<Plugin> tempList = new List<Plugin>();
|
||||
tempList.AddRange(all);
|
||||
Plugin tempPlayer = null; bool returnNull = false;
|
||||
|
||||
foreach (Plugin p in tempList)
|
||||
{
|
||||
if (p.name.ToLower() == name.ToLower()) return p;
|
||||
if (p.name.ToLower().IndexOf(name.ToLower()) != -1)
|
||||
{
|
||||
if (tempPlayer == null) tempPlayer = p;
|
||||
else returnNull = true;
|
||||
Plugin match = null; int matches = 0;
|
||||
name = name.ToLower();
|
||||
|
||||
foreach (Plugin p in tempList) {
|
||||
if (p.name.ToLower() == name) return p;
|
||||
if (p.name.ToLower().Contains(name)) {
|
||||
match = p; matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnNull) return null;
|
||||
if (tempPlayer != null) return tempPlayer;
|
||||
return null;
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user