Skip to content

Common Problems during Development

PXAV edited this page Feb 14, 2021 · 4 revisions

This page lists the most common problems that occur during plugin development with Kelp.

My command is not executed

If you have a command that if you execute neither prints an exception nor an unknown command message, look at your main command's class definition:

@Singleton // <-- this is probably missing
@CreateCommand(
  name = "exampleCmd",
  executorType = ExecutorType.PLAYER_ONLY)
public class ExampleCommand extends KelpCommand {
  ...
}

Kelp can only store your command information consistently if you make your main command a singleton. So make sure it has the @Singleton annotation.

I get a NullPointerException when I create a KelpItem

This might have multiple reasons. Make sure that none of your input is null (do you query your item name from a config, where the result is null? Or is the material null?).

If this is not the case, check whether you chose the correct material. If you want to create a sign item with the material OAK_SIGN, this refers to the block of an oak sign, but not to the item. Use OAK_SIGN_ITEM here instead. The same goes for banners (BLUE_BANNER_ITEM instead of BLUE_BANNER, etc.)

I'm kicked from the server when opening an inventory on NPC interact

This error is a behavior caused by the way the Minecraft protocol works. You cannot receive an interact packet and send an inventory open packet in the same server tick. So try wrapping your operation into a DelayedScheduler with a small delay of like 50ms / 1 tick or so.

An inventory closes immediately after I have opened it

This is a problem that occurs when you use an AnimatedInventory and open another inventory or a prompt from there. The server still thinks the player wants to have the animated inventory and keeps updating the animation, which forces the player to open the previous animated inventory again. To fix this, call KelpPlayer#closeInventory before opening the new inventory with KelpPlayer#openAnvilPrompt() or KelpPlayer#openInventory(AnimatedInventory). This stops the old schedulers and allows fresh inventories to be displayed correctly.

Clone this wiki locally