Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Some cosmetic code changes and typo fixes
Dieser Commit ist enthalten in:
Ursprung
67ba0e9566
Commit
b1b0874c0f
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -71,7 +71,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Additional Server Info
|
label: Additional Server Info
|
||||||
description: |
|
description: |
|
||||||
Do you use a proxy (eg. BungeeCord)? What software do you use and what plugins?
|
Do you use a proxy (e.g. BungeeCord)? What software do you use and what plugins?
|
||||||
placeholder: |
|
placeholder: |
|
||||||
Example: "I also use BungeeCord with the following plugins: x, y, z"
|
Example: "I also use BungeeCord with the following plugins: x, y, z"
|
||||||
validations:
|
validations:
|
||||||
|
@ -117,7 +117,7 @@ public interface ViaAPI<T> {
|
|||||||
* Sends a raw packet to the player.
|
* Sends a raw packet to the player.
|
||||||
*
|
*
|
||||||
* @param player the platform's player object, e.g. for Bukkit this is Player
|
* @param player the platform's player object, e.g. for Bukkit this is Player
|
||||||
* @param packet the packet; you need a VarInt Id, then the packet contents
|
* @param packet the packet; you need a VarInt id, then the packet contents
|
||||||
* @throws IllegalArgumentException if the player is not injected by Via
|
* @throws IllegalArgumentException if the player is not injected by Via
|
||||||
*/
|
*/
|
||||||
void sendRawPacket(T player, ByteBuf packet);
|
void sendRawPacket(T player, ByteBuf packet);
|
||||||
@ -126,7 +126,7 @@ public interface ViaAPI<T> {
|
|||||||
* Sends a raw packet to the player.
|
* Sends a raw packet to the player.
|
||||||
*
|
*
|
||||||
* @param uuid the uuid from the player to send packet
|
* @param uuid the uuid from the player to send packet
|
||||||
* @param packet the packet; you need a VarInt Id, then the packet contents
|
* @param packet the packet; you need a VarInt id, then the packet contents
|
||||||
* @throws IllegalArgumentException if the player is not injected by Via
|
* @throws IllegalArgumentException if the player is not injected by Via
|
||||||
*/
|
*/
|
||||||
void sendRawPacket(UUID uuid, ByteBuf packet);
|
void sendRawPacket(UUID uuid, ByteBuf packet);
|
||||||
|
@ -28,7 +28,7 @@ public interface ViaCommandSender {
|
|||||||
/**
|
/**
|
||||||
* Check if the sender has a permission.
|
* Check if the sender has a permission.
|
||||||
*
|
*
|
||||||
* @param permission Permission string eg. viaversion.admin
|
* @param permission Permission string e.g. viaversion.admin
|
||||||
* @return True if the sender has the permission
|
* @return True if the sender has the permission
|
||||||
*/
|
*/
|
||||||
boolean hasPermission(String permission);
|
boolean hasPermission(String permission);
|
||||||
|
@ -65,7 +65,7 @@ public interface ConnectionManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the UUID from the frontend connection to this proxy server
|
* Returns the UUID from the frontend connection to this proxy server
|
||||||
* Returns null when there isn't a server or this connection isn't frontend or it doesn't have an id
|
* Returns null when there isn't a server or this connection isn't frontend, or it doesn't have an id
|
||||||
* When ViaVersion is reloaded, this method may not return some players.
|
* When ViaVersion is reloaded, this method may not return some players.
|
||||||
* May not return ProtocolSupport players.
|
* May not return ProtocolSupport players.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -31,14 +31,14 @@ public interface ViaInjector {
|
|||||||
/**
|
/**
|
||||||
* Inject into the current Platform
|
* Inject into the current Platform
|
||||||
*
|
*
|
||||||
* @throws Exception If there is an error with injecting
|
* @throws Exception if there is an error with injecting
|
||||||
*/
|
*/
|
||||||
void inject() throws Exception;
|
void inject() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uninject into the current Platform
|
* Uninject into the current Platform
|
||||||
*
|
*
|
||||||
* @throws Exception If there is an error with uninjecting
|
* @throws Exception if there is an error with uninjecting
|
||||||
*/
|
*/
|
||||||
void uninject() throws Exception;
|
void uninject() throws Exception;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public interface ViaInjector {
|
|||||||
* For proxies, this returns the lowest supported protocol version.
|
* For proxies, this returns the lowest supported protocol version.
|
||||||
*
|
*
|
||||||
* @return server protocol version
|
* @return server protocol version
|
||||||
* @throws Exception if there is an error with getting this info, eg. not binded
|
* @throws Exception if there is an error with getting this info, e.g. not binded
|
||||||
* @see ViaPlatform#isProxy()
|
* @see ViaPlatform#isProxy()
|
||||||
*/
|
*/
|
||||||
int getServerProtocolVersion() throws Exception;
|
int getServerProtocolVersion() throws Exception;
|
||||||
@ -66,7 +66,7 @@ public interface ViaInjector {
|
|||||||
* Returns the supported server protocol versions.
|
* Returns the supported server protocol versions.
|
||||||
*
|
*
|
||||||
* @return server protocol versions
|
* @return server protocol versions
|
||||||
* @throws Exception if there is an error with getting this info, eg. not binded
|
* @throws Exception if there is an error with getting this info, e.g. not binded
|
||||||
* @see ViaPlatform#isProxy()
|
* @see ViaPlatform#isProxy()
|
||||||
*/
|
*/
|
||||||
default IntSortedSet getServerProtocolVersions() throws Exception {
|
default IntSortedSet getServerProtocolVersions() throws Exception {
|
||||||
|
@ -25,7 +25,7 @@ package com.viaversion.viaversion.api.platform;
|
|||||||
public interface ViaPlatformLoader {
|
public interface ViaPlatformLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the loading for a platform, eg. registering listeners / providers / events etc.
|
* Initialise the loading for a platform, e.g. registering listeners / providers / events etc.
|
||||||
*/
|
*/
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.protocol.packet.Direction;
|
|||||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy protocol class when there is no need of any of the
|
* Dummy protocol class when there is no need of the
|
||||||
* existing packet type enums or automated channel mappings.
|
* existing packet type enums or automated channel mappings.
|
||||||
*
|
*
|
||||||
* @see Protocol
|
* @see Protocol
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
package com.viaversion.viaversion.api.protocol.packet;
|
package com.viaversion.viaversion.api.protocol.packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to be implemented by server outgoing packet type enums,
|
* Interface to be implemented by server outgoing packet types.
|
||||||
* representing PLAY state packets, ordered by their packet id.
|
|
||||||
*/
|
*/
|
||||||
public interface ClientboundPacketType extends PacketType {
|
public interface ClientboundPacketType extends PacketType {
|
||||||
|
|
||||||
|
@ -81,12 +81,10 @@ public class PacketTracker {
|
|||||||
if (connection.isClientSide()) return false; // Don't apply PPS limiting for client-side
|
if (connection.isClientSide()) return false; // Don't apply PPS limiting for client-side
|
||||||
ViaVersionConfig conf = Via.getConfig();
|
ViaVersionConfig conf = Via.getConfig();
|
||||||
// Max PPS Checker
|
// Max PPS Checker
|
||||||
if (conf.getMaxPPS() > 0) {
|
if (conf.getMaxPPS() > 0 && packetsPerSecond >= conf.getMaxPPS()) {
|
||||||
if (packetsPerSecond >= conf.getMaxPPS()) {
|
|
||||||
connection.disconnect(conf.getMaxPPSKickMessage().replace("%pps", Long.toString(packetsPerSecond)));
|
connection.disconnect(conf.getMaxPPSKickMessage().replace("%pps", Long.toString(packetsPerSecond)));
|
||||||
return true; // don't send current packet
|
return true; // don't send current packet
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Tracking PPS Checker
|
// Tracking PPS Checker
|
||||||
if (conf.getMaxWarnings() > 0 && conf.getTrackingPeriod() > 0) {
|
if (conf.getMaxWarnings() > 0 && conf.getTrackingPeriod() > 0) {
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
package com.viaversion.viaversion.api.protocol.packet;
|
package com.viaversion.viaversion.api.protocol.packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to be implemented by server incoming packet type enums,
|
* Interface to be implemented by server incoming packet types.
|
||||||
* representing PLAY state packets, ordered by their packet id.
|
|
||||||
*/
|
*/
|
||||||
public interface ServerboundPacketType extends PacketType {
|
public interface ServerboundPacketType extends PacketType {
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class ProtocolVersion {
|
|||||||
* @param snapshotVersion snapshot protocol version, or -1 if not a snapshot
|
* @param snapshotVersion snapshot protocol version, or -1 if not a snapshot
|
||||||
* @param name version name
|
* @param name version name
|
||||||
* @param versionRange range of versions that are supported by this protocol version, null if not a range
|
* @param versionRange range of versions that are supported by this protocol version, null if not a range
|
||||||
* @return registered {@link ProtocolVersion}
|
* @return registered ProtocolVersion
|
||||||
*/
|
*/
|
||||||
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
|
||||||
ProtocolVersion protocol = new ProtocolVersion(version, snapshotVersion, name, versionRange);
|
ProtocolVersion protocol = new ProtocolVersion(version, snapshotVersion, name, versionRange);
|
||||||
@ -130,11 +130,11 @@ public class ProtocolVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link ProtocolVersion} instance, even if this protocol version
|
* Returns a ProtocolVersion instance, even if this protocol version
|
||||||
* has not been registered. See {@link #isRegistered(int)} berorehand or {@link #isKnown()}.
|
* has not been registered. See {@link #isRegistered(int)} berorehand or {@link #isKnown()}.
|
||||||
*
|
*
|
||||||
* @param version protocol version
|
* @param version protocol version
|
||||||
* @return registered or unknown {@link ProtocolVersion}
|
* @return registered or unknown ProtocolVersion
|
||||||
*/
|
*/
|
||||||
public static @NonNull ProtocolVersion getProtocol(int version) {
|
public static @NonNull ProtocolVersion getProtocol(int version) {
|
||||||
ProtocolVersion protocolVersion = VERSIONS.get(version);
|
ProtocolVersion protocolVersion = VERSIONS.get(version);
|
||||||
@ -185,12 +185,10 @@ public class ProtocolVersion {
|
|||||||
if (majorVersion.equals(protocol) || (protocol.startsWith(name.substring(0, name.length() - 1)))) {
|
if (majorVersion.equals(protocol) || (protocol.startsWith(name.substring(0, name.length() - 1)))) {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
} else if (version.isRange()) {
|
} else if (version.isRange() && version.getIncludedVersions().contains(protocol)) {
|
||||||
if (version.getIncludedVersions().contains(protocol)) {
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +246,7 @@ public class ProtocolVersion {
|
|||||||
* Returns the snapshot protocol version without the snapshot indicator bit if this is a snapshot protocol version.
|
* Returns the snapshot protocol version without the snapshot indicator bit if this is a snapshot protocol version.
|
||||||
*
|
*
|
||||||
* @return snapshot protocol version without the snapshot indicator bit
|
* @return snapshot protocol version without the snapshot indicator bit
|
||||||
* @throws IllegalArgumentException if the version if not a snapshot version
|
* @throws IllegalArgumentException if the version is not a snapshot version
|
||||||
* @see #isSnapshot()
|
* @see #isSnapshot()
|
||||||
*/
|
*/
|
||||||
public int getSnapshotVersion() {
|
public int getSnapshotVersion() {
|
||||||
@ -260,7 +258,7 @@ public class ProtocolVersion {
|
|||||||
* Returns the snapshot protocol version with the snapshot indicator bit if this is a snapshot protocol version.
|
* Returns the snapshot protocol version with the snapshot indicator bit if this is a snapshot protocol version.
|
||||||
*
|
*
|
||||||
* @return snapshot protocol version with the snapshot indicator bit
|
* @return snapshot protocol version with the snapshot indicator bit
|
||||||
* @throws IllegalArgumentException if the version if not a snapshot version
|
* @throws IllegalArgumentException if the version is not a snapshot version
|
||||||
* @see #isSnapshot()
|
* @see #isSnapshot()
|
||||||
*/
|
*/
|
||||||
public int getFullSnapshotVersion() {
|
public int getFullSnapshotVersion() {
|
||||||
|
@ -52,7 +52,7 @@ public interface ServerProtocolVersion {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the actual protocol version has not yet been identified.
|
* Returns true if the actual protocol version has not yet been identified.
|
||||||
* In that case, all methods above will returns -1.
|
* In that case, all methods above will return -1.
|
||||||
*
|
*
|
||||||
* @return true if set, false if unknown (yet)
|
* @return true if set, false if unknown (yet)
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,7 @@ package com.viaversion.viaversion.api.protocol.version;
|
|||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.platform.providers.Provider;
|
import com.viaversion.viaversion.api.platform.providers.Provider;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
public interface VersionProvider extends Provider {
|
public interface VersionProvider extends Provider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
|
|
||||||
public class StringType extends Type<String> {
|
public class StringType extends Type<String> {
|
||||||
// String#length() (used to limit the string in Minecraft source code) uses char[]#length
|
// String#length() (used to limit the string in Minecraft source code) uses char[]#length
|
||||||
private static final int maxJavaCharUtf8Length = Character.toString(Character.MAX_VALUE)
|
private static final int MAX_CHAR_UTF_8_LENGTH = Character.toString(Character.MAX_VALUE)
|
||||||
.getBytes(StandardCharsets.UTF_8).length;
|
.getBytes(StandardCharsets.UTF_8).length;
|
||||||
private final int maxLength;
|
private final int maxLength;
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ public class StringType extends Type<String> {
|
|||||||
public String read(ByteBuf buffer) throws Exception {
|
public String read(ByteBuf buffer) throws Exception {
|
||||||
int len = Type.VAR_INT.readPrimitive(buffer);
|
int len = Type.VAR_INT.readPrimitive(buffer);
|
||||||
|
|
||||||
Preconditions.checkArgument(len <= maxLength * maxJavaCharUtf8Length,
|
Preconditions.checkArgument(len <= maxLength * MAX_CHAR_UTF_8_LENGTH,
|
||||||
"Cannot receive string longer than Short.MAX_VALUE * " + maxJavaCharUtf8Length + " bytes (got %s bytes)", len);
|
"Cannot receive string longer than Short.MAX_VALUE * " + MAX_CHAR_UTF_8_LENGTH + " bytes (got %s bytes)", len);
|
||||||
|
|
||||||
String string = buffer.toString(buffer.readerIndex(), len, StandardCharsets.UTF_8);
|
String string = buffer.toString(buffer.readerIndex(), len, StandardCharsets.UTF_8);
|
||||||
buffer.skipBytes(len);
|
buffer.skipBytes(len);
|
||||||
|
@ -58,7 +58,7 @@ public final class PaperViaInjector {
|
|||||||
try {
|
try {
|
||||||
Class.forName("org.bukkit.UnsafeValues").getDeclaredMethod("getProtocolVersion");
|
Class.forName("org.bukkit.UnsafeValues").getDeclaredMethod("getProtocolVersion");
|
||||||
return true;
|
return true;
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (final ClassNotFoundException | NoSuchMethodException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public final class PaperViaInjector {
|
|||||||
try {
|
try {
|
||||||
Class.forName(className);
|
Class.forName(className);
|
||||||
return true;
|
return true;
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (final ClassNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,7 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
|||||||
|
|
||||||
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf buf) {
|
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf buf) {
|
||||||
boolean needsCompress = false;
|
boolean needsCompress = false;
|
||||||
if (!handledCompression) {
|
if (!handledCompression && ctx.pipeline().names().indexOf("compress") > ctx.pipeline().names().indexOf("via-encoder")) {
|
||||||
if (ctx.pipeline().names().indexOf("compress") > ctx.pipeline().names().indexOf("via-encoder")) {
|
|
||||||
// Need to decompress this packet due to bad order
|
// Need to decompress this packet due to bad order
|
||||||
ByteBuf decompressed = BungeePipelineUtil.decompress(ctx, buf);
|
ByteBuf decompressed = BungeePipelineUtil.decompress(ctx, buf);
|
||||||
|
|
||||||
@ -80,16 +79,15 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reorder the pipeline
|
// Reorder the pipeline
|
||||||
ChannelHandler dec = ctx.pipeline().get("via-decoder");
|
ChannelHandler decoder = ctx.pipeline().get("via-decoder");
|
||||||
ChannelHandler enc = ctx.pipeline().get("via-encoder");
|
ChannelHandler encoder = ctx.pipeline().get("via-encoder");
|
||||||
ctx.pipeline().remove(dec);
|
ctx.pipeline().remove(decoder);
|
||||||
ctx.pipeline().remove(enc);
|
ctx.pipeline().remove(encoder);
|
||||||
ctx.pipeline().addAfter("decompress", "via-decoder", dec);
|
ctx.pipeline().addAfter("decompress", "via-decoder", decoder);
|
||||||
ctx.pipeline().addAfter("compress", "via-encoder", enc);
|
ctx.pipeline().addAfter("compress", "via-encoder", encoder);
|
||||||
needsCompress = true;
|
needsCompress = true;
|
||||||
handledCompression = true;
|
handledCompression = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return needsCompress;
|
return needsCompress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.connection.Server;
|
||||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
import net.md_5.bungee.api.event.ServerConnectEvent;
|
||||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||||
@ -140,16 +141,19 @@ public class BungeeServerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkServerChange(ServerConnectedEvent e, UserConnection user) throws Exception {
|
public void checkServerChange(ServerConnectedEvent event, UserConnection user) throws Exception {
|
||||||
if (user == null) return;
|
if (user == null || !user.has(BungeeStorage.class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-team handling
|
// Auto-team handling
|
||||||
// Handle server/version change
|
// Handle server/version change
|
||||||
if (user.has(BungeeStorage.class)) {
|
|
||||||
BungeeStorage storage = user.get(BungeeStorage.class);
|
BungeeStorage storage = user.get(BungeeStorage.class);
|
||||||
ProxiedPlayer player = storage.getPlayer();
|
Server server = event.getServer();
|
||||||
|
if (server == null || server.getInfo().getName().equals(storage.getCurrentServer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getServer() != null) {
|
|
||||||
if (!e.getServer().getInfo().getName().equals(storage.getCurrentServer())) {
|
|
||||||
// Clear auto-team
|
// Clear auto-team
|
||||||
EntityTracker1_9 oldEntityTracker = user.getEntityTracker(Protocol1_9To1_8.class);
|
EntityTracker1_9 oldEntityTracker = user.getEntityTracker(Protocol1_9To1_8.class);
|
||||||
if (oldEntityTracker != null) {
|
if (oldEntityTracker != null) {
|
||||||
@ -158,14 +162,13 @@ public class BungeeServerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String serverName = e.getServer().getInfo().getName();
|
String serverName = event.getServer().getInfo().getName();
|
||||||
|
|
||||||
storage.setCurrentServer(serverName);
|
storage.setCurrentServer(serverName);
|
||||||
|
|
||||||
int protocolId = Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName);
|
int protocolId = Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName);
|
||||||
|
|
||||||
if (protocolId <= ProtocolVersion.v1_8.getVersion()) { // 1.8 doesn't have BossBar packet
|
if (protocolId <= ProtocolVersion.v1_8.getVersion() && storage.getBossbar() != null) { // 1.8 doesn't have BossBar packet
|
||||||
if (storage.getBossbar() != null) {
|
|
||||||
// This ensures we can encode it properly as only the 1.9 protocol is currently implemented.
|
// This ensures we can encode it properly as only the 1.9 protocol is currently implemented.
|
||||||
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
|
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
|
||||||
for (UUID uuid : storage.getBossbar()) {
|
for (UUID uuid : storage.getBossbar()) {
|
||||||
@ -177,7 +180,6 @@ public class BungeeServerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
storage.getBossbar().clear();
|
storage.getBossbar().clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ProtocolInfo info = user.getProtocolInfo();
|
ProtocolInfo info = user.getProtocolInfo();
|
||||||
int previousServerProtocol = info.getServerProtocolVersion();
|
int previousServerProtocol = info.getServerProtocolVersion();
|
||||||
@ -207,7 +209,7 @@ public class BungeeServerHandler implements Listener {
|
|||||||
boolean toNewId = previousServerProtocol < id1_13 && protocolId >= id1_13;
|
boolean toNewId = previousServerProtocol < id1_13 && protocolId >= id1_13;
|
||||||
boolean toOldId = previousServerProtocol >= id1_13 && protocolId < id1_13;
|
boolean toOldId = previousServerProtocol >= id1_13 && protocolId < id1_13;
|
||||||
if (previousServerProtocol != -1 && (toNewId || toOldId)) {
|
if (previousServerProtocol != -1 && (toNewId || toOldId)) {
|
||||||
Collection<String> registeredChannels = (Collection<String>) getRegisteredChannels.invoke(e.getPlayer().getPendingConnection());
|
Collection<String> registeredChannels = (Collection<String>) getRegisteredChannels.invoke(event.getPlayer().getPendingConnection());
|
||||||
if (!registeredChannels.isEmpty()) {
|
if (!registeredChannels.isEmpty()) {
|
||||||
Collection<String> newChannels = new HashSet<>();
|
Collection<String> newChannels = new HashSet<>();
|
||||||
for (Iterator<String> iterator = registeredChannels.iterator(); iterator.hasNext(); ) {
|
for (Iterator<String> iterator = registeredChannels.iterator(); iterator.hasNext(); ) {
|
||||||
@ -229,7 +231,8 @@ public class BungeeServerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
registeredChannels.addAll(newChannels);
|
registeredChannels.addAll(newChannels);
|
||||||
}
|
}
|
||||||
PluginMessage brandMessage = (PluginMessage) getBrandMessage.invoke(e.getPlayer().getPendingConnection());
|
|
||||||
|
PluginMessage brandMessage = (PluginMessage) getBrandMessage.invoke(event.getPlayer().getPendingConnection());
|
||||||
if (brandMessage != null) {
|
if (brandMessage != null) {
|
||||||
String channel = brandMessage.getTag();
|
String channel = brandMessage.getTag();
|
||||||
if (toNewId) {
|
if (toNewId) {
|
||||||
@ -252,14 +255,13 @@ public class BungeeServerHandler implements Listener {
|
|||||||
protocol.init(user);
|
protocol.init(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProxiedPlayer player = storage.getPlayer();
|
||||||
EntityTracker1_9 newTracker = user.getEntityTracker(Protocol1_9To1_8.class);
|
EntityTracker1_9 newTracker = user.getEntityTracker(Protocol1_9To1_8.class);
|
||||||
if (newTracker != null) {
|
if (newTracker != null && Via.getConfig().isAutoTeam()) {
|
||||||
if (Via.getConfig().isAutoTeam()) {
|
|
||||||
String currentTeam = null;
|
String currentTeam = null;
|
||||||
for (Team team : player.getScoreboard().getTeams()) {
|
for (Team team : player.getScoreboard().getTeams()) {
|
||||||
if (team.getPlayers().contains(info.getUsername())) {
|
if (team.getPlayers().contains(info.getUsername())) {
|
||||||
currentTeam = team.getName();
|
currentTeam = team.getName();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +277,6 @@ public class BungeeServerHandler implements Listener {
|
|||||||
newTracker.setCurrentTeam(currentTeam);
|
newTracker.setCurrentTeam(currentTeam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Object wrapper = channelWrapper.get(player);
|
Object wrapper = channelWrapper.get(player);
|
||||||
setVersion.invoke(wrapper, protocolId);
|
setVersion.invoke(wrapper, protocolId);
|
||||||
@ -283,7 +284,4 @@ public class BungeeServerHandler implements Listener {
|
|||||||
Object entityMap = getEntityMap.invoke(null, protocolId);
|
Object entityMap = getEntityMap.invoke(null, protocolId);
|
||||||
entityRewrite.set(player, entityMap);
|
entityRewrite.set(player, entityMap);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,21 +27,17 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BungeePipelineUtil {
|
public class BungeePipelineUtil {
|
||||||
private static Method DECODE_METHOD;
|
private static final Method DECODE_METHOD;
|
||||||
private static Method ENCODE_METHOD;
|
private static final Method ENCODE_METHOD;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
DECODE_METHOD = MessageToMessageDecoder.class.getDeclaredMethod("decode", ChannelHandlerContext.class, Object.class, List.class);
|
DECODE_METHOD = MessageToMessageDecoder.class.getDeclaredMethod("decode", ChannelHandlerContext.class, Object.class, List.class);
|
||||||
DECODE_METHOD.setAccessible(true);
|
DECODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
||||||
ENCODE_METHOD.setAccessible(true);
|
ENCODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public abstract class ViaListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the UserConnection from an UUID
|
* Get the UserConnection from a UUID
|
||||||
*
|
*
|
||||||
* @param uuid UUID object
|
* @param uuid UUID object
|
||||||
* @return The UserConnection
|
* @return The UserConnection
|
||||||
|
@ -47,7 +47,7 @@ public class ProtocolInfoImpl implements ProtocolInfo {
|
|||||||
@Override
|
@Override
|
||||||
public void setClientState(final State clientState) {
|
public void setClientState(final State clientState) {
|
||||||
if (Via.getManager().debugHandler().enabled()) {
|
if (Via.getManager().debugHandler().enabled()) {
|
||||||
Via.getPlatform().getLogger().info("Client state changed from " + this.clientState + " to " + clientState + " for " + connection.getProtocolInfo().getUuid());
|
Via.getPlatform().getLogger().info("Client state changed from " + this.clientState + " to " + clientState + " for " + uuid);
|
||||||
}
|
}
|
||||||
this.clientState = clientState;
|
this.clientState = clientState;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ public class ProtocolInfoImpl implements ProtocolInfo {
|
|||||||
@Override
|
@Override
|
||||||
public void setServerState(final State serverState) {
|
public void setServerState(final State serverState) {
|
||||||
if (Via.getManager().debugHandler().enabled()) {
|
if (Via.getManager().debugHandler().enabled()) {
|
||||||
Via.getPlatform().getLogger().info("Server state changed from " + this.serverState + " to " + serverState + " for " + connection.getProtocolInfo().getUuid());
|
Via.getPlatform().getLogger().info("Server state changed from " + this.serverState + " to " + serverState + " for " + uuid);
|
||||||
}
|
}
|
||||||
this.serverState = serverState;
|
this.serverState = serverState;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,9 @@ public class PacketWrapperImpl implements PacketWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendRaw(boolean currentThread) throws Exception {
|
private void sendRaw(boolean currentThread) throws Exception {
|
||||||
if (isCancelled()) return;
|
if (isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuf output = inputBuffer == null ? user().getChannel().alloc().buffer() : inputBuffer.alloc().buffer();
|
ByteBuf output = inputBuffer == null ? user().getChannel().alloc().buffer() : inputBuffer.alloc().buffer();
|
||||||
try {
|
try {
|
||||||
|
@ -40,7 +40,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
|
|||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
boolean newItem = item.identifier() >= 213 && item.identifier() <= 217;
|
boolean newItem = item.identifier() >= 213 && item.identifier() <= 217;
|
||||||
if (newItem) { // Replace server-side unknown items
|
if (newItem) { // Replace server-side unknown items
|
||||||
item.setIdentifier((short) 1);
|
item.setIdentifier(1);
|
||||||
item.setData((short) 0);
|
item.setData((short) 0);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -40,7 +40,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
|
|||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
boolean newItem = item.identifier() == 452;
|
boolean newItem = item.identifier() == 452;
|
||||||
if (newItem) { // Replace server-side unknown items
|
if (newItem) { // Replace server-side unknown items
|
||||||
item.setIdentifier((short) 1);
|
item.setIdentifier(1);
|
||||||
item.setData((short) 0);
|
item.setData((short) 0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -83,7 +83,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
|
|||||||
boolean newItem = item.identifier() >= 218 && item.identifier() <= 234;
|
boolean newItem = item.identifier() >= 218 && item.identifier() <= 234;
|
||||||
newItem |= item.identifier() == 449 || item.identifier() == 450;
|
newItem |= item.identifier() == 449 || item.identifier() == 450;
|
||||||
if (newItem) { // Replace server-side unknown items
|
if (newItem) { // Replace server-side unknown items
|
||||||
item.setIdentifier((short) 1);
|
item.setIdentifier(1);
|
||||||
item.setData((short) 0);
|
item.setData((short) 0);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -122,7 +122,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
|
|||||||
boolean newItem = item.identifier() >= 235 && item.identifier() <= 252;
|
boolean newItem = item.identifier() >= 235 && item.identifier() <= 252;
|
||||||
newItem |= item.identifier() == 453;
|
newItem |= item.identifier() == 453;
|
||||||
if (newItem) { // Replace server-side unknown items
|
if (newItem) { // Replace server-side unknown items
|
||||||
item.setIdentifier((short) 1);
|
item.setIdentifier(1);
|
||||||
item.setData((short) 0);
|
item.setData((short) 0);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -18,17 +18,17 @@
|
|||||||
package com.viaversion.viaversion.protocols.protocol1_13_2to1_13_1.packets;
|
package com.viaversion.viaversion.protocols.protocol1_13_2to1_13_1.packets;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_13;
|
import com.viaversion.viaversion.api.type.types.version.Types1_13;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_13_2;
|
import com.viaversion.viaversion.api.type.types.version.Types1_13_2;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol1_13_2To1_13_1 protocol) {
|
||||||
final PacketHandler metaTypeHandler = wrapper -> {
|
final PacketHandler metaTypeHandler = wrapper -> {
|
||||||
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
||||||
metadata.setMetaType(Types1_13_2.META_TYPES.byId(metadata.metaType().typeId()));
|
metadata.setMetaType(Types1_13_2.META_TYPES.byId(metadata.metaType().typeId()));
|
||||||
|
@ -26,11 +26,9 @@ public class TabCompleteThread implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) {
|
for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) {
|
||||||
if (info.getProtocolInfo() == null) continue;
|
if (info.getProtocolInfo() == null) continue;
|
||||||
if (info.getProtocolInfo().getPipeline().contains(Protocol1_13To1_12_2.class)) {
|
if (info.getProtocolInfo().getPipeline().contains(Protocol1_13To1_12_2.class) && info.getChannel().isOpen()) {
|
||||||
if (info.getChannel().isOpen()) {
|
|
||||||
info.get(TabCompleteTracker.class).sendPacketToServer(info);
|
info.get(TabCompleteTracker.class).sendPacketToServer(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class SpawnEggRewriter {
|
|||||||
spawnEggs.put(key, spawnEggs.size());
|
spawnEggs.put(key, spawnEggs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make it a non existing block id
|
// Make it a non-existing block id
|
||||||
public static int getSpawnEggId(String entityIdentifier) {
|
public static int getSpawnEggId(String entityIdentifier) {
|
||||||
// Fallback to bat
|
// Fallback to bat
|
||||||
if (!spawnEggs.containsKey(entityIdentifier))
|
if (!spawnEggs.containsKey(entityIdentifier))
|
||||||
|
@ -88,7 +88,9 @@ public class BlockEntityProvider implements Provider {
|
|||||||
wrapper.send(Protocol1_13To1_12_2.class);
|
wrapper.send(Protocol1_13To1_12_2.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
public interface BlockEntityHandler {
|
public interface BlockEntityHandler {
|
||||||
|
|
||||||
int transform(UserConnection user, CompoundTag tag);
|
int transform(UserConnection user, CompoundTag tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ public class EntityTracker1_14 extends EntityTrackerBase {
|
|||||||
private final Int2ObjectMap<Byte> playerEntityFlags = Int2ObjectSyncMap.hashmap();
|
private final Int2ObjectMap<Byte> playerEntityFlags = Int2ObjectSyncMap.hashmap();
|
||||||
private int latestTradeWindowId;
|
private int latestTradeWindowId;
|
||||||
private boolean forceSendCenterChunk = true;
|
private boolean forceSendCenterChunk = true;
|
||||||
private int chunkCenterX, chunkCenterZ;
|
private int chunkCenterX;
|
||||||
|
private int chunkCenterZ;
|
||||||
|
|
||||||
public EntityTracker1_14(UserConnection user) {
|
public EntityTracker1_14(UserConnection user) {
|
||||||
super(user, Entity1_14Types.PLAYER);
|
super(user, Entity1_14Types.PLAYER);
|
||||||
|
@ -207,7 +207,7 @@ public class ItemRewriter {
|
|||||||
newItem |= item.identifier() == 397 && item.data() == 5;
|
newItem |= item.identifier() == 397 && item.data() == 5;
|
||||||
newItem |= item.identifier() >= 432 && item.identifier() <= 448;
|
newItem |= item.identifier() >= 432 && item.identifier() <= 448;
|
||||||
if (newItem) { // Replace server-side unknown items
|
if (newItem) { // Replace server-side unknown items
|
||||||
item.setIdentifier((short) 1);
|
item.setIdentifier(1);
|
||||||
item.setData((short) 0);
|
item.setData((short) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,9 @@ public class EntityPackets {
|
|||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.INT, SpawnPackets.toNewDouble); // 1 - X - Needs to be divide by 32
|
map(Type.INT, SpawnPackets.toNewDouble); // 1 - X - Needs to be divided by 32
|
||||||
map(Type.INT, SpawnPackets.toNewDouble); // 2 - Y - Needs to be divide by 32
|
map(Type.INT, SpawnPackets.toNewDouble); // 2 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, SpawnPackets.toNewDouble); // 3 - Z - Needs to be divide by 32
|
map(Type.INT, SpawnPackets.toNewDouble); // 3 - Z - Needs to be divided by 32
|
||||||
|
|
||||||
map(Type.BYTE); // 4 - Pitch
|
map(Type.BYTE); // 4 - Pitch
|
||||||
map(Type.BYTE); // 5 - Yaw
|
map(Type.BYTE); // 5 - Yaw
|
||||||
@ -176,12 +176,11 @@ public class EntityPackets {
|
|||||||
int entityID = wrapper.get(Type.VAR_INT, 0);
|
int entityID = wrapper.get(Type.VAR_INT, 0);
|
||||||
Item stack = wrapper.get(Type.ITEM, 0);
|
Item stack = wrapper.get(Type.ITEM, 0);
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null && Protocol1_9To1_8.isSword(stack.identifier())) {
|
||||||
if (Protocol1_9To1_8.isSword(stack.identifier())) {
|
|
||||||
entityTracker.getValidBlocking().add(entityID);
|
entityTracker.getValidBlocking().add(entityID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
entityTracker.getValidBlocking().remove(entityID);
|
entityTracker.getValidBlocking().remove(entityID);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -234,7 +233,7 @@ public class EntityPackets {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
boolean showParticles = wrapper.read(Type.BOOLEAN); //In 1.8 = true->Show particles : false->Hide particles
|
boolean showParticles = wrapper.read(Type.BOOLEAN); //In 1.8 = true->Show particles : false->Hide particles
|
||||||
boolean newEffect = Via.getConfig().isNewEffectIndicator();
|
boolean newEffect = Via.getConfig().isNewEffectIndicator();
|
||||||
//0: hide, 1: shown without indictator, 2: shown with indicator, 3: hide with beacon indicator but we don't use it.
|
//0: hide, 1: shown without indictator, 2: shown with indicator, 3: hide with beacon indicator, but we don't use it.
|
||||||
wrapper.write(Type.BYTE, (byte) (showParticles ? newEffect ? 2 : 1 : 0));
|
wrapper.write(Type.BYTE, (byte) (showParticles ? newEffect ? 2 : 1 : 0));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,7 @@ public class InventoryPackets {
|
|||||||
final short property = wrapper.get(Type.SHORT, 0);
|
final short property = wrapper.get(Type.SHORT, 0);
|
||||||
short value = wrapper.get(Type.SHORT, 1);
|
short value = wrapper.get(Type.SHORT, 1);
|
||||||
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
||||||
if (inventoryTracker.getInventory() != null) {
|
if (inventoryTracker.getInventory() != null && inventoryTracker.getInventory().equalsIgnoreCase("minecraft:enchanting_table")) {
|
||||||
if (inventoryTracker.getInventory().equalsIgnoreCase("minecraft:enchanting_table")) {
|
|
||||||
if (property > 3 && property < 7) {
|
if (property > 3 && property < 7) {
|
||||||
// Send 2 properties, splitting it into enchantID & level
|
// Send 2 properties, splitting it into enchantID & level
|
||||||
final short level = (short) (value >> 8);
|
final short level = (short) (value >> 8);
|
||||||
@ -63,7 +62,6 @@ public class InventoryPackets {
|
|||||||
wrapper.set(Type.SHORT, 1, level);
|
wrapper.set(Type.SHORT, 1, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -125,13 +123,11 @@ public class InventoryPackets {
|
|||||||
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
||||||
|
|
||||||
short slotID = wrapper.get(Type.SHORT, 0);
|
short slotID = wrapper.get(Type.SHORT, 0);
|
||||||
if (inventoryTracker.getInventory() != null) {
|
if (inventoryTracker.getInventory() != null && inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
||||||
if (inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
|
||||||
if (slotID >= 4) {
|
if (slotID >= 4) {
|
||||||
wrapper.set(Type.SHORT, 0, (short) (slotID + 1));
|
wrapper.set(Type.SHORT, 0, (short) (slotID + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -171,8 +167,7 @@ public class InventoryPackets {
|
|||||||
// Brewing Patch
|
// Brewing Patch
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
||||||
if (inventoryTracker.getInventory() != null) {
|
if (inventoryTracker.getInventory() != null && inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
||||||
if (inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
|
||||||
Item[] oldStack = wrapper.get(Type.ITEM_ARRAY, 0);
|
Item[] oldStack = wrapper.get(Type.ITEM_ARRAY, 0);
|
||||||
Item[] newStack = new Item[oldStack.length + 1];
|
Item[] newStack = new Item[oldStack.length + 1];
|
||||||
for (int i = 0; i < newStack.length; i++) {
|
for (int i = 0; i < newStack.length; i++) {
|
||||||
@ -186,7 +181,6 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
wrapper.set(Type.ITEM_ARRAY, 0, newStack);
|
wrapper.set(Type.ITEM_ARRAY, 0, newStack);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -298,8 +292,7 @@ public class InventoryPackets {
|
|||||||
final short slot = wrapper.get(Type.SHORT, 0);
|
final short slot = wrapper.get(Type.SHORT, 0);
|
||||||
boolean throwItem = (slot == 45 && windowID == 0);
|
boolean throwItem = (slot == 45 && windowID == 0);
|
||||||
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
InventoryTracker inventoryTracker = wrapper.user().get(InventoryTracker.class);
|
||||||
if (inventoryTracker.getInventory() != null) {
|
if (inventoryTracker.getInventory() != null && inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
||||||
if (inventoryTracker.getInventory().equals("minecraft:brewing_stand")) {
|
|
||||||
if (slot == 4) {
|
if (slot == 4) {
|
||||||
throwItem = true;
|
throwItem = true;
|
||||||
}
|
}
|
||||||
@ -307,7 +300,6 @@ public class InventoryPackets {
|
|||||||
wrapper.set(Type.SHORT, 0, (short) (slot - 1));
|
wrapper.set(Type.SHORT, 0, (short) (slot - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (throwItem) {
|
if (throwItem) {
|
||||||
// Send a packet wiping the slot
|
// Send a packet wiping the slot
|
||||||
@ -328,7 +320,9 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerServerbound(ServerboundPackets1_9.CLOSE_WINDOW, new PacketHandlers() {
|
protocol.registerServerbound(ServerboundPackets1_9.CLOSE_WINDOW, new
|
||||||
|
|
||||||
|
PacketHandlers() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
@ -343,7 +337,9 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerServerbound(ServerboundPackets1_9.HELD_ITEM_CHANGE, new PacketHandlers() {
|
protocol.registerServerbound(ServerboundPackets1_9.HELD_ITEM_CHANGE, new
|
||||||
|
|
||||||
|
PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.SHORT); // 0 - Slot id
|
map(Type.SHORT); // 0 - Slot id
|
||||||
|
@ -195,7 +195,7 @@ public class PlayerPackets {
|
|||||||
clientWorld.setEnvironment(dimensionId);
|
clientWorld.setEnvironment(dimensionId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Gotta fake their op
|
// Fake their op status
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
||||||
provider.sendPermission(wrapper.user());
|
provider.sendPermission(wrapper.user());
|
||||||
@ -381,11 +381,9 @@ public class PlayerPackets {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
int hand = wrapper.read(Type.VAR_INT);
|
int hand = wrapper.read(Type.VAR_INT);
|
||||||
|
|
||||||
if (Via.getConfig().isLeftHandedHandling()) {
|
// Add 0x80 if left-handed
|
||||||
// Add 0x80 if left handed
|
if (Via.getConfig().isLeftHandedHandling() && hand == 0) {
|
||||||
if (hand == 0) wrapper.set(Type.UNSIGNED_BYTE, 0,
|
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) (wrapper.get(Type.UNSIGNED_BYTE, 0).intValue() | 0x80));
|
||||||
(short) (wrapper.get(Type.UNSIGNED_BYTE, 0).intValue() | 0x80)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
wrapper.sendToServer(Protocol1_9To1_8.class);
|
wrapper.sendToServer(Protocol1_9To1_8.class);
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
|
@ -69,9 +69,9 @@ public class SpawnPackets {
|
|||||||
tracker.sendMetadataBuffer(entityID);
|
tracker.sendMetadataBuffer(entityID);
|
||||||
});
|
});
|
||||||
|
|
||||||
map(Type.INT, toNewDouble); // 3 - X - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 3 - X - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 4 - Y - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 4 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 5 - Z - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 5 - Z - Needs to be divided by 32
|
||||||
|
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
map(Type.BYTE); // 7 - Yaw
|
map(Type.BYTE); // 7 - Yaw
|
||||||
@ -82,7 +82,9 @@ public class SpawnPackets {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
int data = wrapper.get(Type.INT, 0); // Data (1st Integer)
|
int data = wrapper.get(Type.INT, 0); // Data (1st Integer)
|
||||||
|
|
||||||
short vX = 0, vY = 0, vZ = 0;
|
short vX = 0;
|
||||||
|
short vY = 0;
|
||||||
|
short vZ = 0;
|
||||||
if (data > 0) {
|
if (data > 0) {
|
||||||
vX = wrapper.read(Type.SHORT);
|
vX = wrapper.read(Type.SHORT);
|
||||||
vY = wrapper.read(Type.SHORT);
|
vY = wrapper.read(Type.SHORT);
|
||||||
@ -134,9 +136,9 @@ public class SpawnPackets {
|
|||||||
tracker.sendMetadataBuffer(entityID);
|
tracker.sendMetadataBuffer(entityID);
|
||||||
});
|
});
|
||||||
|
|
||||||
map(Type.INT, toNewDouble); // 1 - X - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 1 - X - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 2 - Y - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 2 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 3 - Z - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 3 - Z - Needs to be divided by 32
|
||||||
|
|
||||||
map(Type.SHORT); // 4 - Amount to spawn
|
map(Type.SHORT); // 4 - Amount to spawn
|
||||||
}
|
}
|
||||||
@ -156,9 +158,9 @@ public class SpawnPackets {
|
|||||||
tracker.sendMetadataBuffer(entityID);
|
tracker.sendMetadataBuffer(entityID);
|
||||||
});
|
});
|
||||||
|
|
||||||
map(Type.INT, toNewDouble); // 2 - X - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 2 - X - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 3 - Y - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 3 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 4 - Z - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 4 - Z - Needs to be divided by 32
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,9 +185,9 @@ public class SpawnPackets {
|
|||||||
tracker.sendMetadataBuffer(entityID);
|
tracker.sendMetadataBuffer(entityID);
|
||||||
});
|
});
|
||||||
|
|
||||||
map(Type.INT, toNewDouble); // 3 - X - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 3 - X - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 4 - Y - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 4 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 5 - Z - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 5 - Z - Needs to be divided by 32
|
||||||
|
|
||||||
map(Type.BYTE); // 6 - Yaw
|
map(Type.BYTE); // 6 - Yaw
|
||||||
map(Type.BYTE); // 7 - Pitch
|
map(Type.BYTE); // 7 - Pitch
|
||||||
@ -255,9 +257,9 @@ public class SpawnPackets {
|
|||||||
tracker.sendMetadataBuffer(entityID);
|
tracker.sendMetadataBuffer(entityID);
|
||||||
});
|
});
|
||||||
|
|
||||||
map(Type.INT, toNewDouble); // 2 - X - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 2 - X - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 3 - Y - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 3 - Y - Needs to be divided by 32
|
||||||
map(Type.INT, toNewDouble); // 4 - Z - Needs to be divide by 32
|
map(Type.INT, toNewDouble); // 4 - Z - Needs to be divided by 32
|
||||||
|
|
||||||
map(Type.BYTE); // 5 - Yaw
|
map(Type.BYTE); // 5 - Yaw
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
|
@ -32,8 +32,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
|||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
|
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type;
|
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ItemRewriter;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ItemRewriter;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||||
@ -92,7 +92,7 @@ public class WorldPackets {
|
|||||||
public void register() {
|
public void register() {
|
||||||
map(Type.STRING); // 0 - Sound Name
|
map(Type.STRING); // 0 - Sound Name
|
||||||
// 1 - Sound Category ID
|
// 1 - Sound Category ID
|
||||||
// Everything else get's written through
|
// Everything else gets written through
|
||||||
|
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
String name = wrapper.get(Type.STRING, 0);
|
String name = wrapper.get(Type.STRING, 0);
|
||||||
@ -298,8 +298,7 @@ public class WorldPackets {
|
|||||||
: item != null && Protocol1_9To1_8.isSword(item.identifier());
|
: item != null && Protocol1_9To1_8.isSword(item.identifier());
|
||||||
|
|
||||||
if (isSword) {
|
if (isSword) {
|
||||||
if (hand == 0) {
|
if (hand == 0 && !tracker.isBlocking()) {
|
||||||
if (!tracker.isBlocking()) {
|
|
||||||
tracker.setBlocking(true);
|
tracker.setBlocking(true);
|
||||||
|
|
||||||
// Check if the shield is already in the offhand
|
// Check if the shield is already in the offhand
|
||||||
@ -310,7 +309,6 @@ public class WorldPackets {
|
|||||||
tracker.setSecondHand(shield);
|
tracker.setSecondHand(shield);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Use the main hand to trigger the blocking
|
// Use the main hand to trigger the blocking
|
||||||
boolean blockUsingMainHand = Via.getConfig().isNoDelayShieldBlocking()
|
boolean blockUsingMainHand = Via.getConfig().isNoDelayShieldBlocking()
|
||||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class CommandBlockStorage implements StorableObject {
|
public class CommandBlockStorage implements StorableObject {
|
||||||
private final Map<Pair<Integer, Integer>, Map<Position, CompoundTag>> storedCommandBlocks = new ConcurrentHashMap<>();
|
private final Map<Pair<Integer, Integer>, Map<Position, CompoundTag>> storedCommandBlocks = new ConcurrentHashMap<>();
|
||||||
private boolean permissions = false;
|
private boolean permissions;
|
||||||
|
|
||||||
public void unloadChunk(int x, int z) {
|
public void unloadChunk(int x, int z) {
|
||||||
Pair<Integer, Integer> chunkPos = new Pair<>(x, z);
|
Pair<Integer, Integer> chunkPos = new Pair<>(x, z);
|
||||||
@ -38,14 +38,15 @@ public class CommandBlockStorage implements StorableObject {
|
|||||||
public void addOrUpdateBlock(Position position, CompoundTag tag) {
|
public void addOrUpdateBlock(Position position, CompoundTag tag) {
|
||||||
Pair<Integer, Integer> chunkPos = getChunkCoords(position);
|
Pair<Integer, Integer> chunkPos = getChunkCoords(position);
|
||||||
|
|
||||||
if (!storedCommandBlocks.containsKey(chunkPos))
|
if (!storedCommandBlocks.containsKey(chunkPos)) {
|
||||||
storedCommandBlocks.put(chunkPos, new ConcurrentHashMap<>());
|
storedCommandBlocks.put(chunkPos, new ConcurrentHashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
Map<Position, CompoundTag> blocks = storedCommandBlocks.get(chunkPos);
|
Map<Position, CompoundTag> blocks = storedCommandBlocks.get(chunkPos);
|
||||||
|
|
||||||
if (blocks.containsKey(position))
|
if (blocks.containsKey(position) && blocks.get(position).equals(tag)) {
|
||||||
if (blocks.get(position).equals(tag))
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
blocks.put(position, tag);
|
blocks.put(position, tag);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class EntityTracker1_9 extends EntityTrackerBase {
|
|||||||
// Update if there is no sword in the main hand or if the player has no shield in the second hand but a sword in the main hand
|
// Update if there is no sword in the main hand or if the player has no shield in the second hand but a sword in the main hand
|
||||||
if (!swordInHand || this.itemInSecondHand == null) {
|
if (!swordInHand || this.itemInSecondHand == null) {
|
||||||
|
|
||||||
// Update shield in off hand depending if a sword is in the main hand
|
// Update shield in off-hand depending on whether a sword is in the main hand
|
||||||
setSecondHand(swordInHand ? new DataItem(442, (byte) 1, (short) 0, null) : null);
|
setSecondHand(swordInHand ? new DataItem(442, (byte) 1, (short) 0, null) : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ import com.viaversion.viaversion.api.connection.StorableObject;
|
|||||||
public class MovementTracker implements StorableObject {
|
public class MovementTracker implements StorableObject {
|
||||||
private static final long IDLE_PACKET_DELAY = 50L; // Update every 50ms (20tps)
|
private static final long IDLE_PACKET_DELAY = 50L; // Update every 50ms (20tps)
|
||||||
private static final long IDLE_PACKET_LIMIT = 20; // Max 20 ticks behind
|
private static final long IDLE_PACKET_LIMIT = 20; // Max 20 ticks behind
|
||||||
private long nextIdlePacket = 0L;
|
private long nextIdlePacket;
|
||||||
private boolean ground = false;
|
private boolean ground;
|
||||||
|
|
||||||
public void incrementIdlePacket() {
|
public void incrementIdlePacket() {
|
||||||
// Notify of next update
|
// Notify of next update
|
||||||
|
@ -41,7 +41,7 @@ public class SoundRewriter<C extends ClientboundPacketType> {
|
|||||||
protocol.registerClientbound(packetType, new PacketHandlers() {
|
protocol.registerClientbound(packetType, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.VAR_INT); // Sound Id
|
map(Type.VAR_INT); // Sound id
|
||||||
handler(getSoundHandler());
|
handler(getSoundHandler());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -111,7 +111,7 @@ public class Version implements Comparable<Version> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tag, eg. -ALPHA
|
* Get the tag, e.g. -ALPHA
|
||||||
*
|
*
|
||||||
* @return The version tag
|
* @return The version tag
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ block-disconnect-msg: "You are using an unsupported Minecraft version!"
|
|||||||
# (We don't suggest using reload either, use a plugin manager)
|
# (We don't suggest using reload either, use a plugin manager)
|
||||||
# You can customise the message we kick people with if you use ProtocolLib here.
|
# You can customise the message we kick people with if you use ProtocolLib here.
|
||||||
reload-disconnect-msg: "Server reload, please rejoin!"
|
reload-disconnect-msg: "Server reload, please rejoin!"
|
||||||
# We warn when there's a error converting item and block data over versions, should we suppress these? (Only suggested if spamming)
|
# We warn when there's an error converting item and block data over versions, should we suppress these? (Only suggested if spamming)
|
||||||
suppress-conversion-warnings: false
|
suppress-conversion-warnings: false
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
@ -41,7 +41,7 @@ suppress-conversion-warnings: false
|
|||||||
bungee-ping-interval: 60
|
bungee-ping-interval: 60
|
||||||
# If the above is enabled, should we save the info to the config (in the section below)
|
# If the above is enabled, should we save the info to the config (in the section below)
|
||||||
bungee-ping-save: true
|
bungee-ping-save: true
|
||||||
# To get a servers protocol, ViaVersion will do the following:
|
# To get a server's protocol, ViaVersion will do the following:
|
||||||
# Look for the server in the following section, then look for the last ping if bungee-ping is enabled
|
# Look for the server in the following section, then look for the last ping if bungee-ping is enabled
|
||||||
# otherwise use default.
|
# otherwise use default.
|
||||||
#
|
#
|
||||||
@ -63,14 +63,14 @@ bungee-servers: {}
|
|||||||
velocity-ping-interval: 60
|
velocity-ping-interval: 60
|
||||||
# If the above is enabled, should we save the info to the config (in the section below)
|
# If the above is enabled, should we save the info to the config (in the section below)
|
||||||
velocity-ping-save: true
|
velocity-ping-save: true
|
||||||
# To get a servers protocol, ViaVersion will do the following:
|
# To get a server's protocol, ViaVersion will do the following:
|
||||||
# Look for the server in the following section, then look for the last ping if velocity-ping is enabled
|
# Look for the server in the following section, then look for the last ping if velocity-ping is enabled
|
||||||
# otherwise use default.
|
# otherwise use default.
|
||||||
#
|
#
|
||||||
# The format for the following is:
|
# The format for the following is:
|
||||||
# servername: protocolversion
|
# servername: protocolversion
|
||||||
# You can find protocol ids on https://wiki.vg/Protocol_version_numbers
|
# You can find protocol ids on https://wiki.vg/Protocol_version_numbers
|
||||||
# It will fallback to the default option if none found.
|
# It will fall back to the default option if none found.
|
||||||
velocity-servers: {}
|
velocity-servers: {}
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
@ -135,14 +135,14 @@ change-1_9-hitbox: false
|
|||||||
# WARNING: This gives 1.14+ players the ability to sneak under blocks, that players under that version cannot (sneaking in places that are only 1.5 blocks high)!
|
# WARNING: This gives 1.14+ players the ability to sneak under blocks, that players under that version cannot (sneaking in places that are only 1.5 blocks high)!
|
||||||
# Another thing to remember is that those players might be missed by projectiles and other hits directed at the very top of their head whilst sneaking.
|
# Another thing to remember is that those players might be missed by projectiles and other hits directed at the very top of their head whilst sneaking.
|
||||||
change-1_14-hitbox: false
|
change-1_14-hitbox: false
|
||||||
# Fixes 1.14+ clients on sub 1.14 servers having a light value of 0 for non full blocks.
|
# Fixes 1.14+ clients on sub 1.14 servers having a light value of 0 for non-full blocks.
|
||||||
fix-non-full-blocklight: true
|
fix-non-full-blocklight: true
|
||||||
# Fixes walk animation not shown when health is set to Float.NaN
|
# Fixes walk animation not shown when health is set to Float.NaN
|
||||||
fix-1_14-health-nan: true
|
fix-1_14-health-nan: true
|
||||||
# Should 1.15+ clients respawn instantly / without showing a death screen?
|
# Should 1.15+ clients respawn instantly / without showing a death screen?
|
||||||
use-1_15-instant-respawn: false
|
use-1_15-instant-respawn: false
|
||||||
#
|
#
|
||||||
# Enable serverside block-connections for 1.13+ clients - all of the options in this section are built around this option
|
# Enable serverside block-connections for 1.13+ clients - all the options in this section are built around this option
|
||||||
serverside-blockconnections: true
|
serverside-blockconnections: true
|
||||||
# Sets the method for the block connections (world for highly experimental (USE AT OWN RISK) world-level or packet for packet-level)
|
# Sets the method for the block connections (world for highly experimental (USE AT OWN RISK) world-level or packet for packet-level)
|
||||||
blockconnection-method: packet
|
blockconnection-method: packet
|
||||||
@ -191,7 +191,7 @@ auto-team: true
|
|||||||
suppress-metadata-errors: false
|
suppress-metadata-errors: false
|
||||||
# When enabled 1.9+ will be able to block by using shields
|
# When enabled 1.9+ will be able to block by using shields
|
||||||
shield-blocking: true
|
shield-blocking: true
|
||||||
# If this setting is active, the main hand is used instead of the off hand to trigger the blocking of the player.
|
# If this setting is active, the main hand is used instead of the off-hand to trigger the blocking of the player.
|
||||||
# With the main hand the blocking starts way faster.
|
# With the main hand the blocking starts way faster.
|
||||||
# (Requires "show-shield-when-sword-in-hand" to be disabled)
|
# (Requires "show-shield-when-sword-in-hand" to be disabled)
|
||||||
no-delay-shield-blocking: false
|
no-delay-shield-blocking: false
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// Data from https://minecraft.gamepedia.com/1.13/Flattening
|
|
||||||
{
|
{
|
||||||
"wooden_slab": [
|
"wooden_slab": [
|
||||||
"oak_slab",
|
"oak_slab",
|
||||||
|
@ -221,7 +221,7 @@ public class VelocityPlugin implements ViaServerProxyPlatform<Player> {
|
|||||||
true,
|
true,
|
||||||
p.getDescription().getName().orElse(p.getDescription().getId()),
|
p.getDescription().getName().orElse(p.getDescription().getId()),
|
||||||
p.getDescription().getVersion().orElse("Unknown Version"),
|
p.getDescription().getVersion().orElse("Unknown Version"),
|
||||||
p.getInstance().isPresent() ? p.getInstance().get().getClass().getCanonicalName() : "Unknown",
|
p.getInstance().map(instance -> instance.getClass().getCanonicalName()).orElse("Unknown"),
|
||||||
p.getDescription().getAuthors()
|
p.getDescription().getAuthors()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,10 @@ public class VelocityDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
// Move Via codec handlers back to right position
|
// Move Via codec handlers back to right position
|
||||||
ChannelPipeline pipeline = ctx.pipeline();
|
ChannelPipeline pipeline = ctx.pipeline();
|
||||||
|
|
||||||
ChannelHandler encoder = pipeline.get(VelocityChannelInitializer.VIA_ENCODER);
|
ChannelHandler encoder = pipeline.remove(VelocityChannelInitializer.VIA_ENCODER);
|
||||||
pipeline.remove(encoder);
|
|
||||||
pipeline.addBefore(VelocityChannelInitializer.MINECRAFT_ENCODER, VelocityChannelInitializer.VIA_ENCODER, encoder);
|
pipeline.addBefore(VelocityChannelInitializer.MINECRAFT_ENCODER, VelocityChannelInitializer.VIA_ENCODER, encoder);
|
||||||
|
|
||||||
ChannelHandler decoder = pipeline.get(VelocityChannelInitializer.VIA_DECODER);
|
ChannelHandler decoder = pipeline.remove(VelocityChannelInitializer.VIA_DECODER);
|
||||||
pipeline.remove(decoder);
|
|
||||||
pipeline.addBefore(VelocityChannelInitializer.MINECRAFT_DECODER, VelocityChannelInitializer.VIA_DECODER, decoder);
|
pipeline.addBefore(VelocityChannelInitializer.MINECRAFT_DECODER, VelocityChannelInitializer.VIA_DECODER, decoder);
|
||||||
|
|
||||||
super.userEventTriggered(ctx, event);
|
super.userEventTriggered(ctx, event);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren