mirror of
https://github.com/Maxlego08/zKoth.git
synced 2024-11-22 11:55:12 +01:00
📝 Fix errors
This commit is contained in:
parent
2bd19b7e75
commit
0f4c74885a
@ -1,5 +1,8 @@
|
||||
# Unreleased
|
||||
|
||||
- Fix error with discord webhook on stop
|
||||
- Fix problem with placeholder on koth spawn
|
||||
|
||||
# 3.0.3
|
||||
|
||||
- Fix NMS
|
||||
|
@ -170,6 +170,10 @@ public class KothManager extends ZUtils implements Savable {
|
||||
return koths.stream().filter(koth -> koth.getStatus() == KothStatus.COOLDOWN).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Koth> getStartKoths() {
|
||||
return koths.stream().filter(koth -> koth.getStatus() != KothStatus.STOP).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<String> getNameKoths() {
|
||||
return this.koths.stream().map(Koth::getFileName).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -94,28 +94,28 @@ public class KothPlaceholder extends ZUtils {
|
||||
}
|
||||
|
||||
public String onFirstKoth(ReturnConsumer<Koth> consumer) {
|
||||
Optional<Koth> optional = this.kothManager.getActiveKoths().stream().findFirst();
|
||||
Optional<Koth> optional = this.kothManager.getStartKoths().stream().findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return consumer.accept(optional.get());
|
||||
} else return Config.noKoth;
|
||||
}
|
||||
|
||||
public String onFirstKoth(Player player, ReturnBiConsumer<Player, Koth, String> consumer) {
|
||||
Optional<Koth> optional = this.kothManager.getActiveKoths().stream().findFirst();
|
||||
Optional<Koth> optional = this.kothManager.getStartKoths().stream().findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return consumer.accept(player, optional.get());
|
||||
} else return Config.noKoth;
|
||||
}
|
||||
|
||||
public String onFirstKoth(String argument, ReturnBiConsumer<String, Koth, String> consumer) {
|
||||
Optional<Koth> optional = this.kothManager.getActiveKoths().stream().findFirst();
|
||||
Optional<Koth> optional = this.kothManager.getStartKoths().stream().findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return consumer.accept(argument, optional.get());
|
||||
} else return Config.noKoth;
|
||||
}
|
||||
|
||||
public String onFirstKothPosition(String argument, ReturnBiConsumer<Integer, Koth, String> consumer) {
|
||||
Optional<Koth> optional = this.kothManager.getActiveKoths().stream().findFirst();
|
||||
Optional<Koth> optional = this.kothManager.getStartKoths().stream().findFirst();
|
||||
if (optional.isPresent()) {
|
||||
try {
|
||||
return consumer.accept(Integer.parseInt(argument), optional.get());
|
||||
|
@ -85,7 +85,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
private AtomicInteger remainingSeconds;
|
||||
private TimerTask timerTask;
|
||||
private TimerTask timerTaskStop;
|
||||
private DiscordWebhookConfig discordWebhookConfig;
|
||||
private final DiscordWebhookConfig discordWebhookConfig;
|
||||
private List<PlayerResult> playerResults = new ArrayList<>();
|
||||
|
||||
public ZKoth(KothPlugin plugin, String fileName, KothType kothType, String name, int captureSeconds, Location minLocation, Location maxLocation, List<String> startCommands, List<String> endCommands, ScoreboardConfiguration cooldownScoreboard, ScoreboardConfiguration startScoreboard, int cooldownStart, int stopAfterSeconds, boolean enableStartCapMessage, boolean enableLooseCapMessage, boolean enableEverySecondsCapMessage, HologramConfig hologramConfig, List<ItemStack> itemStacks, KothLootType kothLootType, DiscordWebhookConfig discordWebhookConfig, int randomItemStacks, List<String> blacklistTeamId, ProgressBar progressBar) {
|
||||
@ -272,7 +272,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
event.call();
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.STOP);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.STOP);
|
||||
|
||||
broadcast(Message.EVENT_STOP);
|
||||
|
||||
@ -314,7 +314,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.START);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.START);
|
||||
|
||||
if (this.cooldownScoreboard.isEnable()) {
|
||||
ScoreBoardManager scoreBoardManager = this.plugin.getScoreBoardManager();
|
||||
@ -362,7 +362,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
event.call();
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.SPAWN);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.SPAWN);
|
||||
|
||||
this.remainingSeconds = new AtomicInteger(this.captureSeconds);
|
||||
|
||||
@ -442,7 +442,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
KothLooseEvent event = new KothLooseEvent(this.currentPlayer, this);
|
||||
event.call();
|
||||
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.LOOSE);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.LOOSE);
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
@ -478,7 +478,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
return;
|
||||
}
|
||||
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.START_CAP);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.START_CAP);
|
||||
|
||||
if (enableStartCapMessage) {
|
||||
broadcast(Message.EVENT_CATCH);
|
||||
@ -522,7 +522,8 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
|
||||
if (kothLooseEvent.isCancelled()) return;
|
||||
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.LOOSE);
|
||||
if (this.discordWebhookConfig != null)
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.LOOSE);
|
||||
|
||||
if (this.timerTask != null) {
|
||||
this.timerTask.cancel();
|
||||
@ -581,7 +582,7 @@ public class ZKoth extends ZUtils implements Koth {
|
||||
|
||||
if (kothWinEvent.isCancelled()) return;
|
||||
|
||||
this.discordWebhookConfig.send(this.plugin, this, KothEvent.WIN);
|
||||
if (this.discordWebhookConfig != null) this.discordWebhookConfig.send(this.plugin, this, KothEvent.WIN);
|
||||
|
||||
task.cancel();
|
||||
broadcast(Message.EVENT_WIN);
|
||||
|
Loading…
Reference in New Issue
Block a user