Skip to content

Commit

Permalink
Address some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed May 9, 2024
1 parent 70fa514 commit 6636c28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//$$ import com.mojang.blaze3d.vertex.PoseStack;
//#endif

public class FriendsButton extends Button implements FriendsListUpdate {
public final class FriendsButton extends Button implements FriendsListUpdate {
private int bgX, bgWidth;

public FriendsButton(int x, int y, int width, int height, OnPress onPress) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.network.chat.Style;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.function.Supplier;

//#if MC >= 1.20.0
Expand All @@ -27,19 +28,18 @@
//$$ import io.github.gaming32.worldhost.gui.PlainTextButton;
//#endif

public class OnlineStatusButton extends PlainTextButton {
public final class OnlineStatusButton extends PlainTextButton {
private static final ChatFormatting[] COLORS = {
ChatFormatting.RED,
ChatFormatting.GOLD,
ChatFormatting.DARK_GREEN
};

@SuppressWarnings("unchecked")
private static final Supplier<Component>[] TEXTS = new Supplier[] {
private static final List<Supplier<Component>> TEXTS = List.of(
() -> Components.translatable("world-host.online_status.offline", WorldHost.reconnectDelay / 20 + 1),
() -> Components.translatable("world-host.online_status.connecting"),
() -> Components.translatable("world-host.online_status.online")
};
);

private final int alignedX;
private final boolean rightAlign;
Expand Down Expand Up @@ -87,7 +87,7 @@ private static Component generateStatusComponent() {
return Components.translatable(
"world-host.online_status",
Components.literal("\u25cf").withStyle(COLORS[status]),
TEXTS[status].get()
TEXTS.get(status).get()
);
}

Expand All @@ -110,7 +110,7 @@ private static Component generateStatusComponent() {
final int status = getStatus();
if (status != currentStatus || (status == 0 && (WorldHost.reconnectDelay + 1) % 20 == 0)) {
currentStatus = status;
final var accessor = (PlainTextButtonAccessor)this;
final var accessor = (PlainTextButtonAccessor)(Object)this;
final Component message = generateStatusComponent();
setMessage(message);
accessor.setPTBMessage(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;

public class ProtocolClient implements AutoCloseable, ProxyPassthrough {
public final class ProtocolClient implements AutoCloseable, ProxyPassthrough {
public static final int PROTOCOL_VERSION = 5;

private final String originalHost;
Expand Down

0 comments on commit 6636c28

Please sign in to comment.