2014-03-28 23:07:48 +01:00
|
|
|
package com.gmail.nossr50.runnables.skills;
|
|
|
|
|
2018-07-26 02:29:40 +02:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
import com.gmail.nossr50.util.HolidayManager;
|
|
|
|
import com.gmail.nossr50.util.Misc;
|
2019-01-13 04:08:54 +01:00
|
|
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
|
|
|
import com.gmail.nossr50.util.sounds.SoundType;
|
2014-03-28 23:07:48 +01:00
|
|
|
import org.bukkit.ChatColor;
|
2014-04-01 15:36:40 +02:00
|
|
|
import org.bukkit.Statistic;
|
2014-03-28 23:07:48 +01:00
|
|
|
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()) {
|
2014-04-01 15:36:40 +02:00
|
|
|
int random = Misc.getRandom().nextInt(40) + 11;
|
2014-03-28 23:07:48 +01:00
|
|
|
int betterRandom = Misc.getRandom().nextInt(2000);
|
|
|
|
if (betterRandom == 0) {
|
2019-01-13 04:08:54 +01:00
|
|
|
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
2014-03-28 23:07:48 +01:00
|
|
|
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
|
2019-04-01 19:04:45 +02:00
|
|
|
// fireworksShow(player);
|
2014-03-28 23:07:48 +01:00
|
|
|
}
|
|
|
|
|
2014-04-01 15:36:40 +02:00
|
|
|
for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) {
|
|
|
|
if (player.getStatistic(statistic) > 0 && player.getStatistic(statistic) % random == 0) {
|
|
|
|
mcMMO.getHolidayManager().levelUpApril(player, HolidayManager.FakeSkillType.getByStatistic(statistic));
|
2014-03-28 23:07:48 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-01 19:04:45 +02:00
|
|
|
/*private void fireworksShow(final Player player) {
|
2014-03-28 23:07:48 +01:00
|
|
|
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);
|
|
|
|
}
|
2019-04-01 19:04:45 +02:00
|
|
|
}*/
|
2014-03-28 23:07:48 +01:00
|
|
|
|
|
|
|
private String unknown(String string) {
|
|
|
|
return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;
|
|
|
|
}
|
|
|
|
}
|