@@ -61,13 +61,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
61
61
File schemFile = new File (plugin .schematicFolder , schemFileName );
62
62
// Check if the file is included in the directory (to prevent ../ and other path traversal attacks)
63
63
if (!schemFile .getParentFile ().equals (plugin .schematicFolder )) {
64
- sender .sendMessage (plugin .messages .error ("error_invalid_folder" ));
64
+ sender .spigot (). sendMessage (plugin .messages .error ("error_invalid_folder" ));
65
65
return true ;
66
66
}
67
67
68
68
// Check if the file exists
69
69
if (!schemFile .exists ()) {
70
- sender .sendMessage (plugin .messages .error ("error_not_found" , schemFileName ));
70
+ sender .spigot (). sendMessage (plugin .messages .error ("error_not_found" , schemFileName ));
71
71
return true ;
72
72
}
73
73
@@ -77,7 +77,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
77
77
78
78
// Send a message if it is expected to take some time
79
79
BukkitTask task = Bukkit .getScheduler ().runTaskLater (plugin , () -> {
80
- sender .sendMessage (plugin .messages .info ("upload_progress" ));
80
+ sender .spigot (). sendMessage (plugin .messages .info ("upload_progress" ));
81
81
}, 20 );
82
82
83
83
// Upload the schem file asynchronously
@@ -90,7 +90,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
90
90
91
91
// Send an error message if the upload fails
92
92
if (!result .success ) {
93
- sender .sendMessage (plugin .messages .error ("upload_failed" , result .error ));
93
+ sender .spigot (). sendMessage (plugin .messages .error ("upload_failed" , result .error ));
94
94
95
95
// Add record to statistics
96
96
plugin .statistics .actionCounter .increment (Statistics .ActionCounter .ActionType .UPLOAD_FAILURE );
@@ -99,7 +99,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
99
99
}
100
100
101
101
// Send a message when the upload is complete
102
- sender .sendMessage (new ComponentBuilder ()
102
+ sender .spigot (). sendMessage (new ComponentBuilder ()
103
103
.append (plugin .messages .success ("upload_done" , schemFileName ))
104
104
.event (new HoverEvent (HoverEvent .Action .SHOW_TEXT , new Text (plugin .messages .getMessage ("upload_done_open_url" ))))
105
105
.event (new ClickEvent (ClickEvent .Action .OPEN_URL , result .url ))
@@ -146,24 +146,24 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
146
146
147
147
// Check if the file is included in the directory (to prevent ../ and other path traversal attacks)
148
148
if (!schemFile .getParentFile ().equals (plugin .schematicFolder )) {
149
- sender .sendMessage (plugin .messages .error ("error_invalid_folder" ));
149
+ sender .spigot (). sendMessage (plugin .messages .error ("error_invalid_folder" ));
150
150
return true ;
151
151
}
152
152
// If the file exists and force flag is not set, send an error message
153
153
if (!force && schemFile .exists ()) {
154
- sender .sendMessage (plugin .messages .error ("error_already_exists" , schemName + ".schem" ));
154
+ sender .spigot (). sendMessage (plugin .messages .error ("error_already_exists" , schemName + ".schem" ));
155
155
return true ;
156
156
}
157
157
158
158
// Check the URL prefix if URL restriction is enabled
159
159
if (PluginConfig .downloadUrlRestrictionEnabled && !url .startsWith (PluginConfig .downloadUrlPrefix )) {
160
- sender .sendMessage (plugin .messages .error ("error_url_prefix" ));
160
+ sender .spigot (). sendMessage (plugin .messages .error ("error_url_prefix" ));
161
161
return true ;
162
162
}
163
163
164
164
// Send a message if it is expected to take some time
165
165
BukkitTask task = Bukkit .getScheduler ().runTaskLater (plugin , () -> {
166
- sender .sendMessage (plugin .messages .info ("download_progress" ));
166
+ sender .spigot (). sendMessage (plugin .messages .info ("download_progress" ));
167
167
}, 20 );
168
168
169
169
// Download the schem file asynchronously
@@ -177,9 +177,9 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
177
177
// Send an error message if the download fails
178
178
if (!result .success ) {
179
179
if (result .exceededSize ) {
180
- sender .sendMessage (plugin .messages .error ("error_file_size_exceeded" , PluginConfig .downloadMaxSize ));
180
+ sender .spigot (). sendMessage (plugin .messages .error ("error_file_size_exceeded" , PluginConfig .downloadMaxSize ));
181
181
} else {
182
- sender .sendMessage (plugin .messages .error ("download_failed" , result .error ));
182
+ sender .spigot (). sendMessage (plugin .messages .error ("download_failed" , result .error ));
183
183
}
184
184
185
185
// Add record to statistics
@@ -189,7 +189,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
189
189
}
190
190
191
191
// Send a message when the download is complete
192
- sender .sendMessage (new ComponentBuilder ()
192
+ sender .spigot (). sendMessage (new ComponentBuilder ()
193
193
.append (plugin .messages .success ("download_done" , schemName + ".schem" ))
194
194
.event (new HoverEvent (HoverEvent .Action .SHOW_TEXT , new Text (plugin .messages .getMessage ("download_done_open_folder" ))))
195
195
.event (new ClickEvent (ClickEvent .Action .OPEN_URL , url ))
0 commit comments