From 345b4b241c94259a362a6c7b95da69d0ec494d54 Mon Sep 17 00:00:00 2001 From: jaotan Date: Fri, 30 Sep 2022 15:26:01 +0900 Subject: [PATCH] Update dependencies packages by renovate (2022-09-30) (#962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update dependencies packages by renovate * chore(deps): update jetbrains/qodana-action action to v2022.2.2 (#960) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency com.jaoafa:jaosuperachievement2 to v2.5.29 (#957) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency org.json:json to v20220924 (#956) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.0 (#944) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: JDA v5.0.0-alpha.20への対応 (#963) * feat: cloud-paperとcloud-minecraft-extrasをv1.7.1に (#964) * feat: cloud-paperとcloud-minecraft-extrasをv1.7.1に * fix: インスペクションの適用 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Tomachi <8929706+book000@users.noreply.github.com> --- .github/workflows/qodana-quality.yml | 2 +- pom.xml | 12 ++++++------ src/main/java/com/jaoafa/mymaid4/Main.java | 6 +++--- .../java/com/jaoafa/mymaid4/command/Cmd_Bug.java | 2 +- .../jaoafa/mymaid4/command/Cmd_DiscordLink.java | 2 +- .../com/jaoafa/mymaid4/command/Cmd_Feedback.java | 2 +- .../com/jaoafa/mymaid4/command/Cmd_Player.java | 3 +-- .../com/jaoafa/mymaid4/command/Cmd_TpAlias.java | 4 ++-- .../java/com/jaoafa/mymaid4/command/Cmd_Wire.java | 1 - .../com/jaoafa/mymaid4/command/Cmd_jaoBox.java | 4 ++-- .../mymaid4/discordEvent/DiscordEvent_ListCmd.java | 6 +++++- .../com/jaoafa/mymaid4/event/Event_Antijaoium.java | 5 +++-- .../com/jaoafa/mymaid4/event/Event_FirstLogin.java | 2 +- .../com/jaoafa/mymaid4/event/Event_History.java | 2 +- .../jaoafa/mymaid4/event/Event_JoinWarnUsers.java | 4 ++-- .../mymaid4/event/Event_NewPlayerAutoBlMap.java | 7 ++++--- .../jaoafa/mymaid4/event/Event_SurvivalSitLay.java | 2 +- .../java/com/jaoafa/mymaid4/event/Event_Vote.java | 2 +- src/main/java/com/jaoafa/mymaid4/lib/ChatBan.java | 2 +- src/main/java/com/jaoafa/mymaid4/lib/ConvLoc.java | 14 +++++++------- src/main/java/com/jaoafa/mymaid4/lib/EBan.java | 2 +- .../java/com/jaoafa/mymaid4/lib/Historyjao.java | 4 ++-- src/main/java/com/jaoafa/mymaid4/lib/Jail.java | 4 ++-- .../java/com/jaoafa/mymaid4/lib/MyMaidCommand.java | 1 - .../java/com/jaoafa/mymaid4/lib/MyMaidData.java | 4 ++-- .../java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java | 9 +++------ .../java/com/jaoafa/mymaid4/lib/TeleportAlias.java | 3 +-- .../mymaid4/tasks/Task_OldWorldAutoRemove.java | 4 ++-- 28 files changed, 57 insertions(+), 58 deletions(-) diff --git a/.github/workflows/qodana-quality.yml b/.github/workflows/qodana-quality.yml index ed315fb6f..c67e72cbd 100644 --- a/.github/workflows/qodana-quality.yml +++ b/.github/workflows/qodana-quality.yml @@ -22,7 +22,7 @@ jobs: distribution: adopt - name: Qodana Scan - uses: JetBrains/qodana-action@v2022.2.1 + uses: JetBrains/qodana-action@v2022.2.2 timeout-minutes: 30 with: upload-result: true diff --git a/pom.xml b/pom.xml index 8bac9c7d5..8f434bead 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.3.0 + 3.4.0 MyMaid4 @@ -165,12 +165,12 @@ cloud.commandframework cloud-paper - 1.6.2 + 1.7.1 cloud.commandframework cloud-minecraft-extras - 1.6.2 + 1.7.1 commons-codec @@ -180,7 +180,7 @@ net.dv8tion JDA - 5.0.0-alpha.17 + 5.0.0-alpha.20 club.minnced @@ -204,7 +204,7 @@ com.jaoafa jaosuperachievement2 - 2.5.28 + 2.5.29 provided @@ -221,7 +221,7 @@ org.json json - 20220320 + 20220924 us.myles diff --git a/src/main/java/com/jaoafa/mymaid4/Main.java b/src/main/java/com/jaoafa/mymaid4/Main.java index aafd4a27a..14e23b691 100644 --- a/src/main/java/com/jaoafa/mymaid4/Main.java +++ b/src/main/java/com/jaoafa/mymaid4/Main.java @@ -138,7 +138,7 @@ private void registerCommand() { Function.identity(), Function.identity()); // case-insensitive support (大文字小文字を区別しない) - manager.setCommandSuggestionProcessor((context, strings) -> { + manager.commandSuggestionProcessor((context, strings) -> { String input = context.getInputQueue().isEmpty() ? "" : context.getInputQueue().peek().toLowerCase(); return strings.stream() .filter(s -> s.toLowerCase().startsWith(input)) @@ -157,12 +157,12 @@ private void registerCommand() { ); // Mojangのコマンドパーサー、Brigadierを登録する - if (manager.queryCapability(CloudBukkitCapabilities.BRIGADIER)) { + if (manager.hasCapability(CloudBukkitCapabilities.BRIGADIER)) { manager.registerBrigadier(); } // 非同期の引数補完 - if (manager.queryCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { + if (manager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { manager.registerAsynchronousCompletions(); } diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Bug.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Bug.java index c23726c61..a1f07070b 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Bug.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Bug.java @@ -34,7 +34,7 @@ public class Cmd_Bug extends MyMaidLibrary implements CommandPremise { static long sendTime = -1L; - static IssueManager.Repository repo = IssueManager.Repository.MyMaid4; + static final IssueManager.Repository repo = IssueManager.Repository.MyMaid4; @Override public MyMaidCommand.Detail details() { diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_DiscordLink.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_DiscordLink.java index 29614e3a7..64a72c6b0 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_DiscordLink.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_DiscordLink.java @@ -25,7 +25,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Feedback.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Feedback.java index abae3fda0..03578433e 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Feedback.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Feedback.java @@ -34,7 +34,7 @@ public class Cmd_Feedback extends MyMaidLibrary implements CommandPremise { static long sendTime = -1L; - static IssueManager.Repository repo = IssueManager.Repository.jaoMinecraftServer; + static final IssueManager.Repository repo = IssueManager.Repository.jaoMinecraftServer; @Override public MyMaidCommand.Detail details() { diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Player.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Player.java index 2bd8a8946..a81cfedbe 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Player.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Player.java @@ -1,7 +1,7 @@ /* * jaoLicense * - * Copyright (c) 2021 jao Minecraft Server + * Copyright (c) 2022 jao Minecraft Server * * The following license applies to this project: jaoLicense * @@ -57,7 +57,6 @@ public MyMaidCommand.Cmd register(Command.Builder builder) { ); } - @SuppressWarnings("deprecation") void getPermGroup(CommandContext context) { OfflinePlayer player; if (context.contains("player")) { diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_TpAlias.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_TpAlias.java index 50ea19845..325ffa6cd 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_TpAlias.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_TpAlias.java @@ -64,8 +64,8 @@ void setAlias(CommandContext context) { SendMessage(context.getSender(), details(), "既に登録されているエイリアスです。"); return; } - boolean result = TeleportAlias.setAlias(target, replacement); - SendMessage(context.getSender(), details(), "追加に" + (result ? "成功" : "失敗") + "しました。"); + TeleportAlias.setAlias(target, replacement); + SendMessage(context.getSender(), details(), "追加に成功しました。"); } void removeAlias(CommandContext context) { diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Wire.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Wire.java index 8b7f5b9ec..449267140 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_Wire.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_Wire.java @@ -256,7 +256,6 @@ void delWireWe(CommandContext context) { List polylist = polyRegion.getPoints(); int polyPosY = polyRegion.getMaximumY(); - int wireRemoveCount = 0; for (int i = 0; i < polylist.size() - 1; i++) { Location loc1 = new Location(player.getWorld(), polylist.get(i).getX() + 0.5, polyPosY + 0.1725, polylist.get(i).getZ() + 0.5); diff --git a/src/main/java/com/jaoafa/mymaid4/command/Cmd_jaoBox.java b/src/main/java/com/jaoafa/mymaid4/command/Cmd_jaoBox.java index 50f5666e9..7a5ab2a0c 100644 --- a/src/main/java/com/jaoafa/mymaid4/command/Cmd_jaoBox.java +++ b/src/main/java/com/jaoafa/mymaid4/command/Cmd_jaoBox.java @@ -37,8 +37,8 @@ import java.util.Objects; public class Cmd_jaoBox extends MyMaidLibrary implements CommandPremise { - public static Component viewerTitleComponent = Component.text("jaoBox", NamedTextColor.YELLOW); - public static Component registerTitleComponent = Component.join( + public static final Component viewerTitleComponent = Component.text("jaoBox", NamedTextColor.YELLOW); + public static final Component registerTitleComponent = Component.join( JoinConfiguration.noSeparators(), Component.text("jaoBox"), Component.space(), diff --git a/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_ListCmd.java b/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_ListCmd.java index 53c8cc2d6..99e47d962 100644 --- a/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_ListCmd.java +++ b/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_ListCmd.java @@ -15,7 +15,11 @@ import com.jaoafa.jaosuperachievement2.lib.Achievement; import com.jaoafa.mymaid4.lib.MyMaidData; import com.jaoafa.mymaid4.lib.MyMaidLibrary; -import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.SubscribeEvent; diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java b/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java index 14075bc2f..f0c71976f 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java @@ -16,7 +16,8 @@ import com.jaoafa.mymaid4.Main; import com.jaoafa.mymaid4.lib.*; import com.jaoafa.mymaid4.tasks.Task_AutoRemoveJailByjaoium; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.apache.commons.codec.digest.DigestUtils; @@ -148,7 +149,7 @@ void saveItem(Player player, ItemStack is) { hash, exists, isWarning ? String.format("\n**[警告]** jaoiumという文字列が含まれていません: `%s`", displayName) : "")).queue(); - channel.sendFile(file, hash + ".txt").queue(); + channel.sendFiles(FileUpload.fromData(file, hash + ".txt")).queue(); } @EventHandler(priority = EventPriority.HIGHEST) diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_FirstLogin.java b/src/main/java/com/jaoafa/mymaid4/event/Event_FirstLogin.java index 2d1fc5202..f27490d02 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_FirstLogin.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_FirstLogin.java @@ -17,7 +17,7 @@ import com.jaoafa.mymaid4.lib.MyMaidData; import com.jaoafa.mymaid4.lib.MyMaidLibrary; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_History.java b/src/main/java/com/jaoafa/mymaid4/event/Event_History.java index 06a9f6b79..6c4bbfa78 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_History.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_History.java @@ -15,7 +15,7 @@ import com.jaoafa.mymaid4.lib.Historyjao; import com.jaoafa.mymaid4.lib.MyMaidData; import com.jaoafa.mymaid4.lib.MyMaidLibrary; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.apache.commons.lang.time.DateUtils; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_JoinWarnUsers.java b/src/main/java/com/jaoafa/mymaid4/event/Event_JoinWarnUsers.java index 88fa62402..9e3900df5 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_JoinWarnUsers.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_JoinWarnUsers.java @@ -1,7 +1,7 @@ /* * jaoLicense * - * Copyright (c) 2021 jao Minecraft Server + * Copyright (c) 2022 jao Minecraft Server * * The following license applies to this project: jaoLicense * @@ -16,7 +16,7 @@ import com.jaoafa.mymaid4.lib.MyMaidData; import com.jaoafa.mymaid4.lib.MyMaidLibrary; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java b/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java index eb0eb94b6..28d358e6c 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java @@ -15,7 +15,8 @@ import com.jaoafa.mymaid4.lib.EventPremise; import com.jaoafa.mymaid4.lib.MyMaidData; import com.jaoafa.mymaid4.lib.MyMaidLibrary; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -95,8 +96,8 @@ public void run() { return; } - channel.sendFile(body.byteStream(), player.getUniqueId() + ".png") - .append(String.format("新規プレイヤー「%s」のブロック編集マップ\nhttps://jaoafa.com/cp/?uuid=%s", player.getName(), player.getUniqueId())).queue(msg -> { + channel.sendFiles(FileUpload.fromData(body.byteStream(), player.getUniqueId() + ".png")) + .addContent(String.format("新規プレイヤー「%s」のブロック編集マップ\nhttps://jaoafa.com/cp/?uuid=%s", player.getName(), player.getUniqueId())).queue(msg -> { Main.getMyMaidLogger().info("NewPlayerAutoBlMap: メッセージ送信完了 (" + msg.getJumpUrl() + ")"); response.close(); }, failure -> { diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_SurvivalSitLay.java b/src/main/java/com/jaoafa/mymaid4/event/Event_SurvivalSitLay.java index f2deaf202..8a303fc23 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_SurvivalSitLay.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_SurvivalSitLay.java @@ -31,7 +31,7 @@ public String description() { return "サバイバルモードなどでsitやlayコマンドを使えないようにします。"; } - static Set targetCommands = Set.of("/sit", "/lay", "/gsit:sit", "/glay:lay"); + static final Set targetCommands = Set.of("/sit", "/lay", "/gsit:sit", "/glay:lay"); @EventHandler public void onCommand(PlayerCommandPreprocessEvent event) { diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java b/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java index b41267f8f..a5cb6314c 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java @@ -17,7 +17,7 @@ import com.jaoafa.mymaid4.lib.*; import com.vexsoftware.votifier.model.Vote; import com.vexsoftware.votifier.model.VotifierEvent; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.event.ClickEvent; diff --git a/src/main/java/com/jaoafa/mymaid4/lib/ChatBan.java b/src/main/java/com/jaoafa/mymaid4/lib/ChatBan.java index f6b73f655..a00addf7e 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/ChatBan.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/ChatBan.java @@ -13,7 +13,7 @@ import com.jaoafa.mymaid4.Main; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.kyori.adventure.key.Key; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.HoverEvent; diff --git a/src/main/java/com/jaoafa/mymaid4/lib/ConvLoc.java b/src/main/java/com/jaoafa/mymaid4/lib/ConvLoc.java index 03955be69..e1de6833e 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/ConvLoc.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/ConvLoc.java @@ -37,9 +37,9 @@ import java.util.regex.Pattern; public class ConvLoc { - Pattern LOC_PATTERN = Pattern.compile("^(~?)(-?)([.\\d]+)$"); - Pattern SELECTOR_PATTERN = Pattern.compile("^@[praes]\\[.*?]$"); - Pattern XYZ_SELECTOR_PATTERN = Pattern.compile("[^d]([xyz])=([~.\\-0-9]+)"); + final Pattern LOC_PATTERN = Pattern.compile("^(~?)(-?)([.\\d]+)$"); + final Pattern SELECTOR_PATTERN = Pattern.compile("^@[praes]\\[.*?]$"); + final Pattern XYZ_SELECTOR_PATTERN = Pattern.compile("[^d]([xyz])=([~.\\-0-9]+)"); public void replace(Player player, List blocks, boolean isRelative) { List replacers = new ArrayList<>(); @@ -132,8 +132,8 @@ public void undo(Player player) { } class Replacer { - Block block; - boolean isRelative; + final Block block; + final boolean isRelative; ReplacerResult result; String oldCommand; @@ -152,11 +152,11 @@ void dryRun() { result = ReplacerResult.NOT_TARGET_MATERIAL; return; } - if (!(block.getState() instanceof CommandBlock cb)) { + if (!(block.getState() instanceof CommandBlock state)) { result = ReplacerResult.FAILED_GET_STATE; return; } - this.cb = cb; + this.cb = state; String command = cb.getCommand(); oldCommand = command; if (command.isEmpty()) { diff --git a/src/main/java/com/jaoafa/mymaid4/lib/EBan.java b/src/main/java/com/jaoafa/mymaid4/lib/EBan.java index 5c3c205d0..ff403797b 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/EBan.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/EBan.java @@ -13,7 +13,7 @@ import com.jaoafa.mymaid4.Main; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.kyori.adventure.key.Key; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.HoverEvent; diff --git a/src/main/java/com/jaoafa/mymaid4/lib/Historyjao.java b/src/main/java/com/jaoafa/mymaid4/lib/Historyjao.java index f3fe7931b..439fe0e1f 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/Historyjao.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/Historyjao.java @@ -14,7 +14,7 @@ import com.jaoafa.mymaid4.Main; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -85,7 +85,7 @@ private void addDiscordNotify(String message, CommandSender sender) { EmbedBuilder builder = new EmbedBuilder() .setTitle("HISTORY ADDED") .setDescription("jaoHistoryに項目が追加されました。") - .addField("MinecraftID", player.getName(), false) + .addField("MinecraftID", player.getName() != null ? player.getName() : "NULL", false) .addField("Message", message, false) .setTimestamp(Instant.now()) .setColor(Color.YELLOW); diff --git a/src/main/java/com/jaoafa/mymaid4/lib/Jail.java b/src/main/java/com/jaoafa/mymaid4/lib/Jail.java index 77bfbc6d2..5fca0a33d 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/Jail.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/Jail.java @@ -15,7 +15,7 @@ import com.jaoafa.jaosuperachievement2.lib.Achievement; import com.jaoafa.mymaid4.Main; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.kyori.adventure.key.Key; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; @@ -51,7 +51,7 @@ public class Jail { static final Map cache = new HashMap<>(); - public static Map hasWarned = new HashMap<>(); + public static final Map hasWarned = new HashMap<>(); final OfflinePlayer player; diff --git a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidCommand.java b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidCommand.java index 3e617442d..9ea4e4ad5 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidCommand.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidCommand.java @@ -64,7 +64,6 @@ public String getDescription() { } } - @SuppressWarnings("ClassCanBeRecord") public static class Cmd { private final Command[] commands; diff --git a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidData.java b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidData.java index 137a8db77..142f075e6 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidData.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidData.java @@ -11,7 +11,7 @@ package com.jaoafa.mymaid4.lib; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -273,7 +273,7 @@ public static List getBoxPrevious(UUID uuid) { return jaoBoxPrevious.get(uuid); } - public static Location paradiseLocation = new Location( + public static final Location paradiseLocation = new Location( Bukkit.getServer().getWorld("Jao_Afa"), 6050, 68, 6050 ); diff --git a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java index e75cb2f07..f712148d6 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java @@ -15,7 +15,8 @@ import com.jaoafa.mymaid4.Main; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextReplacementConfig; @@ -117,7 +118,7 @@ public static void reportError(Class clazz, Throwable e) { .setFooter(String.format("MyMaid4 %s", Main.getJavaPlugin().getDescription().getVersion())) .build(); reportChannel.sendMessageEmbeds(embed).queue(); - reportChannel.sendFile(is, "stacktrace.txt").queue(); + reportChannel.sendFiles(FileUpload.fromData(is, "stacktrace.txt")).queue(); if (Main.getRollbar() != null && !Main.getMyMaidConfig().isDevelopmentServer()) { Main.getRollbar().critical(e, "Class: " + clazz.getName()); @@ -754,8 +755,4 @@ public boolean isjaoium(List list) { } return jaoium; } - - public void wrapGetAchievement(Player player, String achievement) { - - } } diff --git a/src/main/java/com/jaoafa/mymaid4/lib/TeleportAlias.java b/src/main/java/com/jaoafa/mymaid4/lib/TeleportAlias.java index 10f9601ce..e6da12292 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/TeleportAlias.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/TeleportAlias.java @@ -23,11 +23,10 @@ public class TeleportAlias { static Map alias = new HashMap<>(); - public static boolean setAlias(String target, String replacement) { + public static void setAlias(String target, String replacement) { load(); alias.put(target, replacement); save(); - return true; } public static boolean removeAlias(String target) { diff --git a/src/main/java/com/jaoafa/mymaid4/tasks/Task_OldWorldAutoRemove.java b/src/main/java/com/jaoafa/mymaid4/tasks/Task_OldWorldAutoRemove.java index f3dd17cfa..3970ebaef 100644 --- a/src/main/java/com/jaoafa/mymaid4/tasks/Task_OldWorldAutoRemove.java +++ b/src/main/java/com/jaoafa/mymaid4/tasks/Task_OldWorldAutoRemove.java @@ -22,7 +22,7 @@ import java.util.List; public class Task_OldWorldAutoRemove extends BukkitRunnable { - List targetWorlds = List.of( + final List targetWorlds = List.of( "kassi-hp-tk", "Jao_Afa_1", "Jao_Afa_2", @@ -39,7 +39,7 @@ public class Task_OldWorldAutoRemove extends BukkitRunnable { "Summer2020" ); - List nextRemoveWorlds = new ArrayList<>(); + final List nextRemoveWorlds = new ArrayList<>(); @Override public void run() {