Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Use primitive long in task methods
Dieser Commit ist enthalten in:
Ursprung
9e59ef4c4a
Commit
96b5051c75
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren