public static void OnPlayerToggleSneak(PlayerToggleSneakEventArgs args) { PlayerToggleSneak?.Invoke(args); }
private void PlayerActionHandle(PlayerActionPacket pk) { Vector3 pos = pk.Position; BlockFace face = pk.Face; if (pk.ActionType == PlayerActionPacket.ACTION_START_BREAK) { //TODO : InteractEvent //TODO : LevelEventPacket } else if (pk.ActionType == PlayerActionPacket.ACTION_ABORT_BREAK) { } else if (pk.ActionType == PlayerActionPacket.ACTION_STOP_BREAK) { //TODO : LevelEventPacket } else if (pk.ActionType == PlayerActionPacket.ACTION_GET_UPDATED_BLOCK) { } else if (pk.ActionType == PlayerActionPacket.ACTION_DROP_ITEM) { } else if (pk.ActionType == PlayerActionPacket.ACTION_START_SLEEPING) { } else if (pk.ActionType == PlayerActionPacket.ACTION_STOP_SLEEPING) { } else if (pk.ActionType == PlayerActionPacket.ACTION_RESPAWN) { } else if (pk.ActionType == PlayerActionPacket.ACTION_JUMP) { PlayerJumpEventArgs playerJumpEvent = new PlayerJumpEventArgs(this); PlayerEvents.OnPlayerJump(playerJumpEvent); if (this.Sprinting) { this.AddExhaustion(0.8f, PlayerExhaustEventArgs.CAUSE_SPRINT_JUMPING); } else { this.AddExhaustion(0.2f, PlayerExhaustEventArgs.CAUSE_JUMPING); } } else if (pk.ActionType == PlayerActionPacket.ACTION_START_SPRINT) { PlayerToggleSprintEventArgs playerToggleSprintEvent = new PlayerToggleSprintEventArgs(this, true); PlayerEvents.OnPlayerToggleSprint(playerToggleSprintEvent); if (playerToggleSprintEvent.IsCancel) { this.SendDataProperties(); } this.Sprinting = true; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_STOP_SPRINT) { PlayerToggleSprintEventArgs playerToggleSprintEvent = new PlayerToggleSprintEventArgs(this, false); PlayerEvents.OnPlayerToggleSprint(playerToggleSprintEvent); if (playerToggleSprintEvent.IsCancel) { this.SendDataProperties(); } this.Sprinting = false; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_START_SNEAK) { PlayerToggleSneakEventArgs playerToggleSneakEvent = new PlayerToggleSneakEventArgs(this, true); PlayerEvents.OnPlayerToggleSneak(playerToggleSneakEvent); if (playerToggleSneakEvent.IsCancel) { this.SendDataProperties(); } this.Sneaking = true; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_STOP_SNEAK) { PlayerToggleSneakEventArgs playerToggleSneakEvent = new PlayerToggleSneakEventArgs(this, false); PlayerEvents.OnPlayerToggleSneak(playerToggleSneakEvent); if (playerToggleSneakEvent.IsCancel) { this.SendDataProperties(); } this.Sneaking = false; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_DIMENSION_CHANGE_REQUEST) { } else if (pk.ActionType == PlayerActionPacket.ACTION_DIMENSION_CHANGE_ACK) { } else if (pk.ActionType == PlayerActionPacket.ACTION_START_GLIDE) { PlayerToggleGlideEventArgs playerToggleGlideEvent = new PlayerToggleGlideEventArgs(this, true); PlayerEvents.OnPlayerToggleGlide(playerToggleGlideEvent); if (playerToggleGlideEvent.IsCancel) { this.SendDataProperties(); } this.Gliding = true; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_STOP_GLIDE) { PlayerToggleGlideEventArgs playerToggleGlideEvent = new PlayerToggleGlideEventArgs(this, false); PlayerEvents.OnPlayerToggleGlide(playerToggleGlideEvent); if (playerToggleGlideEvent.IsCancel) { this.SendDataProperties(); } this.Gliding = false; this.SendDataProperties(); } else if (pk.ActionType == PlayerActionPacket.ACTION_BUILD_DENIED) { } else if (pk.ActionType == PlayerActionPacket.ACTION_CONTINUE_BREAK) { } this.Action = false; }