mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 21:51:19 -04:00
Move zombie game API into a separate file, splitup Server.Start into several logical functions.
This commit is contained in:
parent
9d90f88687
commit
5a9c135560
@ -241,7 +241,7 @@ namespace MCGalaxy.Commands
|
||||
Player.SendMessage(p, "/os map buildable -- Sets whether any blocks can be placed");
|
||||
Player.SendMessage(p, "/os map deletable -- Sets whether any blocks can be deleted");
|
||||
Player.SendMessage(p, " Textures: If your URL is too long, use the \"<\" symbol to continue it on another line.");
|
||||
Player.SendMessage(p, " Map Types: Desert, flat, forest, island, mountians, ocean, pixel, empty and space");
|
||||
Player.SendMessage(p, " Map Types: Desert, flat, forest, island, mountains, ocean, pixel, empty and space");
|
||||
Player.SendMessage(p, " Motd: If no message is provided, the default message will be used.");
|
||||
}
|
||||
}
|
||||
|
130
Games/ZombieSurvival/ZombieGame.Props.cs
Normal file
130
Games/ZombieSurvival/ZombieGame.Props.cs
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
Copyright 2010 MCLawl Team -
|
||||
Created by Snowl (David D.) and Cazzar (Cayde D.)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.osedu.org/licenses/ECL-2.0
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MCGalaxy.Games {
|
||||
|
||||
public class BountyData {
|
||||
public Player Origin;
|
||||
public int Amount;
|
||||
|
||||
public BountyData(Player origin, int amount) {
|
||||
Origin = origin; Amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ZombieGameStatus { NotStarted, InfiniteRounds, SingleRound, VariableRounds, LastRound }
|
||||
|
||||
public sealed partial class ZombieGame {
|
||||
|
||||
public const string InfectCol = "&infect";
|
||||
|
||||
/// <summary> The number of rounds that have been played in this game so far. </summary>
|
||||
public int RoundsDone = 0;
|
||||
|
||||
/// <summary> The maximum number of rounds that can be played before the game ends. </summary>
|
||||
public int MaxRounds = 0;
|
||||
|
||||
/// <summary> How precise collision detection is between alive and dead players. (Where 1 block = 32 units) </summary>
|
||||
public int HitboxPrecision = 32;
|
||||
|
||||
/// <summary> The maximum distance a player is allowed to move between movement packets. </summary>
|
||||
public int MaxMoveDistance = 70;
|
||||
|
||||
/// <summary> Current round status of the game. </summary>
|
||||
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
||||
|
||||
/// <summary> Gets whether zombie survival is currently running. </summary>
|
||||
public bool Running { get { return Status != ZombieGameStatus.NotStarted; } }
|
||||
|
||||
/// <summary> Whether a round is currently in progress. </summary>
|
||||
public bool RoundInProgress = false;
|
||||
|
||||
/// <summary> Time at which the next round is scheduled to start. </summary>
|
||||
public DateTime RoundStart;
|
||||
|
||||
/// <summary> Time at which the next round is scheduled to end. </summary>
|
||||
public DateTime RoundEnd;
|
||||
|
||||
public static System.Timers.Timer timer;
|
||||
public bool initialChangeLevel = false;
|
||||
|
||||
/// <summary> The name of the level that the last round of zombie survival was played on. </summary>
|
||||
public string LastLevelName = "";
|
||||
|
||||
/// <summary> The name of the level that the current round of zombie survival is being played on. </summary>
|
||||
public string CurLevelName = "";
|
||||
|
||||
/// <summary> The level that the current round of zombie survival is being played on. </summary>
|
||||
public Level CurLevel = null;
|
||||
|
||||
/// <summary> List of alive/human players. </summary>
|
||||
public VolatileArray<Player> Alive = new VolatileArray<Player>(false);
|
||||
|
||||
/// <summary> List of dead/infected players. </summary>
|
||||
public VolatileArray<Player> Infected = new VolatileArray<Player>(false);
|
||||
|
||||
/// <summary> Name of the player queued to be the first zombie in the next round. </summary>
|
||||
public string QueuedZombie;
|
||||
|
||||
/// <summary> Name of the level queued to be used for the next round. </summary>
|
||||
public string QueuedLevel;
|
||||
|
||||
/// <summary> Whether the server's main level should be set to the current level at the end of each round. </summary>
|
||||
public bool SetMainLevel;
|
||||
|
||||
/// <summary> Whether zombie survival should start upon server startup. </summary>
|
||||
public bool StartImmediately;
|
||||
|
||||
/// <summary> Whether changes made during a round of zombie survival should be permanently saved. </summary>
|
||||
public bool SaveLevelBlockchanges;
|
||||
|
||||
/// <summary> Whether maps with '+' in their name are ignored when choosing levels for the next round. </summary>
|
||||
public bool IgnorePersonalWorlds = true;
|
||||
|
||||
/// <summary> Whether the current level name should be shown in the heartbeats sent. </summary>
|
||||
public bool IncludeMapInHeartbeat = false;
|
||||
|
||||
static string[] messages = new string[] { "{0} WIKIWOO'D {1}", "{0} stuck their teeth into {1}",
|
||||
"{0} licked {1}'s brain ", "{0} danubed {1}", "{0} made {1} meet their maker", "{0} tripped {1}",
|
||||
"{0} made some zombie babies with {1}", "{0} made {1} see the dark side", "{0} tweeted {1}",
|
||||
"{0} made {1} open source", "{0} infected {1}", "{0} iDotted {1}", "{1} got nommed on",
|
||||
"{0} transplanted {1}'s living brain" };
|
||||
|
||||
internal bool noRespawn = true, noPillaring = true;
|
||||
internal string ZombieName = "", ZombieModel = "zombie";
|
||||
internal bool ChangeLevels = true;
|
||||
|
||||
/// <summary> List of levels that are randomly picked for zombie survival.
|
||||
/// If this left blank, then all level files are picked from instead. </summary>
|
||||
internal List<string> LevelList = new List<string>();
|
||||
|
||||
/// <summary> List of levels that are never picked for zombie survival. </summary>
|
||||
internal List<string> IgnoredLevelList = new List<string>();
|
||||
|
||||
string lastLevel1 = "", lastLevel2 = "";
|
||||
int Level1Vote = 0, Level2Vote = 0, Level3Vote = 0;
|
||||
|
||||
string lastPlayerToInfect = "";
|
||||
int infectCombo = 0;
|
||||
public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>();
|
||||
}
|
||||
}
|
@ -22,110 +22,7 @@ using System.Threading;
|
||||
|
||||
namespace MCGalaxy.Games {
|
||||
|
||||
public class BountyData {
|
||||
public Player Origin;
|
||||
public int Amount;
|
||||
|
||||
public BountyData(Player origin, int amount) {
|
||||
Origin = origin; Amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ZombieGameStatus { NotStarted, InfiniteRounds, SingleRound, VariableRounds, LastRound }
|
||||
|
||||
public sealed partial class ZombieGame {
|
||||
|
||||
public const string InfectCol = "&infect";
|
||||
|
||||
/// <summary> The number of rounds that have been played in this game so far. </summary>
|
||||
public int RoundsDone = 0;
|
||||
|
||||
/// <summary> The maximum number of rounds that can be played before the game ends. </summary>
|
||||
public int MaxRounds = 0;
|
||||
|
||||
/// <summary> How precise collision detection is between alive and dead players. (Where 1 block = 32 units) </summary>
|
||||
public int HitboxPrecision = 32;
|
||||
|
||||
/// <summary> The maximum distance a player is allowed to move between movement packets. </summary>
|
||||
public int MaxMoveDistance = 70;
|
||||
|
||||
/// <summary> Current round status of the game. </summary>
|
||||
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
||||
|
||||
/// <summary> Gets whether zombie survival is currently running. </summary>
|
||||
public bool Running { get { return Status != ZombieGameStatus.NotStarted; } }
|
||||
|
||||
/// <summary> Whether a round is currently in progress. </summary>
|
||||
public bool RoundInProgress = false;
|
||||
|
||||
/// <summary> Time at which the next round is scheduled to start. </summary>
|
||||
public DateTime RoundStart;
|
||||
|
||||
/// <summary> Time at which the next round is scheduled to end. </summary>
|
||||
public DateTime RoundEnd;
|
||||
|
||||
public static System.Timers.Timer timer;
|
||||
public bool initialChangeLevel = false;
|
||||
|
||||
/// <summary> The name of the level that the last round of zombie survival was played on. </summary>
|
||||
public string LastLevelName = "";
|
||||
|
||||
/// <summary> The name of the level that the current round of zombie survival is being played on. </summary>
|
||||
public string CurLevelName = "";
|
||||
|
||||
/// <summary> The level that the current round of zombie survival is being played on. </summary>
|
||||
public Level CurLevel = null;
|
||||
|
||||
/// <summary> List of alive/human players. </summary>
|
||||
public VolatileArray<Player> Alive = new VolatileArray<Player>(false);
|
||||
|
||||
/// <summary> List of dead/infected players. </summary>
|
||||
public VolatileArray<Player> Infected = new VolatileArray<Player>(false);
|
||||
|
||||
/// <summary> Name of the player queued to be the first zombie in the next round. </summary>
|
||||
public string QueuedZombie;
|
||||
|
||||
/// <summary> Name of the level queued to be used for the next round. </summary>
|
||||
public string QueuedLevel;
|
||||
|
||||
/// <summary> Whether the server's main level should be set to the current level at the end of each round. </summary>
|
||||
public bool SetMainLevel;
|
||||
|
||||
/// <summary> Whether zombie survival should start upon server startup. </summary>
|
||||
public bool StartImmediately;
|
||||
|
||||
/// <summary> Whether changes made during a round of zombie survival should be permanently saved. </summary>
|
||||
public bool SaveLevelBlockchanges;
|
||||
|
||||
/// <summary> Whether maps with '+' in their name are ignored when choosing levels for the next round. </summary>
|
||||
public bool IgnorePersonalWorlds = true;
|
||||
|
||||
/// <summary> Whether the current level name should be shown in the heartbeats sent. </summary>
|
||||
public bool IncludeMapInHeartbeat = false;
|
||||
|
||||
static string[] messages = new string[] { "{0} WIKIWOO'D {1}", "{0} stuck their teeth into {1}",
|
||||
"{0} licked {1}'s brain ", "{0} danubed {1}", "{0} made {1} meet their maker", "{0} tripped {1}",
|
||||
"{0} made some zombie babies with {1}", "{0} made {1} see the dark side", "{0} tweeted {1}",
|
||||
"{0} made {1} open source", "{0} infected {1}", "{0} iDotted {1}", "{1} got nommed on",
|
||||
"{0} transplanted {1}'s living brain" };
|
||||
|
||||
internal bool noRespawn = true, noPillaring = true;
|
||||
internal string ZombieName = "", ZombieModel = "zombie";
|
||||
internal bool ChangeLevels = true;
|
||||
|
||||
/// <summary> List of levels that are randomly picked for zombie survival.
|
||||
/// If this left blank, then all level files are picked from instead. </summary>
|
||||
internal List<string> LevelList = new List<string>();
|
||||
|
||||
/// <summary> List of levels that are never picked for zombie survival. </summary>
|
||||
internal List<string> IgnoredLevelList = new List<string>();
|
||||
|
||||
string lastLevel1 = "", lastLevel2 = "";
|
||||
int Level1Vote = 0, Level2Vote = 0, Level3Vote = 0;
|
||||
|
||||
string lastPlayerToInfect = "";
|
||||
int infectCombo = 0;
|
||||
public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>();
|
||||
|
||||
public void Start(ZombieGameStatus status, int amount) {
|
||||
Status = status;
|
||||
|
@ -459,6 +459,7 @@
|
||||
<Compile Include="Games\ZombieSurvival\ZombieGame.Core.cs" />
|
||||
<Compile Include="Games\ZombieSurvival\ZombieGame.cs" />
|
||||
<Compile Include="Games\ZombieSurvival\ZombieGame.Game.cs" />
|
||||
<Compile Include="Games\ZombieSurvival\ZombieGame.Props.cs" />
|
||||
<Compile Include="GUI\LevelCollection.cs" />
|
||||
<Compile Include="GUI\PropertyWindow.Games.cs">
|
||||
<DependentUpon>PropertyWindow.cs</DependentUpon>
|
||||
|
188
Server/Server.cs
188
Server/Server.cs
@ -354,6 +354,41 @@ namespace MCGalaxy
|
||||
CheckFile("Newtonsoft.Json.dll");
|
||||
CheckFile("LibNoise.dll");
|
||||
|
||||
EnsureFilesExist();
|
||||
MoveOutdatedFiles();
|
||||
Chat.LoadCustomTokens();
|
||||
|
||||
if (File.Exists("text/emotelist.txt")) {
|
||||
foreach (string s in File.ReadAllLines("text/emotelist.txt"))
|
||||
Player.emoteList.Add(s);
|
||||
} else {
|
||||
File.Create("text/emotelist.txt").Dispose();
|
||||
}
|
||||
|
||||
lava = new LavaSurvival();
|
||||
zombie = new ZombieGame();
|
||||
Countdown = new CountdownGame();
|
||||
LoadAllSettings();
|
||||
|
||||
InitDatabase();
|
||||
Economy.LoadDatabase();
|
||||
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
foreach (Level l in loaded)
|
||||
l.Unload();
|
||||
ml.Queue(LoadMainLevel);
|
||||
Plugin.Load();
|
||||
ml.Queue(LoadPlayerLists);
|
||||
ml.Queue(LoadAutoloadCommands);
|
||||
ml.Queue(LoadGCAccepted);
|
||||
|
||||
ml.Queue(InitTimers);
|
||||
ml.Queue(InitRest);
|
||||
ml.Queue(InitHeartbeat);
|
||||
UpdateStaffList();
|
||||
}
|
||||
|
||||
void EnsureFilesExist() {
|
||||
if (!Directory.Exists("properties")) Directory.CreateDirectory("properties");
|
||||
if (!Directory.Exists("levels")) Directory.CreateDirectory("levels");
|
||||
if (!Directory.Exists("bots")) Directory.CreateDirectory("bots");
|
||||
@ -371,9 +406,10 @@ namespace MCGalaxy
|
||||
if (!Directory.Exists("extra/copyBackup/")) Directory.CreateDirectory("extra/copyBackup/");
|
||||
if (!Directory.Exists("extra/Waypoints")) Directory.CreateDirectory("extra/Waypoints");
|
||||
if (!Directory.Exists("blockdefs")) Directory.CreateDirectory("blockdefs");
|
||||
|
||||
try
|
||||
{
|
||||
}
|
||||
|
||||
void MoveOutdatedFiles() {
|
||||
try {
|
||||
if (File.Exists("blocks.json")) File.Move("blocks.json", "blockdefs/global.json");
|
||||
if (File.Exists("server.properties")) File.Move("server.properties", "properties/server.properties");
|
||||
if (File.Exists("rules.txt")) File.Move("rules.txt", "text/rules.txt");
|
||||
@ -385,100 +421,68 @@ namespace MCGalaxy
|
||||
if (useWhitelist && File.Exists("whitelist.txt")) File.Move("whitelist.txt", "ranks/whitelist.txt");
|
||||
}
|
||||
catch { }
|
||||
Chat.LoadCustomTokens();
|
||||
|
||||
if (File.Exists("text/emotelist.txt")) {
|
||||
foreach (string s in File.ReadAllLines("text/emotelist.txt"))
|
||||
Player.emoteList.Add(s);
|
||||
} else {
|
||||
File.Create("text/emotelist.txt").Dispose();
|
||||
}
|
||||
|
||||
void InitDatabase() {
|
||||
try {
|
||||
if (Server.useMySQL)
|
||||
Database.executeQuery("CREATE DATABASE if not exists `" + MySQLDatabaseName + "`", true);
|
||||
} catch (Exception e) {
|
||||
ErrorLog(e);
|
||||
s.Log("MySQL settings have not been set! Please Setup using the properties window.");
|
||||
//process.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lava = new LavaSurvival();
|
||||
zombie = new ZombieGame();
|
||||
Countdown = new CountdownGame();
|
||||
|
||||
LoadAllSettings();
|
||||
|
||||
{//MYSQL stuff
|
||||
try
|
||||
{
|
||||
if (Server.useMySQL)
|
||||
Database.executeQuery("CREATE DATABASE if not exists `" + MySQLDatabaseName + "`", true);
|
||||
}
|
||||
//catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
//{
|
||||
// Server.s.Log("MySQL settings have not been set! Many features will not be available if MySQL is not enabled");
|
||||
// // Server.ErrorLog(e);
|
||||
//}
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorLog(e);
|
||||
s.Log("MySQL settings have not been set! Please Setup using the properties window.");
|
||||
//process.Kill();
|
||||
return;
|
||||
}
|
||||
Database.executeQuery(string.Format("CREATE TABLE if not exists Players (ID INTEGER {0}AUTO{1}INCREMENT NOT NULL, Name TEXT, IP CHAR(15), FirstLogin DATETIME, LastLogin DATETIME, totalLogin MEDIUMINT, Title CHAR(20), TotalDeaths SMALLINT, Money MEDIUMINT UNSIGNED, totalBlocks BIGINT, totalCuboided BIGINT, totalKicked MEDIUMINT, TimeSpent VARCHAR(20), color VARCHAR(6), title_color VARCHAR(6){2});", (useMySQL ? "" : "PRIMARY KEY "), (useMySQL ? "_" : ""), (Server.useMySQL ? ", PRIMARY KEY (ID)" : "")));
|
||||
Database.executeQuery(string.Format("CREATE TABLE if not exists Opstats (ID INTEGER {0}AUTO{1}INCREMENT NOT NULL, Time DATETIME, Name TEXT, Cmd VARCHAR(40), Cmdmsg VARCHAR(40){2});", (useMySQL ? "" : "PRIMARY KEY "), (useMySQL ? "_" : ""), (Server.useMySQL ? ", PRIMARY KEY (ID)" : "")));
|
||||
if (!File.Exists("extra/alter.txt") && Server.useMySQL) {
|
||||
Database.executeQuery("ALTER TABLE Players MODIFY Name TEXT");
|
||||
Database.executeQuery("ALTER TABLE Opstats MODIFY Name TEXT");
|
||||
File.Create("extra/alter.txt");
|
||||
}
|
||||
//since 5.5.11 we are cleaning up the table Playercmds
|
||||
string query = Server.useMySQL ? "SHOW TABLES LIKE 'Playercmds'" : "SELECT name FROM sqlite_master WHERE type='table' AND name='Playercmds';";
|
||||
DataTable playercmds = Database.fillData(query); DataTable opstats = Database.fillData("SELECT * FROM Opstats");
|
||||
//if Playercmds exists copy-filter to Ostats and remove Playercmds
|
||||
if (playercmds.Rows.Count != 0) {
|
||||
foreach (string cmd in Server.Opstats)
|
||||
Database.executeQuery(string.Format("INSERT INTO Opstats (Time, Name, Cmd, Cmdmsg) SELECT Time, Name, Cmd, Cmdmsg FROM Playercmds WHERE cmd = '{0}';", cmd));
|
||||
Database.executeQuery("INSERT INTO Opstats (Time, Name, Cmd, Cmdmsg) SELECT Time, Name, Cmd, Cmdmsg FROM Playercmds WHERE cmd = 'review' AND cmdmsg = 'next';");
|
||||
Database.fillData("DROP TABLE Playercmds");
|
||||
}
|
||||
playercmds.Dispose(); opstats.Dispose();
|
||||
|
||||
// Here, since SQLite is a NEW thing from 5.3.0.0, we do not have to check for existing tables in SQLite.
|
||||
if (useMySQL)
|
||||
{
|
||||
// Check if the color column exists.
|
||||
DataTable colorExists = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='color'");
|
||||
if (colorExists.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN color VARCHAR(6) AFTER totalKicked");
|
||||
colorExists.Dispose();
|
||||
|
||||
DataTable tcolorExists = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='title_color'");
|
||||
if (tcolorExists.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN title_color VARCHAR(6) AFTER color");
|
||||
tcolorExists.Dispose();
|
||||
|
||||
DataTable timespent = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='TimeSpent'");
|
||||
if (timespent.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN TimeSpent VARCHAR(20) AFTER totalKicked");
|
||||
timespent.Dispose();
|
||||
|
||||
DataTable totalCuboided = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='totalCuboided'");
|
||||
if (totalCuboided.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN totalCuboided BIGINT AFTER totalBlocks");
|
||||
totalCuboided.Dispose();
|
||||
}
|
||||
|
||||
string autoInc = useMySQL ? "AUTO_INCREMENT" : "AUTOINCREMENT";
|
||||
Database.executeQuery(string.Format("CREATE TABLE if not exists Players (ID INTEGER {0}" + autoInc + " NOT NULL, " +
|
||||
"Name TEXT, IP CHAR(15), FirstLogin DATETIME, LastLogin DATETIME, totalLogin MEDIUMINT, " +
|
||||
"Title CHAR(20), TotalDeaths SMALLINT, Money MEDIUMINT UNSIGNED, totalBlocks BIGINT, " +
|
||||
"totalCuboided BIGINT, totalKicked MEDIUMINT, TimeSpent VARCHAR(20), color VARCHAR(6), " +
|
||||
"title_color VARCHAR(6){1});", (useMySQL ? "" : "PRIMARY KEY "), (useMySQL ? ", PRIMARY KEY (ID)" : "")));
|
||||
Database.executeQuery(string.Format("CREATE TABLE if not exists Opstats (ID INTEGER {0}" + autoInc + " NOT NULL, " +
|
||||
"Time DATETIME, Name TEXT, Cmd VARCHAR(40), Cmdmsg VARCHAR(40){1});",
|
||||
(useMySQL ? "" : "PRIMARY KEY "), (useMySQL ? ", PRIMARY KEY (ID)" : "")));
|
||||
if (!File.Exists("extra/alter.txt") && useMySQL) {
|
||||
Database.executeQuery("ALTER TABLE Players MODIFY Name TEXT");
|
||||
Database.executeQuery("ALTER TABLE Opstats MODIFY Name TEXT");
|
||||
File.Create("extra/alter.txt");
|
||||
}
|
||||
|
||||
//since 5.5.11 we are cleaning up the table Playercmds
|
||||
string query = Server.useMySQL ? "SHOW TABLES LIKE 'Playercmds'" : "SELECT name FROM sqlite_master WHERE type='table' AND name='Playercmds';";
|
||||
DataTable playercmds = Database.fillData(query), opstats = Database.fillData("SELECT * FROM Opstats");
|
||||
//if Playercmds exists copy-filter to Ostats and remove Playercmds
|
||||
if (playercmds.Rows.Count != 0) {
|
||||
foreach (string cmd in Server.Opstats)
|
||||
Database.executeQuery(string.Format("INSERT INTO Opstats (Time, Name, Cmd, Cmdmsg) SELECT Time, Name, Cmd, Cmdmsg FROM Playercmds WHERE cmd = '{0}';", cmd));
|
||||
Database.executeQuery("INSERT INTO Opstats (Time, Name, Cmd, Cmdmsg) SELECT Time, Name, Cmd, Cmdmsg FROM Playercmds WHERE cmd = 'review' AND cmdmsg = 'next';");
|
||||
Database.fillData("DROP TABLE Playercmds");
|
||||
}
|
||||
playercmds.Dispose(); opstats.Dispose();
|
||||
|
||||
Economy.LoadDatabase();
|
||||
// Here, since SQLite is a NEW thing from 5.3.0.0, we do not have to check for existing tables in SQLite.
|
||||
if (!useMySQL) return;
|
||||
// Check if the color column exists.
|
||||
DataTable colorExists = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='color'");
|
||||
if (colorExists.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN color VARCHAR(6) AFTER totalKicked");
|
||||
colorExists.Dispose();
|
||||
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
foreach (Level l in loaded)
|
||||
l.Unload();
|
||||
ml.Queue(LoadMainLevel);
|
||||
Plugin.Load();
|
||||
ml.Queue(LoadPlayerLists);
|
||||
ml.Queue(LoadAutoloadCommands);
|
||||
ml.Queue(LoadGCAccepted);
|
||||
DataTable tcolorExists = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='title_color'");
|
||||
if (tcolorExists.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN title_color VARCHAR(6) AFTER color");
|
||||
tcolorExists.Dispose();
|
||||
|
||||
ml.Queue(InitTimers);
|
||||
ml.Queue(InitRest);
|
||||
ml.Queue(InitHeartbeat);
|
||||
UpdateStaffList();
|
||||
DataTable timespent = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='TimeSpent'");
|
||||
if (timespent.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN TimeSpent VARCHAR(20) AFTER totalKicked");
|
||||
timespent.Dispose();
|
||||
|
||||
DataTable totalCuboided = Database.fillData("SHOW COLUMNS FROM Players WHERE `Field`='totalCuboided'");
|
||||
if (totalCuboided.Rows.Count == 0)
|
||||
Database.executeQuery("ALTER TABLE Players ADD COLUMN totalCuboided BIGINT AFTER totalBlocks");
|
||||
totalCuboided.Dispose();
|
||||
}
|
||||
|
||||
public static string SendResponse(HttpListenerRequest request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user