mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Fix /back not working with /tpa
This commit is contained in:
parent
170deda2f4
commit
0621ce114d
@ -49,7 +49,7 @@ namespace MCGalaxy.Bots
|
||||
return data;
|
||||
}
|
||||
|
||||
public override void Output(Player p, string[] args, TextWriter w) {
|
||||
public override void Output(Player p, string[] args, TextWriter w) {
|
||||
string time = args.Length > 3 ? args[3] : "10";
|
||||
string speed = args.Length > 4 ? args[4] : "2";
|
||||
w.WriteLine(Name + " " + short.Parse(time) + " " + short.Parse(speed));
|
||||
|
@ -53,22 +53,8 @@ namespace MCGalaxy.Commands.Misc {
|
||||
Help(p); return;
|
||||
}
|
||||
|
||||
SavePreTeleportState(p);
|
||||
Level lvl = bot != null ? bot.level : target.level;
|
||||
|
||||
if (p.level != lvl) PlayerActions.ChangeMap(p, lvl.name);
|
||||
if (target != null && target.Loading) {
|
||||
p.Message("Waiting for {0} &Sto spawn..", p.FormatNick(target));
|
||||
target.BlockUntilLoad(10);
|
||||
}
|
||||
|
||||
// Player wasn't able to join target map, so don't move
|
||||
if (p.level != lvl) return;
|
||||
|
||||
Position pos = bot != null ? bot.Pos : target.Pos;
|
||||
Orientation rot = bot != null ? bot.Rot : target.Rot;
|
||||
p.BlockUntilLoad(10); //Wait for player to spawn in new map
|
||||
p.SendPosition(pos, rot);
|
||||
Entity dst = bot != null ? (Entity)bot : (Entity)target;
|
||||
PlayerOperations.TeleportToEntity(p, dst);
|
||||
}
|
||||
|
||||
internal static bool GetTeleportCoords(Player p, Entity ori, string[] args, bool precise,
|
||||
@ -104,14 +90,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
Position pos; byte yaw, pitch;
|
||||
if (!GetTeleportCoords(p, p, args, precise, out pos, out yaw, out pitch)) return;
|
||||
|
||||
SavePreTeleportState(p);
|
||||
p.SendPosition(pos, new Orientation(yaw, pitch));
|
||||
}
|
||||
|
||||
static void SavePreTeleportState(Player p) {
|
||||
p.PreTeleportMap = p.level.name;
|
||||
p.PreTeleportPos = p.Pos;
|
||||
p.PreTeleportRot = p.Rot;
|
||||
PlayerOperations.TeleportToCoords(p, pos, new Orientation(yaw, pitch));
|
||||
}
|
||||
|
||||
static bool CheckPlayer(Player p, Player target, CommandData data) {
|
||||
|
@ -49,7 +49,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
p.Message("You still have a pending teleport request with this player."); return;
|
||||
}
|
||||
if (p.level != target.level && target.level.IsMuseum) {
|
||||
p.Message("Player \"{0}\" is in a museum.", p.FormatNick(target)); return;
|
||||
p.Message("{0} &Sis in a museum.", p.FormatNick(target)); return;
|
||||
}
|
||||
if (target.Loading) {
|
||||
p.Message("Waiting for {0} &Sto spawn...", p.FormatNick(target));
|
||||
@ -99,13 +99,8 @@ namespace MCGalaxy.Commands.Misc {
|
||||
p.Message("You have accepted {0}&S's teleportation request.", p.FormatNick(sender));
|
||||
sender.Message("{0} &Shas accepted your request. Teleporting now...", sender.FormatNick(p));
|
||||
sender.currentTpa = "";
|
||||
Thread.Sleep(1000);
|
||||
if (p.level != sender.level) {
|
||||
PlayerActions.ChangeMap(sender, p.level);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
sender.SendPosition(p.Pos, p.Rot);
|
||||
|
||||
PlayerOperations.TeleportToEntity(sender, p);
|
||||
}
|
||||
|
||||
void DoDeny(Player p) {
|
||||
|
@ -170,5 +170,33 @@ namespace MCGalaxy
|
||||
Chat.MessageAll(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void TeleportToCoords(Player p, Position pos, Orientation ori) {
|
||||
SavePreTeleportState(p);
|
||||
p.SendPosition(pos, ori);
|
||||
}
|
||||
|
||||
public static void TeleportToEntity(Player p, Entity dst) {
|
||||
SavePreTeleportState(p);
|
||||
Level lvl = dst.Level;
|
||||
|
||||
Player target = dst as Player;
|
||||
if (target != null && target.Loading) {
|
||||
p.Message("Waiting for {0} &Sto spawn..", p.FormatNick(target));
|
||||
target.BlockUntilLoad(10);
|
||||
}
|
||||
|
||||
if (p.level != lvl && !PlayerActions.ChangeMap(p, lvl.name)) return;
|
||||
|
||||
p.BlockUntilLoad(10); // Wait for player to spawn in new map
|
||||
p.SendPosition(dst.Pos, dst.Rot);
|
||||
}
|
||||
|
||||
static void SavePreTeleportState(Player p) {
|
||||
p.PreTeleportMap = p.level.name;
|
||||
p.PreTeleportPos = p.Pos;
|
||||
p.PreTeleportRot = p.Rot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user