Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Add url codec creation method with no content key, remove boolean return to registerAll, fix typo
Dieser Commit ist enthalten in:
Ursprung
2683b59406
Commit
ba78dbaf34
@ -62,9 +62,8 @@ public abstract class SessionLoadResourcePacksEvent extends ConnectionEvent {
|
||||
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
||||
*
|
||||
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
||||
* @return true if resource packs were added successfully, false if at least one failed
|
||||
*/
|
||||
public abstract boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||
public abstract void registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||
|
||||
/**
|
||||
* Unregisters a {@link ResourcePack} from being sent to the client.
|
||||
|
@ -58,9 +58,8 @@ public abstract class GeyserDefineResourcePacksEvent implements Event {
|
||||
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
||||
*
|
||||
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
||||
* @return true if resource packs were added successfully, false if at least one failed
|
||||
*/
|
||||
public abstract boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||
public abstract void registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -81,6 +81,17 @@ public abstract class PackCodec {
|
||||
return GeyserApi.api().provider(PathPackCodec.class, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pack provider from the given url with no content key.
|
||||
*
|
||||
* @param url the url to create the pack provider from
|
||||
* @return the new pack provider
|
||||
*/
|
||||
@NonNull
|
||||
public static PackCodec url(@NonNull String url) {
|
||||
return url(url, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pack provider from the given url and content key.
|
||||
*
|
||||
|
@ -60,14 +60,8 @@ public class GeyserDefineResourcePacksEventImpl extends GeyserDefineResourcePack
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||
boolean successful = true;
|
||||
for (ResourcePack pack : resourcePacks) {
|
||||
if (!this.register(pack)) {
|
||||
successful = false;
|
||||
}
|
||||
}
|
||||
return successful;
|
||||
public void registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||
resourcePacks.forEach(this::register);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,14 +61,8 @@ public class SessionLoadResourcePacksEventImpl extends SessionLoadResourcePacksE
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||
boolean successful = true;
|
||||
for (ResourcePack pack : resourcePacks) {
|
||||
if (!this.register(pack)) {
|
||||
successful = false;
|
||||
}
|
||||
}
|
||||
return successful;
|
||||
public void registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||
resourcePacks.forEach(this::register);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,7 @@ import java.util.OptionalInt;
|
||||
public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
|
||||
private boolean networkSettingsRequested = false;
|
||||
private final Deque<String> packsToSent = new ArrayDeque<>();
|
||||
private final Deque<String> packsToSend = new ArrayDeque<>();
|
||||
private final CompressionStrategy compressionStrategy;
|
||||
|
||||
private SessionLoadResourcePacksEventImpl resourcePackLoadEvent;
|
||||
@ -227,8 +227,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().name()));
|
||||
}
|
||||
case SEND_PACKS -> {
|
||||
packsToSent.addAll(packet.getPackIds());
|
||||
sendPackDataInfo(packsToSent.pop());
|
||||
packsToSend.addAll(packet.getPackIds());
|
||||
sendPackDataInfo(packsToSend.pop());
|
||||
}
|
||||
case HAVE_ALL_PACKS -> {
|
||||
ResourcePackStackPacket stackPacket = new ResourcePackStackPacket();
|
||||
@ -329,8 +329,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
session.sendUpstreamPacket(data);
|
||||
|
||||
// Check if it is the last chunk and send next pack in queue when available.
|
||||
if (remainingSize <= GeyserResourcePack.CHUNK_SIZE && !packsToSent.isEmpty()) {
|
||||
sendPackDataInfo(packsToSent.pop());
|
||||
if (remainingSize <= GeyserResourcePack.CHUNK_SIZE && !packsToSend.isEmpty()) {
|
||||
sendPackDataInfo(packsToSend.pop());
|
||||
}
|
||||
|
||||
return PacketSignal.HANDLED;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren