Style cleanup

This commit is contained in:
themode 2021-01-26 15:53:03 +01:00
parent 73c53a9b17
commit 7a54b4162d
11 changed files with 240 additions and 216 deletions

View File

@ -2,9 +2,15 @@ package net.minestom.server.benchmark;
public class ThreadResult { public class ThreadResult {
private final double cpuPercentage, userPercentage, waitedPercentage, blockedPercentage; private final double cpuPercentage;
private final double userPercentage;
private final double waitedPercentage;
private final double blockedPercentage;
protected ThreadResult(double cpuPercentage, double userPercentage, double waitedPercentage, double blockedPercentage) { protected ThreadResult(double cpuPercentage,
double userPercentage,
double waitedPercentage,
double blockedPercentage) {
this.cpuPercentage = cpuPercentage; this.cpuPercentage = cpuPercentage;
this.userPercentage = userPercentage; this.userPercentage = userPercentage;
this.waitedPercentage = waitedPercentage; this.waitedPercentage = waitedPercentage;

View File

@ -2,6 +2,8 @@ package net.minestom.server.ping;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -29,7 +31,9 @@ public class ResponseData {
private String favicon; private String favicon;
/** Constructs a new {@link ResponseData}. */ /**
* Constructs a new {@link ResponseData}.
*/
public ResponseData() { public ResponseData() {
this.jsonObject = new JsonObject(); this.jsonObject = new JsonObject();
this.versionObject = new JsonObject(); this.versionObject = new JsonObject();
@ -119,6 +123,7 @@ public class ResponseData {
* *
* @return The converted response data as a json tree. * @return The converted response data as a json tree.
*/ */
@NotNull
public JsonObject build() { public JsonObject build() {
versionObject.addProperty("name", name); versionObject.addProperty("name", name);
versionObject.addProperty("protocol", protocol); versionObject.addProperty("protocol", protocol);
@ -143,7 +148,9 @@ public class ResponseData {
return jsonObject; return jsonObject;
} }
/** Represents a player line in the server list hover. */ /**
* Represents a player line in the server list hover.
*/
private static class PingPlayer { private static class PingPlayer {
private String name; private String name;
private UUID uuid; private UUID uuid;

View File

@ -6,19 +6,21 @@ import net.minestom.server.entity.Player;
import net.minestom.server.network.packet.server.play.DisplayScoreboardPacket; import net.minestom.server.network.packet.server.play.DisplayScoreboardPacket;
import net.minestom.server.network.packet.server.play.ScoreboardObjectivePacket; import net.minestom.server.network.packet.server.play.ScoreboardObjectivePacket;
import net.minestom.server.network.packet.server.play.UpdateScorePacket; import net.minestom.server.network.packet.server.play.UpdateScorePacket;
import org.jetbrains.annotations.NotNull;
/** /**
* This interface represents all scoreboard of Minecraft * This interface represents all scoreboard of Minecraft.
*/ */
public interface Scoreboard extends Viewable { public interface Scoreboard extends Viewable {
/** /**
* Creates a creation objective packet * Creates a creation objective packet.
* *
* @param value The value for the objective * @param value The value for the objective
* @param type The type for the objective * @param type The type for the objective
* @return the creation objective packet * @return the creation objective packet
*/ */
@NotNull
default ScoreboardObjectivePacket getCreationObjectivePacket(String value, ScoreboardObjectivePacket.Type type) { default ScoreboardObjectivePacket getCreationObjectivePacket(String value, ScoreboardObjectivePacket.Type type) {
final ScoreboardObjectivePacket packet = new ScoreboardObjectivePacket(); final ScoreboardObjectivePacket packet = new ScoreboardObjectivePacket();
packet.objectiveName = this.getObjectiveName(); packet.objectiveName = this.getObjectiveName();
@ -30,10 +32,11 @@ public interface Scoreboard extends Viewable {
} }
/** /**
* Creates the destruction objective packet * Creates the destruction objective packet.
* *
* @return the destruction objective packet * @return the destruction objective packet
*/ */
@NotNull
default ScoreboardObjectivePacket getDestructionObjectivePacket() { default ScoreboardObjectivePacket getDestructionObjectivePacket() {
final ScoreboardObjectivePacket packet = new ScoreboardObjectivePacket(); final ScoreboardObjectivePacket packet = new ScoreboardObjectivePacket();
packet.objectiveName = this.getObjectiveName(); packet.objectiveName = this.getObjectiveName();
@ -43,11 +46,12 @@ public interface Scoreboard extends Viewable {
} }
/** /**
* Creates the {@link DisplayScoreboardPacket} * Creates the {@link DisplayScoreboardPacket}.
* *
* @param position The position of the scoreboard * @param position The position of the scoreboard
* @return the created display scoreboard packet * @return the created display scoreboard packet
*/ */
@NotNull
default DisplayScoreboardPacket getDisplayScoreboardPacket(byte position) { default DisplayScoreboardPacket getDisplayScoreboardPacket(byte position) {
final DisplayScoreboardPacket packet = new DisplayScoreboardPacket(); final DisplayScoreboardPacket packet = new DisplayScoreboardPacket();
packet.position = position; packet.position = position;
@ -57,7 +61,7 @@ public interface Scoreboard extends Viewable {
} }
/** /**
* Updates the score of a {@link Player} * Updates the score of a {@link Player}.
* *
* @param player The player * @param player The player
* @param score The new score * @param score The new score
@ -73,10 +77,11 @@ public interface Scoreboard extends Viewable {
} }
/** /**
* Gets the objective name of the scoreboard * Gets the objective name of the scoreboard.
* *
* @return the objective name * @return the objective name
*/ */
@NotNull
String getObjectiveName(); String getObjectiveName();
} }

View File

@ -25,43 +25,43 @@ public class Team {
private static final ConnectionManager CONNECTION_MANAGER = MinecraftServer.getConnectionManager(); private static final ConnectionManager CONNECTION_MANAGER = MinecraftServer.getConnectionManager();
/** /**
* A collection of all registered entities who are on the team * A collection of all registered entities who are on the team.
*/ */
private final Set<String> members; private final Set<String> members;
/** /**
* The registry name of the team * The registry name of the team.
*/ */
private final String teamName; private final String teamName;
/** /**
* The display name of the team * The display name of the team.
*/ */
private JsonMessage teamDisplayName; private JsonMessage teamDisplayName;
/** /**
* A BitMask * A BitMask.
*/ */
private byte friendlyFlags; private byte friendlyFlags;
/** /**
* The visibility of the team * The visibility of the team.
*/ */
private NameTagVisibility nameTagVisibility; private NameTagVisibility nameTagVisibility;
/** /**
* The collision rule of the team * The collision rule of the team.
*/ */
private CollisionRule collisionRule; private CollisionRule collisionRule;
/** /**
* Used to color the name of players on the team <br> * Used to color the name of players on the team <br>
* The color of a team defines how the names of the team members are visualized * The color of a team defines how the names of the team members are visualized.
*/ */
private ChatColor teamColor; private ChatColor teamColor;
/** /**
* Shown before the names of the players who belong to this team * Shown before the names of the players who belong to this team.
*/ */
private JsonMessage prefix; private JsonMessage prefix;
/** /**
* Shown after the names of the player who belong to this team * Shown after the names of the player who belong to this team.
*/ */
private JsonMessage suffix; private JsonMessage suffix;

View File

@ -2,7 +2,6 @@ package net.minestom.server.scoreboard;
import net.minestom.server.MinecraftServer; import net.minestom.server.MinecraftServer;
import net.minestom.server.chat.ChatColor; import net.minestom.server.chat.ChatColor;
import net.minestom.server.chat.ColoredText;
import net.minestom.server.chat.JsonMessage; import net.minestom.server.chat.JsonMessage;
import net.minestom.server.entity.LivingEntity; import net.minestom.server.entity.LivingEntity;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;

View File

@ -10,7 +10,9 @@ public class ByteRange extends Range<Byte> {
super(value); super(value);
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean isInRange(Byte value) { public boolean isInRange(Byte value) {
return value >= this.getMinimum() && value <= this.getMaximum(); return value >= this.getMinimum() && value <= this.getMaximum();

View File

@ -10,7 +10,9 @@ public class DoubleRange extends Range<Double> {
super(value); super(value);
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean isInRange(Double value) { public boolean isInRange(Double value) {
return value >= this.getMinimum() && value <= this.getMaximum(); return value >= this.getMinimum() && value <= this.getMaximum();

View File

@ -10,10 +10,11 @@ public class IntRange extends Range<Integer> {
super(value); super(value);
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean isInRange(Integer value) { public boolean isInRange(Integer value) {
return value >= this.getMinimum() && value <= this.getMaximum(); return value >= this.getMinimum() && value <= this.getMaximum();
} }
} }

View File

@ -10,7 +10,9 @@ public class LongRange extends Range<Long> {
super(value); super(value);
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean isInRange(Long value) { public boolean isInRange(Long value) {
return value >= this.getMinimum() && value <= this.getMaximum(); return value >= this.getMinimum() && value <= this.getMaximum();