Project wide syntax/annotation cleanup (#4238)

Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
This commit is contained in:
chris 2023-12-06 00:54:42 +01:00 committed by GitHub
parent 998caee156
commit 95d65350e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
270 changed files with 891 additions and 977 deletions

View file

@ -38,6 +38,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
@ -51,7 +52,6 @@ import org.geysermc.geyser.platform.standalone.gui.GeyserStandaloneGUI;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.util.FileUtils;
import org.geysermc.geyser.util.LoopbackUtil;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
@ -292,7 +292,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
return new GeyserStandaloneDumpInfo(this);
}
@NotNull
@NonNull
@Override
public String getServerBindAddress() {
throw new IllegalStateException();
@ -325,7 +325,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
// Get the ignored properties
Set<String> ignoredProperties = OBJECT_MAPPER.getSerializationConfig().getAnnotationIntrospector()
.findPropertyIgnorals(beanDescription.getClassInfo()).getIgnored();
.findPropertyIgnoralByName(OBJECT_MAPPER.getSerializationConfig() ,beanDescription.getClassInfo()).getIgnored();
// Filter properties removing the ignored ones
return properties.stream()
@ -340,7 +340,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
* @param parentObject The object to alter
* @param value The new value of the property
*/
@SuppressWarnings("unchecked") // Required for enum usage
@SuppressWarnings({"unchecked", "rawtypes"}) // Required for enum usage
private static void setConfigOption(BeanPropertyDefinition property, Object parentObject, Object value) {
Object parsedValue = value;

View file

@ -28,11 +28,16 @@ package org.geysermc.geyser.platform.standalone.gui;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.io.Serial;
/**
* This class was based on this code: https://stackoverflow.com/a/6899478/5299903
* This class was based on this <a href="https://stackoverflow.com/a/6899478/5299903">code</a>
*/
public class ColorPane extends JTextPane {
@Serial
private static final long serialVersionUID = 1L;
private static Color colorCurrent = ANSIColor.RESET.getColor();
private String remaining = "";
@ -62,7 +67,7 @@ public class ColorPane extends JTextPane {
int aPos = 0; // current char position in addString
int aIndex; // index of next Escape sequence
int mIndex; // index of "m" terminating Escape sequence
String tmpString = "";
String tmpString;
boolean stillSearching = true; // true until no more Escape sequences
String addString = remaining + s;
remaining = "";

View file

@ -25,6 +25,7 @@
package org.geysermc.geyser.platform.standalone.gui;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.command.GeyserCommandManager;
@ -64,7 +65,6 @@ public class GeyserStandaloneGUI {
private final List<Integer> ramValues = new ArrayList<>();
private final DefaultTableModel playerTableModel = new DefaultTableModel();
private final JTable playerTable = new JTable(playerTableModel);
/**
* Create and show the Geyser-Standalone GUI
@ -158,6 +158,7 @@ public class GeyserStandaloneGUI {
playerTableModel.addColumn(GeyserLocale.getLocaleStringLog("geyser.gui.table.ip"));
playerTableModel.addColumn(GeyserLocale.getLocaleStringLog("geyser.gui.table.username"));
JTable playerTable = new JTable(playerTableModel);
JScrollPane playerScrollPane = new JScrollPane(playerTable);
rightContentPane.add(playerScrollPane);
@ -253,12 +254,12 @@ public class GeyserStandaloneGUI {
}
@Override
public void write(byte[] b, int off, int len) {
public void write(byte @NonNull [] b, int off, int len) {
appendConsole(new String(b, off, len));
}
@Override
public void write(byte[] b) {
public void write(byte @NonNull[] b) {
write(b, 0, b.length);
}
};

View file

@ -29,15 +29,20 @@ import lombok.Setter;
import javax.swing.*;
import java.awt.*;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* This has been modified to fit Geyser more but is based on
* https://gist.github.com/roooodcastro/6325153#gistcomment-3107524
* <a href="https://gist.github.com/roooodcastro/6325153#gistcomment-3107524">this Github gist</a>
*/
public final class GraphPanel extends JPanel {
@Serial
private static final long serialVersionUID = 1L;
private final static int padding = 10;
private final static int labelPadding = 25;
private final static int pointWidth = 4;
@ -103,7 +108,7 @@ public final class GraphPanel extends JPanel {
g.drawLine(padding + labelPadding + 1 + pointWidth, y, width - padding, y);
g.setColor(Color.BLACK);
final int tickValue = (int) (minScore + ((scoreRange * i) / numberYDivisions));
final int tickValue = minScore + ((scoreRange * i) / numberYDivisions);
final String yLabel = tickValue + "";
final int labelWidth = fontMetrics.stringWidth(yLabel);
g.drawString(yLabel, x1 - labelWidth - 5, y + (fontHeight / 2) - 3);