mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-30 20:48:19 +01:00
parent
8dfa8c20f3
commit
ab7a83b37e
@ -51,6 +51,9 @@ public abstract class AcrobaticsEventHandler {
|
|||||||
* @return true if the damage is fatal, false otherwise
|
* @return true if the damage is fatal, false otherwise
|
||||||
*/
|
*/
|
||||||
protected boolean isFatal(int damage) {
|
protected boolean isFatal(int damage) {
|
||||||
|
if(player == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (player.getHealth() - damage < 1) {
|
if (player.getHealth() - damage < 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ public class AcrobaticsManager {
|
|||||||
* @param event The event to check
|
* @param event The event to check
|
||||||
*/
|
*/
|
||||||
public void rollCheck(EntityDamageEvent event) {
|
public void rollCheck(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionInstance.roll(player)) {
|
if (!permissionInstance.roll(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,6 +57,9 @@ public class AcrobaticsManager {
|
|||||||
* @param event The event to check
|
* @param event The event to check
|
||||||
*/
|
*/
|
||||||
public void dodgeCheck(EntityDamageEvent event) {
|
public void dodgeCheck(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionInstance.dodge(player)) {
|
if (!permissionInstance.dodge(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,17 @@ public class DodgeEventHandler extends AcrobaticsEventHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendAbilityMessage() {
|
protected void sendAbilityMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processXPGain(int xp) {
|
protected void processXPGain(int xp) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = manager.getProfile();
|
PlayerProfile profile = manager.getProfile();
|
||||||
|
|
||||||
if (System.currentTimeMillis() >= profile.getRespawnATS() + 5) {
|
if (System.currentTimeMillis() >= profile.getRespawnATS() + 5) {
|
||||||
|
@ -56,6 +56,9 @@ public class RollEventHandler extends AcrobaticsEventHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendAbilityMessage() {
|
protected void sendAbilityMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (isGraceful) {
|
if (isGraceful) {
|
||||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
player.sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
||||||
}
|
}
|
||||||
@ -67,6 +70,9 @@ public class RollEventHandler extends AcrobaticsEventHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processXPGain(int xpGain) {
|
protected void processXPGain(int xpGain) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xpGain);
|
Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xpGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +80,9 @@ public class RollEventHandler extends AcrobaticsEventHandler {
|
|||||||
* Check if this is a graceful roll.
|
* Check if this is a graceful roll.
|
||||||
*/
|
*/
|
||||||
private void isGracefulRoll() {
|
private void isGracefulRoll() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (Permissions.getInstance().gracefulRoll(player)) {
|
if (Permissions.getInstance().gracefulRoll(player)) {
|
||||||
this.isGraceful = player.isSneaking();
|
this.isGraceful = player.isSneaking();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ public class ArcheryManager {
|
|||||||
* @param livingEntity Entity damaged by the arrow
|
* @param livingEntity Entity damaged by the arrow
|
||||||
*/
|
*/
|
||||||
public void trackArrows(LivingEntity livingEntity) {
|
public void trackArrows(LivingEntity livingEntity) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.trackArrows(player)) {
|
if (!permissionsInstance.trackArrows(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -57,6 +60,9 @@ public class ArcheryManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public void dazeCheck(Player defender, EntityDamageEvent event) {
|
public void dazeCheck(Player defender, EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.daze(player)) {
|
if (!permissionsInstance.daze(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,6 +87,9 @@ public class ArcheryManager {
|
|||||||
* @param event The event to modify.
|
* @param event The event to modify.
|
||||||
*/
|
*/
|
||||||
public void bonusDamage(EntityDamageEvent event) {
|
public void bonusDamage(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.archeryBonus(player)) {
|
if (!permissionsInstance.archeryBonus(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ public class Axes {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
|
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
|
||||||
|
if(attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int MAX_BONUS = 4;
|
final int MAX_BONUS = 4;
|
||||||
|
|
||||||
/* Add 1 DMG for every 50 skill levels */
|
/* Add 1 DMG for every 50 skill levels */
|
||||||
@ -49,6 +52,9 @@ public class Axes {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
|
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
|
||||||
|
if(attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (entity instanceof Tameable) {
|
if (entity instanceof Tameable) {
|
||||||
@ -104,6 +110,8 @@ public class Axes {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||||
|
if(attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Finish this skill. The idea is you will greatly damage an opponents armor.
|
* TODO: Finish this skill. The idea is you will greatly damage an opponents armor.
|
||||||
@ -140,6 +148,9 @@ public class Axes {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||||
|
if(attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int GREATER_IMPACT_CHANCE = 25;
|
final int GREATER_IMPACT_CHANCE = 25;
|
||||||
final double GREATER_IMPACT_MULTIPLIER = 1.5;
|
final double GREATER_IMPACT_MULTIPLIER = 1.5;
|
||||||
|
|
||||||
@ -167,6 +178,9 @@ public class Axes {
|
|||||||
* @return true if the player has armor, false otherwise
|
* @return true if the player has armor, false otherwise
|
||||||
*/
|
*/
|
||||||
private static boolean hasArmor(Player player) {
|
private static boolean hasArmor(Player player) {
|
||||||
|
if(player == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) {
|
if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) {
|
||||||
|
@ -82,6 +82,9 @@ public class BlastMining {
|
|||||||
* @param event Event whose explosion is being processed
|
* @param event Event whose explosion is being processed
|
||||||
*/
|
*/
|
||||||
public static void dropProcessing(Player player, EntityExplodeEvent event) {
|
public static void dropProcessing(Player player, EntityExplodeEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int RANK_1_LEVEL = 125;
|
final int RANK_1_LEVEL = 125;
|
||||||
final int RANK_2_LEVEL = 250;
|
final int RANK_2_LEVEL = 250;
|
||||||
final int RANK_3_LEVEL = 375;
|
final int RANK_3_LEVEL = 375;
|
||||||
@ -172,6 +175,9 @@ public class BlastMining {
|
|||||||
* @param event Event whose explosion radius is being changed
|
* @param event Event whose explosion radius is being changed
|
||||||
*/
|
*/
|
||||||
public static void biggerBombs(Player player, ExplosionPrimeEvent event) {
|
public static void biggerBombs(Player player, ExplosionPrimeEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int RANK_1_LEVEL = 250;
|
final int RANK_1_LEVEL = 250;
|
||||||
final int RANK_2_LEVEL = 500;
|
final int RANK_2_LEVEL = 500;
|
||||||
final int RANK_3_LEVEL = 750;
|
final int RANK_3_LEVEL = 750;
|
||||||
@ -210,6 +216,9 @@ public class BlastMining {
|
|||||||
* @param event Event whose explosion damage is being reduced
|
* @param event Event whose explosion damage is being reduced
|
||||||
*/
|
*/
|
||||||
public static void demolitionsExpertise(Player player, EntityDamageEvent event) {
|
public static void demolitionsExpertise(Player player, EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int RANK_1_LEVEL = 500;
|
final int RANK_1_LEVEL = 500;
|
||||||
final int RANK_2_LEVEL = 750;
|
final int RANK_2_LEVEL = 750;
|
||||||
final int RANK_3_LEVEL = 1000;
|
final int RANK_3_LEVEL = 1000;
|
||||||
@ -242,6 +251,9 @@ public class BlastMining {
|
|||||||
* @param plugin mcMMO plugin instance
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
public static void detonate(PlayerInteractEvent event, Player player, mcMMO plugin) {
|
public static void detonate(PlayerInteractEvent event, Player player, mcMMO plugin) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
if (profile.getSkillLevel(SkillType.MINING) < 125)
|
if (profile.getSkillLevel(SkillType.MINING) < 125)
|
||||||
|
@ -37,6 +37,9 @@ public class Excavation {
|
|||||||
* @param player The player who broke the block
|
* @param player The player who broke the block
|
||||||
*/
|
*/
|
||||||
public static void excavationProcCheck(Block block, Player player) {
|
public static void excavationProcCheck(Block block, Player player) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
Location location = block.getLocation();
|
Location location = block.getLocation();
|
||||||
|
|
||||||
@ -122,6 +125,9 @@ public class Excavation {
|
|||||||
* @param block The block to check
|
* @param block The block to check
|
||||||
*/
|
*/
|
||||||
public static void gigaDrillBreaker(Player player, Block block) {
|
public static void gigaDrillBreaker(Player player, Block block) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
||||||
|
|
||||||
if (!mcMMO.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) {
|
if (!mcMMO.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) {
|
||||||
|
@ -72,6 +72,9 @@ public class Fishing {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
private static void getFishingResults(Player player, PlayerFishEvent event) {
|
private static void getFishingResults(Player player, PlayerFishEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
List<FishingTreasure> rewards = new ArrayList<FishingTreasure>();
|
List<FishingTreasure> rewards = new ArrayList<FishingTreasure>();
|
||||||
Item theCatch = (Item) event.getCaught();
|
Item theCatch = (Item) event.getCaught();
|
||||||
@ -135,6 +138,9 @@ public class Fishing {
|
|||||||
*/
|
*/
|
||||||
public static void processResults(PlayerFishEvent event) {
|
public static void processResults(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
getFishingResults(player, event);
|
getFishingResults(player, event);
|
||||||
|
@ -37,6 +37,9 @@ public class Herbalism {
|
|||||||
* @param block The block to be changed by Green Terra
|
* @param block The block to be changed by Green Terra
|
||||||
*/
|
*/
|
||||||
public static void greenTerra(Player player, Block block) {
|
public static void greenTerra(Player player, Block block) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||||
|
|
||||||
@ -51,6 +54,9 @@ public class Herbalism {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void greenTerraConvert(Player player, Block block) {
|
public static void greenTerraConvert(Player player, Block block) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
|
|
||||||
if (Misc.blockBreakSimulate(block, player, false)) {
|
if (Misc.blockBreakSimulate(block, player, false)) {
|
||||||
@ -77,6 +83,9 @@ public class Herbalism {
|
|||||||
* @param plugin mcMMO plugin instance
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
final int MAX_BONUS_LEVEL = 1000;
|
final int MAX_BONUS_LEVEL = 1000;
|
||||||
|
|
||||||
@ -372,6 +381,9 @@ public class Herbalism {
|
|||||||
* @param plugin mcMMO plugin instance
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int MAX_BONUS_LEVEL = 1500;
|
final int MAX_BONUS_LEVEL = 1500;
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
@ -407,6 +419,9 @@ public class Herbalism {
|
|||||||
* @param block The block being used in the ability
|
* @param block The block being used in the ability
|
||||||
*/
|
*/
|
||||||
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
|
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
final int MAX_BONUS_LEVEL = 1500;
|
final int MAX_BONUS_LEVEL = 1500;
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
|
@ -24,6 +24,9 @@ public class CounterAttackEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isHoldingSword() {
|
protected boolean isHoldingSword() {
|
||||||
|
if(player == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
return ItemChecks.isSword(player.getItemInHand());
|
return ItemChecks.isSword(player.getItemInHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +39,9 @@ public class CounterAttackEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAbilityMessages() {
|
protected void sendAbilityMessages() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
||||||
|
|
||||||
if (attacker instanceof Player) {
|
if (attacker instanceof Player) {
|
||||||
|
@ -19,6 +19,9 @@ public class SerratedStrikesEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void applyAbilityEffects() {
|
protected void applyAbilityEffects() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);
|
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);
|
||||||
BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS);
|
BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@ public class SwordsManager {
|
|||||||
* @param defender The defending entity
|
* @param defender The defending entity
|
||||||
*/
|
*/
|
||||||
public void bleedCheck(LivingEntity defender) {
|
public void bleedCheck(LivingEntity defender) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.swordsBleed(player)) {
|
if (!permissionsInstance.swordsBleed(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@ public class BeastLoreEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendInspectMessage() {
|
protected void sendInspectMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||||
|
|
||||||
if (beast.isTamed()) {
|
if (beast.isTamed()) {
|
||||||
|
@ -29,10 +29,16 @@ public class CallOfTheWildEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendInsufficientAmountMessage() {
|
protected void sendInsufficientAmountMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean nearbyEntityExists() {
|
protected boolean nearbyEntityExists() {
|
||||||
|
if(player == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
boolean entityExists = false;
|
boolean entityExists = false;
|
||||||
|
|
||||||
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
||||||
@ -46,6 +52,9 @@ public class CallOfTheWildEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendFailureMessage() {
|
protected void sendFailureMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (type == EntityType.OCELOT) {
|
if (type == EntityType.OCELOT) {
|
||||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
|
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
|
||||||
}
|
}
|
||||||
@ -55,6 +64,9 @@ public class CallOfTheWildEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void spawnCreature() {
|
protected void spawnCreature() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||||
entity.setMetadata("mcmmoSummoned", new FixedMetadataValue(mcMMO.p, true));
|
entity.setMetadata("mcmmoSummoned", new FixedMetadataValue(mcMMO.p, true));
|
||||||
|
|
||||||
@ -69,6 +81,9 @@ public class CallOfTheWildEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void processResourceCost() {
|
protected void processResourceCost() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
int newAmount = inHand.getAmount() - summonAmount;
|
int newAmount = inHand.getAmount() - summonAmount;
|
||||||
|
|
||||||
if (newAmount == 0) {
|
if (newAmount == 0) {
|
||||||
@ -80,6 +95,9 @@ public class CallOfTheWildEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendSuccessMessage() {
|
protected void sendSuccessMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ public class EnvironmentallyAwareEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void teleportWolf() {
|
protected void teleportWolf() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.getDamage() > wolf.getHealth()) {
|
if (event.getDamage() > wolf.getHealth()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -26,6 +29,9 @@ public class EnvironmentallyAwareEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAbilityMessage() {
|
protected void sendAbilityMessage() {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ public class TamingManager {
|
|||||||
* @param damage The damage being absorbed by the wolf
|
* @param damage The damage being absorbed by the wolf
|
||||||
*/
|
*/
|
||||||
public void fastFoodService(Wolf wolf, int damage) {
|
public void fastFoodService(Wolf wolf, int damage) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.fastFoodService(player)) {
|
if (!permissionsInstance.fastFoodService(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -61,6 +64,9 @@ public class TamingManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public void sharpenedClaws(EntityDamageEvent event) {
|
public void sharpenedClaws(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.sharpenedClaws(player)) {
|
if (!permissionsInstance.sharpenedClaws(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,6 +84,9 @@ public class TamingManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public void gore(EntityDamageEvent event) {
|
public void gore(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.gore(player)) {
|
if (!permissionsInstance.gore(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -150,6 +159,9 @@ public class TamingManager {
|
|||||||
* @param livingEntity The entity to examine
|
* @param livingEntity The entity to examine
|
||||||
*/
|
*/
|
||||||
public void beastLore(LivingEntity livingEntity) {
|
public void beastLore(LivingEntity livingEntity) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.beastLore(player)) {
|
if (!permissionsInstance.beastLore(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,6 +178,9 @@ public class TamingManager {
|
|||||||
* @param summonAmount The amount of material needed to summon the entity
|
* @param summonAmount The amount of material needed to summon the entity
|
||||||
*/
|
*/
|
||||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.callOfTheWild(player)) {
|
if (!permissionsInstance.callOfTheWild(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -198,6 +213,9 @@ public class TamingManager {
|
|||||||
* @param cause The damage cause of the event
|
* @param cause The damage cause of the event
|
||||||
*/
|
*/
|
||||||
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
|
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.environmentallyAware(player)) {
|
if (!permissionsInstance.environmentallyAware(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -230,6 +248,9 @@ public class TamingManager {
|
|||||||
* @param cause The damage cause of the event
|
* @param cause The damage cause of the event
|
||||||
*/
|
*/
|
||||||
private void thickFur(EntityDamageEvent event, DamageCause cause) {
|
private void thickFur(EntityDamageEvent event, DamageCause cause) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.thickFur(player)) {
|
if (!permissionsInstance.thickFur(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,6 +268,9 @@ public class TamingManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
private void shockProof(EntityDamageEvent event) {
|
private void shockProof(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.shockProof(player)) {
|
if (!permissionsInstance.shockProof(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ public class UnarmedManager {
|
|||||||
* @param defender The defending player
|
* @param defender The defending player
|
||||||
*/
|
*/
|
||||||
public void disarmCheck(Player defender) {
|
public void disarmCheck(Player defender) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.disarm(player)) {
|
if (!permissionsInstance.disarm(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,6 +61,9 @@ public class UnarmedManager {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
public void deflectCheck(EntityDamageEvent event) {
|
public void deflectCheck(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.deflect(player)) {
|
if (!permissionsInstance.deflect(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,6 +88,9 @@ public class UnarmedManager {
|
|||||||
* @param event The event to modify.
|
* @param event The event to modify.
|
||||||
*/
|
*/
|
||||||
public void bonusDamage(EntityDamageEvent event) {
|
public void bonusDamage(EntityDamageEvent event) {
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!permissionsInstance.unarmedBonus(player)) {
|
if (!permissionsInstance.unarmedBonus(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -99,6 +108,9 @@ public class UnarmedManager {
|
|||||||
* @return true if the defender was not disarmed, false otherwise
|
* @return true if the defender was not disarmed, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean hasIronGrip(Player defender) {
|
private boolean hasIronGrip(Player defender) {
|
||||||
|
if(defender == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!permissionsInstance.ironGrip(defender)) {
|
if (!permissionsInstance.ironGrip(defender)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user