mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Reduce code duplication in /cmdload, use /mirror as alias for /spin mirror.
This commit is contained in:
parent
3179b7ec34
commit
408dafe1ed
@ -1,37 +1,38 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
Copyright 2011 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Drawing;
|
||||
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdSpin : Command
|
||||
{
|
||||
public sealed class CmdSpin : Command
|
||||
{
|
||||
public override string name { get { return "spin"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
public CmdSpin() { }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new [] { new CommandAlias("mirror", "mirror") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
if (message.Split(' ').Length > 1) { Help(p); return; }
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") message = "y";
|
||||
|
||||
if (p.CopyBuffer == null) {
|
||||
@ -48,12 +49,15 @@ namespace MCGalaxy.Commands
|
||||
case "upsidedown":
|
||||
case "u":
|
||||
case "mirrory":
|
||||
case "mirror y":
|
||||
FlipY(p.CopyBuffer); break;
|
||||
case "mirrorx":
|
||||
case "mirror x":
|
||||
FlipX(p.CopyBuffer); break;
|
||||
case "mirror":
|
||||
case "m":
|
||||
case "mirrorz":
|
||||
case "mirror z":
|
||||
FlipZ(p.CopyBuffer); break;
|
||||
case "z":
|
||||
p.CopyBuffer = RotateZ(p.CopyBuffer); break;
|
||||
@ -178,5 +182,5 @@ namespace MCGalaxy.Commands
|
||||
Player.Message(p, "Shortcuts: u for upside down (mirror on y), m for mirror on z");
|
||||
Player.Message(p, "x for spin 90 on x, y for spin 90 on y, z for spin 90 on z.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
|
||||
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
@ -25,49 +25,21 @@ namespace MCGalaxy.Commands
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
|
||||
if (Command.all.Contains(message.Split(' ')[0]))
|
||||
{
|
||||
Player.Message(p, "That command is already loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] param = message.Split(' ');
|
||||
string name = "Cmd" + param[0];
|
||||
|
||||
|
||||
if (param.Length == 1)
|
||||
{
|
||||
string error = Scripting.Load(name);
|
||||
if (error != null)
|
||||
{
|
||||
Player.Message(p, error);
|
||||
return;
|
||||
}
|
||||
GrpCommands.fillRanks();
|
||||
Player.Message(p, "Command was successfully loaded.");
|
||||
return;
|
||||
} else if (param[1] == "vb") {
|
||||
|
||||
string error = ScriptingVB.Load(name);
|
||||
if (error != null)
|
||||
{
|
||||
Player.Message(p, error);
|
||||
return;
|
||||
}
|
||||
GrpCommands.fillRanks();
|
||||
Player.Message(p, "Command was successfully loaded.");
|
||||
return;
|
||||
public override void Use(Player p, string message) {
|
||||
string[] args = message.Split(' ');
|
||||
if (Command.all.Contains(args[0])) {
|
||||
Player.Message(p, "That command is already loaded!"); return;
|
||||
}
|
||||
|
||||
string error = Scripting.Load("Cmd" + args[0]);
|
||||
if (error != null) { Player.Message(p, error); return; }
|
||||
GrpCommands.fillRanks();
|
||||
Player.Message(p, "Command was successfully loaded.");
|
||||
}
|
||||
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.Message(p, "/cmdload <command name> - Loads a C# command into the server for use.");
|
||||
Player.Message(p, "/cmdload <command name> vb - Loads a Visual basic command into the server for use.");
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/cmdload <command> - Loads a compiled command into the server for use.");
|
||||
Player.Message(p, "This method load both C# and Visual Basic compiled commands.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Copyright 2011 MCForge modified by headdetect
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
Loading…
x
Reference in New Issue
Block a user