From d1ca2796dcaae61771f0dad9ef59c2cf299ca2a4 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Tue, 1 Feb 2022 20:35:22 +0100 Subject: [PATCH] Fix issues with open command --- .../Minepacks/Bukkit/Command/OpenCommand.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java index f377902..b22e88a 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java @@ -28,6 +28,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -95,8 +96,13 @@ public void execute(@NotNull CommandSender sender, @NotNull String main, @NotNul { if(player.hasPermission(Permissions.OTHERS)) { - //noinspection deprecation - plugin.openBackpack(player, Bukkit.getOfflinePlayer(args[0]), player.hasPermission(Permissions.OTHERS_EDIT)); + OfflinePlayer target = Bukkit.getPlayer(args[0]); + if(target == null) + { + //noinspection deprecation + target = Bukkit.getOfflinePlayer(args[0]); + } + plugin.openBackpack(player, target, player.hasPermission(Permissions.OTHERS_EDIT)); } else {