Completely remove Fireworks from mcMMO

This commit is contained in:
nossr50 2019-04-01 10:04:45 -07:00
parent 68e34d682c
commit c6d055cb48
7 changed files with 43 additions and 50 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.31</version> <version>2.1.32-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -405,7 +405,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); } public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); }
public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); } public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); }
public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); } public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); }
public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); } // public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
/* PARTY SETTINGS */ /* PARTY SETTINGS */
public boolean getPartyFriendlyFire() { return config.getBoolean("Party.FriendlyFire", false);} public boolean getPartyFriendlyFire() { return config.getBoolean("Party.FriendlyFire", false);}

View File

@ -22,7 +22,6 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
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.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.Color; import org.bukkit.Color;
@ -243,9 +242,9 @@ public enum PrimarySkillType {
return Permissions.skillEnabled(player, this); return Permissions.skillEnabled(player, this);
} }
public void celebrateLevelUp(Player player) { /* public void celebrateLevelUp(Player player) {
ParticleEffectUtils.fireworkParticleShower(player, runescapeColor); ParticleEffectUtils.fireworkParticleShower(player, runescapeColor);
} }*/
public boolean shouldProcess(Entity target) { public boolean shouldProcess(Entity target) {
return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled(); return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled();

View File

@ -51,9 +51,9 @@ public class SelfListener implements Listener {
return; return;
} }
if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) { /*if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) {
skill.celebrateLevelUp(player); skill.celebrateLevelUp(player);
} }*/
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)

View File

@ -25,7 +25,7 @@ public class AprilTask extends BukkitRunnable {
if (betterRandom == 0) { if (betterRandom == 0) {
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP); SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")"); player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
fireworksShow(player); // fireworksShow(player);
} }
for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) { 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; final int firework_amount = 10;
for (int i = 0; i < firework_amount; i++) { for (int i = 0; i < firework_amount; i++) {
int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4; int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
@ -48,7 +48,7 @@ public class AprilTask extends BukkitRunnable {
} }
}, delay); }, delay);
} }
} }*/
private String unknown(String string) { private String unknown(String string) {
return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW; return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;

View File

@ -7,19 +7,16 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager; 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.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.util.sounds.SoundType;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.*; import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect.Type; import org.bukkit.Color;
import org.bukkit.Statistic;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerStatisticIncrementEvent; import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.inventory.meta.FireworkMeta;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -110,9 +107,9 @@ public final class HolidayManager {
} }
} }
for (DyeColor color : DyeColor.values()) { // for (DyeColor color : DyeColor.values()) {
colors.add(color.getFireworkColor()); // colors.add(color.getFireworkColor());
} // }
Collections.shuffle(chatColors, Misc.getRandom()); Collections.shuffle(chatColors, Misc.getRandom());
Collections.shuffle(colors, Misc.getRandom()); Collections.shuffle(colors, Misc.getRandom());
@ -224,7 +221,7 @@ public final class HolidayManager {
} }
sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR))); sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR)));
if (sender instanceof Player) { /*if (sender instanceof Player) {
final int firework_amount = 10; final int firework_amount = 10;
for (int i = 0; i < firework_amount; i++) { for (int i = 0; i < firework_amount; i++) {
int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4; int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
@ -235,8 +232,8 @@ public final class HolidayManager {
} }
}, delay); }, delay);
} }
} }*/
else { // else {
/* /*
* Credit: http://www.geocities.com/spunk1111/ * Credit: http://www.geocities.com/spunk1111/
* (good luck finding that in 3 years heh) * (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* %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));
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()); hasCelebrated.add(sender.getName());
} }
@ -282,19 +279,19 @@ public final class HolidayManager {
return !(date.before(start) || date.after(end)); return !(date.before(start) || date.after(end));
} }
public void spawnFireworks(Player player) { // public void spawnFireworks(Player player) {
int power = Misc.getRandom().nextInt(3) + 1; // int power = Misc.getRandom().nextInt(3) + 1;
Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)]; // Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)];
double varX = Misc.getRandom().nextGaussian() * 3; // double varX = Misc.getRandom().nextGaussian() * 3;
double varZ = Misc.getRandom().nextGaussian() * 3; // double varZ = Misc.getRandom().nextGaussian() * 3;
//
Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK); // Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK);
FireworkMeta fireworkmeta = fireworks.getFireworkMeta(); // FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build(); // FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build();
fireworkmeta.addEffect(effect); // fireworkmeta.addEffect(effect);
fireworkmeta.setPower(power); // fireworkmeta.setPower(power);
fireworks.setFireworkMeta(fireworkmeta); // fireworks.setFireworkMeta(fireworkmeta);
} // }
private static List<Color> colorChoose() { private static List<Color> colorChoose() {
return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1)); 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; int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1;
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP); SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
NotificationManager.sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal)); 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() { public void registerAprilCommand() {

View File

@ -1,17 +1,14 @@
package com.gmail.nossr50.util.skills; package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.mcMMO; import org.bukkit.Effect;
import org.bukkit.*; import org.bukkit.Location;
import org.bukkit.FireworkEffect.Type; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.metadata.FixedMetadataValue;
public final class ParticleEffectUtils { public final class ParticleEffectUtils {
@ -80,9 +77,9 @@ public final class ParticleEffectUtils {
return; return;
} }
if (hasHeadRoom(player)) { /* if (hasHeadRoom(player)) {
fireworkParticleShower(player, Color.GREEN); fireworkParticleShower(player, Color.GREEN);
} }*/
} }
public static void playAbilityDisabledEffect(Player player) { public static void playAbilityDisabledEffect(Player player) {
@ -90,12 +87,12 @@ public final class ParticleEffectUtils {
return; return;
} }
if (hasHeadRoom(player)) { /*if (hasHeadRoom(player)) {
fireworkParticleShower(player, Color.RED); 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 location = player.getLocation();
location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0)); location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0));
location.setPitch(-90); location.setPitch(-90);
@ -108,7 +105,7 @@ public final class ParticleEffectUtils {
fireworkMeta.addEffect(effect); fireworkMeta.addEffect(effect);
fireworkMeta.setPower(0); fireworkMeta.setPower(0);
firework.setFireworkMeta(fireworkMeta); firework.setFireworkMeta(fireworkMeta);
} }*/
private static boolean hasHeadRoom(Player player) { private static boolean hasHeadRoom(Player player) {
boolean hasHeadRoom = true; boolean hasHeadRoom = true;