prefer explicit new type[] {

This commit is contained in:
UnknownShadow200 2017-03-03 09:09:26 +11:00
parent 785255d389
commit c52b91feff
11 changed files with 42 additions and 38 deletions

View File

@ -89,7 +89,7 @@ namespace MCGalaxy {
string line;
while ((line = r.ReadLine()) != null) {
if (line.StartsWith("//")) continue;
string[] split = line.Split(new[] { ':' }, 2);
string[] split = line.Split(new[] char{ ':' }, 2);
if (split.Length == 2 && !String.IsNullOrEmpty(split[0]))
CustomTokens.Add(split[0], split[1]);
}

View File

@ -629,45 +629,45 @@ namespace MCGalaxy.Commands.CPE {
static string[][] stepsHelp = new string[][] {
null, // step 0
null, // step 1
new[] { "Type the name for the block." },
new[] { "Type '0' if the block is a cube, '1' if a sprite (e.g roses)." },
new string[] { "Type the name for the block." },
new string[] { "Type '0' if the block is a cube, '1' if a sprite (e.g roses)." },
new[] { "Type a number between '0' and '255' for the top texture.",
new string[] { "Type a number between '0' and '255' for the top texture.",
"Textures in terrain.png are numbered from left to right, increasing downwards",
},
new[] { "Type a number between '0' and '255' for the sides texture.",
new string[] { "Type a number between '0' and '255' for the sides texture.",
"Textures in terrain.png are numbered from left to right, increasing downwards.",
},
new[] { "Type a number between '0' and '255' for the bottom texture.",
new string[] { "Type a number between '0' and '255' for the bottom texture.",
"Textures in terrain.png are numbered from left to right, increasing downwards.",
},
new[] { "Enter the three minimum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
new string[] { "Enter the three minimum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
"Minimum coordinates for a normal block are &40 &20 &10." },
new[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
new string[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
"Maximum coordinates for a normal block are &416 &216 &116." },
new[] { "Type '0' if the block is walk-through.", "Type '1' if the block is swim-through.",
new string[] { "Type '0' if the block is walk-through.", "Type '1' if the block is swim-through.",
"Type '2' if the block is solid.",
},
new[] { "Type a number between '0.25' (25% speed) and '3.96' (396% speed).",
new string[] { "Type a number between '0.25' (25% speed) and '3.96' (396% speed).",
"This speed is used when inside or walking on the block. Default speed is 1",
},
new[] { "Type 'yes' if the block casts a shadow, 'no' if it doesn't" },
new[] { "Type a number between '0' and '9' for the sound played when walking on it and breaking.",
new string[] { "Type 'yes' if the block casts a shadow, 'no' if it doesn't" },
new string[] { "Type a number between '0' and '9' for the sound played when walking on it and breaking.",
"0 = None, 1 = Wood, 2 = Gravel, 3 = Grass, 4 = Stone",
"5 = Metal, 6 = Glass, 7 = Cloth, 8 = Sand, 9 = Snow",
},
new[] { "Type 'yes' if the block is fully lit (e.g. lava), 'no' if not." },
new[] { "Enter the block's draw method.", "0 = Opaque, 1 = Transparent (Like glass)",
new string[] { "Type 'yes' if the block is fully lit (e.g. lava), 'no' if not." },
new string[] { "Enter the block's draw method.", "0 = Opaque, 1 = Transparent (Like glass)",
"2 = Transparent (Like leaves), 3 = Translucent (Like ice), 4 = Gas (Like air)",
},
new[] { "Enter the fog density for the block. 0 = No fog at all",
new string[] { "Enter the fog density for the block. 0 = No fog at all",
"1 - 255 = Increasing density (e.g. water has 12, lava 255)",
},
new[] { "Enter the fog color (hex color)", },
new[] { "Enter the fallback block (Block shown to players who can't see custom blocks).",
new string[] { "Enter the fog color (hex color)", },
new string[] { "Enter the fallback block (Block shown to players who can't see custom blocks).",
"You can use any block name or block ID from the normal blocks.",
},
};

View File

@ -132,7 +132,11 @@ namespace MCGalaxy.Commands.Building {
DrawOp op = new CuboidDrawOp();
op.Flags = BlockDBFlags.Cut;
Brush brush = new SolidBrush(Block.air, 0);
Vec3S32[] marks = { new Vec3S32(minX, minY, minZ), new Vec3S32(maxX, maxY, maxZ) };
Vec3S32[] marks = new Vec3S32[] {
new Vec3S32(minX, minY, minZ),
new Vec3S32(maxX, maxY, maxZ)
};
DrawOpPerformer.Do(op, brush, p, marks, false);
}

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Building {
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("imgprint"), new CommandAlias("printimg"),
get { return new[] { new CommandAlias("imgprint"), new CommandAlias("printimg"),
new CommandAlias("imgdraw"), new CommandAlias("drawimg"),
new CommandAlias("drawimage"), new CommandAlias("printimage") }; }
}

View File

@ -22,7 +22,7 @@ namespace MCGalaxy.Eco {
public sealed class LoginMessageItem : SimpleItem {
public LoginMessageItem() {
Aliases = new[] { "login", "loginmsg", "loginmessage" };
Aliases = new string[] { "login", "loginmsg", "loginmessage" };
AllowsNoArgs = true;
}
@ -51,7 +51,7 @@ namespace MCGalaxy.Eco {
public sealed class LogoutMessageItem : SimpleItem {
public LogoutMessageItem() {
Aliases = new[] { "logout", "logoutmsg", "logoutmessage" };
Aliases = new string[] { "logout", "logoutmsg", "logoutmessage" };
AllowsNoArgs = true;
}

View File

@ -22,7 +22,7 @@ namespace MCGalaxy.Eco {
public sealed class TitleItem : SimpleItem {
public TitleItem() {
Aliases = new[] { "titles", "title" };
Aliases = new string[] { "titles", "title" };
AllowsNoArgs = true;
}
@ -51,7 +51,7 @@ namespace MCGalaxy.Eco {
public sealed class NickItem : SimpleItem {
public NickItem() {
Aliases = new[] { "nickname", "nick", "nicks", "name", "names" };
Aliases = new string[] { "nickname", "nick", "nicks", "name", "names" };
AllowsNoArgs = true;
}
@ -80,7 +80,7 @@ namespace MCGalaxy.Eco {
public sealed class TitleColorItem : SimpleItem {
public TitleColorItem() {
Aliases = new[] { "tcolor", "tcolors", "titlecolor", "titlecolors", "tc" };
Aliases = new string[] { "tcolor", "tcolors", "titlecolor", "titlecolors", "tc" };
}
public override string Name { get { return "TitleColor"; } }
@ -103,7 +103,7 @@ namespace MCGalaxy.Eco {
public sealed class ColorItem : SimpleItem {
public ColorItem() {
Aliases = new[] { "colors", "color", "colours", "colour" };
Aliases = new string[] { "colors", "color", "colours", "colour" };
}
public override string Name { get { return "Color"; } }

View File

@ -24,7 +24,7 @@ namespace MCGalaxy.Eco {
public sealed class ReviveItem : SimpleItem {
public ReviveItem() {
Aliases = new[] { "revive", "rev" };
Aliases = new string[] { "revive", "rev" };
Price = 7;
}

View File

@ -24,7 +24,7 @@ namespace MCGalaxy.Eco {
public sealed class BlocksItem : SimpleItem {
public BlocksItem() {
Aliases = new[] { "blocks", "bl", "b" };
Aliases = new string[] { "blocks", "bl", "b" };
Price = 1;
AllowsNoArgs = true;
}
@ -55,7 +55,7 @@ namespace MCGalaxy.Eco {
public sealed class QueueLevelItem : SimpleItem {
public QueueLevelItem() {
Aliases = new[] { "queuelevel", "queuelvl", "queue" };
Aliases = new string[] { "queuelevel", "queuelvl", "queue" };
Price = 150;
}
@ -83,7 +83,7 @@ namespace MCGalaxy.Eco {
public sealed class InfectMessageItem : SimpleItem {
public InfectMessageItem() {
Aliases = new[] { "infectmessage", "infectmsg" };
Aliases = new string[] { "infectmessage", "infectmsg" };
Price = 150;
}
@ -176,7 +176,7 @@ namespace MCGalaxy.Eco {
public sealed class HumanInvisibilityItem : InvisibilityItem {
public HumanInvisibilityItem() {
Aliases = new[] { "invisibility", "invisible", "invis" };
Aliases = new string[] { "invisibility", "invisible", "invis" };
Price = 3;
}
@ -189,7 +189,7 @@ namespace MCGalaxy.Eco {
public sealed class ZombieInvisibilityItem : InvisibilityItem {
public ZombieInvisibilityItem() {
Aliases = new[] { "zinvisibility", "zinvisible", "zinvis" };
Aliases = new string[] { "zinvisibility", "zinvisible", "zinvis" };
Price = 3;
}

View File

@ -60,12 +60,12 @@ namespace MCGalaxy.Generator.Foliage {
int branchMax = branchStart + rnd.Next(3, maxBranchHeight);
int R = clusterSize;
Vec3S32[] marks = new [] {
Vec3S32[] marks = new Vec3S32[] {
new Vec3S32(x + dx - R, y + branchMax - R, z + dz - R),
new Vec3S32(x + dx + R, y + branchMax + R, z + dz + R) };
DrawOp op = new EllipsoidDrawOp();
Brush brush = new RandomBrush(new [] { new ExtBlock(Block.leaf, 0) });
Brush brush = new RandomBrush(new ExtBlock[] { new ExtBlock(Block.leaf, 0) });
op.SetMarks(marks);
op.Perform(marks, brush, b => output(b.X, b.Y, b.Z, b.Block));

View File

@ -338,7 +338,7 @@ namespace MCGalaxy.Generator.Foliage {
public override void Prepare() {
base.Prepare();
branchslope = 0.382f;
foliage_shape = new [] { 2, 3, 3, 2.5f, 1.6f };
foliage_shape = new float[] { 2, 3, 3, 2.5f, 1.6f };
trunkradius = trunkradius * 0.8f;
trunkheight = TRUNKHEIGHT * trunkheight;
}
@ -372,7 +372,7 @@ namespace MCGalaxy.Generator.Foliage {
public override void Prepare() {
base.Prepare();
branchslope = 0.15f;
foliage_shape = new [] { 3, 2.6f, 2, 1 };
foliage_shape = new float[] { 3, 2.6f, 2, 1 };
trunkradius = trunkradius * 0.5f;
}
@ -395,7 +395,7 @@ namespace MCGalaxy.Generator.Foliage {
public override void Prepare() {
base.Prepare();
foliage_shape = new [] { 3.4f, 2.6f };
foliage_shape = new float[] { 3.4f, 2.6f };
branchslope = 1.0f;
trunkradius = trunkradius * 0.382f;
trunkheight = trunkheight * 0.9f;

View File

@ -164,8 +164,8 @@ namespace MCGalaxy {
if (priIndex == -1) return;
// Find the name of this column
char[] sepChars = { '\t', ' ' }; // chars that separate part of a column definition
char[] startChars = { '`', '(', ' ', ',', '\t' }; // chars that can start a column definition
char[] sepChars = new char[] { '\t', ' ' }; // chars that separate part of a column definition
char[] startChars = new char[] { '`', '(', ' ', ',', '\t' }; // chars that can start a column definition
string before = cmd.Substring(0, priIndex);
before = before.Substring(0, before.LastIndexOfAny(sepChars)); // get rid of column type
int nameStart = before.LastIndexOfAny(startChars) + 1;