Use primitive long in task methods

This commit is contained in:
KennyTV 2021-04-29 17:31:16 +02:00
parent 9e59ef4c4a
commit 96b5051c75
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
8 changed files with 23 additions and 29 deletions

View File

@ -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.

View File

@ -103,7 +103,7 @@ public interface ViaPlatform<T> {
* @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<T> {
* @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.

View File

@ -27,7 +27,7 @@ import io.netty.buffer.ByteBuf;
public abstract class PartialType<T, X> extends Type<T> {
private final X param;
public PartialType(X param, Class<T> type) {
protected PartialType(X param, Class<T> type) {
super(type);
this.param = param;
}

View File

@ -198,12 +198,12 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
}
@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));
}

View File

@ -122,12 +122,12 @@ public class BungeePlugin extends Plugin implements ViaPlatform<ProxiedPlayer>,
}
@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));
}

View File

@ -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

View File

@ -146,7 +146,7 @@ public class SpongePlugin implements ViaPlatform<Player> {
}
@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<Player> {
}
@Override
public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) {
public PlatformTask runRepeatingSync(Runnable runnable, long ticks) {
return new SpongeTaskId(
Task.builder()
.execute(runnable)

View File

@ -137,7 +137,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
}
@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<Player> {
}
@Override
public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) {
public PlatformTask runRepeatingSync(Runnable runnable, long ticks) {
return new VelocityTaskId(
PROXY.getScheduler()
.buildTask(this, runnable)