Skip to content

Commit

Permalink
[fix]必要要件をjava 11、mc 1.13以上に引き下げ
Browse files Browse the repository at this point in the history
  • Loading branch information
nova-27 committed Oct 5, 2022
1 parent 60e28f1 commit 063f0c6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
}

shadowJar {
if(project.hasProperty('outputDir'))
if (project.hasProperty('outputDir'))
getDestinationDirectory().set(new File(outputDir))
}

Expand All @@ -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']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, BaseCommand> commands;
Expand All @@ -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;
}

Expand All @@ -45,11 +46,12 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
List<BaseCommand> 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<String> argumentsSuggestions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> commands = new ArrayList<>() {
Expand All @@ -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();
Expand Down Expand Up @@ -87,6 +89,6 @@ public void onCommand(CommandSender sender, String label, String[] args) {
@Override
public @Nullable List<String> 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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 063f0c6

Please sign in to comment.