mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Fix /bots without args from console
This commit is contained in:
parent
bef2cc4469
commit
fbc4fb612a
@ -26,7 +26,7 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
Level lvl = p.level;
|
Level lvl = p == null ? null : p.level;
|
||||||
string[] args = message.SplitSpaces(2);
|
string[] args = message.SplitSpaces(2);
|
||||||
int ignored, offset = 0;
|
int ignored, offset = 0;
|
||||||
|
|
||||||
@ -39,13 +39,15 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
PlayerBot[] bots = PlayerBot.Bots.Items;
|
PlayerBot[] bots = PlayerBot.Bots.Items;
|
||||||
List<PlayerBot> inScope = new List<PlayerBot>();
|
List<PlayerBot> inScope = new List<PlayerBot>();
|
||||||
foreach (PlayerBot bot in bots) {
|
foreach (PlayerBot bot in bots) {
|
||||||
if (bot.level != lvl) continue;
|
if (lvl != null && bot.level != lvl) continue;
|
||||||
inScope.Add(bot);
|
inScope.Add(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
string cmd = lvl == p.level ? "bots" : "bots " + lvl.name;
|
string cmd = (lvl == null || lvl == p.level) ? "bots" : "bots " + lvl.name;
|
||||||
string modifier = args.Length > offset ? args[offset] : "";
|
string modifier = args.Length > offset ? args[offset] : "";
|
||||||
Player.Message(p, "Bots in {0}:", lvl.ColoredName);
|
|
||||||
|
string group = lvl == null ? "All bots:" : "Bots in " + lvl.ColoredName + ":";
|
||||||
|
Player.Message(p, group);
|
||||||
MultiPageOutput.Output(p, inScope, FormatBot, cmd, "bots", modifier, false);
|
MultiPageOutput.Output(p, inScope, FormatBot, cmd, "bots", modifier, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,12 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (p.beforeTeleportMap == "") {
|
if (p.lastTeleportMap == "") {
|
||||||
Player.Message(p, "You have not teleported anywhere yet"); return;
|
Player.Message(p, "You have not teleported anywhere yet"); return;
|
||||||
}
|
}
|
||||||
if (!p.level.name.CaselessEq(p.beforeTeleportMap))
|
|
||||||
PlayerActions.ChangeMap(p, p.beforeTeleportMap);
|
if (!p.level.name.CaselessEq(p.lastTeleportMap))
|
||||||
|
PlayerActions.ChangeMap(p, p.lastTeleportMap);
|
||||||
p.SendPos(Entities.SelfID, p.beforeTeleportPos, new Orientation(0, 0));
|
p.SendPos(Entities.SelfID, p.beforeTeleportPos, new Orientation(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
Help(p); return;
|
Help(p); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.beforeTeleportMap = p.level.name;
|
p.lastTeleportMap = p.level.name;
|
||||||
p.beforeTeleportPos = p.Pos;
|
p.beforeTeleportPos = p.Pos;
|
||||||
Level lvl = bot != null ? bot.level : target.level;
|
Level lvl = bot != null ? bot.level : target.level;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace MCGalaxy {
|
|||||||
internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0;
|
internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0;
|
||||||
public Vec3U16 lastClick = Vec3U16.Zero;
|
public Vec3U16 lastClick = Vec3U16.Zero;
|
||||||
public Position beforeTeleportPos = default(Position);
|
public Position beforeTeleportPos = default(Position);
|
||||||
public string beforeTeleportMap = "";
|
public string lastTeleportMap = "";
|
||||||
public ushort[] pos = new ushort[3];
|
public ushort[] pos = new ushort[3];
|
||||||
public byte[] rot = new byte[2];
|
public byte[] rot = new byte[2];
|
||||||
internal Position tempPos;
|
internal Position tempPos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user