Skip to content

Commit 6b16975

Browse files
committed
Configuration to change the name of the schematics place in the config.
1 parent 69541a1 commit 6b16975

File tree

8 files changed

+23
-7
lines changed

8 files changed

+23
-7
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ You can restrict downloads to specific Discord channels or sites by enabling thi
4242
- By specifying `https://cdn.discordapp.com/attachments/<channel_ID>/`, you can restrict downloads to specific Discord channels.
4343
- `download.url-restriction.name`: Name of the download location
4444
- This name is used in error messages when downloading from locations other than the specified prefix.
45-
- If set to `#schem-storage`, the error message will display as "You can only download files from #schem-storage channel".
45+
- If set to `#schem-storage`, the error message will display as "You can only download schematic files from the '#schem-storage' channel within Discord".
4646

4747
### Full configuration
4848
```yaml
@@ -67,6 +67,10 @@ download:
6767
# Prefix for URL restrictions (Note: For Discord attachment URLs, make sure it starts with cdn. and ends with /)
6868
# Usually, you just need to replace the xxxxxxxxxxxxxxxxxx part with your own channel ID
6969
prefix: https://cdn.discordapp.com/attachments/xxxxxxxxxxxxxxxxxx/
70+
# The name of the download location (displayed in the error message)
71+
# This name is used in error messages when downloading from locations other than the specified prefix.
72+
# If set to #schem-storage, the error message will display as "You can only download schematic files from the '#schem-storage' channel within Discord"
73+
name: "#schem-storage"
7074
file:
7175
# Path to the schematics folder
7276
folder-path: plugins/WorldEdit/schematics

README_ja.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WorldEditのschemファイルをDiscordにアップロード/ダウンロード
4141
- `https://cdn.discordapp.com/attachments/<チャンネルID>/` を指定すれば特定のDiscordチャンネルのみからダウンロードさせることができます。
4242
- `download.url-restriction.name`: ダウンロード場所の名前
4343
- 上記のプレフィックス以外からダウンロードした場合に表示されるエラーにnameが使用されます。
44-
- `#schem置き場` と設定した場合、`#schem置き場 にあるファイルのみダウンロードできます` とエラーメッセージが表示されます。
44+
- `#schem置き場` と設定した場合、`Discord内の「#schem置き場」チャンネルにあるschematicファイルのみダウンロードできます` とエラーメッセージが表示されます。
4545

4646
### 全設定
4747
```yaml
@@ -67,7 +67,9 @@ download:
6767
# 基本的に↓の xxxxxxxxxxxxxxxxxx の部分を自分のチャンネルIDに変えるだけでOK
6868
prefix: https://cdn.discordapp.com/attachments/xxxxxxxxxxxxxxxxxx/
6969
# ダウンロード用のURL制限場所の名前 (エラー時に案内が表示される)
70-
name: Discord内の「#schem置き場」チャンネル
70+
# 上記のプレフィックス以外からダウンロードした場合に表示されるエラーにnameが使用されます。
71+
# `#schem置き場` と設定した場合、`#schem置き場 にあるファイルのみダウンロードできます` とエラーメッセージが表示されます。
72+
name: #schem置き場
7173
```
7274
7375
## 権限

pom.xml

+1-1
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.8-SNAPSHOT</version>
9+
<version>1.9-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SchemUploader</name>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
157157

158158
// Check the URL prefix if URL restriction is enabled
159159
if (PluginConfig.downloadUrlRestrictionEnabled && !url.startsWith(PluginConfig.downloadUrlPrefix)) {
160-
sender.spigot().sendMessage(plugin.messages.error("error_url_prefix"));
160+
sender.spigot().sendMessage(plugin.messages.error("error_url_prefix", PluginConfig.downloadUrlName));
161161
return true;
162162
}
163163

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

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public class PluginConfig {
4343
*/
4444
public static String downloadUrlPrefix;
4545

46+
/**
47+
* This name is used in error messages when downloading from locations other than the specified prefix
48+
*/
49+
public static String downloadUrlName;
50+
4651
/**
4752
* Path to the schematics folder
4853
*/
@@ -62,6 +67,7 @@ public static void loadConfig(Configuration config) {
6267
downloadMaxSize = config.getLong("download.max-size", -1);
6368
downloadUrlRestrictionEnabled = config.getBoolean("download.url-restriction.enabled", true);
6469
downloadUrlPrefix = config.getString("download.url-restriction.prefix");
70+
downloadUrlName = config.getString("download.url-restriction.name", "");
6571
fileFolderPath = config.getString("file.folder-path", "plugins/WorldEdit/schematics");
6672
}
6773

src/main/resources/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ download:
1919
# Prefix for URL restrictions (Note: For Discord attachment URLs, make sure it starts with cdn. and ends with /)
2020
# Usually, you just need to replace the xxxxxxxxxxxxxxxxxx part with your own channel ID
2121
prefix: https://cdn.discordapp.com/attachments/xxxxxxxxxxxxxxxxxx/
22+
# The name of the download location (displayed in the error message)
23+
# This name is used in error messages when downloading from locations other than the specified prefix.
24+
# If set to #schem-storage, the error message will display as "You can only download schematic files from the '#schem-storage' channel within Discord"
25+
name: "#schem-storage"
2226
file:
2327
# Path to the schematics folder
2428
folder-path: plugins/WorldEdit/schematics

src/main/resources/messages_en.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ error_not_found: "File %s does not exist"
77
error_not_schematic: "The file is not a schematic file"
88
error_already_exists: "%s already exists. Please specify -f to overwrite"
99
error_file_size_exceeded: "File size exceeds maximum limit (%d Bytes)"
10-
error_url_prefix: "You can only download schematic files from the '#schem-storage' channel within Discord. You may have copied a wrong link. Please review the URL."
10+
error_url_prefix: "You can only download schematic files from the '%s' channel within Discord. You may have copied a wrong link. Please review the URL."
1111

1212
upload_progress: "Uploading..."
1313
upload_done: "Uploaded %s"

src/main/resources/messages_ja.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ error_not_found: "ファイル %s が存在しません"
77
error_not_schematic: "ファイルがschematicファイルではありません"
88
error_already_exists: "%s は既に存在します。上書きする場合は -f を指定してください"
99
error_file_size_exceeded: "ファイルサイズが大きすぎます (最大 %d Bytes)"
10-
error_url_prefix: "Discord内の「#schem置き場」チャンネルにあるschematicファイルのみダウンロードできます。誤ったリンクをコピーしている可能性があります。URLを見直してください。"
10+
error_url_prefix: "Discord内の「%s」チャンネルにあるschematicファイルのみダウンロードできます。誤ったリンクをコピーしている可能性があります。URLを見直してください。"
1111

1212
upload_progress: "アップロード中..."
1313
upload_done: "%s をアップロードしました"

0 commit comments

Comments
 (0)