Skip to content

Commit c79fcfc

Browse files
committed
Reformat code
1 parent 4d95b39 commit c79fcfc

13 files changed

+37
-35
lines changed

src/main/java/net/clementraynaud/skoice/commands/ConfigureCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public ConfigureCommand(Skoice plugin, CommandExecutor executor, SlashCommandInt
3333
@Override
3434
public void run() {
3535
if (this.plugin.getBot().getStatus() == BotStatus.MFA_REQUIRED) {
36-
this.plugin.getListenerManager().update(executor.getUser());
36+
this.plugin.getListenerManager().update(this.executor.getUser());
3737
}
3838

3939
ConfigurationMenu menu = new ConfigurationMenu(super.plugin.getBot());

src/main/java/net/clementraynaud/skoice/commands/skoice/arguments/LanguageArgument.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void run() {
6161
if (this.plugin.getBot().getStatus() != BotStatus.NOT_CONNECTED) {
6262
this.plugin.getBot().getCommands().register();
6363
}
64-
64+
6565
this.sender.sendMessage(super.plugin.getLang().getMessage("chat.configuration.language-updated",
6666
language.getFullName()));
6767

src/main/java/net/clementraynaud/skoice/listeners/guild/voice/GuildVoiceGuildMuteListener.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void onGuildVoiceGuildMute(GuildVoiceGuildMuteEvent event) {
5252

5353
if (event.getMember().hasPermission(Permission.VOICE_MUTE_OTHERS)
5454
|| UpdateVoiceStateTask.getMutedUsers().contains(event.getMember().getId())) {
55-
event.getMember().mute(true).queue();;
55+
event.getMember().mute(true).queue();
5656
}
5757
}
5858
}

src/main/java/net/clementraynaud/skoice/menus/ConfigurationMenus.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private ConfigurationMenus() {
3232

3333
public static boolean contains(String messageId) {
3434
return ConfigurationMenus.menuSet.stream()
35-
.anyMatch(menu-> messageId.equals(menu.messageId));
35+
.anyMatch(menu -> messageId.equals(menu.messageId));
3636
}
3737

3838
public static Optional<ConfigurationMenu> getFromMessageId(String messageId) {
@@ -43,7 +43,7 @@ public static Optional<ConfigurationMenu> getFromMessageId(String messageId) {
4343

4444
public static void refreshAll() {
4545
ConfigurationMenus.menuSet.removeIf(menu -> menu.hook.isExpired());
46-
menuSet.forEach(menu -> menu.refreshId().editFromHook());
46+
ConfigurationMenus.menuSet.forEach(menu -> menu.refreshId().editFromHook());
4747
}
4848

4949
public static Set<ConfigurationMenu> getMenuSet() {

src/main/java/net/clementraynaud/skoice/menus/Menu.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
import net.dv8tion.jda.api.utils.messages.MessageCreateData;
3333
import org.bukkit.configuration.ConfigurationSection;
3434

35-
import java.util.*;
35+
import java.util.ArrayList;
36+
import java.util.Arrays;
37+
import java.util.Collections;
38+
import java.util.List;
3639
import java.util.stream.Collectors;
3740

3841
public class Menu {
@@ -107,7 +110,7 @@ private MessageEmbed getEmbed(String... args) {
107110
}
108111
embed.setAuthor(author.toString());
109112

110-
if (this.menuId.equals("settings")) {
113+
if ("settings".equals(this.menuId)) {
111114
List<String> unreviewedSettings = this.plugin.getConfigYamlFile().getStringList(ConfigField.UNREVIEWED_SETTINGS.toString());
112115
if (!unreviewedSettings.isEmpty()) {
113116
int stepSize = 3;
@@ -200,7 +203,7 @@ private ActionRow getSecondaryActionRow() {
200203
List<Button> secondaryButtons = new ArrayList<>();
201204
String root = this.getRoot();
202205

203-
if (root.equals("settings")
206+
if ("settings".equals(root)
204207
&& (this.plugin.getBot().getStatus() == BotStatus.READY || "language".equals(this.menuId))) {
205208
String backButtonId = this.parent == null ? "unreachable" : this.parent;
206209
Button backButton = Button.secondary(backButtonId, "← " + this.plugin.getBot().getLang().getMessage("button-label.back"));
@@ -216,7 +219,7 @@ private ActionRow getSecondaryActionRow() {
216219
secondaryButtons.add(Button.link("https://discord.gg/skoice-proximity-voice-chat-741375523275407461",
217220
this.plugin.getBot().getLang().getMessage("button-label.support-server"))
218221
.withEmoji(MenuEmoji.SCREWDRIVER.get()));
219-
if (root.equals("settings")
222+
if ("settings".equals(root)
220223
&& this.plugin.getBot().getStatus() != BotStatus.READY
221224
&& !"language".equals(this.menuId)) {
222225
Menu languageMenu = this.plugin.getBot().getMenuFactory().getMenu("language");

src/main/java/net/clementraynaud/skoice/menus/selectors/RangeSelector.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public SelectMenu get() {
5252
.withEmoji(MenuEmoji.SOUND.get())
5353
));
5454

55-
SelectOption customizedOption = SelectOption.of(super.plugin.getBot().getLang().getMessage("menu.range.select-menu.select-option.customized.label"),
55+
SelectOption customizedOption = SelectOption.of(super.plugin.getBot().getLang().getMessage("menu.range.select-menu.select-option.customized.label"),
5656
RangeSelector.CUSTOMIZED_ID)
5757
.withEmoji(MenuEmoji.PENCIL2.get());
5858

@@ -66,8 +66,8 @@ public SelectMenu get() {
6666
} else if (super.plugin.getBot().getStatus() != BotStatus.NO_RADIUS) {
6767
defaultValue = RangeSelector.CUSTOMIZED_ID;
6868
customizedOption = customizedOption.withDescription(super.plugin.getBot().getLang().getMessage("menu.range.select-menu.select-option.description",
69-
String.valueOf(horizontalRadius),
70-
String.valueOf(verticalRadius)));
69+
String.valueOf(horizontalRadius),
70+
String.valueOf(verticalRadius)));
7171
}
7272

7373
options.add(customizedOption);

src/main/java/net/clementraynaud/skoice/menus/selectors/VoiceChannelSelector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public VoiceChannelSelector(Skoice plugin) {
4242
@Override
4343
public SelectMenu get() {
4444
List<SelectOption> options = new ArrayList<>();
45-
45+
4646
options.add(SelectOption.of(super.plugin.getBot().getLang().getMessage("menu.voice-channel.select-menu.select-option.new-voice-channel.label"), "new-voice-channel")
4747
.withDescription(super.plugin.getBot().getLang().getMessage("menu.voice-channel.select-menu.select-option.new-voice-channel.description"))
4848
.withEmoji(MenuEmoji.HEAVY_PLUS_SIGN.get()));

src/main/java/net/clementraynaud/skoice/storage/config/ConfigYamlFile.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
package net.clementraynaud.skoice.storage.config;
2121

2222
import net.clementraynaud.skoice.Skoice;
23-
import net.clementraynaud.skoice.bot.BotStatus;
2423
import net.clementraynaud.skoice.storage.YamlFile;
2524
import net.clementraynaud.skoice.util.ConfigurationUtil;
2625
import net.dv8tion.jda.api.entities.channel.concrete.Category;

src/main/java/net/clementraynaud/skoice/system/LinkedPlayer.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public LinkedPlayer(Skoice plugin, Player player, String discordId) {
5353
}
5454

5555
public static Set<LinkedPlayer> getOnlineLinkedPlayers() {
56-
try {
56+
try {
5757
if (Bukkit.isPrimaryThread()) {
5858
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
5959
}
@@ -63,7 +63,7 @@ public static Set<LinkedPlayer> getOnlineLinkedPlayers() {
6363
}
6464

6565
public static LinkedPlayer fromMemberId(String memberId) {
66-
try {
66+
try {
6767
if (Bukkit.isPrimaryThread()) {
6868
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
6969
}
@@ -97,7 +97,7 @@ public void sendDisconnectingAlert() {
9797
}
9898

9999
public Set<LinkedPlayer> getPlayersWithinRange() {
100-
try {
100+
try {
101101
if (Bukkit.isPrimaryThread()) {
102102
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
103103
}
@@ -145,7 +145,7 @@ public boolean isCloseEnoughToPlayer(LinkedPlayer linkedPlayer, boolean falloff)
145145

146146
if (this.plugin.getConfigYamlFile().getBoolean(ConfigField.SEPARATED_TEAMS.toString())) {
147147
Scoreboard scoreboard = this.player.getScoreboard();
148-
Team playerTeam = scoreboard.getEntryTeam(player.getName());
148+
Team playerTeam = scoreboard.getEntryTeam(this.player.getName());
149149
if (playerTeam == null) {
150150
if (scoreboard.getEntryTeam(linkedPlayer.getBukkitPlayer().getName()) != null) {
151151
return false;

src/main/java/net/clementraynaud/skoice/system/Network.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void build() {
4444
this.proximityChannel = ProximityChannels.getAll().stream()
4545
.filter(channel -> !Networks.getProximityChannels().contains(channel))
4646
.min(Comparator.comparingInt(channel -> Integer.parseInt(channel.getChannelId())))
47-
.orElseGet(() -> new ProximityChannel(plugin, this));
47+
.orElseGet(() -> new ProximityChannel(this.plugin, this));
4848
}
4949

5050
public boolean canPlayerConnect(LinkedPlayer player) {

src/main/java/net/clementraynaud/skoice/system/Networks.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private Networks() {
3333
}
3434

3535
public static Set<Network> getAll() {
36-
try {
36+
try {
3737
if (Bukkit.isPrimaryThread() && Bukkit.getPluginManager().isPluginEnabled("Skoice")) {
3838
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
3939
}
@@ -43,7 +43,7 @@ public static Set<Network> getAll() {
4343
}
4444

4545
public static Set<Network> getInitialized() {
46-
try {
46+
try {
4747
if (Bukkit.isPrimaryThread()) {
4848
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
4949
}
@@ -55,7 +55,7 @@ public static Set<Network> getInitialized() {
5555
}
5656

5757
public static Set<ProximityChannel> getProximityChannels() {
58-
try {
58+
try {
5959
if (Bukkit.isPrimaryThread()) {
6060
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
6161
}
@@ -67,7 +67,7 @@ public static Set<ProximityChannel> getProximityChannels() {
6767
}
6868

6969
public static void add(Network network) {
70-
try {
70+
try {
7171
if (Bukkit.isPrimaryThread()) {
7272
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
7373
}
@@ -77,7 +77,7 @@ public static void add(Network network) {
7777
}
7878

7979
public static void remove(Network network) {
80-
try {
80+
try {
8181
if (Bukkit.isPrimaryThread()) {
8282
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
8383
}
@@ -95,7 +95,7 @@ public static void merge(Network network1, Network network2) {
9595
}
9696

9797
public static void clean() {
98-
try {
98+
try {
9999
if (Bukkit.isPrimaryThread()) {
100100
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
101101
}
@@ -107,7 +107,7 @@ public static void clean() {
107107
}
108108

109109
public static void clear() {
110-
try {
110+
try {
111111
if (Bukkit.isPrimaryThread() && Bukkit.getPluginManager().isPluginEnabled("Skoice")) {
112112
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
113113
}

src/main/java/net/clementraynaud/skoice/system/ProximityChannels.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private ProximityChannels() {
3434
}
3535

3636
public static Set<ProximityChannel> getAll() {
37-
try {
37+
try {
3838
if (Bukkit.isPrimaryThread()) {
3939
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
4040
}
@@ -44,7 +44,7 @@ public static Set<ProximityChannel> getAll() {
4444
}
4545

4646
public static Set<ProximityChannel> getInitialized() {
47-
try {
47+
try {
4848
if (Bukkit.isPrimaryThread() && Bukkit.getPluginManager().isPluginEnabled("Skoice")) {
4949
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
5050
}
@@ -56,7 +56,7 @@ public static Set<ProximityChannel> getInitialized() {
5656
}
5757

5858
public static void add(ProximityChannel proximityChannel) {
59-
try {
59+
try {
6060
if (Bukkit.isPrimaryThread()) {
6161
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
6262
}
@@ -66,7 +66,7 @@ public static void add(ProximityChannel proximityChannel) {
6666
}
6767

6868
public static void remove(ProximityChannel proximityChannel) {
69-
try {
69+
try {
7070
if (Bukkit.isPrimaryThread()) {
7171
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
7272
}
@@ -76,7 +76,7 @@ public static void remove(ProximityChannel proximityChannel) {
7676
}
7777

7878
public static void remove(String channelId) {
79-
try {
79+
try {
8080
if (Bukkit.isPrimaryThread()) {
8181
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
8282
}
@@ -87,7 +87,7 @@ public static void remove(String channelId) {
8787
}
8888

8989
public static void clean(int possibleUsers) {
90-
try {
90+
try {
9191
if (Bukkit.isPrimaryThread()) {
9292
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
9393
}

src/main/java/net/clementraynaud/skoice/tasks/UpdateNetworksTask.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public UpdateNetworksTask(Skoice plugin) {
5454
}
5555

5656
public static Map<String, Pair<String, CompletableFuture<Void>>> getAwaitingMoves() {
57-
try {
57+
try {
5858
if (Bukkit.isPrimaryThread() && Bukkit.getPluginManager().isPluginEnabled("Skoice")) {
5959
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
6060
}
@@ -64,7 +64,7 @@ public static Map<String, Pair<String, CompletableFuture<Void>>> getAwaitingMove
6464
}
6565

6666
public void run() {
67-
try {
67+
try {
6868
if (Bukkit.isPrimaryThread()) {
6969
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
7070
}
@@ -203,7 +203,7 @@ private void mergeNetworks() {
203203
}
204204

205205
private void manageMoves() {
206-
try {
206+
try {
207207
if (Bukkit.isPrimaryThread()) {
208208
new IllegalStateException("This method should not be called from the main thread.").printStackTrace();
209209
}

0 commit comments

Comments
 (0)