Comments cleanup

This commit is contained in:
themode 2020-10-06 21:03:00 +02:00
parent d03354fe24
commit f811f1efef
3 changed files with 14 additions and 11 deletions

View File

@ -3,21 +3,21 @@ package net.minestom.server.command;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
/** /**
* Represent a simple command which give you the whole string representation * Represents a simple command which give you the whole string representation
*/ */
public interface CommandProcessor { public interface CommandProcessor {
/** /**
* Get the main command's name * Get the main command's name.
* *
* @return the main command's name * @return the main command's name
*/ */
String getCommandName(); String getCommandName();
/** /**
* Get the command's aliases * Get the command's aliases.
* <p> * <p>
* Can be null or empty * Can be null or empty.
* *
* @return the command aliases * @return the command aliases
*/ */
@ -34,7 +34,7 @@ public interface CommandProcessor {
boolean process(CommandSender sender, String command, String[] args); boolean process(CommandSender sender, String command, String[] args);
/** /**
* Called to know if a player has access to the command * Called to know if a player has access to the command.
* <p> * <p>
* Right now it is only used to know if the player should see the command in auto-completion * Right now it is only used to know if the player should see the command in auto-completion
* Conditions still need to be checked in {@link #process(CommandSender, String, String[])} * Conditions still need to be checked in {@link #process(CommandSender, String, String[])}
@ -45,22 +45,25 @@ public interface CommandProcessor {
boolean hasAccess(Player player); boolean hasAccess(Player player);
/** /**
* Disabling it will deactivate the {@link #onWrite(String)} callback * Needed to enable {@link #onWrite(String)} callback
* Enabling it will result in a degression of performance * <p>
* Be aware that enabling it can cost some performance because of how often it will be called.
* *
* @return true to enable writing tracking (and server auto completion) * @return true to enable writing tracking (and server auto completion)
* @see #onWrite(String)
*/ */
default boolean enableWritingTracking() { default boolean enableWritingTracking() {
return false; return false;
} }
/** /**
* Allow for tab auto completion, this is called everytime the player press a key in the chat * Allow for tab auto completion, this is called everytime the player press a key in the chat.
* <p> * <p>
* WARNING: {@link #enableWritingTracking()} needs to return true, you need to override it by default * WARNING: {@link #enableWritingTracking()} needs to return true, you need to override it by default.
* *
* @param text the whole player text * @param text the whole player text
* @return the array containing all the suggestion for the current arg (split " ") * @return the array containing all the suggestion for the current arg (split " ")
* @see #enableWritingTracking()
*/ */
default String[] onWrite(String text) { default String[] onWrite(String text) {
return null; return null;

View File

@ -10,7 +10,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
* Represent a command which have suggestion/auto-completion * Represents a command which have suggestion/auto-completion
*/ */
public class Command { public class Command {

View File

@ -626,7 +626,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
* @param blockPosition the block position * @param blockPosition the block position
* @param actionId * @param actionId
* @param actionParam * @param actionParam
* @see <a href="https://wiki.vg/Protocol#Block_Action">Packet information</a> for the action id &amp; param * @see <a href="https://wiki.vg/Protocol#Block_Action">BlockActionPacket</a> for the action id &amp; param
*/ */
public void sendBlockAction(BlockPosition blockPosition, byte actionId, byte actionParam) { public void sendBlockAction(BlockPosition blockPosition, byte actionId, byte actionParam) {
final short blockStateId = getBlockStateId(blockPosition); final short blockStateId = getBlockStateId(blockPosition);