mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-09 07:09:41 -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;
|
return x >= 0 && y >= 0 && z >= 0 && x < Width && y < Height && z < Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Level Find(string levelName)
|
public static Level Find(string name) {
|
||||||
{
|
name = name.ToLower();
|
||||||
Level tempLevel = null;
|
Level match = null; int matches = 0;
|
||||||
bool returnNull = false;
|
|
||||||
|
foreach (Level level in Server.levels) {
|
||||||
foreach (Level level in Server.levels)
|
if (level.name.ToLower() == name) return level;
|
||||||
{
|
if (level.name.ToLower().Contains(name)) {
|
||||||
if (level.name.ToLower() == levelName) return level;
|
match = level; matches++;
|
||||||
else { continue; }
|
}
|
||||||
if (tempLevel == null) tempLevel = level;
|
|
||||||
else returnNull = true;
|
|
||||||
}
|
}
|
||||||
|
return matches == 1 ? match : null;
|
||||||
return returnNull ? null : tempLevel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Level FindExact(string levelName)
|
public static Level FindExact(string levelName)
|
||||||
|
@ -2693,43 +2693,37 @@ catch { }*/
|
|||||||
public static bool Exists(byte id) {
|
public static bool Exists(byte id) {
|
||||||
foreach ( Player p in players ) { if ( p.id == id ) { return true; } } return false;
|
foreach ( Player p in players ) { if ( p.id == id ) { return true; } } return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Player Find(string name) {
|
public static Player Find(string name) {
|
||||||
List<Player> tempList = new List<Player>();
|
List<Player> tempList = new List<Player>();
|
||||||
tempList.AddRange(players);
|
tempList.AddRange(players);
|
||||||
Player tempPlayer = null; bool returnNull = false;
|
Player match = null; int matches = 0;
|
||||||
|
name = name.ToLower();
|
||||||
|
|
||||||
foreach ( Player p in tempList ) {
|
foreach (Player p in tempList) {
|
||||||
if ( p.name.ToLower() == name.ToLower() ) return p;
|
if (p.name.ToLower() == name) return p;
|
||||||
if ( p.name.ToLower().IndexOf(name.ToLower()) != -1 ) {
|
if (p.name.ToLower().Contains(name)) {
|
||||||
if ( tempPlayer == null ) tempPlayer = p;
|
match = p; matches++;
|
||||||
else returnNull = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matches == 1 ? match : null;
|
||||||
if ( returnNull ) return null;
|
|
||||||
if ( tempPlayer != null ) return tempPlayer;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
public static Player FindNick(string nick)
|
|
||||||
{
|
public static Player FindNick(string nick) {
|
||||||
List<Player> tempList = new List<Player>();
|
List<Player> tempList = new List<Player>();
|
||||||
tempList.AddRange(players);
|
tempList.AddRange(players);
|
||||||
Player tempPlayer = null; bool returnNull = false;
|
Player match = null; int matches = 0;
|
||||||
|
nick = nick.ToLower();
|
||||||
|
|
||||||
foreach (Player p in tempList)
|
foreach (Player p in tempList) {
|
||||||
{
|
if (p.DisplayName.ToLower() == nick) return p;
|
||||||
if (p.DisplayName.ToLower() == nick.ToLower()) return p;
|
if (p.DisplayName.ToLower().Contains(nick)) {
|
||||||
if (p.DisplayName.ToLower().IndexOf(nick.ToLower()) != -1)
|
match = p; matches++;
|
||||||
{
|
|
||||||
if (tempPlayer == null) tempPlayer = p;
|
|
||||||
else returnNull = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matches == 1 ? match : null;
|
||||||
if (returnNull) return null;
|
|
||||||
if (tempPlayer != null) return tempPlayer;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Group GetGroup(string name) {
|
public static Group GetGroup(string name) {
|
||||||
return Group.findPlayerGroup(name);
|
return Group.findPlayerGroup(name);
|
||||||
}
|
}
|
||||||
|
@ -442,23 +442,17 @@ namespace MCGalaxy
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerBot Find(string name)
|
public static PlayerBot Find(string name) {
|
||||||
{
|
PlayerBot match = null; int matches = 0;
|
||||||
PlayerBot tempPlayer = null; bool returnNull = false;
|
name = name.ToLower();
|
||||||
|
|
||||||
foreach (PlayerBot pB in PlayerBot.playerbots)
|
foreach (PlayerBot pB in PlayerBot.playerbots) {
|
||||||
{
|
if (pB.name.ToLower() == name) return pB;
|
||||||
if (pB.name.ToLower() == name.ToLower()) return pB;
|
if (pB.name.ToLower().Contains(name)) {
|
||||||
if (pB.name.ToLower().IndexOf(name.ToLower()) != -1)
|
match = pB; matches++;
|
||||||
{
|
|
||||||
if (tempPlayer == null) tempPlayer = pB;
|
|
||||||
else returnNull = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matches == 1 ? match : null;
|
||||||
if (returnNull) return null;
|
|
||||||
if (tempPlayer != null) return tempPlayer;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ValidName(string name)
|
public static bool ValidName(string name)
|
||||||
|
@ -96,22 +96,16 @@ namespace MCGalaxy
|
|||||||
{
|
{
|
||||||
List<Plugin> tempList = new List<Plugin>();
|
List<Plugin> tempList = new List<Plugin>();
|
||||||
tempList.AddRange(all);
|
tempList.AddRange(all);
|
||||||
Plugin tempPlayer = null; bool returnNull = false;
|
Plugin match = null; int matches = 0;
|
||||||
|
name = name.ToLower();
|
||||||
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;
|
|
||||||
|
|
||||||
|
foreach (Plugin p in tempList) {
|
||||||
|
if (p.name.ToLower() == name) return p;
|
||||||
|
if (p.name.ToLower().Contains(name)) {
|
||||||
|
match = p; matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matches == 1 ? match : null;
|
||||||
if (returnNull) return null;
|
|
||||||
if (tempPlayer != null) return tempPlayer;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user