From e82f03cd2113d7130762f4deb05fdf6455dd78f0 Mon Sep 17 00:00:00 2001 From: Vankka Date: Fri, 22 Apr 2022 21:21:48 +0300 Subject: [PATCH] Resolve a few deprecations --- .../command/game/handler/AbstractBukkitCommandHandler.java | 4 +--- .../com/discordsrv/common/paste/service/BinPasteService.java | 2 +- .../discordsrv/common/paste/service/BytebinPasteService.java | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/discordsrv/bukkit/command/game/handler/AbstractBukkitCommandHandler.java b/bukkit/src/main/java/com/discordsrv/bukkit/command/game/handler/AbstractBukkitCommandHandler.java index fd5e6245..c2126f83 100644 --- a/bukkit/src/main/java/com/discordsrv/bukkit/command/game/handler/AbstractBukkitCommandHandler.java +++ b/bukkit/src/main/java/com/discordsrv/bukkit/command/game/handler/AbstractBukkitCommandHandler.java @@ -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) {} diff --git a/common/src/main/java/com/discordsrv/common/paste/service/BinPasteService.java b/common/src/main/java/com/discordsrv/common/paste/service/BinPasteService.java index 557e4f00..60242698 100644 --- a/common/src/main/java/com/discordsrv/common/paste/service/BinPasteService.java +++ b/common/src/main/java/com/discordsrv/common/paste/service/BinPasteService.java @@ -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()) { diff --git a/common/src/main/java/com/discordsrv/common/paste/service/BytebinPasteService.java b/common/src/main/java/com/discordsrv/common/paste/service/BytebinPasteService.java index bf7b95db..c68a68cc 100644 --- a/common/src/main/java/com/discordsrv/common/paste/service/BytebinPasteService.java +++ b/common/src/main/java/com/discordsrv/common/paste/service/BytebinPasteService.java @@ -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()) {