Skip to content

Commit

Permalink
Merge pull request #4 from PaperMC/dev/3.0.0
Browse files Browse the repository at this point in the history
[pull] main from PaperMC:dev/3.0.0
  • Loading branch information
pull[bot] authored Feb 12, 2025
2 parents 66f453d + 83c1749 commit 0fe17ec
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.Beta;
import com.mojang.brigadier.tree.RootCommandNode;
import com.velocitypowered.api.event.annotation.AwaitingEvent;
import com.velocitypowered.api.proxy.Player;
Expand All @@ -21,7 +20,6 @@
* client.
*/
@AwaitingEvent
@Beta
public class PlayerAvailableCommandsEvent {

private final Player player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.velocitypowered.api.event.player;

import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer;
Expand All @@ -18,7 +17,6 @@
* available in {@link Player#getCurrentServer()}. Velocity will not wait on this event to finish
* firing.
*/
@Beta
public class ServerPostConnectEvent {
private final Player player;
private final RegisteredServer previousServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.velocitypowered.api.event.proxy.server;

import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo;
Expand All @@ -23,7 +22,6 @@
* @param registeredServer A {@link RegisteredServer} that has been registered.
* @since 3.3.0
*/
@Beta
public record ServerRegisteredEvent(@NotNull RegisteredServer registeredServer) {
public ServerRegisteredEvent {
Preconditions.checkNotNull(registeredServer, "registeredServer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.velocitypowered.api.event.proxy.server;

import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo;
Expand All @@ -23,7 +22,6 @@
* @param unregisteredServer A {@link RegisteredServer} that has been unregistered.
* @since 3.3.0
*/
@Beta
public record ServerUnregisteredEvent(@NotNull RegisteredServer unregisteredServer) {
public ServerUnregisteredEvent {
Preconditions.checkNotNull(unregisteredServer, "unregisteredServer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,68 @@ private Builder() {

}

/**
* Uses the modified {@code version} info in the response.
*
* @param version version info to set
* @return this builder, for chaining
*/
public Builder version(Version version) {
this.version = Preconditions.checkNotNull(version, "version");
return this;
}

/**
* Uses the modified {@code onlinePlayers} number in the response.
*
* @param onlinePlayers number for online players to set
* @return this builder, for chaining
*/
public Builder onlinePlayers(int onlinePlayers) {
this.onlinePlayers = onlinePlayers;
return this;
}

/**
* Uses the modified {@code maximumPlayers} number in the response.
* <b>This will not modify the actual maximum players that can join the server.</b>
*
* @param maximumPlayers number for maximum players to set
* @return this builder, for chaining
*/
public Builder maximumPlayers(int maximumPlayers) {
this.maximumPlayers = maximumPlayers;
return this;
}

/**
* Uses the modified {@code players} array in the response.
*
* @param players array of SamplePlayers to set
* @return this builder, for chaining
*/
public Builder samplePlayers(SamplePlayer... players) {
this.samplePlayers.addAll(Arrays.asList(players));
return this;
}

/**
* Uses the modified {@code modType} in the response.
*
* @param modType the mod type to set
* @return this builder, for chaining
*/
public Builder modType(String modType) {
this.modType = Preconditions.checkNotNull(modType, "modType");
return this;
}

/**
* Uses the modified {@code mods} array in the response.
*
* @param mods array of mods to use
* @return this builder, for chaining
*/
public Builder mods(ModInfo.Mod... mods) {
this.mods.addAll(Arrays.asList(mods));
return this;
Expand All @@ -193,7 +230,7 @@ public Builder mods(ModInfo.Mod... mods) {
* Uses the modified {@code mods} list in the response.
*
* @param mods the mods list to use
* @return this build, for chaining
* @return this builder, for chaining
*/
public Builder mods(ModInfo mods) {
Preconditions.checkNotNull(mods, "mods");
Expand All @@ -203,36 +240,74 @@ public Builder mods(ModInfo mods) {
return this;
}

/**
* Clears the current list of mods to use in the response.
*
* @return this builder, for chaining
*/
public Builder clearMods() {
this.mods.clear();
return this;
}

/**
* Clears the current list of PlayerSamples to use in the response.
*
* @return this builder, for chaining
*/
public Builder clearSamplePlayers() {
this.samplePlayers.clear();
return this;
}

/**
* Defines the server as mod incompatible in the response.
*
* @return this builder, for chaining
*/
public Builder notModCompatible() {
this.nullOutModinfo = true;
return this;
}

/**
* Enables nulling Players in the response.
* This will display the player count as {@code ???}.
*
* @return this builder, for chaining
*/
public Builder nullPlayers() {
this.nullOutPlayers = true;
return this;
}

/**
* Uses the {@code description} Component in the response.
*
* @param description Component to use as the description.
* @return this builder, for chaining
*/
public Builder description(net.kyori.adventure.text.Component description) {
this.description = Preconditions.checkNotNull(description, "description");
return this;
}

/**
* Uses the {@code favicon} in the response.
*
* @param favicon Favicon instance to use.
* @return this builder, for chaining
*/
public Builder favicon(Favicon favicon) {
this.favicon = Preconditions.checkNotNull(favicon, "favicon");
return this;
}

/**
* Clears the current favicon used in the response.
*
* @return this builder, for chaining
*/
public Builder clearFavicon() {
this.favicon = null;
return this;
Expand Down

0 comments on commit 0fe17ec

Please sign in to comment.