Add support for modifying the prefix
This relates to #36. Also add a link to the default config file onto the readme. The last thing I did was fixing AnvilGUI for users not using Java 16.
This commit is contained in:
parent
f68aeaa99b
commit
d94907128f
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "AnvilGUI"]
|
||||||
|
path = AnvilGUI
|
||||||
|
url = https://github.com/SeanOMik/AnvilGUI
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -341,13 +341,13 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -20,9 +21,9 @@ public class NMSInterface_1_14_R1 implements NMSInterface {
|
||||||
try { // Replace the fox entity
|
try { // Replace the fox entity
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("aZ");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("aZ");
|
||||||
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -341,13 +341,13 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -20,9 +21,9 @@ public class NMSInterface_1_15_R1 implements NMSInterface {
|
||||||
try { // Replace the fox entity
|
try { // Replace the fox entity
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("ba");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("ba");
|
||||||
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -323,7 +323,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return EnumInteractionResult.SUCCESS;
|
return EnumInteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -344,13 +344,13 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -361,7 +361,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R1.EntityFox;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R1 implements NMSInterface {
|
||||||
try { // Replace the fox entity
|
try { // Replace the fox entity
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("be");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("be");
|
||||||
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return EnumInteractionResult.SUCCESS;
|
return EnumInteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -341,13 +341,13 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R2.EntityTypes;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R2 implements NMSInterface {
|
||||||
try { // Replace the fox entity
|
try { // Replace the fox entity
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
||||||
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return EnumInteractionResult.SUCCESS;
|
return EnumInteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -342,13 +342,13 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
Player player = (Player) entityhuman.getBukkitEntity();
|
Player player = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -359,7 +359,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R3 implements NMSInterface {
|
||||||
try { // Replace the fox entity
|
try { // Replace the fox entity
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
||||||
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.FOX, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -382,7 +382,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
|
||||||
int maxTameCount = Config.getMaxPlayerFoxTames();
|
int maxTameCount = Config.getMaxPlayerFoxTames();
|
||||||
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && 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(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||||
|
|
||||||
return EnumInteractionResult.a;
|
return EnumInteractionResult.a;
|
||||||
}
|
}
|
||||||
|
@ -403,11 +403,11 @@ public class EntityTamableFox extends EntityFox {
|
||||||
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
getBukkitEntity().getWorld().spawnParticle(org.bukkit.Particle.HEART, getBukkitEntity().getLocation(), 6, 0.5D, 0.5D, 0.5D);
|
||||||
|
|
||||||
// Give player tamed message.
|
// Give player tamed message.
|
||||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamedMessage());
|
||||||
|
|
||||||
// Let the player choose the new fox's name if its enabled in config.
|
// Let the player choose the new fox's name if its enabled in config.
|
||||||
if (Config.askForNameAfterTaming()) {
|
if (Config.askForNameAfterTaming()) {
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
|
@ -418,7 +418,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
|
|
||||||
tamableFox.setCustomName(foxName);
|
tamableFox.setCustomName(foxName);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
plr.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.world.entity.animal.EntityFox;
|
||||||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -27,9 +28,9 @@ public class NMSInterface_1_17_R1 implements NMSInterface {
|
||||||
EntityTypes<EntityFox> type = method.invoke(null, "fox", EntityTypes.Builder.a(EntityTamableFox::new, EnumCreatureType.C))*/
|
EntityTypes<EntityFox> type = method.invoke(null, "fox", EntityTypes.Builder.a(EntityTamableFox::new, EnumCreatureType.C))*/
|
||||||
|
|
||||||
FieldHelper.setField(field, EntityTypes.E, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
FieldHelper.setField(field, EntityTypes.E, (EntityTypes.b<EntityFox>) EntityTamableFox::new);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 802f1d18b9ecb6f8f9dc699bff4adc187cfdee28
|
|
@ -73,10 +73,10 @@
|
||||||
<id>sonatype</id>
|
<id>sonatype</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<!--<repository>
|
||||||
<id>codemc-snapshots</id>
|
<id>codemc-snapshots</id>
|
||||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.seanomik.tamablefoxes;
|
||||||
|
|
||||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -24,12 +25,12 @@ public class CommandSpawnTamableFox implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getOnlyRunPlayer());
|
sender.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getOnlyRunPlayer());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sender.hasPermission("tamablefoxes.spawntamablefox")) {
|
if (!sender.hasPermission("tamablefoxes.spawntamablefox")) {
|
||||||
sender.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getNoPermMessage());
|
sender.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getNoPermMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,25 +40,25 @@ public class CommandSpawnTamableFox implements TabExecutor {
|
||||||
case "red":
|
case "red":
|
||||||
try {
|
try {
|
||||||
plugin.nmsInterface.spawnTamableFox(player.getLocation(), NMSInterface.FoxType.RED);
|
plugin.nmsInterface.spawnTamableFox(player.getLocation(), NMSInterface.FoxType.RED);
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RESET + LanguageConfig.getSpawnedFoxMessage(NMSInterface.FoxType.RED));
|
player.sendMessage(Config.getPrefix() + ChatColor.RESET + LanguageConfig.getSpawnedFoxMessage(NMSInterface.FoxType.RED));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "snow":
|
case "snow":
|
||||||
try {
|
try {
|
||||||
plugin.nmsInterface.spawnTamableFox(player.getLocation(), NMSInterface.FoxType.SNOW);
|
plugin.nmsInterface.spawnTamableFox(player.getLocation(), NMSInterface.FoxType.SNOW);
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RESET + LanguageConfig.getSpawnedFoxMessage(NMSInterface.FoxType.SNOW));
|
player.sendMessage(Config.getPrefix() + ChatColor.RESET + LanguageConfig.getSpawnedFoxMessage(NMSInterface.FoxType.SNOW));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "reload":
|
case "reload":
|
||||||
plugin.reloadConfig();
|
plugin.reloadConfig();
|
||||||
LanguageConfig.getConfig(plugin).reloadConfig();
|
LanguageConfig.getConfig(plugin).reloadConfig();
|
||||||
player.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getReloadMessage());
|
player.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getReloadMessage());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
player.sendMessage(ChatColor.RED + "/spawntamablefox " + ChatColor.GRAY + "[red | snow | reload]");
|
player.sendMessage(ChatColor.RED + "/spawntamablefox " + ChatColor.GRAY + "[red | snow | reload]");
|
||||||
|
|
|
@ -52,14 +52,14 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
nmsInterface = new NMSInterface_1_17_R1();
|
nmsInterface = new NMSInterface_1_17_R1();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionRegister());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionRegister());
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + "You're trying to run MC version " + version + " which is not supported!");
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + "You're trying to run MC version " + version + " which is not supported!");
|
||||||
versionSupported = false;
|
versionSupported = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display starting message then register entity.
|
// Display starting message then register entity.
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.YELLOW + LanguageConfig.getMCVersionLoading(version));
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.YELLOW + LanguageConfig.getMCVersionLoading(version));
|
||||||
nmsInterface.registerCustomFoxEntity();
|
nmsInterface.registerCustomFoxEntity();
|
||||||
|
|
||||||
if (Config.getMaxPlayerFoxTames() != 0) {
|
if (Config.getMaxPlayerFoxTames() != 0) {
|
||||||
|
@ -70,7 +70,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
if (!versionSupported) {
|
if (!versionSupported) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionDisable());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionDisable());
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.YELLOW + LanguageConfig.getSavingFoxMessage());
|
getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.YELLOW + LanguageConfig.getSavingFoxMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TamableFoxes getPlugin() {
|
public static TamableFoxes getPlugin() {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
show-owner-in-fox-name: true
|
show-owner-in-fox-name: true
|
||||||
ask-for-name-after-taming: true
|
ask-for-name-after-taming: true
|
||||||
max-fox-tames: 0
|
max-fox-tames: 0
|
||||||
|
prefix: "&c[Tamable Foxes] "
|
||||||
|
|
||||||
tamed-behavior:
|
tamed-behavior:
|
||||||
attack-wild-animals: true
|
attack-wild-animals: true
|
|
@ -9,11 +9,13 @@ SpigotMC Plugin that gives you the ability to tame foxes!
|
||||||
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### <a href="https://github.com/SeanOMik/TamableFoxes/blob/master/Plugin/src/main/resources/config.yml">Default Config</a>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
If you get any errors, <a href="https://github.com/SeanOMik/TamableFoxes/issues/new">create an issue!</a><br><br>
|
If you get any errors, <a href="https://github.com/SeanOMik/TamableFoxes/issues/new">create an issue!</a><br><br>
|
||||||
Have you ever wanted to tame foxes? Well, now you can! Use chicken to tame and sweet berries to breed them!<br><br>
|
Have you ever wanted to tame foxes? Well, now you can! Use chicken to tame and sweet berries to breed them!<br><br>
|
||||||
|
|
||||||
Features:
|
### Features:
|
||||||
* 33% Chance of taming
|
* 33% Chance of taming
|
||||||
* Breeding
|
* Breeding
|
||||||
* Wild foxes pick berry bushes
|
* Wild foxes pick berry bushes
|
||||||
|
@ -32,12 +34,11 @@ Features:
|
||||||
* Language.yml
|
* Language.yml
|
||||||
* Message for when a tamed fox dies
|
* Message for when a tamed fox dies
|
||||||
|
|
||||||
Commands:
|
### Commands:
|
||||||
* /spawntamablefox [red/snow]: Spawns a tamable fox at the players location.
|
* /spawntamablefox [red/snow]: Spawns a tamable fox at the players location.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
Permissions:
|
### Permissions:
|
||||||
* tamablefoxes.spawn: Gives permission to run the command /spawntamablefox. Default: `op`
|
* tamablefoxes.spawn: Gives permission to run the command /spawntamablefox. Default: `op`
|
||||||
* tamablefoxes.tame: Gives the player the ability to tame a fox. Default: `Everybody`
|
* tamablefoxes.tame: Gives the player the ability to tame a fox. Default: `Everybody`
|
||||||
* tamablefoxes.tame.unlimited: Lets players bypass the tame limit. Default: `op`
|
* tamablefoxes.tame.unlimited: Lets players bypass the tame limit. Default: `op`
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.seanomik.tamablefoxes.util;
|
package net.seanomik.tamablefoxes.util;
|
||||||
|
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -39,7 +40,7 @@ public final class FieldHelper {
|
||||||
fieldMutable.setAccessible(false);
|
fieldMutable.setAccessible(false);
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.seanomik.tamablefoxes.util.io;
|
package net.seanomik.tamablefoxes.util.io;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -27,4 +28,8 @@ public class Config {
|
||||||
|
|
||||||
// Check if the plugin asks for a fox name after taming.
|
// Check if the plugin asks for a fox name after taming.
|
||||||
public static boolean askForNameAfterTaming() { return config.getBoolean("ask-for-name-after-taming"); }
|
public static boolean askForNameAfterTaming() { return config.getBoolean("ask-for-name-after-taming"); }
|
||||||
|
|
||||||
|
public static String getPrefix() {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', config.contains("prefix") ? config.getString("prefix") : "&c[Tamable Foxes] ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.seanomik.tamablefoxes.util.io.sqlite;
|
package net.seanomik.tamablefoxes.util.io.sqlite;
|
||||||
|
|
||||||
import net.seanomik.tamablefoxes.util.Utils;
|
import net.seanomik.tamablefoxes.util.Utils;
|
||||||
|
import net.seanomik.tamablefoxes.util.io.Config;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
|
@ -42,7 +43,7 @@ public class SQLiteHelper {
|
||||||
PreparedStatement statement = sqLiteHandler.getConnection().prepareStatement(userFoxAmountQuery);
|
PreparedStatement statement = sqLiteHandler.getConnection().prepareStatement(userFoxAmountQuery);
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
|
|
||||||
plugin.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + "Created previous player bans table!");
|
plugin.getServer().getConsoleSender().sendMessage(Config.getPrefix() + "Created previous player bans table!");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue