TeleportPads

TeleportPads 1.0.2

Plugin Name: TeleportPads
Version: 1.0.2
Author: Rakilem YT

Description:
TeleportPads is a Minecraft server plugin for NukkitX that allows players to create teleportation points using pressure plates. Players can assign a destination to a pressure plate, and when stepped on, the player is instantly teleported to the chosen location.

This plugin includes:

  • Support for multiple plate types with customizable maximum teleport distances:
    • Gold Plate (147:0) → 1000 blocks
    • Iron Plate (148:0) → 750 blocks
    • Stone Plate (70:0) → 500 blocks
    • Wooden Plate (72:0) → 250 blocks
  • Configurable maximum number of pads per player.
  • Optional permission requirement (teleportpads.manage) for creating, removing, and managing pads.
  • Players must look directly at a pressure plate (gold, iron, stone, or wood) when creating or removing teleport pads.
  • Fully customizable messages in messages.yml.

Commands:

  • /setteleportpad <x> <y> <z> → Create a teleport pad while looking at a pressure plate.
  • /removeteleportpad → Remove a teleport pad while looking at it.
  • /listteleportpads → View a list of your teleport pads.
Error Description: The issue lied within the onBlockBreak method within the TeleportPads class. Originally, this method was sending the message "Teleport pad removed" every time a block was broken, without checking whether the broken block was a teleport pad or not. This caused the message to be displayed even when non-teleport pad blocks were broken, which was not the desired behavior.

Solution: The solution involved modifying the onBlockBreak method to check if the broken block is a teleport pad before sending the "Teleport pad removed" message. If the broken block is a teleport pad, then the message is sent; otherwise, no message is sent. This was achieved by adding an if condition that checks if the block is a teleport pad before sending the message.

Additionally, I added a return statement after sending the message in the case where a teleport pad is broken, to prevent the message from being sent for non-teleport pad blocks.

This solution ensures that the "Teleport pad removed" message is sent only when a teleport pad is broken, improving the accuracy and clarity of the plugin.
Top