mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Remove unnecessary try{} catch{}
This commit is contained in:
parent
de79a0e3e4
commit
d8b6240a52
@ -61,13 +61,13 @@ namespace MCGalaxy.Commands.World {
|
|||||||
bool HandleGoto(Player p, string message) {
|
bool HandleGoto(Player p, string message) {
|
||||||
Level lvl = LevelInfo.FindExact(message);
|
Level lvl = LevelInfo.FindExact(message);
|
||||||
if (lvl != null) {
|
if (lvl != null) {
|
||||||
return GoToLevel(p, lvl, message);
|
return GoToLevel(p, lvl);
|
||||||
} else if (Server.AutoLoad) {
|
} else if (Server.AutoLoad) {
|
||||||
// First try exactly matching unloaded levels
|
// First try exactly matching unloaded levels
|
||||||
if (LevelInfo.ExistsOffline(message))
|
if (LevelInfo.ExistsOffline(message))
|
||||||
return GotoOfflineLevel(p, message);
|
return GotoOfflineLevel(p, message);
|
||||||
lvl = LevelInfo.Find(message);
|
lvl = LevelInfo.Find(message);
|
||||||
if (lvl != null) return GoToLevel(p, lvl, message);
|
if (lvl != null) return GoToLevel(p, lvl);
|
||||||
|
|
||||||
string map = LevelInfo.FindMapMatches(p, message);
|
string map = LevelInfo.FindMapMatches(p, message);
|
||||||
if (map == null) return false;
|
if (map == null) return false;
|
||||||
@ -79,7 +79,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
Command.all.Find("search").Use(p, "levels " + message);
|
Command.all.Find("search").Use(p, "levels " + message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return GoToLevel(p, lvl, message);
|
return GoToLevel(p, lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
CmdLoad.LoadLevel(p, message, "0", true);
|
CmdLoad.LoadLevel(p, message, "0", true);
|
||||||
Level lvl = LevelInfo.Find(message);
|
Level lvl = LevelInfo.Find(message);
|
||||||
if (lvl != null) {
|
if (lvl != null) {
|
||||||
return GoToLevel(p, lvl, message);
|
return GoToLevel(p, lvl);
|
||||||
} else {
|
} else {
|
||||||
Player.Message(p, "Level \"{0}\" failed to be auto-loaded.", message);
|
Player.Message(p, "Level \"{0}\" failed to be auto-loaded.", message);
|
||||||
return false;
|
return false;
|
||||||
@ -98,7 +98,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GoToLevel(Player p, Level lvl, string message) {
|
static bool GoToLevel(Player p, Level lvl) {
|
||||||
if (p.level == lvl) { Player.Message(p, "You are already in \"" + lvl.name + "\"."); return false; }
|
if (p.level == lvl) { Player.Message(p, "You are already in \"" + lvl.name + "\"."); return false; }
|
||||||
if (!lvl.CanJoin(p)) return false;
|
if (!lvl.CanJoin(p)) return false;
|
||||||
if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level)) return false;
|
if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level)) return false;
|
||||||
|
@ -230,9 +230,11 @@ namespace MCGalaxy {
|
|||||||
BuildAccess.CheckDetailed(p, false);
|
BuildAccess.CheckDetailed(p, false);
|
||||||
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
|
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
|
||||||
}
|
}
|
||||||
|
if (p.level == this) return p.AllowBuild;
|
||||||
return p.level == this
|
|
||||||
? p.AllowBuild : BuildAccess.Check(p, false);
|
LevelAccessResult access = BuildAccess.Check(p, false);
|
||||||
|
return access == LevelAccessResult.Whitelisted
|
||||||
|
|| access == LevelAccessResult.Allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckAffectPermissions(Player p, ushort x, ushort y, ushort z,
|
public bool CheckAffectPermissions(Player p, ushort x, ushort y, ushort z,
|
||||||
|
@ -62,15 +62,21 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Returns whether the given player is allowed by these access permissions. </summary>
|
/// <summary> Returns the allowed state for the given player. </summary>
|
||||||
public bool Check(Player p, bool ignoreRankPerm = false) {
|
public LevelAccessResult Check(Player p, bool ignoreRankPerm = false) {
|
||||||
if (Blacklisted.CaselessContains(p.name)) return false;
|
if (Blacklisted.CaselessContains(p.name))
|
||||||
if (Whitelisted.CaselessContains(p.name) || ignoreRankPerm) return true;
|
return LevelAccessResult.Blacklisted;
|
||||||
|
if (Whitelisted.CaselessContains(p.name))
|
||||||
|
return LevelAccessResult.Whitelisted;
|
||||||
|
if (ignoreRankPerm)
|
||||||
|
return LevelAccessResult.Allowed;
|
||||||
|
|
||||||
if (p.Rank < Min) return false;
|
if (p.Rank < Min)
|
||||||
|
return LevelAccessResult.BelowMinRank;
|
||||||
string maxCmd = IsVisit ? "pervisitmax" : "perbuildmax";
|
string maxCmd = IsVisit ? "pervisitmax" : "perbuildmax";
|
||||||
if (p.Rank > Max && !p.group.CanExecute(maxCmd)) return false;
|
if (p.Rank > Max && !p.group.CanExecute(maxCmd))
|
||||||
return true;
|
return LevelAccessResult.AboveMaxRank;
|
||||||
|
return LevelAccessResult.Allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Returns whether the given player is allowed for these access permissions. </summary>
|
/// <summary> Returns whether the given player is allowed for these access permissions. </summary>
|
||||||
@ -134,7 +140,7 @@ namespace MCGalaxy {
|
|||||||
bool CheckRank(Player p, LevelPermission perm, string target, bool newPerm) {
|
bool CheckRank(Player p, LevelPermission perm, string target, bool newPerm) {
|
||||||
if (p != null && perm > p.Rank) {
|
if (p != null && perm > p.Rank) {
|
||||||
Player.Message(p, "You cannot change the {0} of a level {1} a {0} higher than your rank.",
|
Player.Message(p, "You cannot change the {0} of a level {1} a {0} higher than your rank.",
|
||||||
target, newPerm ? "to" : "with");
|
target, newPerm ? "to" : "with");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -153,8 +159,29 @@ namespace MCGalaxy {
|
|||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
foreach (Player p in players) {
|
foreach (Player p in players) {
|
||||||
if (p.level != lvl) continue;
|
if (p.level != lvl) continue;
|
||||||
p.AllowBuild = lvl.BuildAccess.Check(p, false);
|
|
||||||
|
LevelAccessResult access = lvl.BuildAccess.Check(p, false);
|
||||||
|
p.AllowBuild = access == LevelAccessResult.Whitelisted
|
||||||
|
|| access == LevelAccessResult.Allowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LevelAccessResult {
|
||||||
|
|
||||||
|
/// <summary> The player is whitelisted and always allowed. </summary>
|
||||||
|
Whitelisted,
|
||||||
|
|
||||||
|
/// <summary> The player is blacklisted and never allowed. </summary>
|
||||||
|
Blacklisted,
|
||||||
|
|
||||||
|
/// <summary> The player is allowed (by their rank) </summary>
|
||||||
|
Allowed,
|
||||||
|
|
||||||
|
/// <summary> The player's rank is below the minimum rank allowed. </summary>
|
||||||
|
BelowMinRank,
|
||||||
|
|
||||||
|
/// <summary> The player's rank is above the maximum rank allowed. </summary>
|
||||||
|
AboveMaxRank,
|
||||||
|
}
|
||||||
}
|
}
|
@ -319,7 +319,10 @@ namespace MCGalaxy {
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
useCheckpointSpawn = false;
|
useCheckpointSpawn = false;
|
||||||
lastCheckpointIndex = -1;
|
lastCheckpointIndex = -1;
|
||||||
AllowBuild = level.BuildAccess.Check(this, false);
|
|
||||||
|
LevelAccessResult access = level.BuildAccess.Check(this, false);
|
||||||
|
AllowBuild = access == LevelAccessResult.Whitelisted
|
||||||
|
|| access == LevelAccessResult.Allowed;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (hasBlockDefs) {
|
if (hasBlockDefs) {
|
||||||
|
@ -187,8 +187,8 @@ namespace MCGalaxy {
|
|||||||
byte[] remaining = new byte[buffer.Length - size];
|
byte[] remaining = new byte[buffer.Length - size];
|
||||||
Buffer.BlockCopy(buffer, size, remaining, 0, remaining.Length);
|
Buffer.BlockCopy(buffer, size, remaining, 0, remaining.Length);
|
||||||
return ProcessReceived(remaining);
|
return ProcessReceived(remaining);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
Server.ErrorLog(e);
|
Server.ErrorLog(ex);
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@ -441,7 +441,6 @@ return;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandleChat(byte[] packet) {
|
void HandleChat(byte[] packet) {
|
||||||
try {
|
|
||||||
if (!loggedIn) return;
|
if (!loggedIn) return;
|
||||||
byte continued = packet[1];
|
byte continued = packet[1];
|
||||||
string text = GetString(packet, 2);
|
string text = GetString(packet, 2);
|
||||||
@ -518,8 +517,6 @@ return;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckForMessageSpam();
|
CheckForMessageSpam();
|
||||||
}
|
|
||||||
catch ( Exception e ) { Server.ErrorLog(e); Chat.MessageAll("An error occurred: {0}", e.Message); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterChat(ref string text, byte continued) {
|
bool FilterChat(ref string text, byte continued) {
|
||||||
|
@ -20,120 +20,115 @@ using MCGalaxy.Commands.World;
|
|||||||
using MCGalaxy.Games;
|
using MCGalaxy.Games;
|
||||||
using MCGalaxy.SQL;
|
using MCGalaxy.SQL;
|
||||||
|
|
||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
public sealed partial class Player : IDisposable {
|
public sealed partial class Player : IDisposable {
|
||||||
|
|
||||||
void HandleLogin(byte[] packet) {
|
void HandleLogin(byte[] packet) {
|
||||||
LastAction = DateTime.UtcNow;
|
LastAction = DateTime.UtcNow;
|
||||||
try {
|
if (loggedIn) return;
|
||||||
if (loggedIn) return;
|
|
||||||
|
|
||||||
byte version = packet[1];
|
byte version = packet[1];
|
||||||
name = enc.GetString(packet, 2, 64).Trim();
|
name = enc.GetString(packet, 2, 64).Trim();
|
||||||
if (name.Length > 16) {
|
if (name.Length > 16) {
|
||||||
Leave("Usernames must be 16 characters or less", true); return;
|
Leave("Usernames must be 16 characters or less", true); return;
|
||||||
|
}
|
||||||
|
truename = name;
|
||||||
|
skinName = name;
|
||||||
|
|
||||||
|
int altsCount = 0;
|
||||||
|
lock (pendingLock) {
|
||||||
|
DateTime now = DateTime.UtcNow;
|
||||||
|
foreach (PendingItem item in pendingNames) {
|
||||||
|
if (item.Name == truename && (now - item.Connected).TotalSeconds <= 60)
|
||||||
|
altsCount++;
|
||||||
}
|
}
|
||||||
truename = name;
|
pendingNames.Add(new PendingItem(name));
|
||||||
skinName = name;
|
}
|
||||||
|
if (altsCount > 0) {
|
||||||
|
Leave("Already logged in!", true); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string verify = enc.GetString(packet, 66, 32).Trim();
|
||||||
|
verifiedName = false;
|
||||||
|
if (Server.verify) {
|
||||||
|
byte[] hash = null;
|
||||||
|
lock (md5Lock)
|
||||||
|
hash = md5.ComputeHash(enc.GetBytes(Server.salt + truename));
|
||||||
|
|
||||||
int altsCount = 0;
|
string hashHex = BitConverter.ToString(hash);
|
||||||
lock (pendingLock) {
|
if (!verify.CaselessEq(hashHex.Replace("-", ""))) {
|
||||||
DateTime now = DateTime.UtcNow;
|
if (!IPInPrivateRange(ip)) {
|
||||||
foreach (PendingItem item in pendingNames) {
|
Leave("Login failed! Try signing in again.", true); return;
|
||||||
if (item.Name == truename && (now - item.Connected).TotalSeconds <= 60)
|
}
|
||||||
altsCount++;
|
} else {
|
||||||
}
|
verifiedName = true;
|
||||||
pendingNames.Add(new PendingItem(name));
|
|
||||||
}
|
}
|
||||||
if (altsCount > 0) {
|
}
|
||||||
|
|
||||||
|
DisplayName = name;
|
||||||
|
if (Server.ClassicubeAccountPlus) name += "+";
|
||||||
|
isDev = Server.Devs.CaselessContains(truename);
|
||||||
|
isMod = Server.Mods.CaselessContains(truename);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower());
|
||||||
|
if (tBan.expiryTime < DateTime.UtcNow) {
|
||||||
|
Server.tempBans.Remove(tBan);
|
||||||
|
} else {
|
||||||
|
string reason = String.IsNullOrEmpty(tBan.reason) ? "" :
|
||||||
|
" (" + tBan.reason + ")";
|
||||||
|
Kick("You're still temp banned!" + reason, true);
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
|
||||||
|
if (!CheckWhitelist()) { Leave("This is a private server!", true); return; }
|
||||||
|
Group foundGrp = Group.findPlayerGroup(name);
|
||||||
|
|
||||||
|
// ban check
|
||||||
|
if (Server.bannedIP.Contains(ip) && (!Server.useWhitelist || !onWhitelist)) {
|
||||||
|
Kick(Server.defaultBanMessage, true); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundGrp.Permission == LevelPermission.Banned) {
|
||||||
|
string[] data = Ban.GetBanData(name);
|
||||||
|
if (data != null) {
|
||||||
|
Kick(Ban.FormatBan(data[0], data[1]), true);
|
||||||
|
} else {
|
||||||
|
Kick(Server.defaultBanMessage, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maxplayer check
|
||||||
|
if (!CheckPlayersCount(foundGrp)) return;
|
||||||
|
if (version != Server.version) { Leave("Wrong version!", true); return; }
|
||||||
|
|
||||||
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
|
foreach (Player p in players) {
|
||||||
|
if (p.name != name) continue;
|
||||||
|
|
||||||
|
if (Server.verify) {
|
||||||
|
string reason = p.ip == ip ? "(Reconnecting)" : "(Reconnecting from a different IP)";
|
||||||
|
p.Leave(reason); break;
|
||||||
|
} else {
|
||||||
Leave("Already logged in!", true); return;
|
Leave("Already logged in!", true); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string verify = enc.GetString(packet, 66, 32).Trim();
|
|
||||||
verifiedName = false;
|
|
||||||
if (Server.verify) {
|
|
||||||
byte[] hash = null;
|
|
||||||
lock (md5Lock)
|
|
||||||
hash = md5.ComputeHash(enc.GetBytes(Server.salt + truename));
|
|
||||||
|
|
||||||
string hashHex = BitConverter.ToString(hash);
|
|
||||||
if (!verify.CaselessEq(hashHex.Replace("-", ""))) {
|
|
||||||
if (!IPInPrivateRange(ip)) {
|
|
||||||
Leave("Login failed! Try signing in again.", true); return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
verifiedName = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DisplayName = name;
|
|
||||||
if (Server.ClassicubeAccountPlus) name += "+";
|
|
||||||
isDev = Server.Devs.CaselessContains(truename);
|
|
||||||
isMod = Server.Mods.CaselessContains(truename);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower());
|
|
||||||
if (tBan.expiryTime < DateTime.UtcNow) {
|
|
||||||
Server.tempBans.Remove(tBan);
|
|
||||||
} else {
|
|
||||||
string reason = String.IsNullOrEmpty(tBan.reason) ? "" :
|
|
||||||
" (" + tBan.reason + ")";
|
|
||||||
Kick("You're still temp banned!" + reason, true);
|
|
||||||
}
|
|
||||||
} catch { }
|
|
||||||
|
|
||||||
if (!CheckWhitelist()) { Leave("This is a private server!", true); return; }
|
|
||||||
Group foundGrp = Group.findPlayerGroup(name);
|
|
||||||
|
|
||||||
// ban check
|
|
||||||
if (Server.bannedIP.Contains(ip) && (!Server.useWhitelist || !onWhitelist)) {
|
|
||||||
Kick(Server.defaultBanMessage, true); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundGrp.Permission == LevelPermission.Banned) {
|
|
||||||
string[] data = Ban.GetBanData(name);
|
|
||||||
if (data != null) {
|
|
||||||
Kick(Ban.FormatBan(data[0], data[1]), true);
|
|
||||||
} else {
|
|
||||||
Kick(Server.defaultBanMessage, true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// maxplayer check
|
|
||||||
if (!CheckPlayersCount(foundGrp)) return;
|
|
||||||
if (version != Server.version) { Leave("Wrong version!", true); return; }
|
|
||||||
|
|
||||||
Player[] players = PlayerInfo.Online.Items;
|
|
||||||
foreach (Player p in players) {
|
|
||||||
if (p.name != name) continue;
|
|
||||||
|
|
||||||
if (Server.verify) {
|
|
||||||
string reason = p.ip == ip ? "(Reconnecting)" : "(Reconnecting from a different IP)";
|
|
||||||
p.Leave(reason); break;
|
|
||||||
} else {
|
|
||||||
Leave("Already logged in!", true); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadIgnores();
|
|
||||||
byte type = packet[130];
|
|
||||||
if (type == 0x42) { hasCpe = true; SendCpeExtensions(); }
|
|
||||||
|
|
||||||
try { left.Remove(name.ToLower()); }
|
|
||||||
catch { }
|
|
||||||
|
|
||||||
group = foundGrp;
|
|
||||||
Loading = true;
|
|
||||||
if (disconnected) return;
|
|
||||||
id = NextFreeId();
|
|
||||||
|
|
||||||
if (type != 0x42)
|
|
||||||
CompleteLoginProcess();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Server.ErrorLog(e);
|
|
||||||
Chat.MessageAll("An error occurred: {0}", e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadIgnores();
|
||||||
|
byte type = packet[130];
|
||||||
|
if (type == 0x42) { hasCpe = true; SendCpeExtensions(); }
|
||||||
|
|
||||||
|
try { left.Remove(name.ToLower()); }
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
group = foundGrp;
|
||||||
|
Loading = true;
|
||||||
|
if (disconnected) return;
|
||||||
|
id = NextFreeId();
|
||||||
|
|
||||||
|
if (type != 0x42)
|
||||||
|
CompleteLoginProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckPlayersCount(Group foundGrp) {
|
bool CheckPlayersCount(Group foundGrp) {
|
||||||
@ -196,43 +191,38 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CompleteLoginProcess() {
|
void CompleteLoginProcess() {
|
||||||
LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin);
|
LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin);
|
||||||
|
|
||||||
try {
|
SendUserMOTD();
|
||||||
SendUserMOTD();
|
SendMap(null);
|
||||||
SendMap(null);
|
if (disconnected) return;
|
||||||
if (disconnected) return;
|
loggedIn = true;
|
||||||
loggedIn = true;
|
|
||||||
|
|
||||||
PlayerInfo.Online.Add(this);
|
PlayerInfo.Online.Add(this);
|
||||||
connections.Remove(this);
|
connections.Remove(this);
|
||||||
RemoveFromPending();
|
RemoveFromPending();
|
||||||
Server.s.PlayerListUpdate();
|
Server.s.PlayerListUpdate();
|
||||||
|
|
||||||
//Test code to show when people come back with different accounts on the same IP
|
//Test code to show when people come back with different accounts on the same IP
|
||||||
string alts = name + " is lately known as:";
|
string alts = name + " is lately known as:";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (!ip.StartsWith("127.0.0.")) {
|
if (!ip.StartsWith("127.0.0.")) {
|
||||||
foreach (KeyValuePair<string, string> prev in left) {
|
foreach (KeyValuePair<string, string> prev in left) {
|
||||||
if (prev.Value == ip) {
|
if (prev.Value == ip) {
|
||||||
found = true;
|
found = true;
|
||||||
alts += " " + prev.Key;
|
alts += " " + prev.Key;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found) {
|
|
||||||
if (group.Permission < adminChatRank || !Server.adminsjoinsilent) {
|
|
||||||
Chat.MessageOps(alts);
|
|
||||||
//IRCBot.Say(temp, true); //Tells people in op channel on IRC
|
|
||||||
}
|
|
||||||
Server.s.Log(alts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckOutdatedClient();
|
|
||||||
} catch (Exception e) {
|
if (found) {
|
||||||
Server.ErrorLog(e);
|
if (group.Permission < adminChatRank || !Server.adminsjoinsilent) {
|
||||||
Chat.MessageAll("An error occurred: {0}", e.Message);
|
Chat.MessageOps(alts);
|
||||||
|
//IRCBot.Say(temp, true); //Tells people in op channel on IRC
|
||||||
|
}
|
||||||
|
Server.s.Log(alts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
CheckOutdatedClient();
|
||||||
|
|
||||||
//OpenClassic Client Check
|
//OpenClassic Client Check
|
||||||
SendBlockchange(0, 0, 0, 0);
|
SendBlockchange(0, 0, 0, 0);
|
||||||
@ -310,16 +300,14 @@ namespace MCGalaxy {
|
|||||||
Server.s.Log(name + " [" + ip + "] has joined the server.");
|
Server.s.Log(name + " [" + ip + "] has joined the server.");
|
||||||
Game.InfectMessages = PlayerDB.GetInfectMessages(this);
|
Game.InfectMessages = PlayerDB.GetInfectMessages(this);
|
||||||
Server.zombie.PlayerJoinedServer(this);
|
Server.zombie.PlayerJoinedServer(this);
|
||||||
try {
|
|
||||||
ushort x = (ushort)((0.5 + level.spawnx) * 32);
|
ushort x = (ushort)((0.5 + level.spawnx) * 32);
|
||||||
ushort y = (ushort)((1 + level.spawny) * 32);
|
ushort y = (ushort)((1 + level.spawny) * 32);
|
||||||
ushort z = (ushort)((0.5 + level.spawnz) * 32);
|
ushort z = (ushort)((0.5 + level.spawnz) * 32);
|
||||||
pos = new ushort[3] { x, y, z }; rot = new byte[2] { level.rotx, level.roty };
|
pos = new ushort[3] { x, y, z };
|
||||||
Entities.SpawnEntities(this, x, y, z, rot[0], rot[1]);
|
rot = new byte[2] { level.rotx, level.roty };
|
||||||
} catch (Exception e) {
|
|
||||||
Server.ErrorLog(e);
|
Entities.SpawnEntities(this, x, y, z, rot[0], rot[1]);
|
||||||
Server.s.Log("Error spawning player \"" + name + "\"");
|
|
||||||
}
|
|
||||||
CmdGoto.CheckGamesJoin(this, null);
|
CmdGoto.CheckGamesJoin(this, null);
|
||||||
Loading = false;
|
Loading = false;
|
||||||
}
|
}
|
||||||
@ -420,7 +408,7 @@ namespace MCGalaxy {
|
|||||||
if (!short.TryParse(reach, out reachDist)) return;
|
if (!short.TryParse(reach, out reachDist)) return;
|
||||||
ReachDistance = reachDist / 32f;
|
ReachDistance = reachDist / 32f;
|
||||||
if (HasCpeExt(CpeExt.ClickDistance))
|
if (HasCpeExt(CpeExt.ClickDistance))
|
||||||
Send(Packet.MakeClickDistance(reachDist));
|
Send(Packet.MakeClickDistance(reachDist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user