mirror of
https://github.com/Maxlego08/zKoth.git
synced 2024-09-27 04:12:39 +02:00
📝 Fix errors
This commit is contained in:
parent
2bd19b7e75
commit
0f4c74885a
@ -1,5 +1,8 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Fix error with discord webhook on stop
|
||||||
|
- Fix problem with placeholder on koth spawn
|
||||||
|
|
||||||
# 3.0.3
|
# 3.0.3
|
||||||
|
|
||||||
- Fix NMS
|
- 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());
|
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() {
|
public List<String> getNameKoths() {
|
||||||
return this.koths.stream().map(Koth::getFileName).collect(Collectors.toList());
|
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) {
|
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()) {
|
if (optional.isPresent()) {
|
||||||
return consumer.accept(optional.get());
|
return consumer.accept(optional.get());
|
||||||
} else return Config.noKoth;
|
} else return Config.noKoth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String onFirstKoth(Player player, ReturnBiConsumer<Player, Koth, String> consumer) {
|
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()) {
|
if (optional.isPresent()) {
|
||||||
return consumer.accept(player, optional.get());
|
return consumer.accept(player, optional.get());
|
||||||
} else return Config.noKoth;
|
} else return Config.noKoth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String onFirstKoth(String argument, ReturnBiConsumer<String, Koth, String> consumer) {
|
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()) {
|
if (optional.isPresent()) {
|
||||||
return consumer.accept(argument, optional.get());
|
return consumer.accept(argument, optional.get());
|
||||||
} else return Config.noKoth;
|
} else return Config.noKoth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String onFirstKothPosition(String argument, ReturnBiConsumer<Integer, Koth, String> consumer) {
|
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()) {
|
if (optional.isPresent()) {
|
||||||
try {
|
try {
|
||||||
return consumer.accept(Integer.parseInt(argument), optional.get());
|
return consumer.accept(Integer.parseInt(argument), optional.get());
|
||||||
|
@ -85,7 +85,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
private AtomicInteger remainingSeconds;
|
private AtomicInteger remainingSeconds;
|
||||||
private TimerTask timerTask;
|
private TimerTask timerTask;
|
||||||
private TimerTask timerTaskStop;
|
private TimerTask timerTaskStop;
|
||||||
private DiscordWebhookConfig discordWebhookConfig;
|
private final DiscordWebhookConfig discordWebhookConfig;
|
||||||
private List<PlayerResult> playerResults = new ArrayList<>();
|
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) {
|
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();
|
event.call();
|
||||||
|
|
||||||
if (event.isCancelled()) return;
|
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);
|
broadcast(Message.EVENT_STOP);
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
|
|
||||||
if (event.isCancelled()) return;
|
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()) {
|
if (this.cooldownScoreboard.isEnable()) {
|
||||||
ScoreBoardManager scoreBoardManager = this.plugin.getScoreBoardManager();
|
ScoreBoardManager scoreBoardManager = this.plugin.getScoreBoardManager();
|
||||||
@ -362,7 +362,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
event.call();
|
event.call();
|
||||||
|
|
||||||
if (event.isCancelled()) return;
|
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);
|
this.remainingSeconds = new AtomicInteger(this.captureSeconds);
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
KothLooseEvent event = new KothLooseEvent(this.currentPlayer, this);
|
KothLooseEvent event = new KothLooseEvent(this.currentPlayer, this);
|
||||||
event.call();
|
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;
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
return;
|
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) {
|
if (enableStartCapMessage) {
|
||||||
broadcast(Message.EVENT_CATCH);
|
broadcast(Message.EVENT_CATCH);
|
||||||
@ -522,7 +522,8 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
|
|
||||||
if (kothLooseEvent.isCancelled()) return;
|
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) {
|
if (this.timerTask != null) {
|
||||||
this.timerTask.cancel();
|
this.timerTask.cancel();
|
||||||
@ -581,7 +582,7 @@ public class ZKoth extends ZUtils implements Koth {
|
|||||||
|
|
||||||
if (kothWinEvent.isCancelled()) return;
|
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();
|
task.cancel();
|
||||||
broadcast(Message.EVENT_WIN);
|
broadcast(Message.EVENT_WIN);
|
||||||
|
Loading…
Reference in New Issue
Block a user