Add a way for certain gameplay related messages to get disabled

This commit is contained in:
SeanOMik 2021-09-20 23:09:04 -04:00
parent ddd00cf9e8
commit c77e8065d3
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
19 changed files with 105 additions and 43 deletions

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_14_R1</artifactId>

View File

@ -255,8 +255,10 @@ public class EntityTamableFox extends EntityFox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -356,7 +358,9 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return true;
}
@ -377,13 +381,17 @@ public class EntityTamableFox extends EntityFox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
Player player = (Player) entityhuman.getBukkitEntity();
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_15_R1</artifactId>

View File

@ -255,8 +255,10 @@ public class EntityTamableFox extends EntityFox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -356,7 +358,9 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return true;
}
@ -377,13 +381,17 @@ public class EntityTamableFox extends EntityFox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
Player player = (Player) entityhuman.getBukkitEntity();
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R1</artifactId>

View File

@ -253,8 +253,10 @@ public class EntityTamableFox extends EntityFox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -357,7 +359,9 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return EnumInteractionResult.SUCCESS;
}
@ -378,13 +382,17 @@ public class EntityTamableFox extends EntityFox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
Player player = (Player) entityhuman.getBukkitEntity();
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R2</artifactId>

View File

@ -251,8 +251,10 @@ public class EntityTamableFox extends EntityFox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -349,7 +351,9 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return EnumInteractionResult.SUCCESS;
}
@ -370,13 +374,17 @@ public class EntityTamableFox extends EntityFox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
Player player = (Player) entityhuman.getBukkitEntity();
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R3</artifactId>

View File

@ -251,8 +251,10 @@ public class EntityTamableFox extends EntityFox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -349,7 +351,9 @@ public class EntityTamableFox extends EntityFox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return EnumInteractionResult.SUCCESS;
}
@ -370,13 +374,17 @@ public class EntityTamableFox extends EntityFox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
Player player = (Player) entityhuman.getBukkitEntity();
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<build>

View File

@ -292,8 +292,10 @@ public class EntityTamableFox extends Fox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -393,7 +395,9 @@ public class EntityTamableFox extends Fox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUUID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return InteractionResult.SUCCESS;
}
@ -412,11 +416,15 @@ public class EntityTamableFox extends Fox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<build>

View File

@ -289,8 +289,10 @@ public class EntityTamableFox extends Fox {
tamableFox.setCustomName(foxName);
tamableFox.setCustomNameVisible(true);
if (!LanguageConfig.getTamingChosenPerfect(input).equalsIgnoreCase("disabled")) {
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
}
}
return AnvilGUI.Response.close();
})
@ -390,7 +392,9 @@ public class EntityTamableFox extends Fox {
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUUID()) >= maxTameCount) {
if (!LanguageConfig.getFoxDoesntTrust().equalsIgnoreCase("disabled")) {
((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
}
return InteractionResult.SUCCESS;
}
@ -409,11 +413,15 @@ public class EntityTamableFox extends Fox {
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
// Give player tamed message.
if (!LanguageConfig.getTamedMessage().equalsIgnoreCase("disabled")) {
((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
}
// Let the player choose the new fox's name if its enabled in config.
if (Config.askForNameAfterTaming()) {
if (!LanguageConfig.getTamingAskingName().equalsIgnoreCase("disabled")) {
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
}
rename(player);
}
} else {

View File

@ -7,7 +7,7 @@
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes</artifactId>

View File

@ -33,9 +33,15 @@ Have you ever wanted to tame foxes? Well, now you can! <b>Use chicken to tame</b
* Snow and red foxes.
* Language.yml
* Message for when a tamed fox dies
* Disabling certain gameplay messages
* Open `language.yml`. These are the messages that be disabled by changing the text to "disabled"
* `taming-tamed-message`
* `taming-asking-for-name-message`
* `taming-chosen-name-perfect`
* `fox-doesnt-trust`
## Commands:
* /spawntamablefox [red/snow]: Spawns a tamable fox at the players location.
* /spawntamablefox [red/snow]: Spawns a tamable fox at the players' location.
## Permissions:
* tamablefoxes.spawn: Gives permission to run the command /spawntamablefox. Default: `op`

View File

@ -7,7 +7,7 @@
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes-util</artifactId>

View File

@ -88,7 +88,7 @@ public class LanguageConfig extends YamlConfiguration {
// This is the text that shows when registering the custom entity
public static String getMCVersionLoading(String mcVersionStr) {
return config.getString("mc-version-loading").replaceAll("%MC_VERSION%", mcVersionStr);
return config.getString("mc-version-loading").replace("%MC_VERSION%", mcVersionStr);
}
// Get the error that shows during register when they try to run the plugin on an unsupported mc version.
@ -128,12 +128,12 @@ public class LanguageConfig extends YamlConfiguration {
// Get the message when you give feed back on the new fox name.
public static String getTamingChosenPerfect(String chosen) {
return config.getString("taming-chosen-name-perfect").replaceAll("%NEW_FOX_NAME%", chosen);
return config.getString("taming-chosen-name-perfect").replace("%NEW_FOX_NAME%", chosen);
}
// Get the fox name format.
public static String getFoxNameFormat(String foxName, String ownerName) {
return config.getString((Config.doesShowOwnerInFoxName()) ? "fox-name-format" : "fox-name-no-owner-name-format").replaceAll("%FOX_NAME%", foxName).replaceAll("%OWNER%", ownerName);
return config.getString((Config.doesShowOwnerInFoxName()) ? "fox-name-format" : "fox-name-no-owner-name-format").replace("%FOX_NAME%", foxName).replace("%OWNER%", ownerName);
}
public static String getFoxDoesntTrust() {
@ -150,7 +150,7 @@ public class LanguageConfig extends YamlConfiguration {
public static String getSpawnedFoxMessage(NMSInterface.FoxType type) {
String typeStr = ((type == type.SNOW) ? ChatColor.AQUA + "Snow" : ChatColor.RED + "Red") + ChatColor.RESET;
return config.getString("spawned-fox-message").replaceAll("%TYPE%", typeStr);
return config.getString("spawned-fox-message").replace("%TYPE%", typeStr);
}
public static String getFailureSpawn() {

View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.1.5-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>