Advertisement
Guest User

Untitled

a guest
Oct 5th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.46 KB | None | 0 0
  1. /*
  2. Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
  3.  
  4. Dual-licensed under the Educational Community License, Version 2.0 and
  5. the GNU General Public License, Version 3 (the "Licenses"); you may
  6. not use this file except in compliance with the Licenses. You may
  7. obtain a copy of the Licenses at
  8.  
  9. http://www.opensource.org/licenses/ecl2.php
  10. http://www.gnu.org/licenses/gpl-3.0.html
  11.  
  12. Unless required by applicable law or agreed to in writing,
  13. software distributed under the Licenses are distributed on an "AS IS"
  14. BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  15. or implied. See the Licenses for the specific language governing
  16. permissions and limitations under the Licenses.
  17. */
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Diagnostics;
  21. using System.Net.Sockets;
  22. using System.Threading;
  23. using System.Windows.Forms;
  24. using MCGalaxy.Config;
  25. using MCGalaxy.Games;
  26.  
  27. namespace MCGalaxy {
  28. public sealed partial class Server {
  29. public static bool cancelcommand;
  30. public static bool canceladmin;
  31. public static bool cancellog;
  32. public static bool canceloplog;
  33. public static string apppath = Application.StartupPath;
  34. public delegate void OnConsoleCommand(string cmd, string message);
  35. public static event OnConsoleCommand ConsoleCommand;
  36. public delegate void OnServerError(Exception error);
  37. public static event OnServerError ServerError;
  38. public delegate void OnServerLog(string message);
  39. public static event OnServerLog ServerLog, ServerAdminLog, ServerOpLog;
  40. public delegate void HeartBeatHandler();
  41. public delegate void MessageEventHandler(string message);
  42. public delegate void PlayerListHandler(List<Player> playerList);
  43. public delegate void VoidHandler();
  44. public delegate void LogHandler(string message);
  45. public event LogHandler OnLog, OnSystem, OnCommand, OnError, OnOp, OnAdmin;
  46. public event HeartBeatHandler HeartBeatFail;
  47. public event MessageEventHandler OnURLChange;
  48. public event PlayerListHandler OnPlayerListChange;
  49. public event VoidHandler OnSettingsUpdate;
  50.  
  51. public static IRCBot IRC;
  52. public static Thread locationChecker;
  53. public static WebServer APIServer, InfoServer;
  54. public static DateTime StartTime, StartTimeLocal;
  55.  
  56. public static PlayerMetaList AutoloadMaps = new PlayerMetaList("text/autoload.txt");
  57. public static PlayerMetaList RankInfo = new PlayerMetaList("text/rankinfo.txt");
  58. public static PlayerMetaList TempRanks = new PlayerMetaList("text/tempranks.txt");
  59. public static PlayerMetaList Notes = new PlayerMetaList("text/notes.txt");
  60. public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
  61.  
  62. public static string VersionString {
  63. get {
  64. Version v = Version;
  65. return v.Major + "." + v.Minor + "." + v.Build + "." + v.Revision;
  66. }
  67. }
  68.  
  69. // URL hash for connecting to the server
  70. public static string Hash = String.Empty, URL = String.Empty;
  71.  
  72. public static Socket listen;
  73. public static System.Timers.Timer updateTimer = new System.Timers.Timer(100);
  74.  
  75. //Chatrooms
  76. public static List<string> Chatrooms = new List<string>();
  77. //Other
  78. public static bool UseCTF = false;
  79. public static bool ServerSetupFinished = false;
  80. public static Auto_CTF ctf = null;
  81. public static PlayerList bannedIP, whiteList, ircControllers, muted;
  82. public static PlayerList ignored, frozen, hidden, agreed, vip, noEmotes;
  83. public static PlayerExtList jailed, models, skins, reach;
  84.  
  85. public static readonly List<string> Devs = new List<string>(), Mods = new List<string>();
  86.  
  87. internal static readonly List<string> opstats = new List<string>(new [] { "ban", "tempban", "kick", "warn", "mute", "freeze", "undo", "kickban", "demote", "promote" });
  88. public static List<string> Opstats { get { return new List<string>(opstats); } }
  89.  
  90. public static List<TempBan> tempBans = new List<TempBan>();
  91. public struct TempBan { public string name, reason; public DateTime expiryTime; }
  92.  
  93. public static PerformanceCounter PCCounter = null;
  94. public static PerformanceCounter ProcessCounter = null;
  95.  
  96. public static Level mainLevel;
  97. [Obsolete("Use LevelInfo.Loaded.Items")]
  98. public static List<Level> levels;
  99. //reviewlist intitialize
  100. public static List<string> reviewlist = new List<string>();
  101. public static List<string> ircafkset = new List<string>();
  102. public static List<string> messages = new List<string>();
  103.  
  104. public static string IP;
  105.  
  106. //Global VoteKick In Progress Flag
  107. public static bool voteKickInProgress = false;
  108. public static int voteKickVotesNeeded = 0;
  109.  
  110. // Extra storage for custom commands
  111. public ExtrasCollection Extras = new ExtrasCollection();
  112.  
  113. // Games
  114. public static ZombieGame zombie;
  115.  
  116. public static int YesVotes = 0, NoVotes = 0;
  117. public static bool voting = false, votingforlevel = false;
  118.  
  119. public static LavaSurvival lava;
  120. public static CountdownGame Countdown;
  121.  
  122. public static Scheduler MainScheduler, Background;
  123. public static Server s;
  124.  
  125. public const byte version = 7;
  126. public static string salt = "";
  127. public static bool chatmod = false, flipHead = false;
  128.  
  129. public static bool shuttingDown = false, restarting = false, abortShutdown = false;
  130.  
  131. #region Settings
  132.  
  133. [ConfigBool("enable-http-api", "Server", null, false)]
  134. public static bool EnableHttpApi = false;
  135. [ConfigInt("position-interval", "Server", null, 100, 20, 2000)]
  136. public static int PositionInterval = 100;
  137. [ConfigBool("classicube-account-plus", "Server", null, true)]
  138. public static bool ClassicubeAccountPlus = true;
  139. [ConfigBool("bufferblocks", "Other", null, false)]
  140. public static bool bufferblocks = true;
  141.  
  142. //auto updater stuff
  143. [ConfigBool("auto-update", "Update", null, false)]
  144. public static bool autoupdate;
  145. public static bool autonotify;
  146. [ConfigBool("in-game-update-notify", "Server", null, false)]
  147. public static bool notifyPlayers;
  148. [ConfigInt("update-countdown", "Update", null, 10)]
  149. public static int restartcountdown = 10;
  150. [ConfigBool("auto-restart", "Server", null, false)]
  151. public static bool autorestart;
  152. [ConfigDateTime("restarttime", "Server", null)]
  153. public static DateTime restarttime;
  154.  
  155. [ConfigBool("log-notes", "Other", null, true)]
  156. public static bool LogNotes = true;
  157. [ConfigBool("allow-tp-to-higher-ranks", "Other", null, true)]
  158. public static bool higherranktp = true;
  159. [ConfigBool("agree-to-rules-on-entry", "Other", null, false)]
  160. public static bool agreetorulesonentry = false;
  161.  
  162. [ConfigPerm("os-perbuild-default", "other", null, LevelPermission.Nobody)]
  163. public static LevelPermission osPerbuildDefault = LevelPermission.Nobody;
  164. [ConfigBool("tablist-rank-sorted", "Tablist", null, true)]
  165. public static bool TablistRankSorted = true;
  166. [ConfigBool("tablist-global", "Tablist", null, false)]
  167. public static bool TablistGlobal = false;
  168. [ConfigBool("tablist-bots", "Tablist", null, false)]
  169. public static bool TablistBots = false;
  170.  
  171. [ConfigString("server-name", "General", null,
  172. "[MCGalaxy] Default", false, "![]&:.,{}~-+()?_/\\' ")]
  173. public static string name = "[MCGalaxy] Default";
  174. [ConfigString("motd", "General", null, "Welcome",
  175. false, "=![]&:.,{}~-+()?_/\\' ")]
  176. public static string motd = "Welcome!";
  177. [ConfigInt("max-players", "Server", null, 12, 1, 128)]
  178. public static int players = 12;
  179. [ConfigInt("max-guests", "Server", null, 10, 1, 128)]
  180. public static int maxGuests = 10;
  181.  
  182. [ConfigInt("port", "Server", null, 25565, 0, 65535)]
  183. public static int port = 25565;
  184. [ConfigBool("public", "Server", null, true)]
  185. public static bool pub = true;
  186. [ConfigBool("verify-names", "Server", null, true)]
  187. public static bool verify = true;
  188. [ConfigBool("world-chat", "Server", null, true)]
  189. public static bool worldChat = true;
  190.  
  191. //Spam Prevention
  192. [ConfigBool("mute-on-spam", "Spam control", null, false)]
  193. public static bool checkspam = false;
  194. [ConfigInt("spam-messages", "Spam control", null, 8)]
  195. public static int spamcounter = 8;
  196. [ConfigInt("spam-mute-time", "Spam control", null, 60)]
  197. public static int mutespamtime = 60;
  198. [ConfigInt("spam-counter-reset-time", "Spam control", null, 5)]
  199. public static int spamcountreset = 5;
  200. [ConfigString("host-state", "Other", null, "Alive")]
  201. public static string ZallState = "Alive";
  202.  
  203. [ConfigString("main-name", "General", null, "main", false, "._+")]
  204. public static string level = "main";
  205. [ConfigString("xjail-map-name", "Other", null, "(main)", false, "()._+")]
  206. public static string xjailLevel = "(main)";
  207. public static string errlog = "error.log";
  208.  
  209. [ConfigBool("report-back", "Error handling", null, true)]
  210. public static bool reportBack = true;
  211.  
  212. [ConfigBool("irc", "IRC bot", null, false)]
  213. public static bool irc = false;
  214. [ConfigBool("irc-player-titles", "IRC bot", null, true)]
  215. public static bool ircPlayerTitles = true;
  216. [ConfigBool("irc-show-world-changes", "IRC bot", null, true)]
  217. public static bool ircShowWorldChanges = true;
  218. [ConfigBool("irc-colorsenable", "IRC bot", null, true)]
  219. public static bool ircColorsEnable = true;
  220. [ConfigInt("irc-port", "IRC bot", null, 6667, 0, 65535)]
  221. public static int ircPort = 6667;
  222. [ConfigString("irc-nick", "IRC bot", null, "ForgeBot")]
  223. public static string ircNick = "ForgeBot";
  224. [ConfigString("irc-server", "IRC bot", null, "irc.esper.net")]
  225. public static string ircServer = "irc.esper.net";
  226. [ConfigString("irc-channel", "IRC bot", null, "#changethis", true)]
  227. public static string ircChannel = "#changethis";
  228. [ConfigString("irc-opchannel", "IRC bot", null, "#changethistoo", true)]
  229. public static string ircOpChannel = "#changethistoo";
  230. [ConfigBool("irc-identify", "IRC bot", null, false)]
  231. public static bool ircIdentify = false;
  232. [ConfigString("irc-password", "IRC bot", null, "", true)]
  233. public static string ircPassword = "";
  234. [ConfigEnum("irc-controller-verify", "IRC bot", null, IRCControllerVerify.HalfOp, typeof(IRCControllerVerify))]
  235. public static IRCControllerVerify IRCVerify = IRCControllerVerify.HalfOp;
  236. [ConfigPerm("irc-controller-rank", "IRC bot", null, LevelPermission.Nobody)]
  237. public static LevelPermission ircControllerRank = LevelPermission.Nobody;
  238.  
  239. [ConfigBool("admin-verification", "Admin", null, true)]
  240. public static bool verifyadmins = true;
  241. [ConfigPerm("verify-admin-perm", "Admin", null, LevelPermission.Operator)]
  242. public static LevelPermission verifyadminsrank = LevelPermission.Operator;
  243.  
  244. [ConfigBool("restart-on-error", "Error handling", null, true)]
  245. public static bool restartOnError = true;
  246. [ConfigInt("rplimit", "Other", null, 500, 0, 50000)]
  247. public static int rpLimit = 500;
  248. [ConfigInt("rplimit-norm", "Other", null, 10000, 0, 50000)]
  249. public static int rpNormLimit = 10000;
  250.  
  251. [ConfigInt("backup-time", "Backup", null, 300, 1)]
  252. public static int backupInterval = 300;
  253. public static int blockInterval = 60;
  254. [ConfigString("backup-location", "Backup", null, "")]
  255. public static string backupLocation = Application.StartupPath + "/levels/backups";
  256. [ConfigStringList("disabledstandardtokens", "Other", null)]
  257. internal static List<string> disabledChatTokens = new List<string>();
  258.  
  259. [ConfigBool("physicsrestart", "Other", null, true)]
  260. public static bool physicsRestart = true;
  261. [ConfigBool("deathcount", "Other", null, true)]
  262. public static bool deathcount = true;
  263. [ConfigBool("autoload", "Server", null, true)]
  264. public static bool AutoLoad = true;
  265. [ConfigInt("physics-undo-max", "Other", null, 20000)]
  266. public static int physUndo = 20000;
  267. [ConfigInt("total-undo", "Other", null, 200)]
  268. public static int totalUndo = 200;
  269. [ConfigBool("parse-emotes", "Other", null, true)]
  270. public static bool parseSmiley = true;
  271. [ConfigBool("use-whitelist", "Other", null, false)]
  272. public static bool useWhitelist = false;
  273. [ConfigBool("force-cuboid", "Other", null, false)]
  274. public static bool forceCuboid = false;
  275. [ConfigBool("profanity-filter", "Other", null, false)]
  276. public static bool profanityFilter = false;
  277. [ConfigBool("repeat-messages", "Other", null, false)]
  278. public static bool repeatMessage = false;
  279.  
  280. [ConfigBool("check-updates", "Update", null, false)]
  281. public static bool checkUpdates = true;
  282.  
  283. [ConfigBool("UseMySQL", "Database", null, false)]
  284. public static bool useMySQL = false;
  285. [ConfigString("host", "Database", null, "127.0.0.1")]
  286. public static string MySQLHost = "127.0.0.1";
  287. [ConfigString("SQLPort", "Database", null, "3306")]
  288. public static string MySQLPort = "3306";
  289. [ConfigString("Username", "Database", null, "root", true)]
  290. public static string MySQLUsername = "root";
  291. [ConfigString("Password", "Database", null, "password", true)]
  292. public static string MySQLPassword = "password";
  293. [ConfigString("DatabaseName", "Database", null, "MCZallDB")]
  294. public static string MySQLDatabaseName = "MCZallDB";
  295. [ConfigBool("Pooling", "Database", null, true)]
  296. public static bool DatabasePooling = true;
  297.  
  298. [ConfigColor("defaultColor", "Colors", null, "&e")]
  299. public static string DefaultColor = "&e";
  300. [ConfigColor("irc-color", "Colors", null, "&5")]
  301. public static string IRCColour = "&5";
  302. [ConfigColor("global-chat-color", "Colors", null, "&6")]
  303. public static string GlobalChatColor = "&6";
  304. [ConfigColor("help-syntax-color", "Colors", null, "&a")]
  305. public static string HelpSyntaxColor = "&a";
  306. [ConfigColor("help-desc-color", "Colors", null, "&e")]
  307. public static string HelpDescriptionColor = "&e";
  308.  
  309. [ConfigBool("global-chat-enabled", "Other", null, true)]
  310. public static bool UseGlobalChat = true;
  311. [ConfigInt("afk-minutes", "Other", null, 10)]
  312. public static int afkminutes = 10;
  313. [ConfigInt("afk-kick", "Other", null, 45)]
  314. public static int afkkick = 45;
  315. [ConfigPerm("afk-kick-perm", "Other", null, LevelPermission.AdvBuilder)]
  316. public static LevelPermission afkkickperm = LevelPermission.AdvBuilder;
  317. [ConfigString("default-rank", "General", null, "guest")]
  318. public static string defaultRank = "guest";
  319.  
  320. [ConfigBool("dollar-before-dollar", "Other", null, true)]
  321. public static bool dollarNames = true;
  322. public static bool unsafe_plugin = true;
  323. [ConfigBool("cheapmessage", "Other", null, true)]
  324. public static bool cheapMessage = true;
  325.  
  326. [ConfigString("cheap-message-given", "Messages", null, " is now being cheap and being immortal")]
  327. public static string cheapMessageGiven = " is now being cheap and being immortal";
  328. [ConfigString("custom-ban-message", "Messages", null, "You're banned!")]
  329. public static string defaultBanMessage = "You're banned!";
  330. [ConfigString("custom-shutdown-message", "Messages", null, "Server shutdown. Rejoin in 10 seconds.")]
  331. public static string shutdownMessage = "Server shutdown. Rejoin in 10 seconds.";
  332. [ConfigString("custom-promote-message", "Messages", null, "&6Congratulations for working hard and getting &2PROMOTED!")]
  333. public static string defaultPromoteMessage = "&6Congratulations for working hard and getting &2PROMOTED!";
  334. [ConfigString("custom-demote-message", "Messages", null, "&4DEMOTED! &6We're sorry for your loss. Good luck on your future endeavors! &1:'(")]
  335. public static string defaultDemoteMessage = "&4DEMOTED! &6We're sorry for your loss. Good luck on your future endeavors! &1:'(";
  336.  
  337. [ConfigString("money-name", "Other", null, "moneys")]
  338. public static string moneys = "moneys";
  339. public static LevelPermission opchatperm = LevelPermission.Operator;
  340. public static LevelPermission adminchatperm = LevelPermission.Admin;
  341.  
  342. [ConfigBool("log-heartbeat", "Other", null, false)]
  343. public static bool logbeat = false;
  344. [ConfigBool("admins-join-silent", "Other", null, false)]
  345. public static bool adminsjoinsilent = false;
  346. public static bool mono { get { return (Type.GetType("Mono.Runtime") != null); } }
  347. [ConfigString("server-owner", "Other", null, "Notch")]
  348. public static string server_owner = "Notch";
  349.  
  350. [ConfigBool("guest-limit-notify", "Other", null, false)]
  351. public static bool guestLimitNotify = false;
  352. [ConfigBool("guest-join-notify", "Other", null, true)]
  353. public static bool guestJoinNotify = true;
  354. [ConfigBool("guest-leave-notify", "Other", null, true)]
  355. public static bool guestLeaveNotify = true;
  356. [ConfigString("default-texture-url", "General", null, "", true)]
  357. public static string defaultTerrainUrl = "";
  358. [ConfigString("default-texture-pack-url", "General", null, "", true)]
  359. public static string defaultTextureUrl = "";
  360.  
  361. //hackrank stuff
  362. [ConfigBool("kick-on-hackrank", "Other", null, true)]
  363. public static bool hackrank_kick = true;
  364. [ConfigInt("hackrank-kick-time", "Other", null, 5)]
  365. public static int hackrank_kick_time = 5; //seconds, it converts it to milliseconds in the command.
  366. [ConfigBool("show-empty-ranks", "Other", null, false)]
  367. public static bool showEmptyRanks = false;
  368.  
  369. [ConfigInt("review-cooldown", "Review", null, 600)]
  370. public static int reviewcooldown = 600;
  371.  
  372. [ConfigInt("draw-reload-limit", "Other", null, 10000)]
  373. public static int DrawReloadLimit = 10000;
  374. [ConfigInt("map-gen-limit-admin", "Other", null, 225 * 1000 * 1000)]
  375. public static int MapGenLimitAdmin = 225 * 1000 * 1000;
  376. [ConfigInt("map-gen-limit", "Other", null, 30 * 1000 * 1000)]
  377. public static int MapGenLimit = 30 * 1000 * 1000;
  378. #endregion
  379. }
  380. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement