Removed April Fools event

This commit is contained in:
nossr50 2021-03-31 15:14:00 -07:00
parent f01efd92f5
commit a2ba406fe5
10 changed files with 679 additions and 693 deletions

View File

@ -1,4 +1,5 @@
Version 2.1.184
Removed April Fools event
Fixed a bug where the default treasures.yml file had incorrect keys (see notes)
NOTES:

View File

@ -35,7 +35,7 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
}
mcMMO.getHolidayManager().anniversaryCheck(sender);
// mcMMO.getHolidayManager().anniversaryCheck(sender);
return true;
case 1:

View File

@ -1,199 +1,199 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class AprilCommand implements TabExecutor {
private String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected DecimalFormat decimal = new DecimalFormat("##0.00");
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
skillName = StringUtils.getCapitalized(label);
if (args.length == 0) {
Player player = (Player) sender;
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
float skillValue = Misc.getRandom().nextInt(99);
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", getXPGainString(fakeSkillType)));
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, Misc.getRandom().nextInt(1000), 1000 + Misc.getRandom().nextInt(1000)));
List<String> effectMessages = effectsDisplay(fakeSkillType);
if (!effectMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
for (String message : effectMessages) {
player.sendMessage(message);
}
}
List<String> statsMessages = statsDisplay(fakeSkillType);
if (!statsMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
for (String message : statsMessages) {
player.sendMessage(message);
}
}
player.sendMessage(LocaleLoader.formatString("[[DARK_AQUA]]Guide for {0} available - type /APRIL FOOLS ! :D", skillName));
return true;
}
return true;
}
private String getXPGainString(FakeSkillType fakeSkillType) {
switch (fakeSkillType) {
case MACHO:
return "Get beaten up";
case JUMPING:
return "Kris Kross will make ya Jump Jump";
case THROWING:
return "Chuck your items on the floor";
case WRECKING:
return "I'M GONNA WRECK IT!";
case CRAFTING:
return "Craft apple pies";
case WALKING:
return "Walk around the park";
case SWIMMING:
return "Like a fish on a bicycle";
case FALLING:
return "Faceplant the floor, headbutt the ground";
case CLIMBING:
return "Climb the highest mountain";
case FLYING:
return "I believe I can fly";
case DIVING:
return "Scuba club 4000";
case PIGGY:
return "OINK! OINK!";
default:
return "Sit and wait?";
}
}
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
return ImmutableList.of("?");
}
return ImmutableList.of();
}
private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<>();
switch (fakeSkillType) {
case MACHO:
messages.add(LocaleLoader.getString("Effects.Template", "Punching bag", "Absorb damage, like a bag of sand"));
break;
case JUMPING:
messages.add(LocaleLoader.getString("Effects.Template", "Jump", "PRESS SPACE TO JUMP"));
messages.add(LocaleLoader.getString("Effects.Template", "Jump Twice", "PRESS SPACE TWICE TO JUMP TWICE"));
break;
case THROWING:
messages.add(LocaleLoader.getString("Effects.Template", "Drop Item", "Randomly drop items, at random"));
break;
case WRECKING:
messages.add(LocaleLoader.getString("Effects.Template", "Ralphinator", "Smash windows with your fists"));
break;
case CRAFTING:
messages.add(LocaleLoader.getString("Effects.Template", "Crafting", "Chance of successful craft"));
break;
case WALKING:
messages.add(LocaleLoader.getString("Effects.Template", "Walk", "Traveling gracefully by foot"));
break;
case SWIMMING:
messages.add(LocaleLoader.getString("Effects.Template", "Swim", "Just keep swimming, swimming, swimming"));
break;
case FALLING:
messages.add(LocaleLoader.getString("Effects.Template", "Skydiving", "Go jump of a cliff. No, seriously."));
break;
case CLIMBING:
messages.add(LocaleLoader.getString("Effects.Template", "Rock Climber", "Use string to climb mountains faster"));
break;
case FLYING:
messages.add(LocaleLoader.getString("Effects.Template", "Fly", "Throw yourself at the ground and miss"));
break;
case DIVING:
messages.add(LocaleLoader.getString("Effects.Template", "Hold Breath", "Press shift to hold your breath longer"));
break;
case PIGGY:
messages.add(LocaleLoader.getString("Effects.Template", "Carrot Turbo", "Supercharge your pigs with carrots"));
break;
}
return messages;
}
private List<String> statsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<>();
switch (fakeSkillType) {
case MACHO:
messages.add(LocaleLoader.formatString("&cDamage Taken: &e{0}%", decimal.format(Misc.getRandom().nextInt(77))));
break;
case JUMPING:
messages.add(LocaleLoader.formatString("&cDouble Jump Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case THROWING:
messages.add(LocaleLoader.formatString("&cDrop Item Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(87))));
break;
case WRECKING:
messages.add(LocaleLoader.formatString("&cWrecking Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(14))));
break;
case CRAFTING:
messages.add(LocaleLoader.formatString("&cCrafting Success: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case WALKING:
messages.add(LocaleLoader.formatString("&cWalk Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case SWIMMING:
messages.add(LocaleLoader.formatString("&cSwim Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case FALLING:
messages.add(LocaleLoader.formatString("&cSkydiving Success: &e{0}%", decimal.format(Misc.getRandom().nextInt(37))));
break;
case CLIMBING:
messages.add(LocaleLoader.formatString("&cRock Climber Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case FLYING:
messages.add(LocaleLoader.formatString("&cFly Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case DIVING:
messages.add(LocaleLoader.formatString("&cHold Breath Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case PIGGY:
messages.add(LocaleLoader.formatString("&cCarrot Turbo Boost: &e{0}%", decimal.format(Misc.getRandom().nextInt(80)) + 10));
break;
}
return messages;
}
}
//package com.gmail.nossr50.commands.skills;
//
//import com.gmail.nossr50.locale.LocaleLoader;
//import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
//import com.gmail.nossr50.util.Misc;
//import com.gmail.nossr50.util.commands.CommandUtils;
//import com.gmail.nossr50.util.text.StringUtils;
//import com.google.common.collect.ImmutableList;
//import org.bukkit.command.Command;
//import org.bukkit.command.CommandSender;
//import org.bukkit.command.TabExecutor;
//import org.bukkit.entity.Player;
//import org.jetbrains.annotations.NotNull;
//
//import java.text.DecimalFormat;
//import java.util.ArrayList;
//import java.util.List;
//
//public class AprilCommand implements TabExecutor {
// private String skillName;
//
// protected DecimalFormat percent = new DecimalFormat("##0.00%");
// protected DecimalFormat decimal = new DecimalFormat("##0.00");
//
// @Override
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
// if (CommandUtils.noConsoleUsage(sender)) {
// return true;
// }
//
// skillName = StringUtils.getCapitalized(label);
//
// if (args.length == 0) {
// Player player = (Player) sender;
// FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
//
// float skillValue = Misc.getRandom().nextInt(99);
//
// player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
// player.sendMessage(LocaleLoader.getString("Commands.XPGain", getXPGainString(fakeSkillType)));
// player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, Misc.getRandom().nextInt(1000), 1000 + Misc.getRandom().nextInt(1000)));
//
//
// List<String> effectMessages = effectsDisplay(fakeSkillType);
//
// if (!effectMessages.isEmpty()) {
// player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
//
// for (String message : effectMessages) {
// player.sendMessage(message);
// }
// }
//
// List<String> statsMessages = statsDisplay(fakeSkillType);
//
// if (!statsMessages.isEmpty()) {
// player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
//
// for (String message : statsMessages) {
// player.sendMessage(message);
// }
// }
//
// player.sendMessage(LocaleLoader.formatString("[[DARK_AQUA]]Guide for {0} available - type /APRIL FOOLS ! :D", skillName));
// return true;
// }
// return true;
// }
//
// private String getXPGainString(FakeSkillType fakeSkillType) {
// switch (fakeSkillType) {
// case MACHO:
// return "Get beaten up";
// case JUMPING:
// return "Kris Kross will make ya Jump Jump";
// case THROWING:
// return "Chuck your items on the floor";
// case WRECKING:
// return "I'M GONNA WRECK IT!";
// case CRAFTING:
// return "Craft apple pies";
// case WALKING:
// return "Walk around the park";
// case SWIMMING:
// return "Like a fish on a bicycle";
// case FALLING:
// return "Faceplant the floor, headbutt the ground";
// case CLIMBING:
// return "Climb the highest mountain";
// case FLYING:
// return "I believe I can fly";
// case DIVING:
// return "Scuba club 4000";
// case PIGGY:
// return "OINK! OINK!";
// default:
// return "Sit and wait?";
// }
// }
//
// @Override
// public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
// if (args.length == 1) {
// return ImmutableList.of("?");
// }
// return ImmutableList.of();
// }
//
// private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
// List<String> messages = new ArrayList<>();
//
// switch (fakeSkillType) {
// case MACHO:
// messages.add(LocaleLoader.getString("Effects.Template", "Punching bag", "Absorb damage, like a bag of sand"));
// break;
// case JUMPING:
// messages.add(LocaleLoader.getString("Effects.Template", "Jump", "PRESS SPACE TO JUMP"));
// messages.add(LocaleLoader.getString("Effects.Template", "Jump Twice", "PRESS SPACE TWICE TO JUMP TWICE"));
// break;
// case THROWING:
// messages.add(LocaleLoader.getString("Effects.Template", "Drop Item", "Randomly drop items, at random"));
// break;
// case WRECKING:
// messages.add(LocaleLoader.getString("Effects.Template", "Ralphinator", "Smash windows with your fists"));
// break;
// case CRAFTING:
// messages.add(LocaleLoader.getString("Effects.Template", "Crafting", "Chance of successful craft"));
// break;
// case WALKING:
// messages.add(LocaleLoader.getString("Effects.Template", "Walk", "Traveling gracefully by foot"));
// break;
// case SWIMMING:
// messages.add(LocaleLoader.getString("Effects.Template", "Swim", "Just keep swimming, swimming, swimming"));
// break;
// case FALLING:
// messages.add(LocaleLoader.getString("Effects.Template", "Skydiving", "Go jump of a cliff. No, seriously."));
// break;
// case CLIMBING:
// messages.add(LocaleLoader.getString("Effects.Template", "Rock Climber", "Use string to climb mountains faster"));
// break;
// case FLYING:
// messages.add(LocaleLoader.getString("Effects.Template", "Fly", "Throw yourself at the ground and miss"));
// break;
// case DIVING:
// messages.add(LocaleLoader.getString("Effects.Template", "Hold Breath", "Press shift to hold your breath longer"));
// break;
// case PIGGY:
// messages.add(LocaleLoader.getString("Effects.Template", "Carrot Turbo", "Supercharge your pigs with carrots"));
// break;
// }
//
// return messages;
// }
//
// private List<String> statsDisplay(FakeSkillType fakeSkillType) {
// List<String> messages = new ArrayList<>();
//
// switch (fakeSkillType) {
// case MACHO:
// messages.add(LocaleLoader.formatString("&cDamage Taken: &e{0}%", decimal.format(Misc.getRandom().nextInt(77))));
// break;
// case JUMPING:
// messages.add(LocaleLoader.formatString("&cDouble Jump Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case THROWING:
// messages.add(LocaleLoader.formatString("&cDrop Item Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(87))));
// break;
// case WRECKING:
// messages.add(LocaleLoader.formatString("&cWrecking Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(14))));
// break;
// case CRAFTING:
// messages.add(LocaleLoader.formatString("&cCrafting Success: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case WALKING:
// messages.add(LocaleLoader.formatString("&cWalk Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case SWIMMING:
// messages.add(LocaleLoader.formatString("&cSwim Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case FALLING:
// messages.add(LocaleLoader.formatString("&cSkydiving Success: &e{0}%", decimal.format(Misc.getRandom().nextInt(37))));
// break;
// case CLIMBING:
// messages.add(LocaleLoader.formatString("&cRock Climber Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case FLYING:
// messages.add(LocaleLoader.formatString("&cFly Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case DIVING:
// messages.add(LocaleLoader.formatString("&cHold Breath Chance: &e{0}%", decimal.format(Misc.getRandom().nextInt(27))));
// break;
// case PIGGY:
// messages.add(LocaleLoader.formatString("&cCarrot Turbo Boost: &e{0}%", decimal.format(Misc.getRandom().nextInt(80)) + 10));
// break;
// }
//
// return messages;
// }
//}

View File

@ -243,8 +243,6 @@ public class Config extends AutoUpdateConfigLoader {
* GENERAL SETTINGS
*/
public boolean isAprilFoolsAllowed() { return config.getBoolean("General.AprilFoolsEvent", true); }
/* General Settings */
public boolean getIsMetricsEnabled() { return config.getBoolean("Metrics.bstats", true); }

View File

@ -971,17 +971,17 @@ public class PlayerListener implements Listener {
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
mcMMO.getHolidayManager().handleStatisticEvent(event);
}
//
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
// /* WORLD BLACKLIST CHECK */
// if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
// return;
//
// if (!mcMMO.getHolidayManager().isAprilFirst()) {
// return;
// }
//
// mcMMO.getHolidayManager().handleStatisticEvent(event);
// }
}

View File

@ -19,7 +19,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
import com.gmail.nossr50.listeners.*;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.CheckDateTask;
import com.gmail.nossr50.runnables.SaveTimerTask;
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
import com.gmail.nossr50.runnables.commands.NotifySquelchReminderTask;
@ -82,7 +81,6 @@ public class mcMMO extends JavaPlugin {
private static ModManager modManager;
private static DatabaseManager databaseManager;
private static FormulaManager formulaManager;
private static HolidayManager holidayManager;
private static UpgradeManager upgradeManager;
private static MaterialMapStore materialMapStore;
private static PlayerLevelUtils playerLevelUtils;
@ -238,7 +236,6 @@ public class mcMMO extends JavaPlugin {
PartyManager.loadParties();
formulaManager = new FormulaManager();
holidayManager = new HolidayManager();
for (Player player : getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
@ -371,7 +368,6 @@ public class mcMMO extends JavaPlugin {
ScoreboardManager.teardownAll();
formulaManager.saveFormula();
holidayManager.saveAnniversaryFiles();
placeStore.closeAll();
}
catch (Exception e) {
@ -444,10 +440,6 @@ public class mcMMO extends JavaPlugin {
return formulaManager;
}
public static HolidayManager getHolidayManager() {
return holidayManager;
}
public static ChunkManager getPlaceStore() {
return placeStore;
}
@ -675,10 +667,6 @@ public class mcMMO extends JavaPlugin {
// Update power level tag scoreboards
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
if (getHolidayManager().nearingAprilFirst()) {
new CheckDateTask().runTaskTimer(this, 10L * Misc.TICK_CONVERSION_FACTOR, 60L * 60L * Misc.TICK_CONVERSION_FACTOR);
}
// Clear the registered XP data so players can earn XP again
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);

View File

@ -1,23 +1,23 @@
package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AprilTask;
import com.gmail.nossr50.util.Misc;
import org.bukkit.scheduler.BukkitRunnable;
public class CheckDateTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
// Set up jokes
new AprilTask().runTaskTimer(mcMMO.p, 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
mcMMO.getHolidayManager().registerAprilCommand();
// Jokes deployed.
this.cancel();
}
}
//package com.gmail.nossr50.runnables;
//
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.runnables.skills.AprilTask;
//import com.gmail.nossr50.util.Misc;
//import org.bukkit.scheduler.BukkitRunnable;
//
//public class CheckDateTask extends BukkitRunnable {
//
// @Override
// public void run() {
// if (!mcMMO.getHolidayManager().isAprilFirst()) {
// return;
// }
//
// // Set up jokes
// new AprilTask().runTaskTimer(mcMMO.p, 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
// mcMMO.getHolidayManager().registerAprilCommand();
//
// // Jokes deployed.
// this.cancel();
// }
//}

View File

@ -1,56 +1,56 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.HolidayManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.ChatColor;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class AprilTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
this.cancel();
return;
}
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
int random = Misc.getRandom().nextInt(40) + 11;
int betterRandom = Misc.getRandom().nextInt(2000);
if (betterRandom == 0) {
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
// fireworksShow(player);
}
for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) {
if (player.getStatistic(statistic) > 0 && player.getStatistic(statistic) % random == 0) {
mcMMO.getHolidayManager().levelUpApril(player, HolidayManager.FakeSkillType.getByStatistic(statistic));
break;
}
}
}
}
/*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;
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
@Override
public void run() {
mcMMO.getHolidayManager().spawnFireworks(player);
}
}, delay);
}
}*/
private String unknown(String string) {
return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;
}
}
//package com.gmail.nossr50.runnables.skills;
//
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.util.HolidayManager;
//import com.gmail.nossr50.util.Misc;
//import com.gmail.nossr50.util.sounds.SoundManager;
//import com.gmail.nossr50.util.sounds.SoundType;
//import org.bukkit.ChatColor;
//import org.bukkit.Statistic;
//import org.bukkit.entity.Player;
//import org.bukkit.scheduler.BukkitRunnable;
//
//public class AprilTask extends BukkitRunnable {
//
// @Override
// public void run() {
// if (!mcMMO.getHolidayManager().isAprilFirst()) {
// this.cancel();
// return;
// }
//
// for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
// int random = Misc.getRandom().nextInt(40) + 11;
// int betterRandom = Misc.getRandom().nextInt(2000);
// if (betterRandom == 0) {
// SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
// player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
//// fireworksShow(player);
// }
//
// for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) {
// if (player.getStatistic(statistic) > 0 && player.getStatistic(statistic) % random == 0) {
// mcMMO.getHolidayManager().levelUpApril(player, HolidayManager.FakeSkillType.getByStatistic(statistic));
// break;
// }
// }
// }
// }
//
// /*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;
// mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
// @Override
// public void run() {
// mcMMO.getHolidayManager().spawnFireworks(player);
// }
// }, delay);
// }
// }*/
//
// private String unknown(String string) {
// return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;
// }
//}

View File

@ -1,388 +1,388 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.commands.skills.AprilCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
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.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList;
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.Player;
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import java.io.*;
import java.util.*;
import java.util.regex.Pattern;
public final class HolidayManager {
private final ArrayList<String> hasCelebrated;
private final int currentYear;
private static final int START_YEAR = 2011;
private static final List<Color> ALL_COLORS;
private static final List<ChatColor> ALL_CHAT_COLORS;
private static final List<ChatColor> CHAT_FORMATS;
public enum FakeSkillType {
MACHO,
JUMPING,
THROWING,
WRECKING,
CRAFTING,
WALKING,
SWIMMING,
FALLING,
CLIMBING,
FLYING,
DIVING,
PIGGY,
UNKNOWN;
public static FakeSkillType getByName(String skillName) {
for (FakeSkillType type : values()) {
if (type.name().equalsIgnoreCase(skillName)) {
return type;
}
}
return null;
}
public static FakeSkillType getByStatistic(Statistic statistic) {
switch (statistic) {
case DAMAGE_TAKEN:
return FakeSkillType.MACHO;
case JUMP:
return FakeSkillType.JUMPING;
case DROP:
return FakeSkillType.THROWING;
case MINE_BLOCK:
case BREAK_ITEM:
return FakeSkillType.WRECKING;
case CRAFT_ITEM:
return FakeSkillType.CRAFTING;
case WALK_ONE_CM:
return FakeSkillType.WALKING;
case SWIM_ONE_CM:
return FakeSkillType.SWIMMING;
case FALL_ONE_CM:
return FakeSkillType.FALLING;
case CLIMB_ONE_CM:
return FakeSkillType.CLIMBING;
case FLY_ONE_CM:
return FakeSkillType.FLYING;
case WALK_UNDER_WATER_ONE_CM:
return FakeSkillType.DIVING;
case PIG_ONE_CM:
return FakeSkillType.PIGGY;
default:
return FakeSkillType.UNKNOWN;
}
}
}
public final Set<Statistic> movementStatistics = EnumSet.of(
Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.WALK_UNDER_WATER_ONE_CM,
Statistic.PIG_ONE_CM);
static {
List<Color> colors = new ArrayList<>();
List<ChatColor> chatColors = new ArrayList<>();
List<ChatColor> chatFormats = new ArrayList<>();
for (ChatColor color : ChatColor.values()) {
if (color.isColor()) {
chatColors.add(color);
}
else {
chatFormats.add(color);
}
}
// for (DyeColor color : DyeColor.values()) {
// colors.add(color.getFireworkColor());
// }
Collections.shuffle(chatColors, Misc.getRandom());
Collections.shuffle(colors, Misc.getRandom());
Collections.shuffle(chatFormats, Misc.getRandom());
ALL_CHAT_COLORS = ImmutableList.copyOf(chatColors);
ALL_COLORS = ImmutableList.copyOf(colors);
CHAT_FORMATS = ImmutableList.copyOf(chatFormats);
}
// This gets called onEnable
public HolidayManager() {
currentYear = Calendar.getInstance().get(Calendar.YEAR);
File anniversaryFile = new File(mcMMO.getFlatFileDirectory(), "anniversary." + currentYear + ".yml");
if (!anniversaryFile.exists()) {
try {
anniversaryFile.createNewFile();
}
catch (IOException ex) {
mcMMO.p.getLogger().severe(ex.toString());
}
}
hasCelebrated = new ArrayList<>();
try {
hasCelebrated.clear();
BufferedReader reader = new BufferedReader(new FileReader(anniversaryFile.getPath()));
String line = reader.readLine();
while (line != null) {
hasCelebrated.add(line);
line = reader.readLine();
}
reader.close();
}
catch (Exception ex) {
mcMMO.p.getLogger().severe(ex.toString());
}
cleanupFiles();
}
private void cleanupFiles() {
File FlatFileDir = new File(mcMMO.getFlatFileDirectory());
File legacy = new File(FlatFileDir, "anniversary.yml");
List<File> toDelete = new ArrayList<>();
if (legacy.exists()) {
toDelete.add(legacy);
}
Pattern pattern = Pattern.compile("anniversary\\.(?:.+)\\.yml");
for (String fileName : FlatFileDir.list()) {
if (!pattern.matcher(fileName).matches() || fileName.equals("anniversary." + currentYear + ".yml")) {
continue;
}
File file = new File(FlatFileDir, fileName);
if (file.isDirectory()) {
continue;
}
toDelete.add(file);
}
for (File file : toDelete) {
if (file.delete()) {
mcMMO.p.debug("Deleted: " + file.getName());
}
}
}
// This gets called onDisable
public void saveAnniversaryFiles() {
mcMMO.p.debug("Saving anniversary files...");
String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml";
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(anniversaryFilePath));
for (String player : hasCelebrated) {
writer.write(player);
writer.newLine();
}
writer.close();
}
catch (Exception ex) {
mcMMO.p.getLogger().severe(ex.toString());
}
}
// This gets called from /mcmmo command
public void anniversaryCheck(final CommandSender sender) {
GregorianCalendar anniversaryStart = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 3);
GregorianCalendar anniversaryEnd = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 6);
GregorianCalendar day = new GregorianCalendar();
if (hasCelebrated.contains(sender.getName())) {
return;
}
if (!getDateRange(day.getTime(), anniversaryStart.getTime(), anniversaryEnd.getTime())) {
return;
}
sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR)));
/*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;
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
@Override
public void run() {
spawnFireworks((Player) sender);
}
}, delay);
}
}*/
// else {
/*
* Credit: http://www.geocities.com/spunk1111/
* (good luck finding that in 3 years heh)
* .''. . *''* :_\/_: .
* :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'.
* .''.: /\ : /)\ ':'* /\ * : '..'. -=:o:=-
* :_\/_:'.:::. ' *''* * '.\'/.'_\(/_ '.':'.'
* : /\ : ::::: *_\/_* -= o =- /)\ '
* '..' ':::' * /\ * .'/.\'. ' *
* * *..* : *
* * * *
* * * *
*/
/*
* Color map
* AAAA D GGGG JJJJJJ K
* AAAAAA DDDDD EEEGGGGGG JJJJJJ KKKKKKK
* BBBBAAAAAA DDD EEEGGGGGG I JJJJJ KKKKKKK
* BBBBBBACCCCC D FFFF G IIIIIIIHHHHH KKKKKKK
* BBBBBB CCCCC FFFFFF IIIIIII HHH K
* BBBB CCCCC FFFFFF IIIIIII H k
* b FFFF I k
* b i k
* b i k
*/
Object[] colorParams = new Object[]{chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose()};
sender.sendMessage(String.format(" %1$s.''. %4$s. %7$s*''* %10$s:_\\/_: %11$s.", colorParams));
sender.sendMessage(String.format(" %1$s:_\\/_: %4$s_\\(/_ %5$s.:.%7$s*_\\/_* %10$s: /\\ : %11$s.'.:.'.", colorParams));
sender.sendMessage(String.format(" %2$s.''.%1$s: /\\ : %4$s/)\\ %5$s':'%7$s* /\\ * %9$s: %10$s'..'. %11$s-=:o:=-", colorParams));
sender.sendMessage(String.format("%2$s:_\\/_:%1$s'%3$s.:::. %4$s' %6$s*''* %7$s* %9$s'.\\'/.'%8$s_\\(/_ %11$s'.':'.'", colorParams));
sender.sendMessage(String.format("%2$s: /\\ : %3$s::::: %6$s*_\\/_* %9$s-= o =-%8$s /)\\ %11$s'", colorParams));
sender.sendMessage(String.format(" %2$s'..' %3$s':::' %6$s* /\\ * %9$s.'/.\\'. %8$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));
// }
hasCelebrated.add(sender.getName());
}
public boolean getDateRange(Date date, Date start, Date end) {
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;
//package com.gmail.nossr50.util;
//
// 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);
//import com.gmail.nossr50.commands.skills.AprilCommand;
//import com.gmail.nossr50.config.Config;
//import com.gmail.nossr50.datatypes.interactions.NotificationType;
//import com.gmail.nossr50.datatypes.player.McMMOPlayer;
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//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.sounds.SoundManager;
//import com.gmail.nossr50.util.sounds.SoundType;
//import com.gmail.nossr50.util.text.StringUtils;
//import com.google.common.collect.ImmutableList;
//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.Player;
//import org.bukkit.event.player.PlayerStatisticIncrementEvent;
//
//import java.io.*;
//import java.util.*;
//import java.util.regex.Pattern;
//
//public final class HolidayManager {
// private final ArrayList<String> hasCelebrated;
// private final int currentYear;
// private static final int START_YEAR = 2011;
//
// private static final List<Color> ALL_COLORS;
// private static final List<ChatColor> ALL_CHAT_COLORS;
// private static final List<ChatColor> CHAT_FORMATS;
//
// public enum FakeSkillType {
// MACHO,
// JUMPING,
// THROWING,
// WRECKING,
// CRAFTING,
// WALKING,
// SWIMMING,
// FALLING,
// CLIMBING,
// FLYING,
// DIVING,
// PIGGY,
// UNKNOWN;
//
// public static FakeSkillType getByName(String skillName) {
// for (FakeSkillType type : values()) {
// if (type.name().equalsIgnoreCase(skillName)) {
// return type;
// }
// }
// return null;
// }
//
// public static FakeSkillType getByStatistic(Statistic statistic) {
// switch (statistic) {
// case DAMAGE_TAKEN:
// return FakeSkillType.MACHO;
// case JUMP:
// return FakeSkillType.JUMPING;
// case DROP:
// return FakeSkillType.THROWING;
// case MINE_BLOCK:
// case BREAK_ITEM:
// return FakeSkillType.WRECKING;
// case CRAFT_ITEM:
// return FakeSkillType.CRAFTING;
// case WALK_ONE_CM:
// return FakeSkillType.WALKING;
// case SWIM_ONE_CM:
// return FakeSkillType.SWIMMING;
// case FALL_ONE_CM:
// return FakeSkillType.FALLING;
// case CLIMB_ONE_CM:
// return FakeSkillType.CLIMBING;
// case FLY_ONE_CM:
// return FakeSkillType.FLYING;
// case WALK_UNDER_WATER_ONE_CM:
// return FakeSkillType.DIVING;
// case PIG_ONE_CM:
// return FakeSkillType.PIGGY;
// default:
// return FakeSkillType.UNKNOWN;
// }
// }
// }
private static List<Color> colorChoose() {
return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1));
}
private static String chatColorChoose() {
StringBuilder ret = new StringBuilder(ALL_CHAT_COLORS.get(Misc.getRandom().nextInt(ALL_CHAT_COLORS.size())).toString());
for (ChatColor chatFormat : CHAT_FORMATS) {
if (Misc.getRandom().nextInt(CHAT_FORMATS.size()) == 0) {
ret.append(chatFormat);
}
}
return ret.toString();
}
public boolean isAprilFirst() {
if(!Config.getInstance().isAprilFoolsAllowed())
return false;
GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
GregorianCalendar aprilSecond = new GregorianCalendar(currentYear, Calendar.APRIL, 2);
GregorianCalendar day = new GregorianCalendar();
return getDateRange(day.getTime(), aprilFirst.getTime(), aprilSecond.getTime());
}
public boolean nearingAprilFirst() {
if(!Config.getInstance().isAprilFoolsAllowed())
return false;
GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
GregorianCalendar end = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.APRIL, 2);
GregorianCalendar day = new GregorianCalendar();
return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
}
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
Player player = event.getPlayer();
Statistic statistic = event.getStatistic();
int newValue = event.getNewValue();
int modifier;
switch (statistic) {
case DAMAGE_TAKEN:
modifier = 500;
break;
case JUMP:
modifier = 500;
break;
case DROP:
modifier = 200;
break;
case MINE_BLOCK:
case BREAK_ITEM:
modifier = 500;
break;
case CRAFT_ITEM:
modifier = 100;
break;
default:
return;
}
if (newValue % modifier == 0) {
mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
}
}
public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
if(!Config.getInstance().isAprilFoolsAllowed())
return;
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if (mmoPlayer == null) return;
int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.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())));
}
public void registerAprilCommand() {
if(!Config.getInstance().isAprilFoolsAllowed())
return;
PluginCommand command = mcMMO.p.getCommand("crafting");
command.setExecutor(new AprilCommand());
}
}
//
// public final Set<Statistic> movementStatistics = EnumSet.of(
// Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
// Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.WALK_UNDER_WATER_ONE_CM,
// Statistic.PIG_ONE_CM);
//
// static {
// List<Color> colors = new ArrayList<>();
// List<ChatColor> chatColors = new ArrayList<>();
// List<ChatColor> chatFormats = new ArrayList<>();
//
// for (ChatColor color : ChatColor.values()) {
// if (color.isColor()) {
// chatColors.add(color);
// }
// else {
// chatFormats.add(color);
// }
// }
//
//// for (DyeColor color : DyeColor.values()) {
//// colors.add(color.getFireworkColor());
//// }
//
// Collections.shuffle(chatColors, Misc.getRandom());
// Collections.shuffle(colors, Misc.getRandom());
// Collections.shuffle(chatFormats, Misc.getRandom());
//
// ALL_CHAT_COLORS = ImmutableList.copyOf(chatColors);
// ALL_COLORS = ImmutableList.copyOf(colors);
// CHAT_FORMATS = ImmutableList.copyOf(chatFormats);
// }
//
// // This gets called onEnable
// public HolidayManager() {
// currentYear = Calendar.getInstance().get(Calendar.YEAR);
//
// File anniversaryFile = new File(mcMMO.getFlatFileDirectory(), "anniversary." + currentYear + ".yml");
//
// if (!anniversaryFile.exists()) {
// try {
// anniversaryFile.createNewFile();
// }
// catch (IOException ex) {
// mcMMO.p.getLogger().severe(ex.toString());
// }
// }
//
// hasCelebrated = new ArrayList<>();
//
// try {
// hasCelebrated.clear();
// BufferedReader reader = new BufferedReader(new FileReader(anniversaryFile.getPath()));
// String line = reader.readLine();
//
// while (line != null) {
// hasCelebrated.add(line);
// line = reader.readLine();
// }
//
// reader.close();
// }
// catch (Exception ex) {
// mcMMO.p.getLogger().severe(ex.toString());
// }
//
// cleanupFiles();
// }
//
// private void cleanupFiles() {
// File FlatFileDir = new File(mcMMO.getFlatFileDirectory());
// File legacy = new File(FlatFileDir, "anniversary.yml");
// List<File> toDelete = new ArrayList<>();
//
// if (legacy.exists()) {
// toDelete.add(legacy);
// }
//
// Pattern pattern = Pattern.compile("anniversary\\.(?:.+)\\.yml");
//
// for (String fileName : FlatFileDir.list()) {
// if (!pattern.matcher(fileName).matches() || fileName.equals("anniversary." + currentYear + ".yml")) {
// continue;
// }
//
// File file = new File(FlatFileDir, fileName);
//
// if (file.isDirectory()) {
// continue;
// }
//
// toDelete.add(file);
// }
//
// for (File file : toDelete) {
// if (file.delete()) {
// mcMMO.p.debug("Deleted: " + file.getName());
// }
// }
// }
//
// // This gets called onDisable
// public void saveAnniversaryFiles() {
// mcMMO.p.debug("Saving anniversary files...");
// String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml";
//
// try {
// BufferedWriter writer = new BufferedWriter(new FileWriter(anniversaryFilePath));
// for (String player : hasCelebrated) {
// writer.write(player);
// writer.newLine();
// }
// writer.close();
// }
// catch (Exception ex) {
// mcMMO.p.getLogger().severe(ex.toString());
// }
// }
//
// // This gets called from /mcmmo command
// public void anniversaryCheck(final CommandSender sender) {
// GregorianCalendar anniversaryStart = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 3);
// GregorianCalendar anniversaryEnd = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 6);
// GregorianCalendar day = new GregorianCalendar();
//
// if (hasCelebrated.contains(sender.getName())) {
// return;
// }
//
// if (!getDateRange(day.getTime(), anniversaryStart.getTime(), anniversaryEnd.getTime())) {
// return;
// }
//
// sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR)));
// /*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;
// mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
// @Override
// public void run() {
// spawnFireworks((Player) sender);
// }
// }, delay);
// }
// }*/
//// else {
// /*
// * Credit: http://www.geocities.com/spunk1111/
// * (good luck finding that in 3 years heh)
// * .''. . *''* :_\/_: .
// * :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'.
// * .''.: /\ : /)\ ':'* /\ * : '..'. -=:o:=-
// * :_\/_:'.:::. ' *''* * '.\'/.'_\(/_ '.':'.'
// * : /\ : ::::: *_\/_* -= o =- /)\ '
// * '..' ':::' * /\ * .'/.\'. ' *
// * * *..* : *
// * * * *
// * * * *
// */
//
// /*
// * Color map
// * AAAA D GGGG JJJJJJ K
// * AAAAAA DDDDD EEEGGGGGG JJJJJJ KKKKKKK
// * BBBBAAAAAA DDD EEEGGGGGG I JJJJJ KKKKKKK
// * BBBBBBACCCCC D FFFF G IIIIIIIHHHHH KKKKKKK
// * BBBBBB CCCCC FFFFFF IIIIIII HHH K
// * BBBB CCCCC FFFFFF IIIIIII H k
// * b FFFF I k
// * b i k
// * b i k
// */
// Object[] colorParams = new Object[]{chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose()};
// sender.sendMessage(String.format(" %1$s.''. %4$s. %7$s*''* %10$s:_\\/_: %11$s.", colorParams));
// sender.sendMessage(String.format(" %1$s:_\\/_: %4$s_\\(/_ %5$s.:.%7$s*_\\/_* %10$s: /\\ : %11$s.'.:.'.", colorParams));
// sender.sendMessage(String.format(" %2$s.''.%1$s: /\\ : %4$s/)\\ %5$s':'%7$s* /\\ * %9$s: %10$s'..'. %11$s-=:o:=-", colorParams));
// sender.sendMessage(String.format("%2$s:_\\/_:%1$s'%3$s.:::. %4$s' %6$s*''* %7$s* %9$s'.\\'/.'%8$s_\\(/_ %11$s'.':'.'", colorParams));
// sender.sendMessage(String.format("%2$s: /\\ : %3$s::::: %6$s*_\\/_* %9$s-= o =-%8$s /)\\ %11$s'", colorParams));
// sender.sendMessage(String.format(" %2$s'..' %3$s':::' %6$s* /\\ * %9$s.'/.\\'. %8$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));
//// }
//
// hasCelebrated.add(sender.getName());
// }
//
// public boolean getDateRange(Date date, Date start, Date end) {
// 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);
//// }
//
// private static List<Color> colorChoose() {
// return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1));
// }
//
// private static String chatColorChoose() {
// StringBuilder ret = new StringBuilder(ALL_CHAT_COLORS.get(Misc.getRandom().nextInt(ALL_CHAT_COLORS.size())).toString());
//
// for (ChatColor chatFormat : CHAT_FORMATS) {
// if (Misc.getRandom().nextInt(CHAT_FORMATS.size()) == 0) {
// ret.append(chatFormat);
// }
// }
//
// return ret.toString();
// }
//
// public boolean isAprilFirst() {
// if(!Config.getInstance().isAprilFoolsAllowed())
// return false;
//
// GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
// GregorianCalendar aprilSecond = new GregorianCalendar(currentYear, Calendar.APRIL, 2);
// GregorianCalendar day = new GregorianCalendar();
// return getDateRange(day.getTime(), aprilFirst.getTime(), aprilSecond.getTime());
// }
//
// public boolean nearingAprilFirst() {
// if(!Config.getInstance().isAprilFoolsAllowed())
// return false;
//
// GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
// GregorianCalendar end = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.APRIL, 2);
// GregorianCalendar day = new GregorianCalendar();
//
// return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
// }
//
// public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
// Player player = event.getPlayer();
// Statistic statistic = event.getStatistic();
// int newValue = event.getNewValue();
//
// int modifier;
// switch (statistic) {
// case DAMAGE_TAKEN:
// modifier = 500;
// break;
// case JUMP:
// modifier = 500;
// break;
// case DROP:
// modifier = 200;
// break;
// case MINE_BLOCK:
// case BREAK_ITEM:
// modifier = 500;
// break;
// case CRAFT_ITEM:
// modifier = 100;
// break;
// default:
// return;
// }
//
// if (newValue % modifier == 0) {
// mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
// }
// }
//
// public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
// if(!Config.getInstance().isAprilFoolsAllowed())
// return;
//
// final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
// if (mmoPlayer == null) return;
//
// int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.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())));
// }
//
// public void registerAprilCommand() {
// if(!Config.getInstance().isAprilFoolsAllowed())
// return;
//
// PluginCommand command = mcMMO.p.getCommand("crafting");
// command.setExecutor(new AprilCommand());
// }
//}

View File

@ -49,7 +49,6 @@ General:
RetroMode:
Enabled: true
Locale: en_US
AprilFoolsEvent: true
MOTD_Enabled: true
EventBroadcasts: true
EventInfoOnPlayerJoin: true