diff --git a/README.md b/README.md index bb860bf..376e69b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # BreedablePetsMC -Breed parrots and polar bears. Customize the food/item you use to tame each mob. +Breed animals that are not normally breed-able in Minecraft. -**Breedable Pets** is a [Minecraft](http://minecraft.net) server plugin for [Bukkit](http://http://bukkit.org) / [Spigot](http://spigotmc.org) / [Paper](http://papermc.io) that allows you to breed animals that are not usually breedable. + + +**Breedable Pets** is a [Minecraft](http://minecraft.net) server plugin for [Bukkit](http://http://bukkit.org) / [Spigot](http://spigotmc.org) / [Paper](http://papermc.io) that allows you to breed animals that are not usually breed-able. ### Installation -Drop the jar in your plugins folder and start the server. +Download jar from the [releases](https://github.com/Magnum97/BreedablePetsMC/releases) page and put it in your server's `plugins/` folder, then start the server. +Optionally you can compile it yourself. ## Usage There is only one command, `/breedablepets` alias `/bp`. Sub commands are: @@ -15,7 +18,7 @@ There is only one command, `/breedablepets` alias `/bp`. Sub commands are: For settings see [config.yml](https://github.com/Magnum97/BreedablePetsMC/blob/master/src/main/resources/config.yml)\ I tried to put all options in there. Some are not implemented yet. \ -Currently only parrots are breedable. You must feed them seeds *other* than wheat. Wheat seeds are still used for taming wild parrots. Foods are hard coded but plan to move to config in a future version. +Currently only parrots are breed-able. You must feed them seeds *other* than wheat. Wheat seeds are still used for taming wild parrots. Foods are hard coded but plan to move to config in a future version. ### Contributing This is a pretty basic plugin. If you have any thoughts, good or bad, I would like them or any suggestions for features or improvements.\ diff --git a/build.gradle b/build.gradle index cff92e3..f3abee7 100644 --- a/build.gradle +++ b/build.gradle @@ -12,16 +12,16 @@ plugins { id 'com.github.johnrengelman.shadow' version '5.1.0' } -group= 'me.magnum' // Put your groupId here -version= '1.3.1a' // Put your version here +group = 'me.magnum' // Put your groupId here +version = '1.3.1a' // Put your version here archivesBaseName = 'BreedablePets' // Put your artifactId here -mainClassName = 'me.magnum.breedablepets.Main' +mainClassName = 'me.magnum.Breedable' targetCompatibility = 1.8 sourceCompatibility = 1.8 // See https://github.com/EntryPointKR/Spigradle#repositories for repository shortcodes repositories { - mavenLocal() +// mavenLocal() mavenCentral() paper() enderZone() @@ -32,9 +32,10 @@ repositories { dependencies { compileOnly spigot('1.15.2') implementation 'fr.mrmicky:FastParticles:1.2.0' - implementation 'com.github.JavaFactoryDev:LightningStorage:3.0.3' + implementation files ('/home/rich/.m2/repository/com/github/javafactorydev/lightningstorage/3.1.1-SNAPSHOT/lightningstorage-3.1.1-SNAPSHOT.jar') +// implementation 'com.github.JavaFactoryDev:LightningStorage:3.1.1-SNAPSHOT' implementation "co.aikar:acf-bukkit:0.5.0-SNAPSHOT" - implementation 'com.github.kangarko:Foundation:5.3.8@jar' // Kangerko's Foundation library +// implementation 'com.github.kangarko:Foundation:5.3.8@jar' // Kangerko's Foundation library } compileJava { @@ -47,33 +48,33 @@ task relocateShadowJar(type: ConfigureShadowRelocation) { prefix = "shadow" // Default value is "shadow" } +tasks.shadowJar.dependsOn tasks.relocateShadowJar shadowJar { classifier = null // remove -all from end of jar } -// TODO Create plugin.yml with correct info spigot { authors = ['Magnum1997'] // depends = ['ProtocolLib'] apiVersion = '1.15' load = STARTUP commands { - give { - aliases = ['i'] - description = 'Give command.' - permission = 'test.foo' - permissionMessage = 'You do not have permission!' - usage = '/ [test|stop]' + breedablepets { + aliases = ['bp'] + description = 'Main command for BreedablePets' + permission = 'breedablepets.command' + permissionMessage = 'You do not have permission: breedablepets.command' + usage = '/ [ help | parrotegg [fertile]]' } } permissions { - 'test.foo' { - description = 'Allows foo command' - defaults = 'true' + 'breedablepets.command' { + description = 'Allows main command' + defaults = 'op' } - 'test.*' { + 'breedablepets.*' { description = 'Wildcard permission' defaults = 'op' - children = ['test.foo': true] + children = ['breedablepets.command': true, 'breedablepets.command.parrot': true, 'breedabpepets.reload': true] } } } diff --git a/src/main/java/me/magnum/breedablepets/Command.java b/src/main/java/me/magnum/breedablepets/Command.java index 36e82c7..c5e3c8d 100644 --- a/src/main/java/me/magnum/breedablepets/Command.java +++ b/src/main/java/me/magnum/breedablepets/Command.java @@ -35,7 +35,9 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandAlias("breedablepet|bp") +// TODO refine permissions +// ie. breedable.command breedable.command.parrot breedable.command.reload +@CommandAlias("breedablepets|bp") public class Command extends BaseCommand { @HelpCommand @@ -45,7 +47,7 @@ public void onHelp (CommandSender sender, CommandHelp help) { @Subcommand("parrotegg") @Description("Get a parrot egg") - @CommandPermission("breedable.parrot.egg") + @CommandPermission("breedablepets.command.parrotegg") public void onCommand (CommandSender sender, @Default("false") String fertile) { ItemUtil util = new ItemUtil(); Player p = (Player) sender; @@ -63,7 +65,7 @@ public void onCommand (CommandSender sender, @Default("false") String fertile) { @Subcommand("reload") @CommandPermission("breedable.reload") public void onReload (CommandSender sender) { - Breedable.getCfg().reloadConfig(); + Breedable.getPlugin().getCfg().forceReload(); } @CommandAlias("sp") diff --git a/src/main/java/me/magnum/breedablepets/listeners/BreedListener.java b/src/main/java/me/magnum/breedablepets/listeners/BreedListener.java index 6cb8cd7..db011c2 100644 --- a/src/main/java/me/magnum/breedablepets/listeners/BreedListener.java +++ b/src/main/java/me/magnum/breedablepets/listeners/BreedListener.java @@ -113,7 +113,7 @@ public void onFeed (PlayerInteractEntityEvent pie) { double y = target.getLocation().getY() + 1; double z = target.getLocation().getZ(); if (hasMate) { - if (ThreadLocalRandom.current().nextInt(100) < (Breedable.getCfg().getInt("fertile-egg-chance"))) { + if (ThreadLocalRandom.current().nextInt(100) < (Breedable.getPlugin().getCfg().getInt("fertile-egg-chance"))) { w.dropItemNaturally(loc, items.regEgg.clone()); // w.dropItemNaturally(loc, items.fertileEgg.clone()); // TODO To be fertile egg - disabled until single throw bug fixed FastParticle.spawnParticle(target.getWorld(), ParticleType.HEART, target.getLocation(), 3); @@ -122,7 +122,7 @@ public void onFeed (PlayerInteractEntityEvent pie) { FastParticle.spawnParticle(w, ParticleType.HEART, x, y, z, 3); } else { - if (ThreadLocalRandom.current().nextInt(1, 101) < Breedable.getCfg().getInt("egg-chance")) { + if (ThreadLocalRandom.current().nextInt(1, 101) < Breedable.getPlugin().getCfg().getInt("egg-chance")) { w.dropItemNaturally(loc, items.regEgg.clone()); FastParticle.spawnParticle(target.getWorld(), ParticleType.HEART, target.getLocation(), 3); FastParticle.spawnParticle(target.getWorld(), ParticleType.HEART, x, y, z, 3); @@ -133,7 +133,7 @@ public void onFeed (PlayerInteractEntityEvent pie) { } else { - if (ThreadLocalRandom.current().nextInt(100) < Breedable.getCfg().getInt("egg-change")) { + if (ThreadLocalRandom.current().nextInt(100) < Breedable.getPlugin().getCfg().getInt("egg-change")) { FastParticle.spawnParticle(w, ParticleType.NOTE, target.getLocation(), 3, x, y, z); // FastParticle.spawnParticle(w, ParticleType.NOTE, x, y, z, 1); w.dropItemNaturally(loc, items.regEgg.clone()); @@ -147,20 +147,20 @@ private Integer foodCalc (Entity target, Material type) { int chance = 0; switch (type) { case WHEAT_SEEDS: - chance = Breedable.getCfg().getInt("modifier.wheat"); + chance = Breedable.getPlugin().getCfg().getInt("modifier.wheat"); break; case BEETROOT_SEEDS: - chance = Breedable.getCfg().getInt("modifier.beetroot"); + chance = Breedable.getPlugin().getCfg().getInt("modifier.beetroot"); break; case PUMPKIN_SEEDS: - chance = Breedable.getCfg().getInt("modifier.pumpkin"); + chance = Breedable.getPlugin().getCfg().getInt("modifier.pumpkin"); break; case MELON_SEEDS: - chance = Breedable.getCfg().getInt("modifier.melon"); + chance = Breedable.getPlugin().getCfg().getInt("modifier.melon"); break; case GLISTERING_MELON_SLICE: _MELON: - chance = Breedable.getCfg().getInt("modifier.glistering"); + chance = Breedable.getPlugin().getCfg().getInt("modifier.glistering"); break; } return chance; diff --git a/src/main/java/me/magnum/breedablepets/util/SpawnPets.java b/src/main/java/me/magnum/breedablepets/util/SpawnPets.java index 72508f1..c9e4f15 100644 --- a/src/main/java/me/magnum/breedablepets/util/SpawnPets.java +++ b/src/main/java/me/magnum/breedablepets/util/SpawnPets.java @@ -27,7 +27,6 @@ package me.magnum.breedablepets.util; import me.magnum.Breedable; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; @@ -48,16 +47,16 @@ public static void newParrot (Player player, Location location) { World world = player.getWorld(); location = world.getHighestBlockAt(location).getLocation().add(0,1,0); Parrot parrot = (Parrot) world.spawnEntity(location, EntityType.PARROT); - parrot.setTamed(Breedable.getCfg().getBoolean("hatches.tamed")); + parrot.setTamed(Breedable.getPlugin().getCfg().getBoolean("hatches.tamed")); parrot.setHealth(1); // TODO add to config parrot.setVariant(Parrot.Variant.RED); if (parrot.isTamed()) { parrot.setOwner(player); parrot.setSitting(true); } - if (Breedable.getCfg().getBoolean("hatches.named")) { + if (Breedable.getPlugin().getCfg().getBoolean("hatches.named")) { parrot.setCustomNameVisible(true); - parrot.setCustomName(ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(Breedable.getCfg().getString("hatches.name")))); + parrot.setCustomName(ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(Breedable.getPlugin().getCfg().getString("hatches.name")))); } } }