From 8d9f6c14a7bd902301c9e33d2e9f510bde0f8cd8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 1 Apr 2019 10:04:45 -0700 Subject: [PATCH] Completely remove Fireworks from mcMMO --- .../datatypes/skills/PrimarySkillType.java | 5 +- .../gmail/nossr50/listeners/SelfListener.java | 4 +- .../nossr50/runnables/skills/AprilTask.java | 6 +-- .../gmail/nossr50/util/HolidayManager.java | 51 +++++++++---------- .../util/skills/ParticleEffectUtils.java | 23 ++++----- 5 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java index a942b4e7f..1623e226f 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java @@ -22,7 +22,6 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager; import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.google.common.collect.ImmutableList; import org.bukkit.Color; @@ -244,9 +243,9 @@ public enum PrimarySkillType { return Permissions.skillEnabled(player, this); } - public void celebrateLevelUp(Player player) { +/* public void celebrateLevelUp(Player player) { ParticleEffectUtils.fireworkParticleShower(player, runescapeColor); - } + }*/ public boolean shouldProcess(Entity target) { return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled(); diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 8ac64704f..5280664fb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -51,9 +51,9 @@ public class SelfListener implements Listener { return; } - if ((event.getSkillLevel() % MainConfig.getInstance().getLevelUpEffectsTier()) == 0) { + /*if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) { skill.celebrateLevelUp(player); - } + }*/ } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java index b32fa4a87..6d37f2050 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java @@ -25,7 +25,7 @@ public class AprilTask extends BukkitRunnable { if (betterRandom == 0) { SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP); player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")"); - fireworksShow(player); +// fireworksShow(player); } for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) { @@ -37,7 +37,7 @@ public class AprilTask extends BukkitRunnable { } } - private void fireworksShow(final Player player) { + /*private void fireworksShow(final Player player) { final int firework_amount = 10; for (int i = 0; i < firework_amount; i++) { int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4; @@ -48,7 +48,7 @@ public class AprilTask extends BukkitRunnable { } }, delay); } - } + }*/ private String unknown(String string) { return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW; diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index e1d88462c..51874338f 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -7,19 +7,16 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; -import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import com.google.common.collect.ImmutableList; -import org.bukkit.*; -import org.bukkit.FireworkEffect.Type; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Statistic; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Firework; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerStatisticIncrementEvent; -import org.bukkit.inventory.meta.FireworkMeta; import java.io.*; import java.util.*; @@ -110,9 +107,9 @@ public final class HolidayManager { } } - for (DyeColor color : DyeColor.values()) { - colors.add(color.getFireworkColor()); - } +// for (DyeColor color : DyeColor.values()) { +// colors.add(color.getFireworkColor()); +// } Collections.shuffle(chatColors, Misc.getRandom()); Collections.shuffle(colors, Misc.getRandom()); @@ -224,7 +221,7 @@ public final class HolidayManager { } sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR))); - if (sender instanceof Player) { + /*if (sender instanceof Player) { final int firework_amount = 10; for (int i = 0; i < firework_amount; i++) { int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4; @@ -235,8 +232,8 @@ public final class HolidayManager { } }, delay); } - } - else { + }*/ +// else { /* * Credit: http://www.geocities.com/spunk1111/ * (good luck finding that in 3 years heh) @@ -273,7 +270,7 @@ public final class HolidayManager { sender.sendMessage(String.format(" %2$s* %6$s*..* %9$s: %11$s*", colorParams)); sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams)); sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams)); - } +// } hasCelebrated.add(sender.getName()); } @@ -282,19 +279,19 @@ public final class HolidayManager { return !(date.before(start) || date.after(end)); } - public void spawnFireworks(Player player) { - int power = Misc.getRandom().nextInt(3) + 1; - Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)]; - double varX = Misc.getRandom().nextGaussian() * 3; - double varZ = Misc.getRandom().nextGaussian() * 3; - - Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK); - FireworkMeta fireworkmeta = fireworks.getFireworkMeta(); - FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build(); - fireworkmeta.addEffect(effect); - fireworkmeta.setPower(power); - fireworks.setFireworkMeta(fireworkmeta); - } +// public void spawnFireworks(Player player) { +// int power = Misc.getRandom().nextInt(3) + 1; +// Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)]; +// double varX = Misc.getRandom().nextGaussian() * 3; +// double varZ = Misc.getRandom().nextGaussian() * 3; +// +// Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK); +// FireworkMeta fireworkmeta = fireworks.getFireworkMeta(); +// FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build(); +// fireworkmeta.addEffect(effect); +// fireworkmeta.setPower(power); +// fireworks.setFireworkMeta(fireworkmeta); +// } private static List colorChoose() { return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1)); @@ -363,7 +360,7 @@ public final class HolidayManager { int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1; SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP); NotificationManager.sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal)); - ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size()))); +// ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size()))); } public void registerAprilCommand() { diff --git a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java index a82a4a286..e581d113b 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java @@ -1,17 +1,14 @@ package com.gmail.nossr50.util.skills; import com.gmail.nossr50.config.MainConfig; -import com.gmail.nossr50.mcMMO; -import org.bukkit.*; -import org.bukkit.FireworkEffect.Type; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; 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; -import org.bukkit.metadata.FixedMetadataValue; public final class ParticleEffectUtils { @@ -80,9 +77,9 @@ public final class ParticleEffectUtils { return; } - if (hasHeadRoom(player)) { + /* if (hasHeadRoom(player)) { fireworkParticleShower(player, Color.GREEN); - } + }*/ } public static void playAbilityDisabledEffect(Player player) { @@ -90,12 +87,12 @@ public final class ParticleEffectUtils { return; } - if (hasHeadRoom(player)) { + /*if (hasHeadRoom(player)) { fireworkParticleShower(player, Color.RED); - } + }*/ } - public static void fireworkParticleShower(Player player, Color color) { +/* public static void fireworkParticleShower(Player player, Color color) { Location location = player.getLocation(); location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0)); location.setPitch(-90); @@ -108,7 +105,7 @@ public final class ParticleEffectUtils { fireworkMeta.addEffect(effect); fireworkMeta.setPower(0); firework.setFireworkMeta(fireworkMeta); - } + }*/ private static boolean hasHeadRoom(Player player) { boolean hasHeadRoom = true;