mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Clean up our particle effects a bit.
This commit is contained in:
parent
1bcf43db63
commit
400c93fb7d
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.acrobatics;
|
package com.gmail.nossr50.skills.acrobatics;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
@ -10,6 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||||
|
|
||||||
public class DodgeEventHandler extends AcrobaticsEventHandler {
|
public class DodgeEventHandler extends AcrobaticsEventHandler {
|
||||||
protected DodgeEventHandler(AcrobaticsManager manager, EntityDamageEvent event) {
|
protected DodgeEventHandler(AcrobaticsManager manager, EntityDamageEvent event) {
|
||||||
@ -45,7 +44,7 @@ public class DodgeEventHandler extends AcrobaticsEventHandler {
|
|||||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
||||||
Player dodgingPlayer = mcMMOPlayer.getPlayer();
|
Player dodgingPlayer = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
dodgingPlayer.playEffect(dodgingPlayer.getEyeLocation(), Effect.SMOKE, BlockFace.SELF);
|
ParticleEffectUtils.playDodgeEffect(dodgingPlayer);
|
||||||
|
|
||||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||||
dodgingPlayer.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
dodgingPlayer.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -12,6 +11,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mods.ModChecks;
|
import com.gmail.nossr50.mods.ModChecks;
|
||||||
import com.gmail.nossr50.util.ItemChecks;
|
import com.gmail.nossr50.util.ItemChecks;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
@ -84,9 +84,7 @@ public class ImpactEventHandler {
|
|||||||
private void handleGreaterImpactEffect() {
|
private void handleGreaterImpactEffect() {
|
||||||
event.setDamage(event.getDamage() + Axes.greaterImpactBonusDamage);
|
event.setDamage(event.getDamage() + Axes.greaterImpactBonusDamage);
|
||||||
|
|
||||||
Location location = defender.getEyeLocation();
|
ParticleEffectUtils.playGreaterImpactEffect(defender);
|
||||||
defender.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
|
|
||||||
|
|
||||||
defender.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
defender.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.utilities.CombatTools;
|
import com.gmail.nossr50.skills.utilities.CombatTools;
|
||||||
|
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||||
|
|
||||||
public class BleedTimer implements Runnable {
|
public class BleedTimer implements Runnable {
|
||||||
private final static int MAX_BLEED_TICKS = 10;
|
private final static int MAX_BLEED_TICKS = 10;
|
||||||
@ -50,7 +51,7 @@ public class BleedTimer implements Runnable {
|
|||||||
//Never kill with Bleeding
|
//Never kill with Bleeding
|
||||||
if (player.getHealth() - 1 > 0) {
|
if (player.getHealth() - 1 > 0) {
|
||||||
CombatTools.dealDamage(player, 1);
|
CombatTools.dealDamage(player, 1);
|
||||||
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, Material.REDSTONE_WIRE);
|
ParticleEffectUtils.playBleedEffect(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.setValue(entry.getValue() - 1);
|
entry.setValue(entry.getValue() - 1);
|
||||||
|
@ -3,20 +3,13 @@ package com.gmail.nossr50.skills.utilities;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Firework;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
@ -38,6 +31,7 @@ import com.gmail.nossr50.mods.ModChecks;
|
|||||||
import com.gmail.nossr50.spout.SpoutConfig;
|
import com.gmail.nossr50.spout.SpoutConfig;
|
||||||
import com.gmail.nossr50.spout.SpoutTools;
|
import com.gmail.nossr50.spout.SpoutTools;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
@ -204,17 +198,7 @@ public class SkillTools {
|
|||||||
profile.setAbilityMode(ability, false);
|
profile.setAbilityMode(ability, false);
|
||||||
profile.setAbilityInformed(ability, false);
|
profile.setAbilityInformed(ability, false);
|
||||||
|
|
||||||
Location location = player.getLocation();
|
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
||||||
location.setY(location.getY() - 2.0);
|
|
||||||
location.setPitch(-90);
|
|
||||||
|
|
||||||
Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
|
||||||
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
|
||||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED). with(Type.BALL_LARGE).trail(true).build();
|
|
||||||
fireworkMeta.addEffect(effect);
|
|
||||||
fireworkMeta.addEffect(effect);
|
|
||||||
fireworkMeta.setPower(0);
|
|
||||||
firework.setFireworkMeta(fireworkMeta);
|
|
||||||
|
|
||||||
if (profile.useChatNotifications()) {
|
if (profile.useChatNotifications()) {
|
||||||
player.sendMessage(ability.getAbilityOff());
|
player.sendMessage(ability.getAbilityOff());
|
||||||
@ -409,17 +393,7 @@ public class SkillTools {
|
|||||||
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
||||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
|
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
|
||||||
|
|
||||||
Location location = player.getLocation();
|
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
||||||
location.setY(location.getY() - 2.0);
|
|
||||||
location.setPitch(-90);
|
|
||||||
|
|
||||||
Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
|
||||||
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
|
||||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.GREEN). with(Type.BALL_LARGE).trail(true).build();
|
|
||||||
fireworkMeta.addEffect(effect);
|
|
||||||
fireworkMeta.addEffect(effect);
|
|
||||||
fireworkMeta.setPower(0);
|
|
||||||
firework.setFireworkMeta(fireworkMeta);
|
|
||||||
|
|
||||||
if (profile.useChatNotifications()) {
|
if (profile.useChatNotifications()) {
|
||||||
player.sendMessage(ability.getAbilityOn());
|
player.sendMessage(ability.getAbilityOn());
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.FireworkEffect.Type;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Firework;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
|
||||||
|
public final class ParticleEffectUtils {
|
||||||
|
|
||||||
|
private ParticleEffectUtils() {};
|
||||||
|
|
||||||
|
public static void playBleedEffect(Player player) {
|
||||||
|
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, Material.REDSTONE_WIRE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void playDodgeEffect(Player player) {
|
||||||
|
Location location = player.getEyeLocation();
|
||||||
|
World world = player.getWorld();
|
||||||
|
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.SOUTH_EAST);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.SOUTH);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.SOUTH_WEST);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.EAST);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.SELF);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.WEST);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.NORTH_EAST);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.NORTH);
|
||||||
|
world.playEffect(location, Effect.SMOKE, BlockFace.NORTH_WEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void playGreaterImpactEffect(LivingEntity livingEntity) {
|
||||||
|
Location location = livingEntity.getEyeLocation();
|
||||||
|
|
||||||
|
livingEntity.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void playAbilityEnabledEffect(Player player) {
|
||||||
|
fireworkParticleShower(player, Color.GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void playAbilityDisabledEffect(Player player) {
|
||||||
|
fireworkParticleShower(player, Color.RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fireworkParticleShower(Player player, Color color) {
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setPitch(-90);
|
||||||
|
|
||||||
|
Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
||||||
|
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
||||||
|
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with(Type.BALL_LARGE).trail(true).build();
|
||||||
|
fireworkMeta.addEffect(effect);
|
||||||
|
fireworkMeta.addEffect(effect);
|
||||||
|
fireworkMeta.setPower(0);
|
||||||
|
firework.setFireworkMeta(fireworkMeta);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user