From 272068d39f9b242e883c7a08a9a11b3a888f9faa Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 21 Nov 2016 13:29:40 -0500 Subject: [PATCH] Moved Send() to DebugPotato, from DPAPI Moved DebugPotatoAPI.sendDebugPotato() to DebugPotato.send(), and deprecated DebugPotatoAPI. Changed TBMCCoreAPI to reflect the deprecation --- src/main/java/buttondevteam/lib/DebugPotato.java | 5 +++-- src/main/java/buttondevteam/lib/DebugPotatoAPI.java | 3 +++ src/main/java/buttondevteam/lib/TBMCCoreAPI.java | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/buttondevteam/lib/DebugPotato.java b/src/main/java/buttondevteam/lib/DebugPotato.java index adb3c65..48f195a 100644 --- a/src/main/java/buttondevteam/lib/DebugPotato.java +++ b/src/main/java/buttondevteam/lib/DebugPotato.java @@ -20,8 +20,9 @@ public class DebugPotato { * @param player * The player */ - public void Send(Player player) { - DebugPotatoAPI.SendDebugPotato(this, player); + public void Send(Player player){ + player.getInventory().addItem(this.toItemStack()); + return; } /** diff --git a/src/main/java/buttondevteam/lib/DebugPotatoAPI.java b/src/main/java/buttondevteam/lib/DebugPotatoAPI.java index 99c690e..5b78edd 100644 --- a/src/main/java/buttondevteam/lib/DebugPotatoAPI.java +++ b/src/main/java/buttondevteam/lib/DebugPotatoAPI.java @@ -2,7 +2,10 @@ package buttondevteam.lib; import org.bukkit.entity.Player; +/**@deprecated + * Fully Replaced by DebugPotato Class - Construct a DebugPotato*/ public class DebugPotatoAPI { + /**@deprecated Replaced by DebugPotato.send*/ public static void SendDebugPotato(DebugPotato dp, Player player) { player.getInventory().addItem(dp.toItemStack()); return; diff --git a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java index f4dab65..56ba8ce 100644 --- a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java +++ b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java @@ -152,16 +152,16 @@ public final class TBMCCoreAPI { Bukkit.getLogger().warning(sourcemsg); e.printStackTrace(); Optional randomPlayer = Bukkit.getOnlinePlayers().stream().findAny(); - if (randomPlayer.isPresent()) - DebugPotatoAPI.SendDebugPotato( - new DebugPotato() + if (randomPlayer.isPresent()){ + DebugPotato potato = new DebugPotato() .setMessage(new String[] { // "§b§o" + potatoMessages[new Random().nextInt(potatoMessages.length)], // "§c§o" + sourcemsg, // "§a§oFind a dev to fix this issue" }) .setType(e instanceof IOException ? "Potato on a Stick" - : e instanceof ClassCastException ? "Square Potato" : "Plain Potato"), - randomPlayer.get()); + : e instanceof ClassCastException ? "Square Potato" : "Plain Potato"); + potato.Send(randomPlayer.get()); + } } /**