Totally removed all uses of jsr305. Fixes #38
This commit is contained in:
@@ -39,7 +39,6 @@ import net.kyori.text.serializer.GsonComponentSerializer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
@@ -73,12 +72,12 @@ public class VelocityServer implements ProxyServer {
|
||||
private final Map<String, ConnectedPlayer> connectionsByName = new ConcurrentHashMap<>();
|
||||
private final CommandSource consoleCommandSource = new CommandSource() {
|
||||
@Override
|
||||
public void sendMessage(@Nonnull Component component) {
|
||||
public void sendMessage(Component component) {
|
||||
logger.info(ComponentSerializers.LEGACY.serialize(component));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@Nonnull String permission) {
|
||||
public boolean hasPermission(String permission) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -246,13 +245,13 @@ public class VelocityServer implements ProxyServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Player> getPlayer(@Nonnull String username) {
|
||||
public Optional<Player> getPlayer(String username) {
|
||||
Preconditions.checkNotNull(username, "username");
|
||||
return Optional.ofNullable(connectionsByName.get(username.toLowerCase(Locale.US)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Player> getPlayer(@Nonnull UUID uuid) {
|
||||
public Optional<Player> getPlayer(UUID uuid) {
|
||||
Preconditions.checkNotNull(uuid, "uuid");
|
||||
return Optional.ofNullable(connectionsByUuid.get(uuid));
|
||||
}
|
||||
@@ -268,7 +267,7 @@ public class VelocityServer implements ProxyServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ServerInfo> getServerInfo(@Nonnull String name) {
|
||||
public Optional<ServerInfo> getServerInfo(String name) {
|
||||
Preconditions.checkNotNull(name, "name");
|
||||
return servers.getServer(name);
|
||||
}
|
||||
@@ -279,12 +278,12 @@ public class VelocityServer implements ProxyServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerServer(@Nonnull ServerInfo server) {
|
||||
public void registerServer(ServerInfo server) {
|
||||
servers.register(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterServer(@Nonnull ServerInfo server) {
|
||||
public void unregisterServer(ServerInfo server) {
|
||||
servers.unregister(server);
|
||||
}
|
||||
|
||||
|
@@ -9,14 +9,13 @@ import com.velocitypowered.proxy.VelocityServer;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ServerCommand implements Command {
|
||||
@Override
|
||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
||||
public void execute(CommandSource source, String[] args) {
|
||||
if (!(source instanceof Player)) {
|
||||
source.sendMessage(TextComponent.of("Only players may run this command.", TextColor.RED));
|
||||
return;
|
||||
@@ -42,7 +41,7 @@ public class ServerCommand implements Command {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> suggest(@Nonnull CommandSource source, @Nonnull String[] currentArgs) {
|
||||
public List<String> suggest(CommandSource source, String[] currentArgs) {
|
||||
if (currentArgs.length == 0) {
|
||||
return VelocityServer.getServer().getAllServers().stream()
|
||||
.map(ServerInfo::getName)
|
||||
|
@@ -6,11 +6,9 @@ import com.velocitypowered.proxy.VelocityServer;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ShutdownCommand implements Command {
|
||||
@Override
|
||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
||||
public void execute(CommandSource source, String[] args) {
|
||||
if (source != VelocityServer.getServer().getConsoleCommandSource()) {
|
||||
source.sendMessage(TextComponent.of("You are not allowed to use this command.", TextColor.RED));
|
||||
return;
|
||||
|
@@ -7,11 +7,9 @@ import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.event.ClickEvent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class VelocityCommand implements Command {
|
||||
@Override
|
||||
public void execute(@Nonnull CommandSource source, @Nonnull String[] args) {
|
||||
public void execute(CommandSource source, String[] args) {
|
||||
String implVersion = VelocityServer.class.getPackage().getImplementationVersion();
|
||||
TextComponent thisIsVelocity = TextComponent.builder()
|
||||
.content("This is ")
|
||||
|
@@ -33,7 +33,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -264,7 +263,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@Nonnull String permission) {
|
||||
public boolean hasPermission(String permission) {
|
||||
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.VelocityPluginModule;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
@@ -34,7 +33,6 @@ public class JavaPluginLoader implements PluginLoader {
|
||||
this.baseDirectory = baseDirectory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public PluginDescription loadPlugin(Path source) throws Exception {
|
||||
Optional<SerializedPluginDescription> serialized = getSerializedPluginInfo(source);
|
||||
@@ -60,7 +58,6 @@ public class JavaPluginLoader implements PluginLoader {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public PluginContainer createPlugin(PluginDescription description) throws Exception {
|
||||
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.PluginDescription;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* This interface is used for loading plugins.
|
||||
*/
|
||||
public interface PluginLoader {
|
||||
@Nonnull
|
||||
PluginDescription loadPlugin(Path source) throws Exception;
|
||||
|
||||
@Nonnull
|
||||
PluginContainer createPlugin(PluginDescription plugin) throws Exception;
|
||||
}
|
||||
|
Reference in New Issue
Block a user