Add a permission to allow players to bypass the tame limit.
This commit is contained in:
parent
de30d65fba
commit
91a8a54624
2
pom.xml
2
pom.xml
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue