3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Use primitive long in task methods

Dieser Commit ist enthalten in:
KennyTV 2021-04-29 17:31:16 +02:00
Ursprung 9e59ef4c4a
Commit 96b5051c75
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
8 geänderte Dateien mit 23 neuen und 29 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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));
}

Datei anzeigen

@ -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));
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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