public WarpZone(string destination) { string[] p = destination.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); //World if (p.Length == 1) { this.DesinationWorld = GetWorld(p [0]); this.Destination = null; return; //Leave Destination null } if (p.Length < 5) this.DesinationWorld = World.Main; else this.DesinationWorld = GetWorld(p [4]); if (p.Length < 4) this.DestinationDimension = 0; else this.DestinationDimension = int.Parse(p [3]); if (p.Length < 3) return; //invalid destination this.Destination = new CoordDouble(double.Parse(p [0].Trim()), double.Parse(p [1].Trim()), double.Parse(p [2].Trim())); }
public WarpZone(string destination) { string[] p = destination.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); //World if (p.Length == 1) { this.DesinationWorld = GetWorld(p [0]); this.Destination = null; return; //Leave Destination null } if (p.Length < 5) { this.DesinationWorld = World.Main; } else { this.DesinationWorld = GetWorld(p [4]); } if (p.Length < 4) { this.DestinationDimension = 0; } else { this.DestinationDimension = int.Parse(p [3]); } if (p.Length < 3) { return; //invalid destination } this.Destination = new CoordDouble(double.Parse(p [0].Trim()), double.Parse(p [1].Trim()), double.Parse(p [2].Trim())); }
/// <summary> /// Warp Player /// </summary> public void Warp(CoordDouble destination, Dimensions dimension, World world) { //Prevent multiple warp commands if (nextWarp > DateTime.Now) return; //Already warped nextWarp = DateTime.Now.AddSeconds(5); SendToClient(new SoundEffect("portal.trigger", Session.Position, 0.5, 63)); SendToClient(new SoundEffect("portal.travel", Session.Position, 0.5, 63)); ///Vanilla tp is enough if (Session.Dimension == dimension && Session.World == world) { Session.World.Send("tp " + MinecraftUsername + " " + destination.ToStringClean("0.00")); return; } //Change worlds if (Session.World != world) { SetWorld(world); return; } //Error message this.TellSystem("", "Warp cross dimension never worked in vanilla"); }
/// <summary> /// Special worlds where the entrance region matters /// such as banks and warpzones /// </summary> public void SetWorld(World w) { lock (sessionLock) { if (Phase == Phases.FinalClose) w = World.Void; WorldSession old = Session; Session = World.Void.Join(this); clientThread.State = "Void"; if (old != null) old.Close("going to " + w); WorldSession n; //Banned players BadPlayer b = Banned.CheckBanned(this); if (b == null) { n = w.Join(this); AfkSession afk = n as AfkSession; if (afk != null) afk.OriginalWorld = old.World; } else n = World.HellBanned.Join(this); //If we are denied if (n == null) Session = World.Wait.Join(this); else Session = n; clientThread.State = Session.ToString(); } }