Skip to content

Commit

Permalink
fix: Update to Velocity 3.3.0 and change some imports accordingly whe…
Browse files Browse the repository at this point in the history
…re needed
  • Loading branch information
MemencioPerez committed May 8, 2024
1 parent c9a5555 commit 46137b1
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

repositories {
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://mvn.exceptionflug.de/repository/exceptionflug-public/")
maven("https://repo.william278.net/velocity/")
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group = io.github._4drian3d.unsignedvelocity
version = 1.4.2
version = 1.4.3-SNAPSHOT
description = Remove Signed Information from your Velocity Commands
url = https://github.com/4drian3d/UnSignedVelocity
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]

# Compile only
velocity = "3.2.0-SNAPSHOT"
velocity = "3.3.0-SNAPSHOT"
bstats = "3.0.2"

blossom = "1.3.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github._4drian3d.unsignedvelocity.configuration;

import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.hocon.HoconConfigurationLoader;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -20,18 +20,18 @@ public interface Configuration {
static Configuration loadConfig(final Path path) throws IOException {
final Path configPath = loadFiles(path);
final HoconConfigurationLoader loader = HoconConfigurationLoader.builder()
.setPath(configPath)
.path(configPath)
.build();

final CommentedConfigurationNode loaded = loader.load();

final boolean removeSignedKey = loaded.getNode("remove-signed-key-on-join")
final boolean removeSignedKey = loaded.node("remove-signed-key-on-join")
.getBoolean(false);
final boolean removeSigneCommandInformation = loaded.getNode("remove-signed-command-information")
final boolean removeSigneCommandInformation = loaded.node("remove-signed-command-information")
.getBoolean(false);
final boolean applyChatMessages = loaded.getNode("apply-chat-messages")
final boolean applyChatMessages = loaded.node("apply-chat-messages")
.getBoolean(true);
final boolean sendSecureChatData = loaded.getNode("send-secure-chat-data")
final boolean sendSecureChatData = loaded.node("send-secure-chat-data")
.getBoolean(false);

return new Configuration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.player.PlayerChatEvent;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChatPacket;
import io.github._4drian3d.unsignedvelocity.UnSignedVelocity;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.EventListener;
Expand All @@ -26,7 +26,7 @@ public void register() {

private void onChat(final PacketReceiveEvent event) {
// Packet sent by players with version 1.19 and 1.19.1
if (!(event.getPacket() instanceof final KeyedPlayerChat chatPacket)) {
if (!(event.getPacket() instanceof final KeyedPlayerChatPacket chatPacket)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.player.PlayerChatEvent;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChatPacket;
import io.github._4drian3d.unsignedvelocity.UnSignedVelocity;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.EventListener;
Expand All @@ -27,7 +27,7 @@ public void register() {

private void onChat(PacketReceiveEvent event) {
// Packet sent by players with version 1.19.3 and up
if (!(event.getPacket() instanceof final SessionPlayerChat chatPacket)) {
if (!(event.getPacket() instanceof final SessionPlayerChatPacket chatPacket)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.chat.CommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.builder.ChatBuilderV2;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommandPacket;
import io.github._4drian3d.unsignedvelocity.UnSignedVelocity;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.EventListener;
import io.github._4drian3d.vpacketevents.api.event.PacketReceiveEvent;

import java.util.concurrent.CompletableFuture;

public final class KeyedCommandListener implements EventListener, CommandHandler<KeyedPlayerCommand> {
public final class KeyedCommandListener implements EventListener, CommandHandler<KeyedPlayerCommandPacket> {
@Inject
private Configuration configuration;
@Inject
Expand All @@ -42,7 +42,7 @@ public boolean canBeLoaded() {
}

public void onCommand(final PacketReceiveEvent event) {
if (!(event.getPacket() instanceof final KeyedPlayerCommand packet)) {
if (!(event.getPacket() instanceof final KeyedPlayerCommandPacket packet)) {
return;
}

Expand Down Expand Up @@ -91,12 +91,12 @@ public void onCommand(final PacketReceiveEvent event) {
}

@Override
public Class<KeyedPlayerCommand> packetClass() {
return KeyedPlayerCommand.class;
public Class<KeyedPlayerCommandPacket> packetClass() {
return KeyedPlayerCommandPacket.class;
}

@Override
public void handlePlayerCommandInternal(KeyedPlayerCommand keyedPlayerCommand) {
public void handlePlayerCommandInternal(KeyedPlayerCommandPacket keyedPlayerCommand) {
//noop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.chat.CommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket;
import io.github._4drian3d.unsignedvelocity.UnSignedVelocity;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.EventListener;
import io.github._4drian3d.vpacketevents.api.event.PacketReceiveEvent;

import java.util.concurrent.CompletableFuture;

public final class SessionCommandListener implements EventListener, CommandHandler<SessionPlayerCommand> {
public final class SessionCommandListener implements EventListener, CommandHandler<SessionPlayerCommandPacket> {
@Inject
private Configuration configuration;
@Inject
Expand All @@ -41,7 +41,7 @@ public boolean canBeLoaded() {
}

public void onCommand(final PacketReceiveEvent event) {
if (!(event.getPacket() instanceof final SessionPlayerCommand packet)) {
if (!(event.getPacket() instanceof final SessionPlayerCommandPacket packet)) {
return;
}

Expand Down Expand Up @@ -89,12 +89,12 @@ public void onCommand(final PacketReceiveEvent event) {
}

@Override
public Class<SessionPlayerCommand> packetClass() {
return SessionPlayerCommand.class;
public Class<SessionPlayerCommandPacket> packetClass() {
return SessionPlayerCommandPacket.class;
}

@Override
public void handlePlayerCommandInternal(SessionPlayerCommand sessionPlayerCommand) {
public void handlePlayerCommandInternal(SessionPlayerCommandPacket sessionPlayerCommand) {
// noop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.inject.Inject;
import com.velocitypowered.api.event.EventManager;
import com.velocitypowered.proxy.protocol.packet.ServerData;
import com.velocitypowered.proxy.protocol.packet.ServerDataPacket;
import io.github._4drian3d.unsignedvelocity.UnSignedVelocity;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.EventListener;
Expand All @@ -16,8 +16,8 @@ public final class ServerDataListener implements EventListener {

static {
try {
final MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(ServerData.class, MethodHandles.lookup());
ENFORCED_SETTER = lookup.findSetter(ServerData.class, "secureChatEnforced", Boolean.TYPE);
final MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(ServerDataPacket.class, MethodHandles.lookup());
ENFORCED_SETTER = lookup.findSetter(ServerDataPacket.class, "secureChatEnforced", Boolean.TYPE);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand All @@ -36,7 +36,7 @@ public void register() {
}

private void onData(final PacketSendEvent event) {
if (!(event.getPacket() instanceof final ServerData serverData)) {
if (!(event.getPacket() instanceof final ServerDataPacket serverData)) {
return;
}

Expand Down

0 comments on commit 46137b1

Please sign in to comment.