diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4642963..74ed93b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,20 +12,20 @@ jobs: contents: write steps: - - uses: actions/checkout@v3 - - name: Set up JDK 16 - uses: actions/setup-java@v3 - with: - java-version: '16' - distribution: 'corretto' + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'corretto' - - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: shadowJar + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: shadowJar - - name: Publish to Github Releases - uses: softprops/action-gh-release@v1 - with: - name: Release ${{ github.ref }} - files: build/libs/* + - name: Publish to Github Releases + uses: softprops/action-gh-release@v1 + with: + name: Release ${{ github.ref }} + files: build/libs/* diff --git a/.idea/misc.xml b/.idea/misc.xml index 69a87ac..c2e72af 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,7 +6,7 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5f2063d..80bb72f 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ dependencies { } shadowJar { - if(project.hasProperty('outputDir')) + if (project.hasProperty('outputDir')) getDestinationDirectory().set(new File(outputDir)) } @@ -36,7 +36,7 @@ bukkit { main = "${project.group}.${rootProject.name.toLowerCase()}.${rootProject.name}" description = 'CrafterePost公式プラグイン' website = 'https://crafterepost.netlify.app/' - apiVersion = '1.18' + apiVersion = '1.13' author = 'nova27' depend = ['WorldEdit', 'ProtocolLib'] diff --git a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/CommandManager.java b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/CommandManager.java index a5b6d9b..26b029e 100644 --- a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/CommandManager.java +++ b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/CommandManager.java @@ -10,6 +10,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.stream.Collectors; public class CommandManager implements CommandExecutor, TabCompleter { private final Map commands; @@ -29,9 +30,9 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command // サブコマンドが存在しない if (subCommand == null) return false; - if (sender instanceof Player player && !subCommand.checkPermission(player)) { + if (sender instanceof Player && !subCommand.checkPermission((Player) sender)) { //権限無し - player.sendMessage(ChatColor.RED + "権限が不足しています!"); + sender.sendMessage(ChatColor.RED + "権限が不足しています!"); return true; } @@ -45,11 +46,12 @@ public List onTabComplete(@NotNull CommandSender sender, @NotNull Comman List subCommandSuggestions = new ArrayList<>(); for (var registeredCommand : commands.values()) { if (!registeredCommand.getName().startsWith(args[0])) continue; - if (sender instanceof Player player && !registeredCommand.checkPermission(player)) continue; + if (sender instanceof Player && !registeredCommand.checkPermission((Player) sender)) continue; subCommandSuggestions.add(registeredCommand); } - if (args.length == 1) return subCommandSuggestions.stream().map(BaseCommand::getName).toList(); + if (args.length == 1) + return subCommandSuggestions.stream().map(BaseCommand::getName).collect(Collectors.toList()); var subCommandArgs = Arrays.copyOfRange(args, 1, args.length); List argumentsSuggestions = new ArrayList<>(); diff --git a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/RecordCommand.java b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/RecordCommand.java index 1f42cf4..14aac57 100644 --- a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/RecordCommand.java +++ b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/RecordCommand.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; public class RecordCommand extends BaseCommand { private static final List commands = new ArrayList<>() { @@ -35,11 +36,12 @@ public boolean checkPermission(Player player) { @Override public void onCommand(CommandSender sender, String label, String[] args) { - if (!(sender instanceof Player player)) { + if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "このコマンドはプレイヤーのみ実行可能です!"); return; } + Player player = (Player) sender; if (args.length < 1) args = new String[]{""}; var recordingManager = CrafterePost.getInstance().getRecordingManager(); @@ -87,6 +89,6 @@ public void onCommand(CommandSender sender, String label, String[] args) { @Override public @Nullable List onTabComplete(CommandSender sender, String[] args) { if (!(sender instanceof Player) || args.length > 1) return null; - return commands.stream().filter(cmd -> cmd.startsWith(args[0])).toList(); + return commands.stream().filter(cmd -> cmd.startsWith(args[0])).collect(Collectors.toList()); } } diff --git a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/SchemCommand.java b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/SchemCommand.java index 380af30..f3c836c 100644 --- a/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/SchemCommand.java +++ b/src/main/java/com/github/nova_27/mcplugin/crafterepost/command/SchemCommand.java @@ -27,11 +27,12 @@ public boolean checkPermission(Player player) { @Override public void onCommand(CommandSender sender, String label, String[] args) { - if (!(sender instanceof Player player)) { + if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "このコマンドはプレイヤーのみ実行可能です!"); return; } + Player player = (Player) sender; Region region; try { region = Utils.getSelection(player);