mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 12:44:45 +02:00
Squashed commit of the following:
commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
This commit is contained in:
@ -1,53 +1,54 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class BeastLoreEventHandler {
|
||||
private Player player;
|
||||
private LivingEntity livingEntity;
|
||||
private Tameable beast;
|
||||
|
||||
protected BeastLoreEventHandler(Player player, LivingEntity livingEntity) {
|
||||
this.player = player;
|
||||
this.livingEntity = livingEntity;
|
||||
this.beast = (Tameable) livingEntity;
|
||||
}
|
||||
|
||||
protected void sendInspectMessage() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
||||
if (beast.isTamed()) {
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", getOwnerName()) + " ");
|
||||
}
|
||||
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", livingEntity.getHealth(), livingEntity.getMaxHealth()));
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a tameable animal's owner.
|
||||
*
|
||||
* @return the name of the animal's owner
|
||||
*/
|
||||
private String getOwnerName() {
|
||||
AnimalTamer tamer = beast.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
return ((Player) tamer).getName();
|
||||
}
|
||||
else if (tamer instanceof OfflinePlayer) {
|
||||
return ((OfflinePlayer) tamer).getName();
|
||||
}
|
||||
|
||||
return "Unknown Master";
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class BeastLoreEventHandler {
|
||||
private Player player;
|
||||
private LivingEntity livingEntity;
|
||||
private Tameable beast;
|
||||
|
||||
protected BeastLoreEventHandler(Player player, LivingEntity livingEntity) {
|
||||
this.player = player;
|
||||
this.livingEntity = livingEntity;
|
||||
this.beast = (Tameable) livingEntity;
|
||||
}
|
||||
|
||||
protected void sendInspectMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
||||
if (beast.isTamed()) {
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", getOwnerName()) + " ");
|
||||
}
|
||||
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", livingEntity.getHealth(), livingEntity.getMaxHealth()));
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a tameable animal's owner.
|
||||
*
|
||||
* @return the name of the animal's owner
|
||||
*/
|
||||
private String getOwnerName() {
|
||||
AnimalTamer tamer = beast.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
return ((Player) tamer).getName();
|
||||
}
|
||||
else if (tamer instanceof OfflinePlayer) {
|
||||
return ((OfflinePlayer) tamer).getName();
|
||||
}
|
||||
|
||||
return "Unknown Master";
|
||||
}
|
||||
}
|
||||
|
@ -1,102 +1,108 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class CallOfTheWildEventHandler {
|
||||
protected Player player;
|
||||
protected ItemStack inHand;
|
||||
protected EntityType type;
|
||||
protected int summonAmount;
|
||||
|
||||
protected CallOfTheWildEventHandler(Player player, EntityType type, int summonAmount) {
|
||||
this.player = player;
|
||||
this.inHand = player.getItemInHand();
|
||||
this.type = type;
|
||||
this.summonAmount = summonAmount;
|
||||
}
|
||||
|
||||
protected void sendInsufficientAmountMessage() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(inHand.getTypeId())));
|
||||
}
|
||||
|
||||
protected boolean nearbyEntityExists() {
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
boolean entityExists = false;
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
||||
if (entity.getType() == type) {
|
||||
entityExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entityExists;
|
||||
}
|
||||
|
||||
protected void sendFailureMessage() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Wolf"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnCreature() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
|
||||
}
|
||||
else {
|
||||
entity.setHealth(entity.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
protected void processResourceCost() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
int newAmount = inHand.getAmount() - summonAmount;
|
||||
|
||||
if (newAmount == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
else {
|
||||
player.getItemInHand().setAmount(inHand.getAmount() - summonAmount);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendSuccessMessage() {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class CallOfTheWildEventHandler {
|
||||
protected Player player;
|
||||
protected ItemStack inHand;
|
||||
protected EntityType type;
|
||||
protected int summonAmount;
|
||||
|
||||
protected CallOfTheWildEventHandler(Player player, EntityType type, int summonAmount) {
|
||||
this.player = player;
|
||||
this.inHand = player.getItemInHand();
|
||||
this.type = type;
|
||||
this.summonAmount = summonAmount;
|
||||
}
|
||||
|
||||
protected void sendInsufficientAmountMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(inHand.getTypeId())));
|
||||
}
|
||||
|
||||
protected boolean nearbyEntityExists() {
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean entityExists = false;
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
||||
if (entity.getType() == type) {
|
||||
entityExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entityExists;
|
||||
}
|
||||
|
||||
protected void sendFailureMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Wolf"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnCreature() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
|
||||
}
|
||||
else {
|
||||
entity.setHealth(entity.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
protected void processResourceCost() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int newAmount = inHand.getAmount() - summonAmount;
|
||||
|
||||
if (newAmount == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
else {
|
||||
player.getItemInHand().setAmount(inHand.getAmount() - summonAmount);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendSuccessMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Wolf;
|
||||
|
||||
public class FastFoodServiceEventHandler {
|
||||
private Wolf wolf;
|
||||
|
||||
public FastFoodServiceEventHandler (Wolf wolf) {
|
||||
this.wolf = wolf;
|
||||
}
|
||||
|
||||
protected void modifyHealth(int damage) {
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
|
||||
if (health < maxHealth) {
|
||||
int newHealth = health + damage;
|
||||
|
||||
if (newHealth <= maxHealth) {
|
||||
wolf.setHealth(newHealth);
|
||||
}
|
||||
else {
|
||||
wolf.setHealth(maxHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Wolf;
|
||||
|
||||
public class FastFoodServiceEventHandler {
|
||||
private Wolf wolf;
|
||||
|
||||
public FastFoodServiceEventHandler(Wolf wolf) {
|
||||
this.wolf = wolf;
|
||||
}
|
||||
|
||||
protected void modifyHealth(int damage) {
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
|
||||
if (health < maxHealth) {
|
||||
int newHealth = health + damage;
|
||||
|
||||
if (newHealth <= maxHealth) {
|
||||
wolf.setHealth(newHealth);
|
||||
}
|
||||
else {
|
||||
wolf.setHealth(maxHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
|
||||
public class GoreEventHandler {
|
||||
private TamingManager manager;
|
||||
private EntityDamageEvent event;
|
||||
private Entity entity;
|
||||
protected int skillModifier;
|
||||
|
||||
protected GoreEventHandler(TamingManager manager, EntityDamageEvent event) {
|
||||
this.manager = manager;
|
||||
this.event = event;
|
||||
this.entity = event.getEntity();
|
||||
calculateSkillModifier();
|
||||
}
|
||||
|
||||
protected void calculateSkillModifier() {
|
||||
this.skillModifier = SkillTools.skillCheck(manager.getSkillLevel(), Taming.goreMaxBonusLevel);
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() * Taming.goreModifier);
|
||||
}
|
||||
|
||||
protected void sendAbilityMessage() {
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
}
|
||||
|
||||
protected void applyBleed() {
|
||||
BleedTimer.add((LivingEntity) entity, Taming.goreBleedTicks);
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class GoreEventHandler {
|
||||
private TamingManager manager;
|
||||
private EntityDamageEvent event;
|
||||
private Entity entity;
|
||||
protected int skillModifier;
|
||||
|
||||
protected GoreEventHandler(TamingManager manager, EntityDamageEvent event) {
|
||||
this.manager = manager;
|
||||
this.event = event;
|
||||
this.entity = event.getEntity();
|
||||
calculateSkillModifier();
|
||||
}
|
||||
|
||||
protected void calculateSkillModifier() {
|
||||
this.skillModifier = SkillUtils.skillCheck(manager.getSkillLevel(), Taming.goreMaxBonusLevel);
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() * Taming.goreModifier);
|
||||
}
|
||||
|
||||
protected void sendAbilityMessage() {
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
}
|
||||
|
||||
protected void applyBleed() {
|
||||
BleedTimerTask.add((LivingEntity) entity, Taming.goreBleedTicks);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class SharpenedClawsEventHandler {
|
||||
private EntityDamageEvent event;
|
||||
|
||||
public SharpenedClawsEventHandler (EntityDamageEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() + Taming.sharpenedClawsBonusDamage);
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class SharpenedClawsEventHandler {
|
||||
private EntityDamageEvent event;
|
||||
|
||||
public SharpenedClawsEventHandler(EntityDamageEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() + Taming.sharpenedClawsBonusDamage);
|
||||
}
|
||||
}
|
||||
|
@ -8,33 +8,33 @@ import org.bukkit.entity.Wolf;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class Taming {
|
||||
public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock();
|
||||
public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock();
|
||||
public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock();
|
||||
|
||||
public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
|
||||
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
||||
public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
|
||||
|
||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||
public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
|
||||
public static int goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||
public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
|
||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||
public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
|
||||
public static int goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||
|
||||
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
|
||||
public static int sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
||||
|
||||
public static int shockProofUnlockLevel = AdvancedConfig.getInstance().getShockProofUnlock();
|
||||
public static int shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
|
||||
public static int shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
|
||||
|
||||
public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
|
||||
public static int thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
||||
public static int thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
||||
|
||||
public static int wolfXp = Config.getInstance().getTamingXPWolf();
|
||||
public static int wolfXp = Config.getInstance().getTamingXPWolf();
|
||||
public static int ocelotXp = Config.getInstance().getTamingXPOcelot();
|
||||
|
||||
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
||||
@ -42,19 +42,19 @@ public class Taming {
|
||||
}
|
||||
|
||||
public static boolean canUseThickFur(Player player) {
|
||||
return SkillTools.unlockLevelReached(player, SkillType.TAMING, thickFurUnlockLevel) && Permissions.thickFur(player);
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, thickFurUnlockLevel) && Permissions.thickFur(player);
|
||||
}
|
||||
|
||||
public static boolean canUseEnvironmentallyAware(Player player) {
|
||||
return SkillTools.unlockLevelReached(player, SkillType.TAMING, environmentallyAwareUnlockLevel) && Permissions.environmentallyAware(player);
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, environmentallyAwareUnlockLevel) && Permissions.environmentallyAware(player);
|
||||
}
|
||||
|
||||
public static boolean canUseShockProof(Player player) {
|
||||
return SkillTools.unlockLevelReached(player, SkillType.TAMING, shockProofUnlockLevel) && Permissions.shockProof(player);
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, shockProofUnlockLevel) && Permissions.shockProof(player);
|
||||
}
|
||||
|
||||
public static boolean canUseHolyHound(Player player) {
|
||||
return SkillTools.unlockLevelReached(player, SkillType.TAMING, holyHoundUnlockLevel) && Permissions.holyHound(player);
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, holyHoundUnlockLevel) && Permissions.holyHound(player);
|
||||
}
|
||||
|
||||
public static int processThickFur(Wolf wolf, int damage) {
|
||||
|
@ -1,165 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillCommand;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class TamingCommand extends SkillCommand {
|
||||
private String goreChance;
|
||||
private String goreChanceLucky;
|
||||
|
||||
private boolean canBeastLore;
|
||||
private boolean canGore;
|
||||
private boolean canSharpenedClaws;
|
||||
private boolean canEnvironmentallyAware;
|
||||
private boolean canThickFur;
|
||||
private boolean canShockProof;
|
||||
private boolean canCallWild;
|
||||
private boolean canFastFood;
|
||||
private boolean canHolyHound;
|
||||
|
||||
public TamingCommand() {
|
||||
super(SkillType.TAMING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
String[] goreStrings = calculateAbilityDisplayValues(Taming.goreMaxBonusLevel, Taming.goreMaxChance);
|
||||
goreChance = goreStrings[0];
|
||||
goreChanceLucky = goreStrings[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBeastLore = Permissions.beastLore(player);
|
||||
canCallWild = Permissions.callOfTheWild(player);
|
||||
canEnvironmentallyAware = Permissions.environmentallyAware(player);
|
||||
canFastFood = Permissions.fastFoodService(player);
|
||||
canGore = Permissions.gore(player);
|
||||
canSharpenedClaws = Permissions.sharpenedClaws(player);
|
||||
canShockProof = Permissions.shockProof(player);
|
||||
canThickFur = Permissions.thickFur(player);
|
||||
canHolyHound = Permissions.holyHound(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canBeastLore || canCallWild || canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur || canHolyHound;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
luckyEffectsDisplay();
|
||||
|
||||
if (canBeastLore) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1")));
|
||||
}
|
||||
|
||||
if (canGore) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3")));
|
||||
}
|
||||
|
||||
if (canSharpenedClaws) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5")));
|
||||
}
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7")));
|
||||
}
|
||||
|
||||
if (canThickFur) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9")));
|
||||
}
|
||||
|
||||
if (canShockProof) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11")));
|
||||
}
|
||||
|
||||
if (canFastFood) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17")));
|
||||
}
|
||||
|
||||
if (canHolyHound) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.18"), LocaleLoader.getString("Taming.Effect.19")));
|
||||
}
|
||||
|
||||
if (canCallWild) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13")));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWOcelotCost()));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWWolfCost()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur || canHolyHound;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canFastFood) {
|
||||
if (skillValue < Taming.fastFoodServiceUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.4", Taming.fastFoodServiceUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9", percent.format(Taming.fastFoodServiceActivationChance / 100D))));
|
||||
}
|
||||
}
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
if (skillValue < Taming.environmentallyAwareUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.0", Taming.environmentallyAwareUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));
|
||||
}
|
||||
}
|
||||
|
||||
if (canThickFur) {
|
||||
if (skillValue < Taming.thickFurUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.1", Taming.thickFurUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3", Taming.thickFurModifier)));
|
||||
}
|
||||
}
|
||||
|
||||
if (canHolyHound) {
|
||||
if (skillValue < Taming.holyHoundUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.5", Taming.holyHoundUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.10"), LocaleLoader.getString("Taming.Ability.Bonus.11")));
|
||||
}
|
||||
}
|
||||
|
||||
if (canShockProof) {
|
||||
if (skillValue < Taming.shockProofUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.2", Taming.shockProofUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5", Taming.shockProofModifier)));
|
||||
}
|
||||
}
|
||||
|
||||
if (canSharpenedClaws) {
|
||||
if (skillValue < Taming.sharpenedClawsUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.3", Taming.sharpenedClawsUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7", Taming.sharpenedClawsBonusDamage)));
|
||||
}
|
||||
}
|
||||
|
||||
if (canGore) {
|
||||
if (isLucky) {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", goreChance) + LocaleLoader.getString("Perks.lucky.bonus", goreChanceLucky));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", goreChance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,145 +1,145 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class TamingManager extends SkillManager {
|
||||
public TamingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.TAMING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Award XP for taming.
|
||||
*
|
||||
* @param event The event to award XP for
|
||||
*/
|
||||
public void awardTamingXP(LivingEntity entity) {
|
||||
switch (entity.getType()) {
|
||||
case WOLF:
|
||||
applyXpGain(Taming.wolfXp);
|
||||
return;
|
||||
|
||||
case OCELOT:
|
||||
applyXpGain(Taming.ocelotXp);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Fast Food Service ability.
|
||||
*
|
||||
* @param wolf The wolf using the ability
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, int damage) {
|
||||
if (SkillTools.activationSuccessful(getPlayer(), skill, Taming.fastFoodServiceActivationChance)) {
|
||||
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
|
||||
if (health < maxHealth) {
|
||||
int newHealth = health + damage;
|
||||
wolf.setHealth(Math.min(newHealth, maxHealth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Sharpened Claws ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void sharpenedClaws(EntityDamageEvent event) {
|
||||
SharpenedClawsEventHandler eventHandler = new SharpenedClawsEventHandler(event);
|
||||
eventHandler.modifyEventDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Gore ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void gore(EntityDamageEvent event) {
|
||||
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
|
||||
|
||||
float chance = (float) ((Taming.goreMaxChance / Taming.goreMaxBonusLevel) * getSkillLevel());
|
||||
if (chance > Taming.goreMaxChance) chance = (float) Taming.goreMaxChance;
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.applyBleed();
|
||||
eventHandler.sendAbilityMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon an ocelot to your side.
|
||||
*/
|
||||
public void summonOcelot() {
|
||||
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWOcelotCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon a wolf to your side.
|
||||
*/
|
||||
public void summonWolf() {
|
||||
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Beast Lore ability.
|
||||
*
|
||||
* @param livingEntity The entity to examine
|
||||
*/
|
||||
public void beastLore(LivingEntity livingEntity) {
|
||||
BeastLoreEventHandler eventHandler = new BeastLoreEventHandler(mcMMOPlayer.getPlayer(), livingEntity);
|
||||
eventHandler.sendInspectMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Call of the Wild ability.
|
||||
*
|
||||
* @param type The type of entity to summon.
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
if (!Permissions.callOfTheWild(mcMMOPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallOfTheWildEventHandler eventHandler = new CallOfTheWildEventHandler(mcMMOPlayer.getPlayer(), type, summonAmount);
|
||||
|
||||
ItemStack inHand = eventHandler.inHand;
|
||||
int inHandAmount = inHand.getAmount();
|
||||
|
||||
if (inHandAmount < summonAmount) {
|
||||
eventHandler.sendInsufficientAmountMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventHandler.nearbyEntityExists()) {
|
||||
eventHandler.sendFailureMessage();
|
||||
}
|
||||
else {
|
||||
eventHandler.spawnCreature();
|
||||
eventHandler.processResourceCost();
|
||||
eventHandler.sendSuccessMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class TamingManager extends SkillManager {
|
||||
public TamingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.TAMING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Award XP for taming.
|
||||
*
|
||||
* @param event The event to award XP for
|
||||
*/
|
||||
public void awardTamingXP(LivingEntity entity) {
|
||||
switch (entity.getType()) {
|
||||
case WOLF:
|
||||
applyXpGain(Taming.wolfXp);
|
||||
return;
|
||||
|
||||
case OCELOT:
|
||||
applyXpGain(Taming.ocelotXp);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Fast Food Service ability.
|
||||
*
|
||||
* @param wolf The wolf using the ability
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, int damage) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, Taming.fastFoodServiceActivationChance)) {
|
||||
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
|
||||
if (health < maxHealth) {
|
||||
int newHealth = health + damage;
|
||||
wolf.setHealth(Math.min(newHealth, maxHealth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Sharpened Claws ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void sharpenedClaws(EntityDamageEvent event) {
|
||||
SharpenedClawsEventHandler eventHandler = new SharpenedClawsEventHandler(event);
|
||||
eventHandler.modifyEventDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Gore ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void gore(EntityDamageEvent event) {
|
||||
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
|
||||
|
||||
float chance = (float) ((Taming.goreMaxChance / Taming.goreMaxBonusLevel) * getSkillLevel());
|
||||
if (chance > Taming.goreMaxChance) {
|
||||
chance = (float) Taming.goreMaxChance;
|
||||
}
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.applyBleed();
|
||||
eventHandler.sendAbilityMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon an ocelot to your side.
|
||||
*/
|
||||
public void summonOcelot() {
|
||||
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWOcelotCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon a wolf to your side.
|
||||
*/
|
||||
public void summonWolf() {
|
||||
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Beast Lore ability.
|
||||
*
|
||||
* @param livingEntity The entity to examine
|
||||
*/
|
||||
public void beastLore(LivingEntity livingEntity) {
|
||||
BeastLoreEventHandler eventHandler = new BeastLoreEventHandler(mcMMOPlayer.getPlayer(), livingEntity);
|
||||
eventHandler.sendInspectMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Call of the Wild ability.
|
||||
*
|
||||
* @param type The type of entity to summon.
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
if (!Permissions.callOfTheWild(mcMMOPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallOfTheWildEventHandler eventHandler = new CallOfTheWildEventHandler(mcMMOPlayer.getPlayer(), type, summonAmount);
|
||||
|
||||
ItemStack inHand = eventHandler.inHand;
|
||||
int inHandAmount = inHand.getAmount();
|
||||
|
||||
if (inHandAmount < summonAmount) {
|
||||
eventHandler.sendInsufficientAmountMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventHandler.nearbyEntityExists()) {
|
||||
eventHandler.sendFailureMessage();
|
||||
}
|
||||
else {
|
||||
eventHandler.spawnCreature();
|
||||
eventHandler.processResourceCost();
|
||||
eventHandler.sendSuccessMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user