3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00
Dieser Commit ist enthalten in:
xxDark 2019-01-12 18:47:46 +03:00 committet von Andrew Steinborn
Ursprung 564b87de1d
Commit bc70c76aec
6 geänderte Dateien mit 21 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -47,13 +47,13 @@ public class VelocityCommandManager implements CommandManager {
} }
String alias = split[0]; String alias = split[0];
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
Command command = commands.get(alias.toLowerCase(Locale.ENGLISH)); Command command = commands.get(alias.toLowerCase(Locale.ENGLISH));
if (command == null) { if (command == null) {
return false; return false;
} }
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
try { try {
if (!command.hasPermission(source, actualArgs)) { if (!command.hasPermission(source, actualArgs)) {
return false; return false;
@ -103,14 +103,14 @@ public class VelocityCommandManager implements CommandManager {
return availableCommands; return availableCommands;
} }
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
Command command = commands.get(alias.toLowerCase(Locale.ENGLISH)); Command command = commands.get(alias.toLowerCase(Locale.ENGLISH));
if (command == null) { if (command == null) {
// No such command, so we can't offer any tab complete suggestions. // No such command, so we can't offer any tab complete suggestions.
return ImmutableList.of(); return ImmutableList.of();
} }
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
try { try {
if (!command.hasPermission(source, actualArgs)) { if (!command.hasPermission(source, actualArgs)) {
return ImmutableList.of(); return ImmutableList.of();
@ -140,14 +140,14 @@ public class VelocityCommandManager implements CommandManager {
} }
String alias = split[0]; String alias = split[0];
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
Command command = commands.get(alias.toLowerCase(Locale.ENGLISH)); Command command = commands.get(alias.toLowerCase(Locale.ENGLISH));
if (command == null) { if (command == null) {
// No such command. // No such command.
return false; return false;
} }
@SuppressWarnings("nullness")
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
try { try {
return command.hasPermission(source, actualArgs); return command.hasPermission(source, actualArgs);
} catch (Exception e) { } catch (Exception e) {

Datei anzeigen

@ -24,7 +24,6 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftCompressDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftCompressEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftCompressEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder;
import com.velocitypowered.proxy.protocol.packet.Disconnect;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
@ -136,7 +135,11 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (ctx.channel().isActive()) { if (ctx.channel().isActive()) {
if (sessionHandler != null) { if (sessionHandler != null) {
sessionHandler.exception(cause); try {
sessionHandler.exception(cause);
} catch (Exception ex) {
logger.error("{}: exception handling exception", (association != null ? association : channel.remoteAddress()), cause);
}
} }
if (association != null) { if (association != null) {

Datei anzeigen

@ -117,7 +117,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
// BungeeCord IP forwarding is simply a special injection after the "address" in the handshake, // BungeeCord IP forwarding is simply a special injection after the "address" in the handshake,
// separated by \0 (the null byte). In order, you send the original host, the player's IP, their // separated by \0 (the null byte). In order, you send the original host, the player's IP, their
// UUID (undashed), and if you are in online-mode, their login properties (from Mojang). // UUID (undashed), and if you are in online-mode, their login properties (from Mojang).
StringBuilder data = new StringBuilder(2048) StringBuilder data = new StringBuilder()
.append(registeredServer.getServerInfo().getAddress().getHostString()) .append(registeredServer.getServerInfo().getAddress().getHostString())
.append('\0') .append('\0')
.append(proxyPlayer.getRemoteAddress().getHostString()) .append(proxyPlayer.getRemoteAddress().getHostString())

Datei anzeigen

@ -13,7 +13,7 @@ import java.util.concurrent.CompletableFuture;
class SimpleHttpResponseCollector extends ChannelInboundHandlerAdapter { class SimpleHttpResponseCollector extends ChannelInboundHandlerAdapter {
private final StringBuilder buffer = new StringBuilder(1024); private final StringBuilder buffer = new StringBuilder();
private final CompletableFuture<SimpleHttpResponse> reply; private final CompletableFuture<SimpleHttpResponse> reply;
private int httpCode; private int httpCode;
private boolean canKeepAlive; private boolean canKeepAlive;

Datei anzeigen

@ -1,5 +1,6 @@
package com.velocitypowered.proxy.plugin; package com.velocitypowered.proxy.plugin;
import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
@ -31,6 +32,12 @@ public class PluginClassLoader extends URLClassLoader {
} }
} }
@Override
public void close() throws IOException {
loaders.remove(this);
super.close();
}
@Override @Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
return loadClass0(name, resolve, true); return loadClass0(name, resolve, true);

Datei anzeigen

@ -41,9 +41,7 @@ public class VelocityPluginManager implements PluginManager {
private void registerPlugin(PluginContainer plugin) { private void registerPlugin(PluginContainer plugin) {
plugins.put(plugin.getDescription().getId(), plugin); plugins.put(plugin.getDescription().getId(), plugin);
Optional<?> instance = plugin.getInstance(); Optional<?> instance = plugin.getInstance();
if (instance.isPresent()) { instance.ifPresent(o -> pluginInstances.put(o, plugin));
pluginInstances.put(instance.get(), plugin);
}
} }
/** /**