Cleanup + typo fix

This commit is contained in:
themode 2020-10-13 12:49:29 +02:00
parent 59d5008d1b
commit 0e5831cdc3
14 changed files with 43 additions and 58 deletions

View File

@ -20,7 +20,7 @@ import java.util.concurrent.Future;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**
* Manager responsive for the server ticks. * Manager responsible for the server ticks.
* <p> * <p>
* The {@link ThreadProvider} manages the multi-thread aspect for {@link Instance} ticks, * The {@link ThreadProvider} manages the multi-thread aspect for {@link Instance} ticks,
* it can be modified with {@link #setThreadProvider(ThreadProvider)}. * it can be modified with {@link #setThreadProvider(ThreadProvider)}.

View File

@ -8,7 +8,7 @@ import net.minestom.server.item.Material;
* Represents an {@link Advancement} which is the root of an {@link AdvancementTab}. * Represents an {@link Advancement} which is the root of an {@link AdvancementTab}.
* Every tab requires one since advancements needs to be linked to a parent. * Every tab requires one since advancements needs to be linked to a parent.
* <p> * <p>
* The difference between this and an {@link Advancement} is that the root is responsive for the tab background. * The difference between this and an {@link Advancement} is that the root is responsible for the tab background.
*/ */
public class AdvancementRoot extends Advancement { public class AdvancementRoot extends Advancement {

View File

@ -42,7 +42,7 @@ public class NotificationCenter {
} }
/** /**
* Create the packet responsive for showing the Toast to players * Create the packet responsible for showing the Toast to players
* *
* @param notification the notification * @param notification the notification
* @return the packet used to show the Toast * @return the packet used to show the Toast

View File

@ -62,7 +62,7 @@ public final class CommandManager {
} }
/** /**
* Stop the console responsive for the console commands processing * Stop the console responsible for the console commands processing
* <p> * <p>
* WARNING: it cannot be re-run later * WARNING: it cannot be re-run later
*/ */

View File

@ -13,7 +13,7 @@ public interface ArgumentCallback {
* Executed when an error is found * Executed when an error is found
* *
* @param source the sender which executed the command * @param source the sender which executed the command
* @param value the raw string argument which is responsive for the error * @param value the raw string argument which is responsible for the error
* @param error the error id (you can check its meaning in the specific argument class or ask the developer about it) * @param error the error id (you can check its meaning in the specific argument class or ask the developer about it)
*/ */
void apply(CommandSender source, String value, int error); void apply(CommandSender source, String value, int error);

View File

@ -3,7 +3,7 @@ package net.minestom.server.entity.damage;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
/** /**
* Represents damage inflicted by an entity, via a projectile * Represents damage inflicted by an entity, via a projectile.
*/ */
public class EntityProjectileDamage extends DamageType { public class EntityProjectileDamage extends DamageType {
@ -17,7 +17,7 @@ public class EntityProjectileDamage extends DamageType {
} }
/** /**
* Get the projectile responsive for the damage * Get the projectile responsible for the damage.
* *
* @return the projectile * @return the projectile
*/ */
@ -26,7 +26,7 @@ public class EntityProjectileDamage extends DamageType {
} }
/** /**
* Get the shooter of the projectile * Get the shooter of the projectile.
* *
* @return the shooter of the projectile, null if not any * @return the shooter of the projectile, null if not any
*/ */

View File

@ -5,8 +5,8 @@ import net.minestom.server.entity.Player;
import net.minestom.server.event.Event; import net.minestom.server.event.Event;
/** /**
* Called when the players open the advancement screens or switch the tab * Called when a {@link Player} opens the advancement screens or switch the tab
* and when he closes the screen * and when he closes the screen.
*/ */
public class AdvancementTabEvent extends Event { public class AdvancementTabEvent extends Event {
@ -21,7 +21,7 @@ public class AdvancementTabEvent extends Event {
} }
/** /**
* Get the player responsive for the event * Get the {@link Player} responsible for the event
* *
* @return the player * @return the player
*/ */

View File

@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
import net.minestom.server.event.CancellableEvent; import net.minestom.server.event.CancellableEvent;
/** /**
* Used when the player finish the animation of an item * Used when a {@link Player} finish the animation of an item
* *
* @see ItemAnimationType * @see ItemAnimationType
*/ */
@ -19,7 +19,7 @@ public class PlayerItemAnimationEvent extends CancellableEvent {
} }
/** /**
* Get the player who is responsive for the animation * Get the {@link Player} who is responsible for the animation.
* *
* @return the player * @return the player
*/ */

View File

@ -207,7 +207,7 @@ public abstract class Chunk implements Viewable, DataContainer {
* be sure that the data is only used for this reading. * be sure that the data is only used for this reading.
* @param callback the callback to execute once the chunk is done reading * @param callback the callback to execute once the chunk is done reading
* WARNING: this need to be called to notify the instance. * WARNING: this need to be called to notify the instance.
* @see #getSerializedData() which is responsive for the serialized data given * @see #getSerializedData() which is responsible for the serialized data given
*/ */
public abstract void readChunk(BinaryReader reader, ChunkCallback callback); public abstract void readChunk(BinaryReader reader, ChunkCallback callback);

View File

@ -7,7 +7,7 @@ import net.minestom.server.world.biomes.Biome;
import java.util.List; import java.util.List;
/** /**
* Responsive for the {@link Chunk} generation, can be set using {@link Instance#setChunkGenerator(ChunkGenerator)}. * Responsible for the {@link Chunk} generation, can be set using {@link Instance#setChunkGenerator(ChunkGenerator)}.
* <p> * <p>
* Called if {@link IChunkLoader} hasn't been able to load it. * Called if {@link IChunkLoader} hasn't been able to load it.
*/ */

View File

@ -125,7 +125,7 @@ public class PlayerDiggingListener {
// Finished digging, remove effect if any // Finished digging, remove effect if any
player.resetTargetBlock(); player.resetTargetBlock();
// Unverified block break, client is fully responsive // Unverified block break, client is fully responsible
final boolean result = instance.breakBlock(player, blockPosition); final boolean result = instance.breakBlock(player, blockPosition);
final int updatedBlockId = result ? 0 : blockStateId; final int updatedBlockId = result ? 0 : blockStateId;

View File

@ -1,7 +1,6 @@
package net.minestom.server.network; package net.minestom.server.network;
import net.minestom.server.chat.ColoredText; import net.minestom.server.chat.JsonMessage;
import net.minestom.server.chat.RichMessage;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.entity.fakeplayer.FakePlayer; import net.minestom.server.entity.fakeplayer.FakePlayer;
import net.minestom.server.listener.manager.PacketConsumer; import net.minestom.server.listener.manager.PacketConsumer;
@ -15,6 +14,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
/**
* Manage the connected clients.
*/
public final class ConnectionManager { public final class ConnectionManager {
private Set<Player> players = new CopyOnWriteArraySet<>(); private Set<Player> players = new CopyOnWriteArraySet<>();
@ -81,51 +83,27 @@ public final class ConnectionManager {
} }
/** /**
* Send a rich message to all online players who validate the condition {@code condition} * Send a {@link JsonMessage} to all online players who validate the condition {@code condition}.
* *
* @param richMessage the rich message to send * @param jsonMessage the message to send
* @param condition the condition to receive the message * @param condition the condition to receive the message
*/ */
public void broadcastMessage(RichMessage richMessage, Function<Player, Boolean> condition) { public void broadcastMessage(JsonMessage jsonMessage, Function<Player, Boolean> condition) {
final Collection<Player> recipients = getRecipients(condition); final Collection<Player> recipients = getRecipients(condition);
if (!recipients.isEmpty()) { if (!recipients.isEmpty()) {
final String jsonText = richMessage.toString(); final String jsonText = jsonMessage.toString();
broadcastJson(jsonText, recipients); broadcastJson(jsonText, recipients);
} }
} }
/** /**
* Send a rich message to all online players without exception * Send a {@link JsonMessage} to all online players.
* *
* @param richMessage the rich message to send * @param jsonMessage the message to send
*/ */
public void broadcastMessage(RichMessage richMessage) { public void broadcastMessage(JsonMessage jsonMessage) {
broadcastMessage(richMessage, null); broadcastMessage(jsonMessage, null);
}
/**
* Send a message to all online players who validate the condition {@code condition}
*
* @param coloredText the message to send
* @param condition the condition to receive the message
*/
public void broadcastMessage(ColoredText coloredText, Function<Player, Boolean> condition) {
final Collection<Player> recipients = getRecipients(condition);
if (!recipients.isEmpty()) {
final String jsonText = coloredText.toString();
broadcastJson(jsonText, recipients);
}
}
/**
* Send a message to all online players without exception
*
* @param coloredText the message to send
*/
public void broadcastMessage(ColoredText coloredText) {
broadcastMessage(coloredText, null);
} }
private void broadcastJson(String json, Collection<Player> recipients) { private void broadcastJson(String json, Collection<Player> recipients) {
@ -171,7 +149,9 @@ public final class ConnectionManager {
} }
/** /**
* Shouldn't be override if already defined * Change how {@link UUID} are attributed to players.
* <p>
* Shouldn't be override if already defined.
* *
* @param uuidProvider the new player connection uuid provider * @param uuidProvider the new player connection uuid provider
* @see #getPlayerConnectionUuid(PlayerConnection, String) * @see #getPlayerConnectionUuid(PlayerConnection, String)
@ -183,7 +163,7 @@ public final class ConnectionManager {
/** /**
* Compute the UUID of the specified connection * Compute the UUID of the specified connection
* Used in {@link net.minestom.server.network.packet.client.login.LoginStartPacket} in order * Used in {@link net.minestom.server.network.packet.client.login.LoginStartPacket} in order
* to give the player the right UUID * to give the player the right {@link UUID}.
* *
* @param playerConnection the player connection * @param playerConnection the player connection
* @return the uuid based on {@code playerConnection} * @return the uuid based on {@code playerConnection}
@ -258,8 +238,8 @@ public final class ConnectionManager {
} }
/** /**
* Remove a {@link Player} from the players list * Remove a {@link Player} from the players list,
* used during disconnection * used during disconnection.
* *
* @param connection the player connection * @param connection the player connection
*/ */

View File

@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
import net.minestom.server.utils.validate.Check; import net.minestom.server.utils.validate.Check;
/** /**
* Represents a resource pack which can be send to a {@link Player}. * Represents a resource pack which can be sent using {@link Player#setResourcePack(ResourcePack)}.
*/ */
public class ResourcePack { public class ResourcePack {
@ -19,7 +19,7 @@ public class ResourcePack {
} }
/** /**
* Get the resource pack URL * Get the resource pack URL.
* *
* @return the resource pack URL * @return the resource pack URL
*/ */
@ -28,10 +28,10 @@ public class ResourcePack {
} }
/** /**
* Get the resource pack hash * Get the resource pack hash.
* <p> * <p>
* WARNING: if null or empty, the player will probably waste bandwidth by re-downloading * WARNING: if null or empty, the player will probably waste bandwidth by re-downloading
* the resource pack * the resource pack.
* *
* @return the resource pack hash * @return the resource pack hash
*/ */

View File

@ -1,5 +1,10 @@
package net.minestom.server.resourcepack; package net.minestom.server.resourcepack;
import net.minestom.server.entity.Player;
/**
* Represents the result of {@link Player#setResourcePack(ResourcePack)}.
*/
public enum ResourcePackStatus { public enum ResourcePackStatus {
SUCCESS, DECLINED, FAILED_DOWNLOAD, ACCEPTED SUCCESS, DECLINED, FAILED_DOWNLOAD, ACCEPTED
} }