Skip to content

Commit 65fb4cd

Browse files
committed
ファイルが無いときのエラー処理
1 parent a44c3bd commit 65fb4cd

File tree

4 files changed

+10
-26
lines changed

4 files changed

+10
-26
lines changed

pom.xml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.kamesuta</groupId>
88
<artifactId>SchemUploader</artifactId>
9-
<version>1.5-SNAPSHOT</version>
9+
<version>1.6-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SchemUploader</name>
@@ -42,26 +42,6 @@
4242
</configuration>
4343
</execution>
4444
</executions>
45-
<configuration>
46-
<relocations>
47-
<relocation>
48-
<pattern>com.squareup.okhttp</pattern>
49-
<shadedPattern>com.kamesuta.schemuploader.lib.com.squareup.okhttp</shadedPattern>
50-
</relocation>
51-
<relocation>
52-
<pattern>org.apache.commons.lang3</pattern>
53-
<shadedPattern>com.kamesuta.schemuploader.lib.org.apache.commons.lang3</shadedPattern>
54-
</relocation>
55-
<relocation>
56-
<pattern>okio</pattern>
57-
<shadedPattern>com.kamesuta.schemuploader.lib.okio</shadedPattern>
58-
</relocation>
59-
<relocation>
60-
<pattern>com.kamesuta.commandlib</pattern>
61-
<shadedPattern>com.kamesuta.schemuploader.lib.commandlib</shadedPattern>
62-
</relocation>
63-
</relocations>
64-
</configuration>
6545
</plugin>
6646
</plugins>
6747
<resources>
@@ -90,11 +70,6 @@
9070
<version>1.16.5-R0.1-SNAPSHOT</version>
9171
<scope>provided</scope>
9272
</dependency>
93-
<dependency>
94-
<groupId>com.squareup.okhttp</groupId>
95-
<artifactId>okhttp</artifactId>
96-
<version>2.7.5</version>
97-
</dependency>
9873
<dependency>
9974
<groupId>com.google.code.gson</groupId>
10075
<artifactId>gson</artifactId>

src/main/java/com/kamesuta/schemuploader/CommandListener.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
6464
sender.sendMessage(plugin.messages.error("error_invalid_folder"));
6565
return true;
6666
}
67+
68+
// Check if the file exists
69+
if (!schemFile.exists()) {
70+
sender.sendMessage(plugin.messages.error("error_not_found", schemFileName));
71+
return true;
72+
}
73+
6774
// Get the name and UUID of the sender
6875
String senderName = sender.getName();
6976
UUID senderUUID = (sender instanceof Player) ? ((Player) sender).getUniqueId() : null;

src/main/resources/messages_en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ prefix: "[SchemUploader] "
33
error_invalid_folder: "You can only specify locations within the WorldEdit schematic folder"
44
error_http_status: "HTTP status code: %d"
55
error_io: "IO error: %s"
6+
error_not_found: "File %s does not exist"
67
error_not_schematic: "The file is not a schematic file"
78
error_already_exists: "%s already exists. Please specify -f to overwrite"
89
error_file_size_exceeded: "File size exceeds maximum limit (%d Bytes)"

src/main/resources/messages_ja.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ prefix: "[SchemUploader] "
33
error_invalid_folder: "WorldEditのschematicフォルダー以外の場所を指定することはできません"
44
error_http_status: "HTTPステータスコード: %d"
55
error_io: "IOエラー: %s"
6+
error_not_found: "ファイル %s が存在しません"
67
error_not_schematic: "ファイルがschematicファイルではありません"
78
error_already_exists: "%s は既に存在します。上書きする場合は -f を指定してください"
89
error_file_size_exceeded: "ファイルサイズが大きすぎます (最大 %d Bytes)"

0 commit comments

Comments
 (0)