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>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -320,7 +320,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_14_R1.EntityTypes;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -20,9 +21,9 @@ public class NMSInterface_1_14_R1 implements NMSInterface {
|
|||
try { // Replace the fox entity
|
||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("aZ");
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -320,7 +320,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_15_R1.EntityTypes;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -20,9 +21,9 @@ public class NMSInterface_1_15_R1 implements NMSInterface {
|
|||
try { // Replace the fox entity
|
||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("ba");
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -323,7 +323,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -361,7 +361,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R1.EntityFox;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R1 implements NMSInterface {
|
|||
try { // Replace the fox entity
|
||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("be");
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -320,7 +320,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -358,7 +358,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R2.EntityTypes;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R2 implements NMSInterface {
|
|||
try { // Replace the fox entity
|
||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -321,7 +321,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -359,7 +359,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.v1_16_R3.EntityTypes;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -21,9 +22,9 @@ public class NMSInterface_1_16_R3 implements NMSInterface {
|
|||
try { // Replace the fox entity
|
||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("bf");
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -382,7 +382,7 @@ 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) {
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
((Player) entityhuman.getBukkitEntity()).sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
|
||||
|
||||
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);
|
||||
|
||||
// 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.
|
||||
if (Config.askForNameAfterTaming()) {
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getTamingAskingName());
|
||||
new AnvilGUI.Builder()
|
||||
.onComplete((plr, input) -> { // Called when the inventory output slot is clicked
|
||||
if (!input.equals("")) {
|
||||
|
@ -418,7 +418,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
tamableFox.setCustomName(foxName);
|
||||
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();
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.world.entity.animal.EntityFox;
|
|||
import net.seanomik.tamablefoxes.util.FieldHelper;
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
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))*/
|
||||
|
||||
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) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 802f1d18b9ecb6f8f9dc699bff4adc187cfdee28
|
|
@ -73,10 +73,10 @@
|
|||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.seanomik.tamablefoxes;
|
|||
|
||||
import net.seanomik.tamablefoxes.util.NMSInterface;
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -24,12 +25,12 @@ public class CommandSpawnTamableFox implements TabExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getOnlyRunPlayer());
|
||||
sender.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getOnlyRunPlayer());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("tamablefoxes.spawntamablefox")) {
|
||||
sender.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getNoPermMessage());
|
||||
sender.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getNoPermMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,25 +40,25 @@ public class CommandSpawnTamableFox implements TabExecutor {
|
|||
case "red":
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||
}
|
||||
break;
|
||||
case "snow":
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureSpawn());
|
||||
}
|
||||
break;
|
||||
case "reload":
|
||||
plugin.reloadConfig();
|
||||
LanguageConfig.getConfig(plugin).reloadConfig();
|
||||
player.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getReloadMessage());
|
||||
player.sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getReloadMessage());
|
||||
break;
|
||||
default:
|
||||
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();
|
||||
break;
|
||||
default:
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Utils.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 + LanguageConfig.getUnsupportedMCVersionRegister());
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + "You're trying to run MC version " + version + " which is not supported!");
|
||||
versionSupported = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
if (Config.getMaxPlayerFoxTames() != 0) {
|
||||
|
@ -70,7 +70,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
|||
|
||||
@Override
|
||||
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() {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
show-owner-in-fox-name: true
|
||||
ask-for-name-after-taming: true
|
||||
max-fox-tames: 0
|
||||
prefix: "&c[Tamable Foxes] "
|
||||
|
||||
tamed-behavior:
|
||||
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
|
||||
```
|
||||
|
||||
### <a href="https://github.com/SeanOMik/TamableFoxes/blob/master/Plugin/src/main/resources/config.yml">Default Config</a>
|
||||
|
||||
<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>
|
||||
|
||||
Features:
|
||||
### Features:
|
||||
* 33% Chance of taming
|
||||
* Breeding
|
||||
* Wild foxes pick berry bushes
|
||||
|
@ -32,12 +34,11 @@ Features:
|
|||
* Language.yml
|
||||
* Message for when a tamed fox dies
|
||||
|
||||
Commands:
|
||||
### Commands:
|
||||
* /spawntamablefox [red/snow]: Spawns a tamable fox at the players location.
|
||||
|
||||
<br>
|
||||
|
||||
Permissions:
|
||||
### Permissions:
|
||||
* 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.unlimited: Lets players bypass the tame limit. Default: `op`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.seanomik.tamablefoxes.util;
|
||||
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import net.seanomik.tamablefoxes.util.io.LanguageConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -39,7 +40,7 @@ public final class FieldHelper {
|
|||
fieldMutable.setAccessible(false);
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.seanomik.tamablefoxes.util.io;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -27,4 +28,8 @@ public class Config {
|
|||
|
||||
// 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 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;
|
||||
|
||||
import net.seanomik.tamablefoxes.util.Utils;
|
||||
import net.seanomik.tamablefoxes.util.io.Config;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
@ -42,7 +43,7 @@ public class SQLiteHelper {
|
|||
PreparedStatement statement = sqLiteHandler.getConnection().prepareStatement(userFoxAmountQuery);
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue