Kill off pointless /chain command, raise default perm of /summon to operator

This commit is contained in:
UnknownShadow200 2017-09-21 14:57:16 +10:00
parent dab15609b3
commit f010bd3880
5 changed files with 4 additions and 105 deletions

View File

@ -60,14 +60,10 @@ namespace MCGalaxy.Commands.Fun {
DoScores(p, text); return;
case "players":
case "player":
case "ps":
case "pl":
case "p":
DoPlayers(p, text); break;
case "health":
case "heal":
case "hp":
case "hlth":
DoHealth(p, text); break;
case "setup":
case "s":

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.World {
if (message.Length > 0) { Help(p); return; }
if (!LevelInfo.ValidateAction(p, p.level.name, "set spawn of this level")) return;
Player.Message(p, "Spawn location set to your current position.");
Player.Message(p, "Spawn location set to your current location.");
p.level.spawnx = (ushort)p.Pos.BlockX;
p.level.spawny = (ushort)p.Pos.BlockY;
p.level.spawnz = (ushort)p.Pos.BlockZ;
@ -39,7 +39,7 @@ namespace MCGalaxy.Commands.World {
public override void Help(Player p) {
Player.Message(p, "%T/SetSpawn");
Player.Message(p, "%HSets the default spawn location of the map you are currently located in.");
Player.Message(p, "%HSets the spawn location of the map to your current location.");
}
}
}

View File

@ -1,96 +0,0 @@
/*
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.
*/
using System;
using System.Threading;
using MCGalaxy.Maths;
namespace MCGalaxy.Commands.Misc {
public sealed class CmdChain : Command {
public override string name { get { return "Chain"; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override bool SuperUseable { get { return false; } }
public override void Use(Player p, string message) {
if (!p.level.BuildAccess.CheckDetailed(p)) return;
Level lvl = p.level;
int x = p.Pos.BlockX, y = p.Pos.BlockY, z = p.Pos.BlockZ;
if (x < 0 || z < 0 || x >= lvl.Width || z >= lvl.Length) {
Player.Message(p, "You must be inside the map to use this command."); return;
}
int dirX = 0, dirZ = 0;
DirUtils.EightYaw(p.Rot.RotY, out dirX, out dirZ);
DoChain(p, (ushort)x, (ushort)y, (ushort)z, dirX, dirZ);
}
void DoChain(Player p, ushort x, ushort y, ushort z, int dirX, int dirZ) {
Vec3U16 cur, next, target;
cur.X = next.X = target.X = x;
cur.Y = next.Y = target.Y = y;
cur.Z = next.Z = target.Z = z;
target.X = (ushort)(target.X + dirX);
target.Z = (ushort)(target.Z + dirZ);
for (int i = 0; ; i++) {
cur.X = (ushort)(x + i * dirX);
cur.Z = (ushort)(z + i * dirZ);
next.X = (ushort)(cur.X + dirX);
next.Z = (ushort)(cur.Z + dirZ);
if (next.X >= p.level.Width || next.Z >= p.level.Length) {
if (i == 0) return;
PullBack(p, cur, target, dirX, dirZ);
p.level.Blockchange(p, x, y, z, ExtBlock.Air); return;
}
Thread.Sleep(250);
p.level.Blockchange(p, cur.X, cur.Y, cur.Z, (ExtBlock)Block.Mushroom);
if (!p.level.IsAirAt(next.X, next.Y, next.Z)) {
PullBack(p, next, target, dirX, dirZ);
p.level.Blockchange(p, x, y, z, ExtBlock.Air); return;
}
}
}
void PullBack(Player p, Vec3U16 cur, Vec3U16 target, int dirX, int dirZ) {
ExtBlock block = p.level.GetBlock(cur.X, cur.Y, cur.Z);
p.level.Blockchange(p, cur.X, cur.Y, cur.Z, block);
while (cur.X != target.X || cur.Z != target.Z) {
ExtBlock curBlock = p.level.GetBlock(cur.X, cur.Y, cur.Z);
if (curBlock == block) p.level.Blockchange(p, cur.X, cur.Y, cur.Z, ExtBlock.Air);
cur.X = (ushort)(cur.X - dirX); cur.Z = (ushort)(cur.Z - dirZ);
if (cur.X >= p.level.Width || cur.Z >= p.level.Length) return;
curBlock = p.level.GetBlock(cur.X, cur.Y, cur.Z);
if (curBlock.BlockID == Block.Mushroom)
p.level.Blockchange(p, cur.X, cur.Y, cur.Z, block);
Thread.Sleep(250);
}
}
public override void Help(Player p) {
Player.Message(p, "%T/Chain");
Player.Message(p, "%HShoots a chain of brown mushrooms and grabs a block and brings it back to the start.");
}
}
}

View File

@ -24,7 +24,7 @@ namespace MCGalaxy.Commands.Misc {
public override string shortcut { get { return "s"; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override bool SuperUseable { get { return false; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("Fetch"), new CommandAlias("Bring"), new CommandAlias("BringAll", "all") }; }

View File

@ -332,7 +332,6 @@
<Compile Include="Commands\Moderation\ModActionCmd.cs" />
<Compile Include="Commands\other\CmdAscend.cs" />
<Compile Include="Commands\other\CmdBack.cs" />
<Compile Include="Commands\other\CmdChain.cs" />
<Compile Include="Commands\other\cmdCTFADSFD.cs" />
<Compile Include="Commands\other\CmdDelay.cs" />
<Compile Include="Commands\other\CmdDescend.cs" />