Add a permission to allow players to bypass the tame limit.

This commit is contained in:
SeanOMik 2020-10-28 16:50:10 -05:00
parent de30d65fba
commit 91a8a54624
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
7 changed files with 10 additions and 8 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>tamablefoxes</artifactId> <artifactId>tamablefoxes</artifactId>
<version>1.7.7-SNAPSHOT</version> <version>1.7.8-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Tamablefoxes</name> <name>Tamablefoxes</name>

View File

@ -15,9 +15,8 @@ import org.bukkit.plugin.java.JavaPlugin;
// @TODO: // @TODO:
/* @CHANGELOG (1.7.7-SNAPSHOT): /* @CHANGELOG (1.7.8-SNAPSHOT):
* Make foxes sleep on the bed with players, similar to what cats do. * Add a permission to allow players to bypass the tame limit.
* Add a configurable option to set the maximum about of foxes a player can tame.
*/ */
public final class TamableFoxes extends JavaPlugin implements Listener { public final class TamableFoxes extends JavaPlugin implements Listener {
private static TamableFoxes plugin; private static TamableFoxes plugin;

View File

@ -315,7 +315,7 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance();
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if (maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
return true; return true;

View File

@ -314,7 +314,7 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance();
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if (maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
return true; return true;

View File

@ -317,7 +317,7 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance();
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if (maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
return EnumInteractionResult.SUCCESS; return EnumInteractionResult.SUCCESS;

View File

@ -314,7 +314,7 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance();
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if (maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
return EnumInteractionResult.SUCCESS; return EnumInteractionResult.SUCCESS;

View File

@ -17,3 +17,6 @@ permissions:
tamablefoxes.tame: tamablefoxes.tame:
description: "Gives the player the ability to tame a fox." description: "Gives the player the ability to tame a fox."
default: true default: true
tamablefoxes.tame.unlimited:
description: "Lets players bypass the tame limit."
default: op