Slapper is a high-performance NPC (Non-Player Character) plugin specifically optimized for PowerNukkitX. It allows server administrators to create stationary, persistent entities that execute one or multiple commands when interacted with or attacked by players.
- Optimized for PowerNukkitX: Leverages modern PNX entity registries and NBT handling for maximum stability.
- Diverse Entity Support: Support for a wide range of entities including Humans, Mob types, and even objects like Primed TNT or Minecarts.
- Deep Human Customization: Full persistence for skins (including Persona and Geometry), armor, inventory, and off-hand items.
- Command Automation: Attach multiple commands to a single entity with console-level execution.
- Dynamic Placeholders: Use
{player}in commands to dynamically target the player interacting with the NPC. - Remote Command Authority (RCA): Includes a utility to force players to execute commands via
/rca. - Robust Persistence: Custom
SlapperLoaderEntitylogic ensures NPCs are correctly restored after chunk reloads or server restarts. - Developer API: Comprehensive custom events for integration with other PNX plugins.
- Download Slapper.jar.
- Place the file into your PowerNukkitX
plugins/folder. - Restart your server.
- Done.
| Command | Description | Permission | Default |
|---|---|---|---|
/slapper id |
Find an NPC's ID by hitting/slapping it. | slapper.command.id |
OP |
/slapper cancel |
Cancel the hit session of (/slapper id) & (/slapper remove | slapper.command.cancel |
OP |
/slapper edit <id> <action> [value] |
Modifies an existing NPC's properties, equipment, commands, scale, or location | slapper.command.edit |
OP |
/slapper help |
Show all available Slapper commands. | slapper.command.help |
OP |
/slapper list |
Show a list of all available slapper entities. | slapper.command.list |
OP |
/slapper remove <null:id> |
Enter removal mode to delete an NPC. | slapper.command.remove |
OP |
/slapper spawn <type> [name] |
Spawns a new NPC at your location. | slapper.command.spawn |
OP |
| Command | Description | Permission | Default |
|---|---|---|---|
/rca <player> <command> |
Force a player to execute a command. | rca.command |
OP |
To create a Human NPC that opens a menu or teleports a player:
- Spawn:
/slapper spawn human §6§lNavigator - Identify: Run
/slapper idand hit the NPC. (Let's say the ID is500). - Add Command:
/slapper edit 500 addcommand rca {player} warp lobby - Execute Command: Ensure the
/warp lobbycommand is for teleport to lobby then interact slapper to execute the command. - To delete an NPC: Run
/slapper removethen hit the target NPC. You will see:[Slapper] Entity removed!.
You can listen to Slapper events by registering a listener in your PNX plugin:
SlapperCreationEvent: Called when an NPC is created.SlapperHitEvent: Called when a player interacts with an NPC (Cancellable).SlapperDeletionEvent: Called when an NPC is removed (Cancellable).
@EventHandler
public void onSlapperHit(SlapperHitEvent event) {
Player player = event.getExecutor();
if (player != null) {
player.sendMessage("You interacted with a Slapper NPC!");
}
}Contributions are welcome! If you'd like to improve Slapper, please follow these steps:
- Fork the repository.
- Create a Feature Branch
git checkout -b feature/AmazingFeature - Commit your changes
git commit -m 'Add some AmazingFeature' - Push to the branch
git push origin feature/AmazingFeature - Open a Pull Request.
Please ensure your code follows the existing style, maintains compatibility with the PowerNukkitX API, and includes comments for complex logic.
