public void UpdateBlock(Player p, ushort x, ushort y, ushort z, ExtBlock block, ushort flags = BlockDBFlags.ManualPlace, bool buffered = false) { ExtBlock old = GetBlock(x, y, z); bool drawn = (flags & BlockDBFlags.ManualPlace) != 0; int type = DoBlockchange(p, x, y, z, block, drawn); if (type == 0) { return; // no block change performed } BlockDB.Cache.Add(p, x, y, z, flags, old, block); if (type == 1) { return; // not different visually } int index = PosToInt(x, y, z); if (buffered) { BlockQueue.Addblock(p, index, block); } else { Player.GlobalBlockchange(this, x, y, z, block); } }
public void UpdateBlock(Player p, ushort x, ushort y, ushort z, byte block, byte extBlock, ushort flags) { byte old = GetTile(x, y, z), oldExt = 0; if (old == Block.custom_block) { oldExt = GetExtTile(x, y, z); } bool drawn = (flags & BlockDBFlags.ManualPlace) != 0; if (!DoBlockchange(p, x, y, z, block, extBlock, drawn)) { return; } BlockDB.Add(p, x, y, z, flags, old, oldExt, block, extBlock); int index = PosToInt(x, y, z); if (bufferblocks) { BlockQueue.Addblock(p, index, block, extBlock); } else { Player.GlobalBlockchange(this, x, y, z, block, extBlock); } }
void InitRest() { try { if (EnableHttpApi) { APIServer = new WebServer(SendResponse, "http://localhost:8080/api/"); APIServer.Run(); InfoServer = new WebServer(WhoIsResponse, "http://localhost:8080/whois/"); InfoServer.Run(); } } catch { Server.s.Log("Failed to start local API server"); } IRC = new IRCBot(); if (Server.irc) { IRC.Connect(); } locationChecker = new Thread(ServerTasks.LocationChecks); locationChecker.Name = "MCG_LocationCheck"; locationChecker.Start(); InitZombieSurvival(); BlockQueue.Start(); Log("Finished setting up server, finding classicube.net url.."); ServerSetupFinished = true; }
public void UpdateBlock(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { if (!DoBlockchange(p, x, y, z, type, extType)) { return; } BlockPos bP = default(BlockPos); bP.name = p.name; bP.index = PosToInt(x, y, z); bP.SetData(type, extType, type == 0); blockCache.Add(bP); if (bufferblocks) { BlockQueue.Addblock(p, bP.index, type, extType); } else { Player.GlobalBlockchange(this, x, y, z, type, extType); } }
void InitRest() { try { if (EnableHttpApi) { APIServer = new WebServer(SendResponse, "http://localhost:8080/api/"); APIServer.Run(); InfoServer = new WebServer(WhoIsResponse, "http://localhost:8080/whois/"); InfoServer.Run(); } } catch { Server.s.Log("Failed to start local API server"); } IRC = new ForgeBot(Server.ircChannel, Server.ircOpChannel, Server.ircNick, Server.ircServer); GlobalChat = new GlobalChatBot(GlobalChatNick()); if (Server.irc) { IRC.Connect(); } if (Server.UseGlobalChat) { GlobalChat.Connect(); } new AutoSaver(Server.backupInterval); blockThread = new Thread(DoBlockUpdates); blockThread.Name = "MCG_BlockUpdates"; blockThread.Start(); locationChecker = new Thread(DoLocationChecks); locationChecker.Name = "MCG_LocationCheck"; locationChecker.Start(); #if DEBUG UseTextures = true; #endif Log("Finished setting up server, finding classicube.net url.."); ServerSetupFinished = true; Checktimer.StartTimer(); Commands.CommandKeywords.SetKeyWords(); try { if (Server.lava.startOnStartup) { Server.lava.Start(); } if (ZombieGame.StartImmediately) { Server.zombie.Start(ZombieGameStatus.InfiniteRounds, 0); } //This doesnt use the main map if (Server.UseCTF) { ctf = new Auto_CTF(); } } catch (Exception e) { Server.ErrorLog(e); } BlockQueue.Start(); }