diff --git a/api/src/main/java/com/viaversion/viaversion/api/connection/UserConnection.java b/api/src/main/java/com/viaversion/viaversion/api/connection/UserConnection.java index 6737ba93e..58410f255 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/connection/UserConnection.java +++ b/api/src/main/java/com/viaversion/viaversion/api/connection/UserConnection.java @@ -76,6 +76,15 @@ public interface UserConnection { */ void sendRawPacket(ByteBuf packet, boolean currentThread); + /** + * Send a raw packet to the player (netty thread). + * + * @param packet The packet to send + */ + default void sendRawPacket(ByteBuf packet) { + sendRawPacket(packet, false); + } + /** * Send a raw packet to the player with returning the future. * @@ -84,13 +93,6 @@ public interface UserConnection { */ ChannelFuture sendRawPacketFuture(ByteBuf packet); - /** - * Send a raw packet to the player (netty thread). - * - * @param packet The packet to send - */ - void sendRawPacket(ByteBuf packet); - /** * Returns the user's packet tracker used for the inbuilt packet-limiter. * @@ -118,7 +120,9 @@ public interface UserConnection { * * @param packet Raw packet to be sent */ - void sendRawPacketToServer(ByteBuf packet); + default void sendRawPacketToServer(ByteBuf packet) { + sendRawPacketToServer(packet, false); + } /** * Monitors serverbound packets and returns whether a packet can/should be processed. diff --git a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java index bb32557bc..94b642cdf 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java +++ b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java @@ -103,7 +103,7 @@ public interface ViaPlatform { * @param ticks The interval to run it after * @return The Task ID */ - PlatformTask runSync(Runnable runnable, Long ticks); + PlatformTask runSync(Runnable runnable, long ticks); /** * Run a task at a repeating interval. @@ -113,7 +113,7 @@ public interface ViaPlatform { * @param ticks The interval to run it at * @return The Task ID */ - PlatformTask runRepeatingSync(Runnable runnable, Long ticks); + PlatformTask runRepeatingSync(Runnable runnable, long ticks); /** * Cancels a task. diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java b/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java index 401072b63..ed97e2b03 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java @@ -27,7 +27,7 @@ import io.netty.buffer.ByteBuf; public abstract class PartialType extends Type { private final X param; - public PartialType(X param, Class type) { + protected PartialType(X param, Class type) { super(type); this.param = param; } diff --git a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java index 990d26a4d..7cbdd902b 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java @@ -198,12 +198,12 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform } @Override - public PlatformTask runSync(Runnable runnable, Long ticks) { + public PlatformTask runSync(Runnable runnable, long ticks) { return new BukkitTaskId(getServer().getScheduler().runTaskLater(this, runnable, ticks)); } @Override - public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) { + public PlatformTask runRepeatingSync(Runnable runnable, long ticks) { return new BukkitTaskId(getServer().getScheduler().runTaskTimer(this, runnable, 0, ticks)); } diff --git a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java index ff963de7b..53ce09ee4 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java +++ b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java @@ -122,12 +122,12 @@ public class BungeePlugin extends Plugin implements ViaPlatform, } @Override - public PlatformTask runSync(Runnable runnable, Long ticks) { + public PlatformTask runSync(Runnable runnable, long ticks) { return new BungeeTaskId(getProxy().getScheduler().schedule(this, runnable, ticks * 50, TimeUnit.MILLISECONDS)); } @Override - public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) { + public PlatformTask runRepeatingSync(Runnable runnable, long ticks) { return new BungeeTaskId(getProxy().getScheduler().schedule(this, runnable, 0, ticks * 50, TimeUnit.MILLISECONDS)); } diff --git a/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java b/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java index 6018d8473..1fa3092bd 100644 --- a/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java @@ -142,11 +142,6 @@ public class UserConnectionImpl implements UserConnection { return getChannel().newSucceededFuture(); } - @Override - public void sendRawPacket(ByteBuf packet) { - sendRawPacket(packet, false); - } - @Override public PacketTracker getPacketTracker() { return packetTracker; @@ -224,11 +219,6 @@ public class UserConnectionImpl implements UserConnection { } } - @Override - public void sendRawPacketToServer(ByteBuf packet) { - sendRawPacketToServer(packet, false); - } - @Override public boolean checkServerboundPacket() { // Ignore if pending disconnect diff --git a/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java b/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java index 8f5572f84..2c812a557 100644 --- a/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java +++ b/sponge/src/main/java/com/viaversion/viaversion/SpongePlugin.java @@ -146,7 +146,7 @@ public class SpongePlugin implements ViaPlatform { } @Override - public PlatformTask runSync(Runnable runnable, Long ticks) { + public PlatformTask runSync(Runnable runnable, long ticks) { return new SpongeTaskId( Task.builder() .execute(runnable) @@ -156,7 +156,7 @@ public class SpongePlugin implements ViaPlatform { } @Override - public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) { + public PlatformTask runRepeatingSync(Runnable runnable, long ticks) { return new SpongeTaskId( Task.builder() .execute(runnable) diff --git a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java index 3edadc210..95972d3ae 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java +++ b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java @@ -137,7 +137,7 @@ public class VelocityPlugin implements ViaPlatform { } @Override - public PlatformTask runSync(Runnable runnable, Long ticks) { + public PlatformTask runSync(Runnable runnable, long ticks) { return new VelocityTaskId( PROXY.getScheduler() .buildTask(this, runnable) @@ -146,7 +146,7 @@ public class VelocityPlugin implements ViaPlatform { } @Override - public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) { + public PlatformTask runRepeatingSync(Runnable runnable, long ticks) { return new VelocityTaskId( PROXY.getScheduler() .buildTask(this, runnable)