Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Totally removed all uses of jsr305. Fixes #38
Dieser Commit ist enthalten in:
Ursprung
27760f5a97
Commit
8fd026e025
@ -4,8 +4,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.velocitypowered.api.proxy.InboundConnection;
|
import com.velocitypowered.api.proxy.InboundConnection;
|
||||||
import com.velocitypowered.api.server.ServerPing;
|
import com.velocitypowered.api.server.ServerPing;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class ProxyPingEvent {
|
public class ProxyPingEvent {
|
||||||
private final InboundConnection connection;
|
private final InboundConnection connection;
|
||||||
private ServerPing ping;
|
private ServerPing ping;
|
||||||
@ -23,7 +21,7 @@ public class ProxyPingEvent {
|
|||||||
return ping;
|
return ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPing(@Nonnull ServerPing ping) {
|
public void setPing(ServerPing ping) {
|
||||||
this.ping = Preconditions.checkNotNull(ping, "ping");
|
this.ping = Preconditions.checkNotNull(ping, "ping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
|
|||||||
import com.velocitypowered.api.scheduler.Scheduler;
|
import com.velocitypowered.api.scheduler.Scheduler;
|
||||||
import com.velocitypowered.api.server.ServerInfo;
|
import com.velocitypowered.api.server.ServerInfo;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -22,14 +21,14 @@ public interface ProxyServer {
|
|||||||
* @param username the username
|
* @param username the username
|
||||||
* @return an {@link Optional} with the player
|
* @return an {@link Optional} with the player
|
||||||
*/
|
*/
|
||||||
Optional<Player> getPlayer(@Nonnull String username);
|
Optional<Player> getPlayer(String username);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the player currently connected to this proxy by their Minecraft UUID.
|
* Retrieves the player currently connected to this proxy by their Minecraft UUID.
|
||||||
* @param uuid the UUID
|
* @param uuid the UUID
|
||||||
* @return an {@link Optional} with the player
|
* @return an {@link Optional} with the player
|
||||||
*/
|
*/
|
||||||
Optional<Player> getPlayer(@Nonnull UUID uuid);
|
Optional<Player> getPlayer(UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all players currently connected to this proxy. This call may or may not be a snapshot of all players
|
* Retrieves all players currently connected to this proxy. This call may or may not be a snapshot of all players
|
||||||
@ -49,7 +48,7 @@ public interface ProxyServer {
|
|||||||
* @param name the name of the server
|
* @param name the name of the server
|
||||||
* @return the server
|
* @return the server
|
||||||
*/
|
*/
|
||||||
Optional<ServerInfo> getServerInfo(@Nonnull String name);
|
Optional<ServerInfo> getServerInfo(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link ServerInfo}s registered with this proxy.
|
* Retrieves all {@link ServerInfo}s registered with this proxy.
|
||||||
@ -61,13 +60,13 @@ public interface ProxyServer {
|
|||||||
* Registers a server with this proxy. A server with this name should not already exist.
|
* Registers a server with this proxy. A server with this name should not already exist.
|
||||||
* @param server the server to register
|
* @param server the server to register
|
||||||
*/
|
*/
|
||||||
void registerServer(@Nonnull ServerInfo server);
|
void registerServer(ServerInfo server);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters this server from the proxy.
|
* Unregisters this server from the proxy.
|
||||||
* @param server the server to unregister
|
* @param server the server to unregister
|
||||||
*/
|
*/
|
||||||
void unregisterServer(@Nonnull ServerInfo server);
|
void unregisterServer(ServerInfo server);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an instance of {@link CommandSource} that can be used to determine if the command is being invoked by
|
* Returns an instance of {@link CommandSource} that can be used to determine if the command is being invoked by
|
||||||
|
@ -39,7 +39,6 @@ import net.kyori.text.serializer.GsonComponentSerializer;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
@ -73,12 +72,12 @@ public class VelocityServer implements ProxyServer {
|
|||||||
private final Map<String, ConnectedPlayer> connectionsByName = new ConcurrentHashMap<>();
|
private final Map<String, ConnectedPlayer> connectionsByName = new ConcurrentHashMap<>();
|
||||||
private final CommandSource consoleCommandSource = new CommandSource() {
|
private final CommandSource consoleCommandSource = new CommandSource() {
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(@Nonnull Component component) {
|
public void sendMessage(Component component) {
|
||||||
logger.info(ComponentSerializers.LEGACY.serialize(component));
|
logger.info(ComponentSerializers.LEGACY.serialize(component));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(@Nonnull String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -246,13 +245,13 @@ public class VelocityServer implements ProxyServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Player> getPlayer(@Nonnull String username) {
|
public Optional<Player> getPlayer(String username) {
|
||||||
Preconditions.checkNotNull(username, "username");
|
Preconditions.checkNotNull(username, "username");
|
||||||
return Optional.ofNullable(connectionsByName.get(username.toLowerCase(Locale.US)));
|
return Optional.ofNullable(connectionsByName.get(username.toLowerCase(Locale.US)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Player> getPlayer(@Nonnull UUID uuid) {
|
public Optional<Player> getPlayer(UUID uuid) {
|
||||||
Preconditions.checkNotNull(uuid, "uuid");
|
Preconditions.checkNotNull(uuid, "uuid");
|
||||||
return Optional.ofNullable(connectionsByUuid.get(uuid));
|
return Optional.ofNullable(connectionsByUuid.get(uuid));
|
||||||
}
|
}
|
||||||
@ -268,7 +267,7 @@ public class VelocityServer implements ProxyServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ServerInfo> getServerInfo(@Nonnull String name) {
|
public Optional<ServerInfo> getServerInfo(String name) {
|
||||||
Preconditions.checkNotNull(name, "name");
|
Preconditions.checkNotNull(name, "name");
|
||||||
return servers.getServer(name);
|
return servers.getServer(name);
|
||||||
}
|
}
|
||||||
@ -279,12 +278,12 @@ public class VelocityServer implements ProxyServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerServer(@Nonnull ServerInfo server) {
|
public void registerServer(ServerInfo server) {
|
||||||
servers.register(server);
|
servers.register(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unregisterServer(@Nonnull ServerInfo server) {
|
public void unregisterServer(ServerInfo server) {
|
||||||
servers.unregister(server);
|
servers.unregister(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,14 +9,13 @@ import com.velocitypowered.proxy.VelocityServer;
|
|||||||
import net.kyori.text.TextComponent;
|
import net.kyori.text.TextComponent;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ServerCommand implements Command {
|
public class ServerCommand implements Command {
|
||||||
@Override
|
@Override
|
||||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
public void execute(CommandSource source, String[] args) {
|
||||||
if (!(source instanceof Player)) {
|
if (!(source instanceof Player)) {
|
||||||
source.sendMessage(TextComponent.of("Only players may run this command.", TextColor.RED));
|
source.sendMessage(TextComponent.of("Only players may run this command.", TextColor.RED));
|
||||||
return;
|
return;
|
||||||
@ -42,7 +41,7 @@ public class ServerCommand implements Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> suggest(@Nonnull CommandSource source, @Nonnull String[] currentArgs) {
|
public List<String> suggest(CommandSource source, String[] currentArgs) {
|
||||||
if (currentArgs.length == 0) {
|
if (currentArgs.length == 0) {
|
||||||
return VelocityServer.getServer().getAllServers().stream()
|
return VelocityServer.getServer().getAllServers().stream()
|
||||||
.map(ServerInfo::getName)
|
.map(ServerInfo::getName)
|
||||||
|
@ -6,11 +6,9 @@ import com.velocitypowered.proxy.VelocityServer;
|
|||||||
import net.kyori.text.TextComponent;
|
import net.kyori.text.TextComponent;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class ShutdownCommand implements Command {
|
public class ShutdownCommand implements Command {
|
||||||
@Override
|
@Override
|
||||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
public void execute(CommandSource source, String[] args) {
|
||||||
if (source != VelocityServer.getServer().getConsoleCommandSource()) {
|
if (source != VelocityServer.getServer().getConsoleCommandSource()) {
|
||||||
source.sendMessage(TextComponent.of("You are not allowed to use this command.", TextColor.RED));
|
source.sendMessage(TextComponent.of("You are not allowed to use this command.", TextColor.RED));
|
||||||
return;
|
return;
|
||||||
|
@ -7,11 +7,9 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.ClickEvent;
|
import net.kyori.text.event.ClickEvent;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class VelocityCommand implements Command {
|
public class VelocityCommand implements Command {
|
||||||
@Override
|
@Override
|
||||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
public void execute(CommandSource source, String[] args) {
|
||||||
String implVersion = VelocityServer.class.getPackage().getImplementationVersion();
|
String implVersion = VelocityServer.class.getPackage().getImplementationVersion();
|
||||||
TextComponent thisIsVelocity = TextComponent.builder()
|
TextComponent thisIsVelocity = TextComponent.builder()
|
||||||
.content("This is ")
|
.content("This is ")
|
||||||
|
@ -33,7 +33,6 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -264,7 +263,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(@Nonnull String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return permissionFunction.getPermissionSetting(permission).asBoolean();
|
return permissionFunction.getPermissionSetting(permission).asBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import com.velocitypowered.proxy.plugin.loader.java.JavaVelocityPluginDescriptio
|
|||||||
import com.velocitypowered.proxy.plugin.loader.java.SerializedPluginDescription;
|
import com.velocitypowered.proxy.plugin.loader.java.SerializedPluginDescription;
|
||||||
import com.velocitypowered.proxy.plugin.loader.java.VelocityPluginModule;
|
import com.velocitypowered.proxy.plugin.loader.java.VelocityPluginModule;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
@ -34,7 +33,6 @@ public class JavaPluginLoader implements PluginLoader {
|
|||||||
this.baseDirectory = baseDirectory;
|
this.baseDirectory = baseDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public PluginDescription loadPlugin(Path source) throws Exception {
|
public PluginDescription loadPlugin(Path source) throws Exception {
|
||||||
Optional<SerializedPluginDescription> serialized = getSerializedPluginInfo(source);
|
Optional<SerializedPluginDescription> serialized = getSerializedPluginInfo(source);
|
||||||
@ -60,7 +58,6 @@ public class JavaPluginLoader implements PluginLoader {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public PluginContainer createPlugin(PluginDescription description) throws Exception {
|
public PluginContainer createPlugin(PluginDescription description) throws Exception {
|
||||||
if (!(description instanceof JavaVelocityPluginDescription)) {
|
if (!(description instanceof JavaVelocityPluginDescription)) {
|
||||||
|
@ -3,16 +3,13 @@ package com.velocitypowered.proxy.plugin.loader;
|
|||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import com.velocitypowered.api.plugin.PluginDescription;
|
import com.velocitypowered.api.plugin.PluginDescription;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used for loading plugins.
|
* This interface is used for loading plugins.
|
||||||
*/
|
*/
|
||||||
public interface PluginLoader {
|
public interface PluginLoader {
|
||||||
@Nonnull
|
|
||||||
PluginDescription loadPlugin(Path source) throws Exception;
|
PluginDescription loadPlugin(Path source) throws Exception;
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
PluginContainer createPlugin(PluginDescription plugin) throws Exception;
|
PluginContainer createPlugin(PluginDescription plugin) throws Exception;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren