mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Project wide syntax/annotation cleanup (#4238)
Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
This commit is contained in:
parent
998caee156
commit
95d65350e4
270 changed files with 891 additions and 977 deletions
|
@ -32,7 +32,7 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.security.SecureRandom;
|
||||
|
||||
public final class AesKeyProducer implements KeyProducer {
|
||||
public static int KEY_SIZE = 128;
|
||||
public static final int KEY_SIZE = 128;
|
||||
|
||||
@Override
|
||||
public SecretKey produce() {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.geysermc.floodgate.crypto;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.floodgate.util.InvalidFormatException;
|
||||
|
||||
import java.security.Key;
|
||||
|
@ -97,7 +98,8 @@ public interface FloodgateCipher {
|
|||
* @return the decrypted data in a UTF-8 String
|
||||
* @throws Exception when the decrypting failed
|
||||
*/
|
||||
default String decryptToString(byte[] data) throws Exception {
|
||||
@SuppressWarnings("unused")
|
||||
default @Nullable String decryptToString(byte[] data) throws Exception {
|
||||
byte[] decrypted = decrypt(data);
|
||||
if (decrypted == null) {
|
||||
return null;
|
||||
|
@ -113,6 +115,7 @@ public interface FloodgateCipher {
|
|||
* @return the decrypted data in a byte[]
|
||||
* @throws Exception when the decrypting failed
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
default byte[] decryptFromString(String data) throws Exception {
|
||||
return decrypt(data.getBytes(UTF_8));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.nio.file.Path;
|
|||
import java.security.Key;
|
||||
|
||||
public interface KeyProducer {
|
||||
Key produce();
|
||||
@SuppressWarnings("unused") Key produce();
|
||||
Key produceFrom(byte[] keyFileData);
|
||||
|
||||
default Key produceFrom(Path keyFileLocation) throws IOException {
|
||||
|
|
|
@ -109,6 +109,7 @@ public final class NewsItem {
|
|||
return (T) data;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getRawMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
package org.geysermc.floodgate.news;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public enum NewsItemAction {
|
||||
ON_SERVER_STARTED,
|
||||
ON_OPERATOR_JOIN,
|
||||
|
@ -33,7 +35,7 @@ public enum NewsItemAction {
|
|||
|
||||
private static final NewsItemAction[] VALUES = values();
|
||||
|
||||
public static NewsItemAction getByName(String actionName) {
|
||||
public static @Nullable NewsItemAction getByName(String actionName) {
|
||||
for (NewsItemAction type : VALUES) {
|
||||
if (type.name().equalsIgnoreCase(actionName)) {
|
||||
return type;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
package org.geysermc.floodgate.news;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
// {} is used for things that have to be filled in by the server,
|
||||
// {@} is for things that have to be filled in by us
|
||||
|
@ -49,7 +50,7 @@ public enum NewsItemMessage {
|
|||
this.messageSplitted = messageFormat.split(" ");
|
||||
}
|
||||
|
||||
public static NewsItemMessage getById(int id) {
|
||||
public static @Nullable NewsItemMessage getById(int id) {
|
||||
return VALUES.length > id ? VALUES[id] : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
package org.geysermc.floodgate.news;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.floodgate.news.data.*;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
@ -44,7 +45,7 @@ public enum NewsType {
|
|||
this.readFunction = readFunction;
|
||||
}
|
||||
|
||||
public static NewsType getByName(String newsType) {
|
||||
public static @Nullable NewsType getByName(String newsType) {
|
||||
for (NewsType type : VALUES) {
|
||||
if (type.name().equalsIgnoreCase(newsType)) {
|
||||
return type;
|
||||
|
|
|
@ -56,6 +56,7 @@ public final class BuildSpecificData implements ItemData {
|
|||
(allAffected || buildId > affectedGreaterThan && buildId < affectedLessThan);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getBranch() {
|
||||
return branch;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public final class ConfigSpecificData implements ItemData {
|
|||
return configSpecificData;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean isAffected(Map<String, String> config) {
|
||||
for (Map.Entry<String, Pattern> entry : affectedKeys.entrySet()) {
|
||||
if (config.containsKey(entry.getKey())) {
|
||||
|
|
|
@ -72,6 +72,7 @@ public final class BedrockData implements Cloneable {
|
|||
false, subscribeId, verifyCode);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static BedrockData fromString(String data) {
|
||||
String[] split = data.split("\0");
|
||||
if (split.length != EXPECTED_LENGTH) {
|
||||
|
@ -92,6 +93,7 @@ public final class BedrockData implements Cloneable {
|
|||
dataLength);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean hasPlayerLink() {
|
||||
return linkedPlayer != null;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
package org.geysermc.floodgate.util;
|
||||
|
||||
public class InvalidFormatException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidFormatException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ package org.geysermc.floodgate.util;
|
|||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -56,7 +57,7 @@ public final class LinkedPlayer implements Cloneable {
|
|||
return new LinkedPlayer(javaUsername, javaUniqueId, bedrockId);
|
||||
}
|
||||
|
||||
public static LinkedPlayer fromString(String data) {
|
||||
public static @Nullable LinkedPlayer fromString(String data) {
|
||||
String[] split = data.split(";");
|
||||
if (split.length != 3) {
|
||||
return null;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
package org.geysermc.floodgate.util;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public enum UiProfile {
|
||||
CLASSIC,
|
||||
POCKET;
|
||||
|
@ -37,7 +39,7 @@ public enum UiProfile {
|
|||
* @param id the UiProfile identifier
|
||||
* @return The UiProfile or {@link #CLASSIC} if the UiProfile wasn't found
|
||||
*/
|
||||
public static UiProfile fromId(int id) {
|
||||
public static @NonNull UiProfile fromId(int id) {
|
||||
return VALUES.length > id ? VALUES[id] : VALUES[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
package org.geysermc.floodgate.util;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public enum WebsocketEventType {
|
||||
/**
|
||||
* Sent once we successfully connected to the server
|
||||
|
@ -81,7 +83,7 @@ public enum WebsocketEventType {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public static WebsocketEventType fromId(int id) {
|
||||
public static @Nullable WebsocketEventType fromId(int id) {
|
||||
return VALUES.length > id ? VALUES[id] : null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue