mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Use primitive long in task methods
This commit is contained in:
parent
9e59ef4c4a
commit
96b5051c75
@ -76,6 +76,15 @@ public interface UserConnection {
|
|||||||
*/
|
*/
|
||||||
void sendRawPacket(ByteBuf packet, boolean currentThread);
|
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.
|
* Send a raw packet to the player with returning the future.
|
||||||
*
|
*
|
||||||
@ -84,13 +93,6 @@ public interface UserConnection {
|
|||||||
*/
|
*/
|
||||||
ChannelFuture sendRawPacketFuture(ByteBuf packet);
|
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.
|
* 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
|
* @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.
|
* Monitors serverbound packets and returns whether a packet can/should be processed.
|
||||||
|
@ -103,7 +103,7 @@ public interface ViaPlatform<T> {
|
|||||||
* @param ticks The interval to run it after
|
* @param ticks The interval to run it after
|
||||||
* @return The Task ID
|
* @return The Task ID
|
||||||
*/
|
*/
|
||||||
PlatformTask runSync(Runnable runnable, Long ticks);
|
PlatformTask runSync(Runnable runnable, long ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a task at a repeating interval.
|
* Run a task at a repeating interval.
|
||||||
@ -113,7 +113,7 @@ public interface ViaPlatform<T> {
|
|||||||
* @param ticks The interval to run it at
|
* @param ticks The interval to run it at
|
||||||
* @return The Task ID
|
* @return The Task ID
|
||||||
*/
|
*/
|
||||||
PlatformTask runRepeatingSync(Runnable runnable, Long ticks);
|
PlatformTask runRepeatingSync(Runnable runnable, long ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels a task.
|
* Cancels a task.
|
||||||
|
@ -27,7 +27,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
public abstract class PartialType<T, X> extends Type<T> {
|
public abstract class PartialType<T, X> extends Type<T> {
|
||||||
private final X param;
|
private final X param;
|
||||||
|
|
||||||
public PartialType(X param, Class<T> type) {
|
protected PartialType(X param, Class<T> type) {
|
||||||
super(type);
|
super(type);
|
||||||
this.param = param;
|
this.param = param;
|
||||||
}
|
}
|
||||||
|
@ -198,12 +198,12 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlatformTask runSync(Runnable runnable, Long ticks) {
|
public PlatformTask runSync(Runnable runnable, long ticks) {
|
||||||
return new BukkitTaskId(getServer().getScheduler().runTaskLater(this, runnable, ticks));
|
return new BukkitTaskId(getServer().getScheduler().runTaskLater(this, runnable, ticks));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return new BukkitTaskId(getServer().getScheduler().runTaskTimer(this, runnable, 0, ticks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,12 +122,12 @@ public class BungeePlugin extends Plugin implements ViaPlatform<ProxiedPlayer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return new BungeeTaskId(getProxy().getScheduler().schedule(this, runnable, ticks * 50, TimeUnit.MILLISECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return new BungeeTaskId(getProxy().getScheduler().schedule(this, runnable, 0, ticks * 50, TimeUnit.MILLISECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,11 +142,6 @@ public class UserConnectionImpl implements UserConnection {
|
|||||||
return getChannel().newSucceededFuture();
|
return getChannel().newSucceededFuture();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRawPacket(ByteBuf packet) {
|
|
||||||
sendRawPacket(packet, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacketTracker getPacketTracker() {
|
public PacketTracker getPacketTracker() {
|
||||||
return packetTracker;
|
return packetTracker;
|
||||||
@ -224,11 +219,6 @@ public class UserConnectionImpl implements UserConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRawPacketToServer(ByteBuf packet) {
|
|
||||||
sendRawPacketToServer(packet, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkServerboundPacket() {
|
public boolean checkServerboundPacket() {
|
||||||
// Ignore if pending disconnect
|
// Ignore if pending disconnect
|
||||||
|
@ -146,7 +146,7 @@ public class SpongePlugin implements ViaPlatform<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlatformTask runSync(Runnable runnable, Long ticks) {
|
public PlatformTask runSync(Runnable runnable, long ticks) {
|
||||||
return new SpongeTaskId(
|
return new SpongeTaskId(
|
||||||
Task.builder()
|
Task.builder()
|
||||||
.execute(runnable)
|
.execute(runnable)
|
||||||
@ -156,7 +156,7 @@ public class SpongePlugin implements ViaPlatform<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) {
|
public PlatformTask runRepeatingSync(Runnable runnable, long ticks) {
|
||||||
return new SpongeTaskId(
|
return new SpongeTaskId(
|
||||||
Task.builder()
|
Task.builder()
|
||||||
.execute(runnable)
|
.execute(runnable)
|
||||||
|
@ -137,7 +137,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlatformTask runSync(Runnable runnable, Long ticks) {
|
public PlatformTask runSync(Runnable runnable, long ticks) {
|
||||||
return new VelocityTaskId(
|
return new VelocityTaskId(
|
||||||
PROXY.getScheduler()
|
PROXY.getScheduler()
|
||||||
.buildTask(this, runnable)
|
.buildTask(this, runnable)
|
||||||
@ -146,7 +146,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlatformTask runRepeatingSync(Runnable runnable, Long ticks) {
|
public PlatformTask runRepeatingSync(Runnable runnable, long ticks) {
|
||||||
return new VelocityTaskId(
|
return new VelocityTaskId(
|
||||||
PROXY.getScheduler()
|
PROXY.getScheduler()
|
||||||
.buildTask(this, runnable)
|
.buildTask(this, runnable)
|
||||||
|
Loading…
Reference in New Issue
Block a user