Beispiel #1
0
 public void Use(Player p, string[] args) {
     string IsFlying = (string)p.ExtraData["IsFlying"];
     if (IsFlying != null) {
         p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal;
         p.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
         if (IsFlying == "+" && glassesFlatAndMiddle != null) {
             p.ResendBlockChange(glassesFlatAndMiddle, (Vector3S)p.ExtraData["FlyLastPos"]);
         }
         else if (IsFlying == "water" && fluidCube != null) {
             p.ResendBlockChange(fluidCube, (Vector3S)p.ExtraData["FlyLastPos"]);
         }
         else {
             p.ResendBlockChange(glassesFlat, (Vector3S)p.ExtraData["FlyLastPos"]);
         }
         p.ResendBlockChange(glassesFlat, (Vector3S)p.ExtraData["FlyLastPos"]);
         p.ExtraData["IsFlying"] = null;
         p.SendMessage(stopFlyMessage);
         return;
     }
     Vector3S belowBlock = p.belowBlock;
     if (args.Length > 0) {
         if (args[0] == "+" && glassesFlatAndMiddle != null) {
             p.ExtraData["IsFlying"] = "+";
             p.SendBlockChangeWhereAir(glassesFlatAndMiddle, belowBlock, 20);
             p.ExtraData["FlyLastPos"] = belowBlock;
         }
         else if (args[0].ToLower() == "water" && fluidCube != null) {
             p.ExtraData["IsFlying"] = "water";
             Vector3S tmp = belowBlock;
             tmp.y++;
             p.SendBlockChangeWhereAir(fluidCube, tmp, 9);
             p.ExtraData["FlyLastPos"] = tmp;
         }
         else {
             p.ExtraData["IsFlying"] = "normal";
             p.SendBlockChangeWhereAir(glassesFlat, belowBlock, 20);
             p.ExtraData["FlyLastPos"] = belowBlock;
         }
     }
     else {
         p.ExtraData["IsFlying"] = "normal";
         p.SendBlockChangeWhereAir(glassesFlat, belowBlock, 20);
         p.ExtraData["FlyLastPos"] = belowBlock;
     }
     p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal;
     p.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
     p.SendMessage(startFlyMessage);
 }
Beispiel #2
0
 public void Use(Player p, string[] args) {
     p.ExtraData.CreateIfNotExist("IsFlying", false);
     p.ExtraData["IsFlying"] = !(bool)p.ExtraData["IsFlying"];
     if (!(bool)p.ExtraData["IsFlying"]) {
         p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal;
         p.ResendBlockChange(glasses, (Vector3S)p.ExtraData["FlyLastPos"]);
         return;
     }
     p.SendBlockChangeWhereAir(glasses, p.belowBlock, 20);
     p.ExtraData["FlyLastPos"] = p.belowBlock;
     p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal;
     p.SendMessage("You are now flying. &cJump!");
 }
Beispiel #3
0
 void OnPlayerBigMove_Normal(Player sender, API.Events.MoveEventArgs args) {
     sender.ResendBlockChange(glasses, (Vector3S)sender.ExtraData["FlyLastPos"]);
     sender.ExtraData["FlyLastPos"] = sender.belowBlock;
     sender.SendBlockChangeWhereAir(glasses, sender.belowBlock, 20);
 }