From 714a49c5034eb58de4ca0838239feace082b9647 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 26 Jun 2016 18:27:21 +1000 Subject: [PATCH] Code cleanup. --- Commands/Fun/CmdGun.cs | 2 +- Commands/Fun/CmdLavaSurvival.cs | 12 ++++++------ Commands/Fun/CmdMissile.cs | 2 +- Commands/Fun/CmdTntWars.cs | 12 ++++++------ Commands/Fun/CmdZombieSpawn.cs | 2 +- Commands/Fun/WeaponCmd.cs | 4 ++-- Commands/Information/CmdAbout.cs | 7 +++---- Commands/Information/CmdMeasure.cs | 10 +++++----- Commands/Moderation/CmdRestoreSelection.cs | 10 +++++----- Commands/Moderation/CmdUndoArea.cs | 8 ++++---- Commands/Moderation/CmdZone.cs | 4 ++-- Commands/building/CmdCenter.cs | 8 ++++---- Commands/building/CmdCopy.cs | 10 +++++----- Commands/building/CmdCuboid.cs | 4 ++-- Commands/building/CmdDraw.cs | 6 +++--- Commands/building/CmdDrill.cs | 2 +- Commands/building/CmdFill.cs | 6 +++--- Commands/building/CmdHollow.cs | 10 +++++----- Commands/building/CmdImageprint.cs | 8 ++++---- Commands/building/CmdLine.cs | 4 ++-- Commands/building/CmdMaze.cs | 10 +++++----- Commands/building/CmdMessageBlock.cs | 6 +++--- Commands/building/CmdOutline.cs | 10 +++++----- Commands/building/CmdPaste.cs | 6 +++--- Commands/building/CmdPyramid.cs | 4 ++-- Commands/building/CmdRainbow.cs | 10 +++++----- Commands/building/CmdReplaceBrush.cs | 10 +++++----- Commands/building/CmdRestartPhysics.cs | 10 +++++----- Commands/building/CmdSPlace.cs | 10 +++++----- Commands/building/CmdSphere.cs | 4 ++-- Commands/building/CmdSpheroid.cs | 4 ++-- Commands/building/CmdTorus.cs | 4 ++-- Commands/building/CmdTree.cs | 6 +++--- Commands/building/CmdTriangle.cs | 8 ++++---- Commands/building/CmdWrite.cs | 10 +++++----- Commands/building/DrawCmd.cs | 8 ++++---- Commands/building/ReplaceCmd.cs | 10 +++++----- Commands/other/CmdC4.cs | 6 +++--- Commands/other/cmdCTFADSFD.cs | 2 +- Server/Extra/Checktimer.cs | 9 +++++---- Starter.csproj | 1 + 41 files changed, 140 insertions(+), 139 deletions(-) diff --git a/Commands/Fun/CmdGun.cs b/Commands/Fun/CmdGun.cs index 491834492..5e569dda9 100644 --- a/Commands/Fun/CmdGun.cs +++ b/Commands/Fun/CmdGun.cs @@ -27,7 +27,7 @@ namespace MCGalaxy.Commands { public override string shortcut { get { return ""; } } protected override string Weapon { get { return "Gun"; } } - protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { p.RevertBlock(x, y, z); if (!Block.canPlace(p, type)) { Player.Message(p, "You cannot place this block."); return; } diff --git a/Commands/Fun/CmdLavaSurvival.cs b/Commands/Fun/CmdLavaSurvival.cs index 820eff2a2..9eb773205 100644 --- a/Commands/Fun/CmdLavaSurvival.cs +++ b/Commands/Fun/CmdLavaSurvival.cs @@ -157,7 +157,7 @@ namespace MCGalaxy.Commands cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; return; } if (s[2] == "layer") @@ -167,7 +167,7 @@ namespace MCGalaxy.Commands cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; return; } @@ -181,7 +181,7 @@ namespace MCGalaxy.Commands cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; return; } if (s[1] == "settings") @@ -364,7 +364,7 @@ namespace MCGalaxy.Commands } } - public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -373,7 +373,7 @@ namespace MCGalaxy.Commands { cpos.x = x; cpos.y = y; cpos.z = z; p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; return; } @@ -385,7 +385,7 @@ namespace MCGalaxy.Commands Player.Message(p, "Position set! &b({0}, {1}, {2})", x, y, z); } - public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; diff --git a/Commands/Fun/CmdMissile.cs b/Commands/Fun/CmdMissile.cs index 9afee5313..61316c6ca 100644 --- a/Commands/Fun/CmdMissile.cs +++ b/Commands/Fun/CmdMissile.cs @@ -28,7 +28,7 @@ namespace MCGalaxy.Commands { public override string shortcut { get { return ""; } } protected override string Weapon { get { return "Missile"; } } - protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { if (!p.staticCommands) { p.ClearBlockchange(); p.aiming = false; diff --git a/Commands/Fun/CmdTntWars.cs b/Commands/Fun/CmdTntWars.cs index 499c1e769..002e8a0c0 100644 --- a/Commands/Fun/CmdTntWars.cs +++ b/Commands/Fun/CmdTntWars.cs @@ -980,7 +980,7 @@ namespace MCGalaxy.Commands { CheckZone = false; Player.Message(p, "TNT Wars: Place 2 blocks to create the zone for {0}!", msg); //p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; break; case "delete": @@ -997,7 +997,7 @@ namespace MCGalaxy.Commands { CheckZone = false; Player.Message(p, "TNT Wars: Place a block to delete the zone for {0}!", msg); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; break; case "check": @@ -1006,7 +1006,7 @@ namespace MCGalaxy.Commands { CheckZone = true; Player.Message(p, "TNT Wars: Place a block to check for no {0}!", msg); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; break; } } @@ -1186,13 +1186,13 @@ namespace MCGalaxy.Commands { } } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; if (DeleteZone == false && CheckZone == false) { Player.Message(p, "TNT Wars: Place another block to mark the other corner of the zone!"); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; return; } @@ -1222,7 +1222,7 @@ namespace MCGalaxy.Commands { } } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; TntWarsGame.Zone Zn = new TntWarsGame.Zone(); diff --git a/Commands/Fun/CmdZombieSpawn.cs b/Commands/Fun/CmdZombieSpawn.cs index 219ae1b64..52c242b1c 100644 --- a/Commands/Fun/CmdZombieSpawn.cs +++ b/Commands/Fun/CmdZombieSpawn.cs @@ -149,7 +149,7 @@ using System.Threading; Player.Message(theP, "Place a block for center of zombie spawn."); theP.ClearBlockchange(); - theP.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + theP.Blockchange += Blockchange1; } else { diff --git a/Commands/Fun/WeaponCmd.cs b/Commands/Fun/WeaponCmd.cs index 7fd057e77..fa84e5bb8 100644 --- a/Commands/Fun/WeaponCmd.cs +++ b/Commands/Fun/WeaponCmd.cs @@ -48,7 +48,7 @@ namespace MCGalaxy.Commands { if (cpos.ending == EndType.Invalid) return; p.blockchangeObject = cpos; p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark; p.SendMessage(Weapon + " mode engaged, fire at will"); if (p.aiming) return; @@ -135,7 +135,7 @@ namespace MCGalaxy.Commands { } } - protected abstract void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType); + protected abstract void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType); protected Player GetPlayer(Player p, Vec3U16 pos, bool skipSelf) { Player[] players = PlayerInfo.Online.Items; diff --git a/Commands/Information/CmdAbout.cs b/Commands/Information/CmdAbout.cs index 7fa25f3ef..994a74e55 100644 --- a/Commands/Information/CmdAbout.cs +++ b/Commands/Information/CmdAbout.cs @@ -35,11 +35,10 @@ namespace MCGalaxy.Commands if (Player.IsSuper(p)) { MessageInGameOnly(p); return; } Player.Message(p, "Break/build a block to display information."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange); - } - + p.Blockchange += PlacedBlock; + } - void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedBlock(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { if (!p.staticCommands) p.ClearBlockchange(); byte b = p.level.GetTile(x, y, z); if (b == Block.Zero) { Player.Message(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; } diff --git a/Commands/Information/CmdMeasure.cs b/Commands/Information/CmdMeasure.cs index b0b98adc7..c849c6856 100644 --- a/Commands/Information/CmdMeasure.cs +++ b/Commands/Information/CmdMeasure.cs @@ -40,17 +40,17 @@ namespace MCGalaxy.Commands { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; ushort minX = Math.Min(cpos.x, x), maxX = Math.Max(cpos.x, x); @@ -72,7 +72,7 @@ namespace MCGalaxy.Commands { " Volume is " + (width * height * length) + " blocks." ); string name = " non-" + Block.Name(cpos.toIgnore); Player.Message(p, "There are " + foundBlocks + name + " blocks in the area."); - if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + if (p.staticCommands) p.Blockchange += PlacedMark1; } struct CatchPos { public ushort x, y, z; public byte toIgnore; } diff --git a/Commands/Moderation/CmdRestoreSelection.cs b/Commands/Moderation/CmdRestoreSelection.cs index 78136d323..ecb5a1c66 100644 --- a/Commands/Moderation/CmdRestoreSelection.cs +++ b/Commands/Moderation/CmdRestoreSelection.cs @@ -34,21 +34,21 @@ namespace MCGalaxy.Commands { if (LevelInfo.ExistsBackup(p.level.name, message)) { p.blockchangeObject = new CatchPos() { backup = message }; p.ClearBlockchange(); - p.Blockchange += Blockchange1; + p.Blockchange += PlacedMark1; p.SendMessage("Select two corners for restore."); } else { Player.Message(p, "Backup " + message + " does not exist."); } } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += Blockchange2; + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; string path = LevelInfo.BackupPath(p.level.name, cpos.backup); @@ -58,7 +58,7 @@ namespace MCGalaxy.Commands { if (!CopyBlocks(p, other, x, y, z, cpos)) return; } if (p.staticCommands) - p.Blockchange += Blockchange1; + p.Blockchange += PlacedMark1; } catch (Exception ex) { Server.ErrorLog(ex); Server.s.Log("Restore selection failed"); diff --git a/Commands/Moderation/CmdUndoArea.cs b/Commands/Moderation/CmdUndoArea.cs index ba79b5cce..ba4f69a43 100644 --- a/Commands/Moderation/CmdUndoArea.cs +++ b/Commands/Moderation/CmdUndoArea.cs @@ -40,18 +40,18 @@ namespace MCGalaxy.Commands { Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; cpos.x = x; cpos.y = y; cpos.z = z; p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; Player who = PlayerInfo.Find(cpos.message); diff --git a/Commands/Moderation/CmdZone.cs b/Commands/Moderation/CmdZone.cs index e320b87b7..d58bba834 100644 --- a/Commands/Moderation/CmdZone.cs +++ b/Commands/Moderation/CmdZone.cs @@ -102,14 +102,14 @@ namespace MCGalaxy.Commands { Player.Message(p, "Place two blocks to determine the edges."); Player.Message(p, "Zone for: &b" + cpos.Owner + "."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += Blockchange1; } void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += Blockchange2; } void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { diff --git a/Commands/building/CmdCenter.cs b/Commands/building/CmdCenter.cs index 0fa84f9b2..9a141171b 100644 --- a/Commands/building/CmdCenter.cs +++ b/Commands/building/CmdCenter.cs @@ -12,16 +12,16 @@ namespace MCGalaxy.Commands.Building { public override void Use(Player p, string message) { Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); p.blockchangeObject = new Vec3U16(x, y, z); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); Vec3U16 start = (Vec3U16)p.blockchangeObject; int xCen = (start.X + x) / 2, yCen = (start.Y + y) / 2, zCen = (start.Z + z) / 2; diff --git a/Commands/building/CmdCopy.cs b/Commands/building/CmdCopy.cs index 753095f84..02baf83e6 100644 --- a/Commands/building/CmdCopy.cs +++ b/Commands/building/CmdCopy.cs @@ -89,19 +89,19 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; p.copystart[0] = x; p.copystart[1] = y; p.copystart[2] = z; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; ushort minX = (ushort)Math.Min(x, cpos.x), maxX = (ushort)Math.Max(x, cpos.x); @@ -150,7 +150,7 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, format, state.UsedBlocks); if (cpos.allowoffset != -1) { Player.Message(p, "Place a block to determine where to paste from"); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3); + p.Blockchange += Blockchange3; } } diff --git a/Commands/building/CmdCuboid.cs b/Commands/building/CmdCuboid.cs index 36e61bd36..9414d5ce4 100644 --- a/Commands/building/CmdCuboid.cs +++ b/Commands/building/CmdCuboid.cs @@ -30,7 +30,7 @@ namespace MCGalaxy.Commands.Building { new CommandAlias("box"), new CommandAlias("hbox", null, "hollow") }; } } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -63,7 +63,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected override DrawMode ParseMode(string msg) { diff --git a/Commands/building/CmdDraw.cs b/Commands/building/CmdDraw.cs index 34f551672..633cc0ebb 100644 --- a/Commands/building/CmdDraw.cs +++ b/Commands/building/CmdDraw.cs @@ -41,7 +41,7 @@ namespace MCGalaxy.Commands.Building { return DrawMode.normal; } - protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -93,10 +93,10 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, brush, p, marks)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { } + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { } bool CheckTwoArgs(Player p, ref ushort radius, ref ushort height, string[] parts) { if (parts.Length < 3) { Help(p); return false; } diff --git a/Commands/building/CmdDrill.cs b/Commands/building/CmdDrill.cs index 76972bc40..9ec6d5e89 100644 --- a/Commands/building/CmdDrill.cs +++ b/Commands/building/CmdDrill.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Destroy the block you wish to drill."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += Blockchange1; } void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { diff --git a/Commands/building/CmdFill.cs b/Commands/building/CmdFill.cs index e7a215e7b..9a2a29c1f 100644 --- a/Commands/building/CmdFill.cs +++ b/Commands/building/CmdFill.cs @@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Building { return DrawMode.normal; } - protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { p.ClearBlockchange(); CatchPos cpos = (CatchPos)p.blockchangeObject; byte oldType = p.level.GetTile(x, y, z), oldExtType = 0; @@ -72,10 +72,10 @@ namespace MCGalaxy.Commands.Building { op.Positions = null; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { } + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { } void FloodFill(Player p, ushort x, ushort y, ushort z, byte oldType, byte oldExtType, DrawMode fillType, SparseBitSet bits, List buffer, List origins, int depth) { diff --git a/Commands/building/CmdHollow.cs b/Commands/building/CmdHollow.cs index 0bfc418bb..978a30a30 100644 --- a/Commands/building/CmdHollow.cs +++ b/Commands/building/CmdHollow.cs @@ -39,17 +39,17 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z )) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } struct CatchPos { diff --git a/Commands/building/CmdImageprint.cs b/Commands/building/CmdImageprint.cs index bd736acd1..399965a2b 100644 --- a/Commands/building/CmdImageprint.cs +++ b/Commands/building/CmdImageprint.cs @@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine direction."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } bool DownloadWebFile(string url, Player p) { @@ -97,14 +97,14 @@ namespace MCGalaxy.Commands.Building { } } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; if (x == cpos.x && z == cpos.z) { Player.Message(p, "No direction was selected"); return; } diff --git a/Commands/building/CmdLine.cs b/Commands/building/CmdLine.cs index c9a553760..0b1e0dd73 100644 --- a/Commands/building/CmdLine.cs +++ b/Commands/building/CmdLine.cs @@ -52,7 +52,7 @@ namespace MCGalaxy.Commands.Building { return ParseMode(parts[parts.Length - 2]); } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -81,7 +81,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } public override void Help(Player p) { diff --git a/Commands/building/CmdMaze.cs b/Commands/building/CmdMaze.cs index c02053ab6..7d1e54218 100644 --- a/Commands/building/CmdMaze.cs +++ b/Commands/building/CmdMaze.cs @@ -35,18 +35,18 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; cpos.x = x; cpos.y = y; cpos.z = z; p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; MazeDrawOp drawOp = new MazeDrawOp(); @@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, null, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } public override void Help(Player p) { diff --git a/Commands/building/CmdMessageBlock.cs b/Commands/building/CmdMessageBlock.cs index 39d6f8806..0686a68a2 100644 --- a/Commands/building/CmdMessageBlock.cs +++ b/Commands/building/CmdMessageBlock.cs @@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place where you wish the message block to go."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark; } bool CheckCommand(Player p, string message) { @@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Building { return message.CaselessEq(cmd) || message.CaselessStarts(cmd + " "); } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { p.ClearBlockchange(); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -99,7 +99,7 @@ namespace MCGalaxy.Commands.Building { } if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark; } void UpdateDatabase(Player p, CatchPos cpos, ushort x, ushort y, ushort z) { diff --git a/Commands/building/CmdOutline.cs b/Commands/building/CmdOutline.cs index 41f6340d5..f45da691d 100644 --- a/Commands/building/CmdOutline.cs +++ b/Commands/building/CmdOutline.cs @@ -40,17 +40,17 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -60,7 +60,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z )) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } struct CatchPos { public byte type, extType, newType, newExtType; public ushort x, y, z; } diff --git a/Commands/building/CmdPaste.cs b/Commands/building/CmdPaste.cs index a745abf7d..2d07679fd 100644 --- a/Commands/building/CmdPaste.cs +++ b/Commands/building/CmdPaste.cs @@ -39,10 +39,10 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place a block in the corner of where you want to paste."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedOrigin; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedOrigin(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { CatchPos cpos = (CatchPos)p.blockchangeObject; RevertAndClearState(p, x, y, z); int x1 = p.copyoffset[0] + x, y1 = p.copyoffset[1] + y, z1 = p.copyoffset[2] + z; @@ -67,7 +67,7 @@ namespace MCGalaxy.Commands.Building { Vec3S32[] marks = { new Vec3S32(x1, y1, z1) }; if (!DrawOp.DoDrawOp(op, null, p, marks)) return; - if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + if (p.staticCommands) p.Blockchange += PlacedOrigin; } struct CatchPos { public string message; } diff --git a/Commands/building/CmdPyramid.cs b/Commands/building/CmdPyramid.cs index 32e4a4b91..f0a7e1d41 100644 --- a/Commands/building/CmdPyramid.cs +++ b/Commands/building/CmdPyramid.cs @@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building { public override string name { get { return "pyramid"; } } public override string shortcut { get { return "pd"; } } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -52,7 +52,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected override DrawMode ParseMode(string msg) { diff --git a/Commands/building/CmdRainbow.cs b/Commands/building/CmdRainbow.cs index 3b94e50b6..6c96225fa 100644 --- a/Commands/building/CmdRainbow.cs +++ b/Commands/building/CmdRainbow.cs @@ -32,17 +32,17 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -50,7 +50,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z )) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } struct CatchPos { public ushort x, y, z; } diff --git a/Commands/building/CmdReplaceBrush.cs b/Commands/building/CmdReplaceBrush.cs index c4dfae7a7..b4234a67e 100644 --- a/Commands/building/CmdReplaceBrush.cs +++ b/Commands/building/CmdReplaceBrush.cs @@ -42,18 +42,18 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; type = type < 128 ? p.bindings[type] : type; @@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected virtual bool ReplaceNot { get { return false; } } diff --git a/Commands/building/CmdRestartPhysics.cs b/Commands/building/CmdRestartPhysics.cs index 868fa9b67..76cb835ba 100644 --- a/Commands/building/CmdRestartPhysics.cs +++ b/Commands/building/CmdRestartPhysics.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } bool ParseArgs(Player p, string message, ref CatchPos cpos) { @@ -90,14 +90,14 @@ namespace MCGalaxy.Commands.Building { return false; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; List buffer = new List(); @@ -127,7 +127,7 @@ namespace MCGalaxy.Commands.Building { p.level.AddCheck(index, true, cpos.extraInfo); Player.Message(p, "Activated " + buffer.Count + " blocks."); if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } struct CatchPos { public ushort x, y, z; public PhysicsArgs extraInfo; } diff --git a/Commands/building/CmdSPlace.cs b/Commands/building/CmdSPlace.cs index 4c1ea98b9..567523225 100644 --- a/Commands/building/CmdSPlace.cs +++ b/Commands/building/CmdSPlace.cs @@ -52,17 +52,17 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, "Place two blocks to determine direction."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; ushort distance = cpos.distance, interval = cpos.interval; @@ -97,7 +97,7 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Placed stone blocks " + interval + " apart"); else Player.Message(p, "Placed stone blocks " + distance + " apart"); - if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + if (p.staticCommands) p.Blockchange += PlacedMark1; } struct CatchPos { diff --git a/Commands/building/CmdSphere.cs b/Commands/building/CmdSphere.cs index 0f1b681c8..d62489048 100644 --- a/Commands/building/CmdSphere.cs +++ b/Commands/building/CmdSphere.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands.Building { return DrawMode.normal; } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -63,7 +63,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, brush, p, marks)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } public override void Help(Player p) { diff --git a/Commands/building/CmdSpheroid.cs b/Commands/building/CmdSpheroid.cs index ecf1420de..83927742c 100644 --- a/Commands/building/CmdSpheroid.cs +++ b/Commands/building/CmdSpheroid.cs @@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.Building { get { return new[] { new CommandAlias("eh", null, "hollow"), new CommandAlias("cylinder", null, "vertical") }; } } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -49,7 +49,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected override DrawMode ParseMode(string msg) { diff --git a/Commands/building/CmdTorus.cs b/Commands/building/CmdTorus.cs index c5bf6a83c..cd3d9f885 100644 --- a/Commands/building/CmdTorus.cs +++ b/Commands/building/CmdTorus.cs @@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Building { } protected override string PlaceMessage { get { return "Place a block for the centre, then another for the radius."; } } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -46,7 +46,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, brush, p, marks)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected override DrawMode ParseMode(string msg) { return DrawMode.normal; } diff --git a/Commands/building/CmdTree.cs b/Commands/building/CmdTree.cs index 0c15d01f0..00ed90cf0 100644 --- a/Commands/building/CmdTree.cs +++ b/Commands/building/CmdTree.cs @@ -49,11 +49,11 @@ namespace MCGalaxy.Commands.Building { cpos.brushMsg = brushMsg; p.ClearBlockchange(); p.blockchangeObject = cpos; - p.Blockchange += new Player.BlockchangeEventHandler(PlaceBlock1); + p.Blockchange += PlacedBase; Player.Message(p, "Select where you wish your tree to grow"); } - void PlaceBlock1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedBase(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; type = type < 128 ? p.bindings[type] : type; @@ -75,7 +75,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(op, brush, p, marks)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(PlaceBlock1); + p.Blockchange += PlacedBase; } static Brush ParseBrush(string brushMsg, Player p, byte type, byte extType) { diff --git a/Commands/building/CmdTriangle.cs b/Commands/building/CmdTriangle.cs index 675153516..49e8b565a 100644 --- a/Commands/building/CmdTriangle.cs +++ b/Commands/building/CmdTriangle.cs @@ -27,15 +27,15 @@ namespace MCGalaxy.Commands.Building { get { return "Place three blocks to determine the edges."; } } - protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x2 = x; bp.y2 = y; bp.z2 = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3); + p.Blockchange += PlacedMark3; } - void Blockchange3(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark3(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); @@ -47,7 +47,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(new TriangleDrawOp(), brush, p, marks)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected override DrawMode ParseMode(string msg) { diff --git a/Commands/building/CmdWrite.cs b/Commands/building/CmdWrite.cs index 75fc221f2..6fa85cc54 100644 --- a/Commands/building/CmdWrite.cs +++ b/Commands/building/CmdWrite.cs @@ -48,17 +48,17 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Place two blocks to determine direction."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { type = type < 128 ? p.bindings[type] : type; RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; @@ -73,7 +73,7 @@ namespace MCGalaxy.Commands.Building { return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } struct CatchPos { public byte scale, spacing; public ushort x, y, z; public string givenMessage; } diff --git a/Commands/building/DrawCmd.cs b/Commands/building/DrawCmd.cs index a9716f685..dc5d659de 100644 --- a/Commands/building/DrawCmd.cs +++ b/Commands/building/DrawCmd.cs @@ -36,21 +36,21 @@ namespace MCGalaxy.Commands.Building { p.blockchangeObject = cpos; Player.Message(p, PlaceMessage); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } // most draw commands use two coordinates, so implement this here to simplify implementation. - protected virtual void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + protected virtual void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } protected virtual string PlaceMessage { get { return "Place two blocks to determine the edges."; } } - protected abstract void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType); + protected abstract void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType); protected abstract DrawMode ParseMode(string mode); diff --git a/Commands/building/ReplaceCmd.cs b/Commands/building/ReplaceCmd.cs index 320b2025a..65253c4eb 100644 --- a/Commands/building/ReplaceCmd.cs +++ b/Commands/building/ReplaceCmd.cs @@ -34,18 +34,18 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Place two blocks to determine the edges."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos bp = (CatchPos)p.blockchangeObject; bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp; - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2); + p.Blockchange += PlacedMark2; } - void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; BrushArgs args = new BrushArgs(p, cpos.message, type, extType); @@ -56,7 +56,7 @@ namespace MCGalaxy.Commands.Building { if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) return; if (p.staticCommands) - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedMark1; } protected virtual bool ReplaceNot { get { return false; } } diff --git a/Commands/other/CmdC4.cs b/Commands/other/CmdC4.cs index 90d09b6a4..c99f9e737 100644 --- a/Commands/other/CmdC4.cs +++ b/Commands/other/CmdC4.cs @@ -37,13 +37,13 @@ namespace MCGalaxy.Commands p.level.C4list.Add(c4); p.c4circuitNumber = numb; Player.Message(p, "Place any block for c4 and place a &cred %Sblock for the detonator!"); - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedNext; } else { Player.Message(p, "To use c4, the physics level must be 1, 2, 3 or 4"); } } - void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { + void PlacedNext(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { p.ClearBlockchange(); if (type == Block.red) { p.ManualChange(x, y, z, 1, Block.c4det); @@ -52,7 +52,7 @@ namespace MCGalaxy.Commands } else if (type != Block.air) { p.ManualChange(x, y, z, 1, Block.c4); } - p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); + p.Blockchange += PlacedNext; } public override void Help(Player p) { diff --git a/Commands/other/cmdCTFADSFD.cs b/Commands/other/cmdCTFADSFD.cs index dfa631dbd..e6cf6b021 100644 --- a/Commands/other/cmdCTFADSFD.cs +++ b/Commands/other/cmdCTFADSFD.cs @@ -85,7 +85,7 @@ namespace MCGalaxy.Commands cpos.x = 0; cpos.y = 0; cpos.z = 0; cpos.color = color; p.blockchangeObject = cpos; Player.Message(p, "Place a block to determine where to place the flag."); p.ClearBlockchange(); - p.Blockchange += new Player.BlockchangeEventHandler(AddFlag); + p.Blockchange += AddFlag; } else if (message.Split(' ')[0].ToLower() == "reset") { diff --git a/Server/Extra/Checktimer.cs b/Server/Extra/Checktimer.cs index 087da6395..ed0d6eef1 100644 --- a/Server/Extra/Checktimer.cs +++ b/Server/Extra/Checktimer.cs @@ -14,17 +14,18 @@ permiusing MCGalaxy;ssions and limitations under the Licenses. */ using System; using System.IO; +using System.Timers; namespace MCGalaxy { public static class Checktimer { - static System.Timers.Timer t; + static Timer t; const StringComparison comp = StringComparison.OrdinalIgnoreCase; public static void StartTimer() { - t = new System.Timers.Timer(); + t = new Timer(); t.AutoReset = false; - t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed); + t.Elapsed += TimerElapsed; t.Interval = GetInterval(); t.Start(); } @@ -34,7 +35,7 @@ namespace MCGalaxy { return ((60 - now.Second) * 1000 - now.Millisecond); } - static void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { + static void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { t.Interval = GetInterval(); t.Start(); TRExpiryCheck(); // every 60 seconds diff --git a/Starter.csproj b/Starter.csproj index ce8e4d075..57b4d1340 100644 --- a/Starter.csproj +++ b/Starter.csproj @@ -141,6 +141,7 @@ +