Resolve a few deprecations

This commit is contained in:
Vankka 2022-04-22 21:21:48 +03:00
parent 7c8ff0d57b
commit e82f03cd21
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
3 changed files with 3 additions and 5 deletions

View File

@ -79,9 +79,7 @@ public abstract class AbstractBukkitCommandHandler implements ICommandHandler {
PluginCommand command = null;
try {
Constructor<?> constructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
if (!constructor.isAccessible()) {
constructor.setAccessible(true);
}
constructor.setAccessible(true);
command = (PluginCommand) constructor.newInstance(label, discordSRV.plugin());
discordSRV.server().getCommandMap().register(label, discordSRV.plugin().getName().toLowerCase(Locale.ROOT), command);
} catch (ReflectiveOperationException ignored) {}

View File

@ -52,7 +52,7 @@ public class BinPasteService implements PasteService {
Request request = new Request.Builder()
.url(binUrl + "/v1/post")
.post(RequestBody.create(MediaType.get("application/json"), json.toString()))
.post(RequestBody.create(json.toString(), MediaType.get("application/json")))
.build();
try (Response response = discordSRV.httpClient().newCall(request).execute()) {

View File

@ -39,7 +39,7 @@ public class BytebinPasteService implements PasteService {
Request request = new Request.Builder()
.url(bytebinUrl + "/post")
.header("Content-Encoding", "gzip")
.post(RequestBody.create(MediaType.get("application/octet-stream"), fileContent))
.post(RequestBody.create(fileContent, MediaType.get("application/octet-stream")))
.build();
try (Response response = discordSRV.httpClient().newCall(request).execute()) {