Skip to content

Commit 74bfa70

Browse files
committed
Remove TASK_DELAY, remove event ending code from play particle task
1 parent e6b8d50 commit 74bfa70

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

src/main/java/ru/meloncode/xmas/Main.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public class Main extends JavaPlugin implements Listener {
3434
static long endTime;
3535
static boolean inProgress;
3636
private static int UPDATE_SPEED;
37-
private static int TASK_DELAY;
3837
private static int PARTICLES_DELAY;
3938
private static List<String> heads;
4039
private static Plugin plugin;
@@ -69,9 +68,6 @@ public void onEnable() {
6968
config.set("core.update-speed", 7);
7069
UPDATE_SPEED = 7;
7170
}
72-
TASK_DELAY = config.getInt("core.task-delay");
73-
if (TASK_DELAY <= 0)
74-
config.set("core.task-delay", 7);
7571
PARTICLES_DELAY = config.getInt("core.particles-delay");
7672
if (PARTICLES_DELAY <= 0)
7773
config.set("particles-delay", 35);
@@ -127,8 +123,8 @@ public void onEnable() {
127123
LUCK_CHANCE_ENABLED = config.getBoolean("xmas.luck.enabled");
128124
LUCK_CHANCE = (float) config.getInt("xmas.luck.chance") / 100;
129125
new Events().registerListener();
130-
new MagicTask(this).runTaskTimer(this, 5, TASK_DELAY);
131-
new MagicTaskParticles(this).runTaskTimerAsynchronously(this, 5, PARTICLES_DELAY);
126+
new MagicTask(this).runTaskTimer(this, 5, UPDATE_SPEED);
127+
new PlayParticlesTask(this).runTaskTimerAsynchronously(this, 5, PARTICLES_DELAY);
132128
XMas.XMAS_CRYSTAL = new ItemMaker(Material.EMERALD, LocaleManager.CRYSTAL_NAME, LocaleManager.CRYSTAL_LORE).make();
133129

134130
ShapedRecipe grinderRecipe;
@@ -146,7 +142,7 @@ public void onEnable() {
146142
try {
147143
if (!registered)
148144
getServer().addRecipe(grinderRecipe);
149-
} catch (Exception e) {
145+
} catch (Exception ignored) {
150146
}
151147
XMasCommand.register(this);
152148
TextUtils.sendConsoleMessage(LocaleManager.PLUGIN_ENABLED);

src/main/java/ru/meloncode/xmas/MagicTaskParticles.java renamed to src/main/java/ru/meloncode/xmas/PlayParticlesTask.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import org.bukkit.scheduler.BukkitRunnable;
44

5-
class MagicTaskParticles extends BukkitRunnable {
5+
class PlayParticlesTask extends BukkitRunnable {
66

77
private final Main xmas;
88

9-
MagicTaskParticles(Main main) {
9+
PlayParticlesTask(Main main) {
1010
this.xmas = main;
1111
}
1212

@@ -16,9 +16,5 @@ public void run() {
1616
for (MagicTree tree : XMas.getAllTrees()) {
1717
tree.playParticles();
1818
}
19-
if ((Main.autoEnd && Main.endTime < System.currentTimeMillis()) || !Main.inProgress) {
20-
xmas.end();
21-
cancel();
22-
}
2319
}
2420
}

0 commit comments

Comments
 (0)