From c4287c2fb6514a1bc8f4ed3a13a6936aa978363e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 2 Mar 2017 10:01:05 +1100 Subject: [PATCH] prefer explicit array declarations --- MCGalaxy/Blocks/Extended/MessageBlock.cs | 2 +- MCGalaxy/Bots/Instructions/FunInstructions.cs | 4 ++-- .../Bots/Instructions/HunterInstructions.cs | 9 ++++--- .../Bots/Instructions/MoveInstructions.cs | 12 ++++++---- .../Bots/Instructions/OtherInstructions.cs | 12 ++++++---- MCGalaxy/Commands/Chat/CmdEat.cs | 2 +- MCGalaxy/Commands/Chat/CmdSend.cs | 2 +- MCGalaxy/Commands/Economy/CmdAwardMod.cs | 2 +- MCGalaxy/Commands/Economy/CmdEconomy.cs | 2 +- MCGalaxy/Commands/Fun/Cmd8Ball.cs | 3 ++- MCGalaxy/Commands/Fun/CmdTntWars.cs | 2 +- MCGalaxy/Commands/World/CmdPhysics.cs | 3 ++- MCGalaxy/Database/ColumnDesc.cs | 2 +- MCGalaxy/Database/PlayerDB.cs | 2 +- MCGalaxy/Drawing/Brushes/RainbowBrush.cs | 2 +- MCGalaxy/Drawing/DrawOps/LineDrawOp.cs | 24 +++++++++---------- MCGalaxy/Drawing/Flip.cs | 6 ++--- MCGalaxy/Drawing/Image/ImagePalette.cs | 8 +++---- MCGalaxy/Economy/Economy.cs | 2 +- MCGalaxy/Games/CTF/CtfGame.cs | 2 +- MCGalaxy/Games/CTF/CtfTeam.cs | 4 ++-- MCGalaxy/Games/ZombieSurvival/ZombieGame.cs | 2 +- MCGalaxy/Levels/LevelDB.cs | 8 +++---- MCGalaxy/Network/Heart.cs | 2 +- MCGalaxy/Network/IRCBot.cs | 2 +- MCGalaxy/Server/Server.DB.cs | 4 ++-- MCGalaxy/sharkbite.thresher/Listener.cs | 2 +- MCGalaxy/util/Extensions/Extensions.cs | 2 +- 28 files changed, 71 insertions(+), 58 deletions(-) diff --git a/MCGalaxy/Blocks/Extended/MessageBlock.cs b/MCGalaxy/Blocks/Extended/MessageBlock.cs index 82e4ecc03..c49c6cce3 100644 --- a/MCGalaxy/Blocks/Extended/MessageBlock.cs +++ b/MCGalaxy/Blocks/Extended/MessageBlock.cs @@ -57,7 +57,7 @@ namespace MCGalaxy.Blocks.Extended { } } - static string[] sep = { " |/" }; + static string[] sep = new string[] { " |/" }; const StringSplitOptions opts = StringSplitOptions.RemoveEmptyEntries; static List empty = new List(); internal static List GetParts(string message, out string text) { diff --git a/MCGalaxy/Bots/Instructions/FunInstructions.cs b/MCGalaxy/Bots/Instructions/FunInstructions.cs index 4028e44a1..b25e5a9d7 100644 --- a/MCGalaxy/Bots/Instructions/FunInstructions.cs +++ b/MCGalaxy/Bots/Instructions/FunInstructions.cs @@ -56,7 +56,7 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] spin ", + static string[] help = new string[] { "%T/botai add [name] spin ", "%HCauses the bot to spin around for a period of time.", "%H is in tenths of a second, so an interval of 20 means " + "spin for two seconds. (defaults to 1 second)", @@ -95,7 +95,7 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] nod ", + static string[] help = new string[] { "%T/botai add [name] nod ", "%HCauses the bot to nod up and down for a period of time.", "%H is in tenths of a second, so an interval of 20 means " + "nod for two seconds. (defaults to 1 second)", diff --git a/MCGalaxy/Bots/Instructions/HunterInstructions.cs b/MCGalaxy/Bots/Instructions/HunterInstructions.cs index cab366734..ce0611913 100644 --- a/MCGalaxy/Bots/Instructions/HunterInstructions.cs +++ b/MCGalaxy/Bots/Instructions/HunterInstructions.cs @@ -88,7 +88,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] hunt ", + static string[] help = new string[] { + "%T/botai add [name] hunt ", "%HCauses the bot to move towards the closest player in the search radius.", "%H defaults to 75 blocks.", }; @@ -113,7 +114,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] kill", + static string[] help = new string[] { + "%T/botai add [name] kill", "%HCauses the bot to kill any players it is touching.", }; } @@ -167,7 +169,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] stare ", + static string[] help = new string[] { + "%T/botai add [name] stare ", "%HCauses the bot to stare at the closest player in the search radius.", "%H defaults to 20000 blocks.", }; diff --git a/MCGalaxy/Bots/Instructions/MoveInstructions.cs b/MCGalaxy/Bots/Instructions/MoveInstructions.cs index 28fad8dc0..c4c88aa77 100644 --- a/MCGalaxy/Bots/Instructions/MoveInstructions.cs +++ b/MCGalaxy/Bots/Instructions/MoveInstructions.cs @@ -55,7 +55,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] teleport", + static string[] help = new string[] { + "%T/botai add [name] teleport", "%HCauses the bot to instantly teleport to a position.", "%H Note: The position saved to the AI is your current position.", }; @@ -82,7 +83,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] walk", + static string[] help = new string[] { + "%T/botai add [name] walk", "%HCauses the bot to walk towards to a position.", "%H Note: The position saved to the AI is your current position.", }; @@ -98,7 +100,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] jump", + static string[] help = new string[] { + "%T/botai add [name] jump", "%HCauses the bot to perform a jump.", "%H Note bots can also do other instructions while jumping", "%H (e.g. For a \"jump\" then a \"walk\" instruction, the bot will jump while also walking", @@ -127,7 +130,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] speed [percentage]", + static string[] help = new string[] { + "%T/botai add [name] speed [percentage]", "%HSets how fast the bot moves, relative to its normal speed.", "%H 100 means it moves at normal speed", "%H 50 means it moves at half speed", diff --git a/MCGalaxy/Bots/Instructions/OtherInstructions.cs b/MCGalaxy/Bots/Instructions/OtherInstructions.cs index 00937c241..b3100d792 100644 --- a/MCGalaxy/Bots/Instructions/OtherInstructions.cs +++ b/MCGalaxy/Bots/Instructions/OtherInstructions.cs @@ -29,7 +29,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] reset", + static string[] help = new string[] { + "%T/botai add [name] reset", "%HCauses the bot to go back to the first instruction", }; } @@ -43,7 +44,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] remove", + static string[] help = new string[] { + "%T/botai add [name] remove", "%HCauses the bot to be removed from the world", }; } @@ -77,7 +79,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] linkscript [ai name]", + static string[] help = new string[] { + "%T/botai add [name] linkscript [ai name]", "%HCauses the bot to switch to the given AI, and execute that AI's instructions instead.", }; } @@ -109,7 +112,8 @@ namespace MCGalaxy.Bots { } public override string[] Help { get { return help; } } - static string[] help = { "%T/botai add [name] wait ", + static string[] help = new string[] { + "%T/botai add [name] wait ", "%HCauses the bot to stay still for a period of time.", "%H is in tenths of a second, so an interval of 20 means " + "stay still for two seconds. (defaults to 1 second)", diff --git a/MCGalaxy/Commands/Chat/CmdEat.cs b/MCGalaxy/Commands/Chat/CmdEat.cs index efa38b1bf..c08036345 100644 --- a/MCGalaxy/Commands/Chat/CmdEat.cs +++ b/MCGalaxy/Commands/Chat/CmdEat.cs @@ -51,7 +51,7 @@ namespace MCGalaxy.Commands { p.SetMoney(p.money - 1); } - static string[] defMessages = { "guzzled a grape", "chewed a cherry", "ate an avocado" }; + static string[] defMessages = new string[] { "guzzled a grape", "chewed a cherry", "ate an avocado" }; public override void Help(Player p) { Player.Message(p, "%T/eat %H- Eats a random snack."); diff --git a/MCGalaxy/Commands/Chat/CmdSend.cs b/MCGalaxy/Commands/Chat/CmdSend.cs index f28f420ab..4b4efbb3e 100644 --- a/MCGalaxy/Commands/Chat/CmdSend.cs +++ b/MCGalaxy/Commands/Chat/CmdSend.cs @@ -62,7 +62,7 @@ namespace MCGalaxy.Commands { } } - static ColumnDesc[] createInbox = { + static ColumnDesc[] createInbox = new ColumnDesc[] { new ColumnDesc("PlayerFrom", ColumnType.Char, 20), new ColumnDesc("TimeSent", ColumnType.DateTime), new ColumnDesc("Contents", ColumnType.VarChar, 255), diff --git a/MCGalaxy/Commands/Economy/CmdAwardMod.cs b/MCGalaxy/Commands/Economy/CmdAwardMod.cs index 7dce6bd4a..7067234df 100644 --- a/MCGalaxy/Commands/Economy/CmdAwardMod.cs +++ b/MCGalaxy/Commands/Economy/CmdAwardMod.cs @@ -23,7 +23,7 @@ namespace MCGalaxy.Commands { public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } public CmdAwardMod() { } - static char[] awardArgs = { ':' }; + static char[] awardArgs = new char[] { ':' }; public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } diff --git a/MCGalaxy/Commands/Economy/CmdEconomy.cs b/MCGalaxy/Commands/Economy/CmdEconomy.cs index 1b4c6ce47..8b95b7687 100644 --- a/MCGalaxy/Commands/Economy/CmdEconomy.cs +++ b/MCGalaxy/Commands/Economy/CmdEconomy.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands { public override void Use(Player p, string message) { string[] raw = message.Split(' '); - string[] args = { "", "", "", "", "", "", "", "" }; + string[] args = new string[] { "", "", "", "", "", "", "", "" }; for (int i = 0; i < Math.Min(args.Length, raw.Length); i++) args[i] = raw[i]; HandleSetup(p, args); diff --git a/MCGalaxy/Commands/Fun/Cmd8Ball.cs b/MCGalaxy/Commands/Fun/Cmd8Ball.cs index 70977c85c..e74be4128 100644 --- a/MCGalaxy/Commands/Fun/Cmd8Ball.cs +++ b/MCGalaxy/Commands/Fun/Cmd8Ball.cs @@ -27,7 +27,8 @@ namespace MCGalaxy.Commands { public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public Cmd8Ball() { } - static string[] messages = { "Not likely." , "Very likely." , "Impossible!" , "No." , "Yes." , "Definitely!" , "Do some more thinking." }; + static string[] messages = new string[] { "Not likely." , "Very likely." , "Impossible!" , + "No." , "Yes." , "Definitely!" , "Do some more thinking." }; DateTime nextUse; static TimeSpan delay = TimeSpan.FromSeconds(2); diff --git a/MCGalaxy/Commands/Fun/CmdTntWars.cs b/MCGalaxy/Commands/Fun/CmdTntWars.cs index f9e409191..113f671dd 100644 --- a/MCGalaxy/Commands/Fun/CmdTntWars.cs +++ b/MCGalaxy/Commands/Fun/CmdTntWars.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands { bool DeleteZone = false, CheckZone = false, NoTntZone = false; public override void Use(Player p, string message) { - string[] text = { "", "", "", "", "" }; + string[] text = new string[] { "", "", "", "", "" }; string[] parts = message.ToLower().Split(' '); for (int i = 0; i < Math.Min(text.Length, parts.Length); i++) text[i] = parts[i]; diff --git a/MCGalaxy/Commands/World/CmdPhysics.cs b/MCGalaxy/Commands/World/CmdPhysics.cs index abe24835f..27ed59d5d 100644 --- a/MCGalaxy/Commands/World/CmdPhysics.cs +++ b/MCGalaxy/Commands/World/CmdPhysics.cs @@ -42,7 +42,8 @@ namespace MCGalaxy.Commands { SetPhysics(level, state); } - internal static string[] states = { "&cOFF", "&aNormal", "&aAdvanced", "&aHardcore", "&aInstant", "&4Doors-only" }; + internal static string[] states = new string[] { "&cOFF", "&aNormal", "&aAdvanced", + "&aHardcore", "&aInstant", "&4Doors-only" }; void ShowPhysics(Player p) { Level[] loaded = LevelInfo.Loaded.Items; diff --git a/MCGalaxy/Database/ColumnDesc.cs b/MCGalaxy/Database/ColumnDesc.cs index 1353244c4..38a216be7 100644 --- a/MCGalaxy/Database/ColumnDesc.cs +++ b/MCGalaxy/Database/ColumnDesc.cs @@ -48,7 +48,7 @@ namespace MCGalaxy.SQL { return colTypes[(int)Type]; } - static string[] colTypes = { + static string[] colTypes = new string[] { "TINYINT UNSIGNED", "SMALLINT UNSIGNED", "MEDIUMINT UNSIGNED", "INT UNSIGNED", "BIGINT UNSIGNED", "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT", "INTEGER", "BOOL", "DATETIME", "TEXT" diff --git a/MCGalaxy/Database/PlayerDB.cs b/MCGalaxy/Database/PlayerDB.cs index 53dc04b8a..cda8f35fa 100644 --- a/MCGalaxy/Database/PlayerDB.cs +++ b/MCGalaxy/Database/PlayerDB.cs @@ -19,7 +19,7 @@ namespace MCGalaxy { } - static char[] trimChars = {'='}; + static char[] trimChars = new char[] {'='}; public static bool Load( Player p ) { if (!File.Exists("players/" + p.name + "DB.txt")) return false; diff --git a/MCGalaxy/Drawing/Brushes/RainbowBrush.cs b/MCGalaxy/Drawing/Brushes/RainbowBrush.cs index 1a251bf81..7af720f0f 100644 --- a/MCGalaxy/Drawing/Brushes/RainbowBrush.cs +++ b/MCGalaxy/Drawing/Brushes/RainbowBrush.cs @@ -39,7 +39,7 @@ namespace MCGalaxy.Drawing.Brushes { public override string Name { get { return "BWRainbow"; } } - static byte[] blocks = { Block.iron, Block.white, Block.lightgrey, + static byte[] blocks = new byte[] { Block.iron, Block.white, Block.lightgrey, Block.darkgrey, Block.obsidian, Block.darkgrey, Block.lightgrey, Block.white }; public override byte NextBlock(DrawOp op) { int offset = (op.Coords.X + op.Coords.Y + op.Coords.Z) % 8; diff --git a/MCGalaxy/Drawing/DrawOps/LineDrawOp.cs b/MCGalaxy/Drawing/DrawOps/LineDrawOp.cs index f0d10bb89..8aadff5bc 100644 --- a/MCGalaxy/Drawing/DrawOps/LineDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/LineDrawOp.cs @@ -60,13 +60,13 @@ namespace MCGalaxy.Drawing.Ops { internal static void DrawLine(int x1, int y1, int z1, int maxLen, int x2, int y2, int z2, List buffer) { Line lx, ly, lz; - int[] pixel = { x1, y1, z1 }; + int[] pixel = new int[] { x1, y1, z1 }; int dx = x2 - x1, dy = y2 - y1, dz = z2 - z1; - lx.inc = Math.Sign(dx); ly.inc = Math.Sign(dy); lz.inc = Math.Sign(dz); + lx.dir = Math.Sign(dx); ly.dir = Math.Sign(dy); lz.dir = Math.Sign(dz); int xLen = Math.Abs(dx), yLen = Math.Abs(dy), zLen = Math.Abs(dz); - lx.dx2 = xLen << 1; ly.dx2 = yLen << 1; lz.dx2 = zLen << 1; - lx.index = 0; ly.index = 1; lz.index = 2; + lx.len2 = xLen << 1; ly.len2 = yLen << 1; lz.len2 = zLen << 1; + lx.axis = 0; ly.axis = 1; lz.axis = 2; if (xLen >= yLen && xLen >= zLen) DoLine(ly, lz, lx, xLen, pixel, maxLen, buffer); @@ -80,26 +80,26 @@ namespace MCGalaxy.Drawing.Ops { buffer.Add(pos); } - struct Line { public int dx2, inc, index; } + struct Line { public int len2, dir, axis; } static void DoLine(Line l1, Line l2, Line l3, int len, int[] pixel, int maxLen, List buffer) { - int err_1 = l1.dx2 - len, err_2 = l2.dx2 - len; + int err_1 = l1.len2 - len, err_2 = l2.len2 - len; Vec3S32 pos; for (int i = 0; i < len && i < (maxLen - 1); i++) { pos.X = pixel[0]; pos.Y = pixel[1]; pos.Z = pixel[2]; buffer.Add(pos); if (err_1 > 0) { - pixel[l1.index] += l1.inc; - err_1 -= l3.dx2; + pixel[l1.axis] += l1.dir; + err_1 -= l3.len2; } if (err_2 > 0) { - pixel[l2.index] += l2.inc; - err_2 -= l3.dx2; + pixel[l2.axis] += l2.dir; + err_2 -= l3.len2; } - err_1 += l1.dx2; err_2 += l2.dx2; - pixel[l3.index] += l3.inc; + err_1 += l1.len2; err_2 += l2.len2; + pixel[l3.axis] += l3.dir; } } } diff --git a/MCGalaxy/Drawing/Flip.cs b/MCGalaxy/Drawing/Flip.cs index b57f614ef..3d30c2a71 100644 --- a/MCGalaxy/Drawing/Flip.cs +++ b/MCGalaxy/Drawing/Flip.cs @@ -26,7 +26,7 @@ namespace MCGalaxy.Drawing { newState.Height = angle == 180 ? state.Height : state.Length; newState.Length = angle == 180 ? state.Length : state.Height; - int[] m = { posX, negZ, posY }; + int[] m = new int[] { posX, negZ, posY }; if (angle == 180) { m[1] = negY; m[2] = negZ; } if (angle == 270) { m[1] = posZ; m[2] = negY; } return Rotate(state, newState, m); @@ -37,7 +37,7 @@ namespace MCGalaxy.Drawing { newState.Width = angle == 180 ? state.Width : state.Length; newState.Length = angle == 180 ? state.Length : state.Width; - int[] m = { negZ, posY, posX }; + int[] m = new int[] { negZ, posY, posX }; if (angle == 180) { m[0] = negX; m[2] = negZ; } if (angle == 270) { m[0] = posZ; m[2] = negX; } return Rotate(state, newState, m); @@ -48,7 +48,7 @@ namespace MCGalaxy.Drawing { newState.Width = angle == 180 ? state.Width : state.Height; newState.Height = angle == 180 ? state.Height : state.Width; - int[] m = { posY, negX, posZ }; + int[] m = new int[] { posY, negX, posZ }; if (angle == 180) { m[0] = negX; m[1] = negY; } if (angle == 270) { m[0] = negY; m[1] = posX; } return Rotate(state, newState, m); diff --git a/MCGalaxy/Drawing/Image/ImagePalette.cs b/MCGalaxy/Drawing/Image/ImagePalette.cs index f88350423..9e0850712 100644 --- a/MCGalaxy/Drawing/Image/ImagePalette.cs +++ b/MCGalaxy/Drawing/Image/ImagePalette.cs @@ -111,7 +111,7 @@ namespace MCGalaxy.Drawing { } - static PaletteEntry[] Color = { + static PaletteEntry[] Color = new PaletteEntry[] { new PaletteEntry(128, 86, 57, Block.dirt), new PaletteEntry(162, 129, 75, Block.wood), new PaletteEntry(244, 237, 174, Block.sand), @@ -135,21 +135,21 @@ namespace MCGalaxy.Drawing { new PaletteEntry(0, 0, 0, Block.obsidian), }; - static PaletteEntry[] Grayscale = { + static PaletteEntry[] Grayscale = new PaletteEntry[] { new PaletteEntry(0, 0, 0, Block.obsidian), new PaletteEntry(46, 68, 47, Block.darkgrey), new PaletteEntry(135, 145, 130, Block.lightgrey), new PaletteEntry(230, 240, 225, Block.white), }; - static PaletteEntry[] GrayscaleSimple = { + static PaletteEntry[] GrayscaleSimple = new PaletteEntry[] { new PaletteEntry(32, 32, 32, Block.obsidian), new PaletteEntry(96, 96, 96, Block.darkgrey), new PaletteEntry(160, 160, 160, Block.lightgrey), new PaletteEntry(224, 224, 224, Block.white), }; - static PaletteEntry[] BlackWhite = { + static PaletteEntry[] BlackWhite = new PaletteEntry[] { new PaletteEntry(255, 255, 255, Block.white), new PaletteEntry(0, 0, 0, Block.obsidian), }; diff --git a/MCGalaxy/Economy/Economy.cs b/MCGalaxy/Economy/Economy.cs index 5bedca61f..af14e8a30 100644 --- a/MCGalaxy/Economy/Economy.cs +++ b/MCGalaxy/Economy/Economy.cs @@ -29,7 +29,7 @@ namespace MCGalaxy { public static bool Enabled; const string propertiesFile = "properties/economy.properties"; - static ColumnDesc[] createEconomy = { + static ColumnDesc[] createEconomy = new ColumnDesc[] { new ColumnDesc("player", ColumnType.VarChar, 20, priKey: true), new ColumnDesc("money", ColumnType.Int32), new ColumnDesc("total", ColumnType.Integer, notNull: true, def: "0"), diff --git a/MCGalaxy/Games/CTF/CtfGame.cs b/MCGalaxy/Games/CTF/CtfGame.cs index 98f1da8d1..e54f575ab 100644 --- a/MCGalaxy/Games/CTF/CtfGame.cs +++ b/MCGalaxy/Games/CTF/CtfGame.cs @@ -227,7 +227,7 @@ namespace MCGalaxy.Games { } } - static ColumnDesc[] createSyntax = { + static ColumnDesc[] createSyntax = new ColumnDesc[] { new ColumnDesc("ID", ColumnType.Integer, priKey: true, autoInc: true, notNull: true), new ColumnDesc("Name", ColumnType.VarChar, 20), new ColumnDesc("Points", ColumnType.UInt24), diff --git a/MCGalaxy/Games/CTF/CtfTeam.cs b/MCGalaxy/Games/CTF/CtfTeam.cs index cb7ec27f5..29302f99e 100644 --- a/MCGalaxy/Games/CTF/CtfTeam.cs +++ b/MCGalaxy/Games/CTF/CtfTeam.cs @@ -23,8 +23,8 @@ namespace MCGalaxy.Games { public char color; public int points = 0; - public ushort[] flagBase = { 0, 0, 0 }; - public ushort[] flagLocation = { 0, 0, 0 }; + public ushort[] flagBase = new ushort[3]; + public ushort[] flagLocation = new ushort[3]; public List spawns = new List(); public List players = new List(); public Level mapOn; diff --git a/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs b/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs index edb24298c..67acdc4be 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs @@ -250,7 +250,7 @@ namespace MCGalaxy.Games { #region Database - static ColumnDesc[] createSyntax = { + static ColumnDesc[] createSyntax = new ColumnDesc[] { new ColumnDesc("ID", ColumnType.Integer, priKey: true, autoInc: true, notNull: true), new ColumnDesc("Name", ColumnType.Char, 20), new ColumnDesc("TotalRounds", ColumnType.Int32), diff --git a/MCGalaxy/Levels/LevelDB.cs b/MCGalaxy/Levels/LevelDB.cs index e930a8e79..477b44e43 100644 --- a/MCGalaxy/Levels/LevelDB.cs +++ b/MCGalaxy/Levels/LevelDB.cs @@ -121,7 +121,7 @@ namespace MCGalaxy { } - internal static ColumnDesc[] createBlock = { + internal static ColumnDesc[] createBlock = new ColumnDesc[] { new ColumnDesc("Username", ColumnType.Char, 20), new ColumnDesc("TimePerformed", ColumnType.DateTime), new ColumnDesc("X", ColumnType.UInt16), @@ -131,7 +131,7 @@ namespace MCGalaxy { new ColumnDesc("Deleted", ColumnType.Bool), }; - internal static ColumnDesc[] createPortals = { + internal static ColumnDesc[] createPortals = new ColumnDesc[] { new ColumnDesc("EntryX", ColumnType.UInt16), new ColumnDesc("EntryY", ColumnType.UInt16), new ColumnDesc("EntryZ", ColumnType.UInt16), @@ -141,14 +141,14 @@ namespace MCGalaxy { new ColumnDesc("ExitZ", ColumnType.UInt16), }; - internal static ColumnDesc[] createMessages = { + internal static ColumnDesc[] createMessages = new ColumnDesc[] { new ColumnDesc("X", ColumnType.UInt16), new ColumnDesc("Y", ColumnType.UInt16), new ColumnDesc("Z", ColumnType.UInt16), new ColumnDesc("Message", ColumnType.Char, 255), }; - internal static ColumnDesc[] createZones = { + internal static ColumnDesc[] createZones = new ColumnDesc[] { new ColumnDesc("SmallX", ColumnType.UInt16), new ColumnDesc("SmallY", ColumnType.UInt16), new ColumnDesc("SmallZ", ColumnType.UInt16), diff --git a/MCGalaxy/Network/Heart.cs b/MCGalaxy/Network/Heart.cs index 024170156..6bb91b6eb 100644 --- a/MCGalaxy/Network/Heart.cs +++ b/MCGalaxy/Network/Heart.cs @@ -35,7 +35,7 @@ namespace MCGalaxy { static Timer timer; - readonly static IBeat[] Beats = { + readonly static IBeat[] Beats = new IBeat[] { new ClassiCubeBeat() }; //Keep these in order diff --git a/MCGalaxy/Network/IRCBot.cs b/MCGalaxy/Network/IRCBot.cs index 73e1d6991..a0ba0e021 100644 --- a/MCGalaxy/Network/IRCBot.cs +++ b/MCGalaxy/Network/IRCBot.cs @@ -37,7 +37,7 @@ namespace MCGalaxy { byte retries = 0; Dictionary> users = new Dictionary>(); - static char[] trimChars = { ' ' }; + static char[] trimChars = new char[] { ' ' }; ConnectionArgs args; DateTime lastWho, lastOpWho; diff --git a/MCGalaxy/Server/Server.DB.cs b/MCGalaxy/Server/Server.DB.cs index 6c556479d..9d4b3c75f 100644 --- a/MCGalaxy/Server/Server.DB.cs +++ b/MCGalaxy/Server/Server.DB.cs @@ -23,7 +23,7 @@ using MCGalaxy.SQL; namespace MCGalaxy { public sealed partial class Server { - static ColumnDesc[] createPlayers = { + static ColumnDesc[] createPlayers = new ColumnDesc[] { new ColumnDesc("ID", ColumnType.Integer, priKey: true, autoInc: true, notNull: true), new ColumnDesc("Name", ColumnType.Text), new ColumnDesc("IP", ColumnType.Char, 15), @@ -41,7 +41,7 @@ namespace MCGalaxy { new ColumnDesc("title_color", ColumnType.VarChar, 6), }; - static ColumnDesc[] createOpstats = { + static ColumnDesc[] createOpstats = new ColumnDesc[] { new ColumnDesc("ID", ColumnType.Integer, priKey: true, autoInc: true, notNull: true), new ColumnDesc("Time", ColumnType.DateTime), new ColumnDesc("Name", ColumnType.Text), diff --git a/MCGalaxy/sharkbite.thresher/Listener.cs b/MCGalaxy/sharkbite.thresher/Listener.cs index 459ea938e..c72037763 100644 --- a/MCGalaxy/sharkbite.thresher/Listener.cs +++ b/MCGalaxy/sharkbite.thresher/Listener.cs @@ -222,7 +222,7 @@ namespace Sharkbite.Irc private const string MODE = "MODE"; private const string KILL = "KILL"; private const string ACTION = "\u0001ACTION"; - private readonly char[] Separator = { ' ' }; + private readonly char[] Separator = new char[] { ' ' }; private readonly Regex userPattern; private readonly Regex channelPattern; private readonly Regex replyRegex; diff --git a/MCGalaxy/util/Extensions/Extensions.cs b/MCGalaxy/util/Extensions/Extensions.cs index ad203993a..ce9197e3a 100644 --- a/MCGalaxy/util/Extensions/Extensions.cs +++ b/MCGalaxy/util/Extensions/Extensions.cs @@ -27,7 +27,7 @@ namespace MCGalaxy { public static class Extensions { - static char[] trimChars = {' '}; + static char[] trimChars = new char[] {' '}; public static string[] SplitSpaces(this string value, int maxParts) { return value.Split(trimChars, maxParts); }