diff --git a/1_14_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/EntityTamableFox.java b/1_14_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/EntityTamableFox.java index 1bce800..bf40b93 100644 --- a/1_14_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/EntityTamableFox.java +++ b/1_14_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/EntityTamableFox.java @@ -246,26 +246,29 @@ public class EntityTamableFox extends EntityFox { public void rename(org.bukkit.entity.Player player) { new AnvilGUI.Builder() - .onComplete((plr, input) -> { // Called when the inventory output slot is clicked - if (!input.equals("")) { + .onClick((slot, stateSnapshot) -> { + String text = stateSnapshot.getText(); + if (slot == AnvilGUI.Slot.OUTPUT && !text.isEmpty()) { org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); // This will auto format the name for config settings. - String foxName = LanguageConfig.getFoxNameFormat(input, player.getDisplayName()); + String foxName = LanguageConfig.getFoxNameFormat(text, player.getDisplayName()); tamableFox.setCustomName(foxName); tamableFox.setCustomNameVisible(true); - if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) { - plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input)); + if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text)); } + } else if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GRAY + "The fox was not named"); } - //return AnvilGUI.Response.close(); return Arrays.asList(AnvilGUI.ResponseAction.close()); }) - .text("Fox name") // Sets the text the GUI should start with - .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance - .open(player); // Opens the GUI for the player provided + .text("Fox name") + .title("Name your new friend!") + .plugin(Utils.tamableFoxesPlugin) + .open(player); } // deobf: mobInteract @@ -526,7 +529,7 @@ public class EntityTamableFox extends EntityFox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); } diff --git a/1_15_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/EntityTamableFox.java b/1_15_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/EntityTamableFox.java index 295a7f1..17c1f8a 100644 --- a/1_15_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/EntityTamableFox.java +++ b/1_15_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/EntityTamableFox.java @@ -246,26 +246,29 @@ public class EntityTamableFox extends EntityFox { public void rename(org.bukkit.entity.Player player) { new AnvilGUI.Builder() - .onComplete((plr, input) -> { // Called when the inventory output slot is clicked - if (!input.equals("")) { - org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); + .onClick((slot, stateSnapshot) -> { + String text = stateSnapshot.getText(); + if (slot == AnvilGUI.Slot.OUTPUT && !text.isEmpty()) { + org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); - // This will auto format the name for config settings. - String foxName = LanguageConfig.getFoxNameFormat(input, player.getDisplayName()); + // This will auto format the name for config settings. + String foxName = LanguageConfig.getFoxNameFormat(text, player.getDisplayName()); - tamableFox.setCustomName(foxName); - tamableFox.setCustomNameVisible(true); - if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) { - plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input)); - } + tamableFox.setCustomName(foxName); + tamableFox.setCustomNameVisible(true); + if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text)); } + } else if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GRAY + "The fox was not named"); + } - //return AnvilGUI.Response.close(); - return Arrays.asList(AnvilGUI.ResponseAction.close()); - }) - .text("Fox name") // Sets the text the GUI should start with - .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance - .open(player); // Opens the GUI for the player provided + return Arrays.asList(AnvilGUI.ResponseAction.close()); + }) + .text("Fox name") + .title("Name your new friend!") + .plugin(Utils.tamableFoxesPlugin) + .open(player); } // deobf: mobInteract @@ -526,7 +529,7 @@ public class EntityTamableFox extends EntityFox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); } diff --git a/1_16_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/EntityTamableFox.java b/1_16_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/EntityTamableFox.java index 437c650..69b588d 100644 --- a/1_16_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/EntityTamableFox.java +++ b/1_16_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/EntityTamableFox.java @@ -244,26 +244,29 @@ public class EntityTamableFox extends EntityFox { public void rename(org.bukkit.entity.Player player) { new AnvilGUI.Builder() - .onComplete((plr, input) -> { // Called when the inventory output slot is clicked - if (!input.equals("")) { - org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); + .onClick((slot, stateSnapshot) -> { + String text = stateSnapshot.getText(); + if (slot == AnvilGUI.Slot.OUTPUT && !text.isEmpty()) { + org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); - // This will auto format the name for config settings. - String foxName = LanguageConfig.getFoxNameFormat(input, player.getDisplayName()); + // This will auto format the name for config settings. + String foxName = LanguageConfig.getFoxNameFormat(text, player.getDisplayName()); - tamableFox.setCustomName(foxName); - tamableFox.setCustomNameVisible(true); - if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) { - plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input)); - } + tamableFox.setCustomName(foxName); + tamableFox.setCustomNameVisible(true); + if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text)); } + } else if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GRAY + "The fox was not named"); + } - //return AnvilGUI.Response.close(); - return Arrays.asList(AnvilGUI.ResponseAction.close()); - }) - .text("Fox name") // Sets the text the GUI should start with - .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance - .open(player); // Opens the GUI for the player provided + return Arrays.asList(AnvilGUI.ResponseAction.close()); + }) + .text("Fox name") + .title("Name your new friend!") + .plugin(Utils.tamableFoxesPlugin) + .open(player); } // deobf: mobInteract @@ -528,7 +531,7 @@ public class EntityTamableFox extends EntityFox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); } diff --git a/1_16_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/EntityTamableFox.java b/1_16_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/EntityTamableFox.java index f9d7500..c322bc8 100644 --- a/1_16_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/EntityTamableFox.java +++ b/1_16_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/EntityTamableFox.java @@ -242,26 +242,29 @@ public class EntityTamableFox extends EntityFox { public void rename(org.bukkit.entity.Player player) { new AnvilGUI.Builder() - .onComplete((plr, input) -> { // Called when the inventory output slot is clicked - if (!input.equals("")) { - org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); + .onClick((slot, stateSnapshot) -> { + String text = stateSnapshot.getText(); + if (slot == AnvilGUI.Slot.OUTPUT && !text.isEmpty()) { + org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); - // This will auto format the name for config settings. - String foxName = LanguageConfig.getFoxNameFormat(input, player.getDisplayName()); + // This will auto format the name for config settings. + String foxName = LanguageConfig.getFoxNameFormat(text, player.getDisplayName()); - tamableFox.setCustomName(foxName); - tamableFox.setCustomNameVisible(true); - if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) { - plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input)); - } + tamableFox.setCustomName(foxName); + tamableFox.setCustomNameVisible(true); + if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text)); } + } else if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GRAY + "The fox was not named"); + } - //return AnvilGUI.Response.close(); - return Arrays.asList(AnvilGUI.ResponseAction.close()); - }) - .text("Fox name") // Sets the text the GUI should start with - .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance - .open(player); // Opens the GUI for the player provided + return Arrays.asList(AnvilGUI.ResponseAction.close()); + }) + .text("Fox name") + .title("Name your new friend!") + .plugin(Utils.tamableFoxesPlugin) + .open(player); } // deobf: mobInteract @@ -520,7 +523,7 @@ public class EntityTamableFox extends EntityFox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); } diff --git a/1_16_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/EntityTamableFox.java b/1_16_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/EntityTamableFox.java index 75d3a0a..c98f524 100644 --- a/1_16_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/EntityTamableFox.java +++ b/1_16_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/EntityTamableFox.java @@ -242,26 +242,29 @@ public class EntityTamableFox extends EntityFox { public void rename(org.bukkit.entity.Player player) { new AnvilGUI.Builder() - .onComplete((plr, input) -> { // Called when the inventory output slot is clicked - if (!input.equals("")) { - org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); + .onClick((slot, stateSnapshot) -> { + String text = stateSnapshot.getText(); + if (slot == AnvilGUI.Slot.OUTPUT && !text.isEmpty()) { + org.bukkit.entity.Entity tamableFox = this.getBukkitEntity(); - // This will auto format the name for config settings. - String foxName = LanguageConfig.getFoxNameFormat(input, player.getDisplayName()); + // This will auto format the name for config settings. + String foxName = LanguageConfig.getFoxNameFormat(text, player.getDisplayName()); - tamableFox.setCustomName(foxName); - tamableFox.setCustomNameVisible(true); - if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) { - plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input)); - } + tamableFox.setCustomName(foxName); + tamableFox.setCustomNameVisible(true); + if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text)); } + } else if (!LanguageConfig.getTamingChosenPerfect(text).equalsIgnoreCase("disabled")) { + stateSnapshot.getPlayer().sendMessage(Config.getPrefix() + ChatColor.GRAY + "The fox was not named"); + } - //return AnvilGUI.Response.close(); - return Arrays.asList(AnvilGUI.ResponseAction.close()); - }) - .text("Fox name") // Sets the text the GUI should start with - .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance - .open(player); // Opens the GUI for the player provided + return Arrays.asList(AnvilGUI.ResponseAction.close()); + }) + .text("Fox name") + .title("Name your new friend!") + .plugin(Utils.tamableFoxesPlugin) + .open(player); } // deobf: mobInteract @@ -520,7 +523,7 @@ public class EntityTamableFox extends EntityFox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); } diff --git a/1_17_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_1_R1/EntityTamableFox.java b/1_17_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_1_R1/EntityTamableFox.java index 6f4f45a..f99428c 100644 --- a/1_17_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_1_R1/EntityTamableFox.java +++ b/1_17_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_1_R1/EntityTamableFox.java @@ -554,7 +554,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_17_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_R1/EntityTamableFox.java b/1_17_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_R1/EntityTamableFox.java index 1e1b124..6f5afe8 100644 --- a/1_17_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_R1/EntityTamableFox.java +++ b/1_17_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_17_R1/EntityTamableFox.java @@ -551,7 +551,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java b/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java index c72c2f0..2b60fac 100644 --- a/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java +++ b/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java @@ -573,7 +573,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java b/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java index 0d186ce..bf2fe40 100644 --- a/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java +++ b/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java @@ -573,7 +573,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_18_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R2/EntityTamableFox.java b/1_18_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R2/EntityTamableFox.java index 2df6363..39f6037 100644 --- a/1_18_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R2/EntityTamableFox.java +++ b/1_18_R2/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R2/EntityTamableFox.java @@ -571,7 +571,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_19_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_1_R1/EntityTamableFox.java b/1_19_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_1_R1/EntityTamableFox.java index b297dd9..78917ca 100644 --- a/1_19_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_1_R1/EntityTamableFox.java +++ b/1_19_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_1_R1/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_19_2_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_2_R1/EntityTamableFox.java b/1_19_2_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_2_R1/EntityTamableFox.java index dd0d0f2..9529090 100644 --- a/1_19_2_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_2_R1/EntityTamableFox.java +++ b/1_19_2_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_2_R1/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_19_3_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_3_R1/EntityTamableFox.java b/1_19_3_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_3_R1/EntityTamableFox.java index 06f7ee0..0235cd9 100644 --- a/1_19_3_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_3_R1/EntityTamableFox.java +++ b/1_19_3_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_3_R1/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_19_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R1/EntityTamableFox.java b/1_19_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R1/EntityTamableFox.java index c92f1c3..3ae66b7 100644 --- a/1_19_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R1/EntityTamableFox.java +++ b/1_19_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R1/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_19_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R3/EntityTamableFox.java b/1_19_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R3/EntityTamableFox.java index c8ec640..d3a00ce 100644 --- a/1_19_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R3/EntityTamableFox.java +++ b/1_19_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_19_R3/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); } diff --git a/1_20_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R1/EntityTamableFox.java b/1_20_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R1/EntityTamableFox.java index a825492..b8f3517 100644 --- a/1_20_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R1/EntityTamableFox.java +++ b/1_20_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R1/EntityTamableFox.java @@ -572,7 +572,7 @@ public class EntityTamableFox extends Fox { } // Remove the amount of foxes the player has tamed if the limit is enabled. - if (Config.getMaxPlayerFoxTames() > 0) { + if (Config.getMaxPlayerFoxTames() > 0 && this.getOwner() != null) { SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUUID(), 1); }