Skip to content

Commit

Permalink
Huh it actually works
Browse files Browse the repository at this point in the history
  • Loading branch information
lexize committed Oct 29, 2024
1 parent c92b681 commit d1b130b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
name: Forge-Artifacts
path: forge/build/libs/

# - name: Upload Spigot artifacts to GitHub
# uses: actions/upload-artifact@v3
# with:
# name: Spigot-Artifacts
# path: spigot/build/libs/
- name: Upload Spigot artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: Spigot-Artifacts
path: spigot/build/libs/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
public class AvatarDataPacket implements Packet {
public static final Identifier PACKET_ID = new Identifier("figura", "avatars/data");
public static final int MAX_CHUNK_SIZE = 32767 - 5;
public static final int MAX_CHUNK_SIZE = 32766 - 5;


private final int streamId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class CustomFSBPacket implements Packet {
public static final Identifier PACKET_ID = new Identifier("figura", "ping/server");
public static final int MAX_SERVER_PING_SIZE = 32767 - 4;
public static final int MAX_SERVER_PING_SIZE = 32766 - 4;
private final int id;
private final byte[] data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class C2SPingPacket implements Packet {
public static final Identifier PACKET_ID = new Identifier("figura", "c2s/ping");
public static final int MAX_PING_SIZE = 32767 - 21; // Max size of ping that is possible to send
public static final int MAX_PING_SIZE = 32766 - 21; // Max size of ping that is possible to send

private final int id;
private final boolean sync;
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ include("common:mojmap")
include("server-common")
include("fabric")
include("forge")
// include(":spigot")
include("spigot")

rootProject.name = "Figura"
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public Path getFiguraFolder() {
@Override
protected void sendPacketInternal(UUID receiver, Packet packet) {
Player player = Bukkit.getPlayer(receiver);
if (player == null) return;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStreamByteBuf buf = new OutputStreamByteBuf(baos);
packet.write(buf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,10 @@ public void onDisable() {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
var player = event.getPlayer();
var uuid = player.getUniqueId();
for (Identifier ident: FiguraServerSpigot.OUTCOMING_PACKETS) {
call(player, "addChannel", CHANNEL_ARGS, ident.toString());
srv.logDebug("Registered %s for %s".formatted(ident, player.getName()));
}
new BukkitRunnable() {
@Override
public void run() {
srv.sendHandshake(uuid);
srv.userManager().onUserJoin(uuid);
}
}.runTaskLater(this, 30);
}

@EventHandler
Expand Down

0 comments on commit d1b130b

Please sign in to comment.