- Баллы
- 98
- Имя в Minecraft
- Dymeth
Достаточно было прислать только проблемный участок. А без кода наши полномочия всё...Он очень длинный, я ничего не поменял с кода выше
Следуйте инструкциям в видео ниже, чтобы узнать, как установить наш сайт как веб-приложение на главный экран вашего устройства.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
Достаточно было прислать только проблемный участок. А без кода наши полномочия всё...Он очень длинный, я ничего не поменял с кода выше
public void setTimeLeft(float timeleft) {
Iterator<String> tplayers = this.players.keySet().iterator();
while (tplayers.hasNext()) {
String splayer = tplayers.next();
Player player = Bukkit.getServer().getPlayerExact(splayer);
if (player != null && player.isOnline()) {
player.setExp(timeleft);
continue;
}
this.players.remove(splayer);
}
}
package com.tux2mc.colorshuffle;
import org.bukkit.ChatColor;
import org.bukkit.plugin.Plugin;
import org.bukkit.Bukkit;
import java.util.Random;
public class CSTimer implements Runnable {
CSArena arena;
ColorShuffle plugin;
int ticksforround;
int status;
int colorround;
boolean iscolorshuffle;
Random rand;
int tickstilendofround;
public CSTimer(final ColorShuffle plugin, final CSArena arena) {
this.ticksforround = 200;
this.status = 1;
this.colorround = 0;
this.iscolorshuffle = false;
this.rand = new Random();
this.tickstilendofround = this.ticksforround;
this.plugin = plugin;
this.arena = arena;
this.ticksforround = arena.getFirstRoundTicks();
}
@Override
public void run() {
if (this.arena.getPlayers().size() == 0) {
this.arena.resetArena();
return;
}
if (this.status == 0) {
this.arena.roundEnded();
++this.status;
this.colorround = 0;
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 15L);
} else if (this.status == 1) {
++this.status;
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 45L);
} else if (this.status == 2) {
this.arena.replaceFloor();
this.arena.spinColors(false);
++this.colorround;
++this.status;
if (this.rand.nextInt(5) == 1) {
this.iscolorshuffle = true;
this.arena.sendMessageToPlayers(
ChatColor.GOLD + "It's time for the " + this.plugin.colorize("C O L O R S H U F F L E!"));
} else {
this.iscolorshuffle = false;
}
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 7L);
} else if (this.status == 3) {
this.arena.spinColors(false);
if (this.iscolorshuffle) {
this.arena.shuffleMats();
}
switch (++this.colorround) {
case 2:
this.arena.sendMessageToPlayers(
String.valueOf(this.plugin.getColorShufflePrefix()) + ChatColor.GREEN + " 3");
break;
case 4:
this.arena.sendMessageToPlayers(
String.valueOf(this.plugin.getColorShufflePrefix()) + ChatColor.GREEN + " 2");
break;
case 6:
this.arena.sendMessageToPlayers(
String.valueOf(this.plugin.getColorShufflePrefix()) + ChatColor.GREEN + " 1");
break;
}
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 7L);
if (this.colorround > 6) {
++this.status;
}
} else if (this.status == 4) {
this.arena.startRound();
if (this.arena.getRound() > 1) {
this.ticksforround *= (int) (1.0 - this.arena.getDecay());
}
this.tickstilendofround = this.ticksforround;
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 5L);
++this.status;
} else if (this.status == 5) {
this.tickstilendofround -= 5;
final float timeleft = this.tickstilendofround / (float) this.ticksforround;
this.arena.setTimeLeft(timeleft);
if (this.tickstilendofround < 5) {
this.status = 0;
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this,
(long) this.tickstilendofround);
} else {
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this.plugin, (Runnable) this, 5L);
}
}
}
}