Skip to content

Commit c3b6f32

Browse files
style: apply OpenRewrite
1 parent d452882 commit c3b6f32

24 files changed

Lines changed: 69 additions & 56 deletions

File tree

build-data/src/main/java/net/pistonmaster/pistonqueue/data/BuildData.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ public class BuildData {
2424
DESCRIPTION = properties.getProperty("description");
2525
URL = properties.getProperty("url");
2626
}
27+
28+
private BuildData() {
29+
}
2730
}

bukkit/src/main/java/net/pistonmaster/pistonqueue/bukkit/QueuePluginMessageListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ public final class QueuePluginMessageListener implements PluginMessageListener {
3838
@Override
3939
@SuppressWarnings("UnstableApiUsage")
4040
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player messagePlayer, byte[] message) {
41-
if (!channel.equals("piston:queue")) return;
41+
if (!"piston:queue".equals(channel)) {
42+
return;
43+
}
4244

4345
ByteArrayDataInput in = ByteStreams.newDataInput(message);
4446
String subChannel = in.readUTF();
4547

46-
if (plugin.isPlayXP() && subChannel.equals("xpV2")) {
48+
if (plugin.isPlayXP() && "xpV2".equals(subChannel)) {
4749
List<UUID> uuids = new ArrayList<>();
4850
int count = in.readInt();
4951
for (int i = 0; i < count; i++) {

bungee/src/main/java/net/pistonmaster/pistonqueue/bungee/PistonQueueBungee.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public Optional<String> getCurrentServer() {
209209

210210
@Override
211211
public void sendMessage(MessageType type, String message) {
212-
if (message.equalsIgnoreCase("/") || message.isBlank()) {
212+
if ("/".equalsIgnoreCase(message) || message.isBlank()) {
213213
return;
214214
}
215215

placeholder/src/main/java/net/pistonmaster/pistonqueue/placeholder/PistonQueuePlaceholder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ public void onEnable() {
5757

5858
@Override
5959
public void onPluginMessageReceived(String channel, @NotNull Player player, byte[] bytes) {
60-
if (!channel.equalsIgnoreCase("piston:queue")) {
60+
if (!"piston:queue".equalsIgnoreCase(channel)) {
6161
return;
6262
}
6363

6464
@SuppressWarnings({"UnstableApiUsage"})
6565
ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
6666
String subChannel = in.readUTF();
6767

68-
if (subChannel.equalsIgnoreCase("onlineQueue")) {
68+
if ("onlineQueue".equalsIgnoreCase(subChannel)) {
6969
int count = in.readInt();
7070

7171
for (int i = 0; i < count; i++) {
@@ -74,7 +74,7 @@ public void onPluginMessageReceived(String channel, @NotNull Player player, byte
7474

7575
onlineQueue.put(queue, online);
7676
}
77-
} else if (subChannel.equalsIgnoreCase("onlineTarget")) {
77+
} else if ("onlineTarget".equalsIgnoreCase(subChannel)) {
7878
int count = in.readInt();
7979

8080
for (int i = 0; i < count; i++) {

shared/src/main/java/net/pistonmaster/pistonqueue/shared/command/MainCommandShared.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,21 @@ default List<String> onTab(String[] args, PermissibleWrapper wrapper, PistonQueu
230230

231231
if (args.length == 1) {
232232
for (String string : commands) {
233-
if (string.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT)))
233+
if (string.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT))) {
234234
completions.add(string);
235+
}
235236
}
236237

237238
if (wrapper.hasPermission(config.ADMIN_PERMISSION)) {
238239
for (String string : adminCommands) {
239-
if (string.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT)))
240+
if (string.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT))) {
240241
completions.add(string);
242+
}
241243
}
242244
}
243245
} else if (wrapper.hasPermission(config.ADMIN_PERMISSION)
244246
&& args.length == 2
245-
&& (args[0].equalsIgnoreCase("shadowban") || args[0].equalsIgnoreCase("unshadowban"))) {
247+
&& ("shadowban".equalsIgnoreCase(args[0]) || "unshadowban".equalsIgnoreCase(args[0]))) {
246248
addPlayers(completions, args, plugin);
247249
}
248250

@@ -256,8 +258,9 @@ default List<String> onTab(String[] args, PermissibleWrapper wrapper, PistonQueu
256258

257259
default void addPlayers(List<String> completions, String[] args, PistonQueuePlugin proxy) {
258260
for (PlayerWrapper player : proxy.getPlayers()) {
259-
if (player.getName().toLowerCase(Locale.ROOT).startsWith(args[1].toLowerCase(Locale.ROOT)))
261+
if (player.getName().toLowerCase(Locale.ROOT).startsWith(args[1].toLowerCase(Locale.ROOT))) {
260262
completions.add(player.getName());
263+
}
261264
}
262265
}
263266

shared/src/main/java/net/pistonmaster/pistonqueue/shared/config/Config.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,23 @@ public final class Config {
6666

6767
@Comment("Where to send the queue position message and what to send.")
6868
public boolean POSITION_MESSAGE_CHAT = true;
69-
public boolean POSITION_MESSAGE_HOT_BAR = false;
69+
public boolean POSITION_MESSAGE_HOT_BAR;
7070
public String QUEUE_POSITION = "&6Position in queue: &l%position%";
7171
public int POSITION_MESSAGE_DELAY = 10000;
7272

7373
@Comment("Whether to show a custom player list header and footer (tab) with the queue position.")
7474
public boolean POSITION_PLAYER_LIST = true;
7575

7676
@Comment("This is a message to hide the actual reason of why you are getting kicked from the server.")
77-
public boolean ENABLE_KICK_MESSAGE = false;
77+
public boolean ENABLE_KICK_MESSAGE;
7878
public String KICK_MESSAGE = "&6You have lost connection to the server";
7979

8080
@Comment("Failure protection for the queue")
8181
public boolean PAUSE_QUEUE_IF_TARGET_DOWN = true;
8282
public String PAUSE_QUEUE_IF_TARGET_DOWN_MESSAGE = "&6The main server is down. We will be back soon!";
8383

8484
@Comment("When the servers are down should we prevent new players from joining the proxy?")
85-
public boolean KICK_WHEN_DOWN = false;
85+
public boolean KICK_WHEN_DOWN;
8686
public String SERVER_DOWN_KICK_MESSAGE = "%server_name% &6is down please try again later :(";
8787

8888
@Comment("%TARGET_SERVER%, %QUEUE_SERVER% and %SOURCE_SERVER% are placeholders for the server names")
@@ -114,13 +114,13 @@ public final class Config {
114114
public String QUEUE_SERVER = "queue";
115115
public String TARGET_SERVER = "main";
116116

117-
public boolean FORCE_TARGET_SERVER = false;
117+
public boolean FORCE_TARGET_SERVER;
118118

119119
@Comment({
120120
"Set this to true if you're a lobby or cracked/offline mode server.",
121121
"This option is required for those setups to work. Make your proxy sends source -> target."
122122
})
123-
public boolean ENABLE_SOURCE_SERVER = false;
123+
public boolean ENABLE_SOURCE_SERVER;
124124
public String SOURCE_SERVER = "lobby";
125125

126126
@Comment("Connecting to server message")
@@ -136,7 +136,7 @@ public final class Config {
136136
public int MAX_PLAYERS_PER_MOVE = 10;
137137

138138
@Comment("Should the queue be always active or only when the target server is full?")
139-
public boolean ALWAYS_QUEUE = false;
139+
public boolean ALWAYS_QUEUE;
140140

141141
@Comment("Send an XP sound to every player who gets to position 5 or below in the queue")
142142
public boolean SEND_XP_SOUND = true;
@@ -242,7 +242,7 @@ public void copyFrom(Config source) {
242242

243243
public QueueType getQueueType(PlayerWrapper player) {
244244
for (QueueType type : allQueueTypes) {
245-
if (type.getPermission().equals("default") || player.hasPermission(type.getPermission())) {
245+
if ("default".equals(type.getPermission()) || player.hasPermission(type.getPermission())) {
246246
return type;
247247
}
248248
}
@@ -443,7 +443,7 @@ private void registerGroup(QueueGroup group) {
443443
@Configuration
444444
public static final class QueueTypeConfiguration {
445445
private int ORDER = 1;
446-
private int SLOTS = 0;
446+
private int SLOTS;
447447
private String PERMISSION = "default";
448448
private List<String> HEADER = new ArrayList<>();
449449
private List<String> FOOTER = new ArrayList<>();

shared/src/main/java/net/pistonmaster/pistonqueue/shared/plugin/PistonQueuePlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ default void scheduleTasks(QueueListenerShared queueListener) {
133133
if (serverInfoWrapper.get().isOnline()) {
134134
queueListener.getOnlineServers().add(server);
135135
} else {
136-
warning(String.format("Server %s is down!!!", server));
136+
warning("Server %s is down!!!".formatted(server));
137137
queueListener.getOnlineServers().remove(server);
138138
}
139139
} else {
140-
warning(String.format("Server \"%s\" not set up!!! Check out: https://github.com/AlexProgrammerDE/PistonQueue/wiki/FAQ#server-not-set-up", server));
140+
warning("Server \"%s\" not set up!!! Check out: https://github.com/AlexProgrammerDE/PistonQueue/wiki/FAQ#server-not-set-up".formatted(server));
141141
}
142142
} finally {
143143
latch.countDown();

shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/logic/KickEventHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ private void handleKickMessage(PQKickedFromServerEvent event) {
8686
event.setKickMessage(config.KICK_MESSAGE);
8787
}
8888
}
89-
}
89+
}

shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/logic/QueueEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public String defaultTarget(QueueGroup group) {
9292
if (group.getTargetServers().isEmpty()) {
9393
return config().TARGET_SERVER;
9494
}
95-
return group.getTargetServers().get(0);
95+
return group.getTargetServers().getFirst();
9696
}
9797

9898
public boolean isGroupTargetOnline(QueueGroup group) {

shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/logic/ShadowBanKickHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ public void handleShadowBanKick(PlayerWrapper player) {
4646
player.disconnect(config.SERVER_DOWN_KICK_MESSAGE);
4747
}
4848
}
49-
}
49+
}

0 commit comments

Comments
 (0)