Skip to main content

Migrating

Nothing has been removed yet — every old name still works as a deprecated delegate. But @Deprecated(forRemoval = true) means they will go, so move when convenient.

Requires 1.0.3, which is not released yet

The replacement names below do not exist in 1.0.2, the current release. On 1.0.2, registerCommand and getPlayer() are the only options and this page does not apply to you yet.

These docs describe 1.0.3 as it is being developed.

Registration: registerCommand → trackCommand​

The old names were easy to mix up, which is why they were replaced:

  • registerCommand never actually touched the server. It only recorded the command — the name promised more than it did.
  • unregisterCommands() removed only reloadable commands, despite a name that reads as "remove everything".
DeprecatedUse instead
registerCommand(cmd)trackCommand(cmd)
registerCommands()flushRegistrations()
unregisterCommands()unregisterReloadableCommands()
// Before
this.commands.registerCommand(new HealCommand(this));
this.commands.registerCommands();

// After
this.commands.trackCommand(new HealCommand(this));
this.commands.flushRegistrations();

Dispatch: getPlayer → getSenderAsPlayer​

getPlayer() returned the sender while getOptionalPlayer(name) resolved an argument. They read as a nullable/non-null pair of one concept and were unrelated.

DeprecatedUse insteadReads
getPlayer()getSenderAsPlayer()the sender
getOptionalPlayer(name)resolvePlayer(name)an argument

Silencing the warnings​

@Deprecated(forRemoval = true) emits a removal warning, which @SuppressWarnings("deprecation") does not silence. You need:

@SuppressWarnings("removal")

Better to just migrate — the replacements are one-for-one.

Checklist​

  • Replace registerCommand / registerCommands with trackCommand / flushRegistrations
  • Replace unregisterCommands() with unregisterReloadableCommands()
  • Replace getPlayer() with getSenderAsPlayer(), and null-check it
  • Replace getOptionalPlayer(name) with resolvePlayer(name)
  • Confirm you call unregisterAll(this), not unregisterAll(), unless you really do host other plugins' commands
  • Rebuild and confirm relocation still applies (Shading)