🐛 Fix scoreboard

This commit is contained in:
Maxlego08 2022-03-16 18:24:17 +01:00
parent a9161fb149
commit 4d64d9bac0
3 changed files with 20 additions and 14 deletions

View File

@ -1,7 +1,7 @@
name: zKoth
author: Maxlego08
main: fr.maxlego08.zkoth.ZKothPlugin
version: 2.1.0.1
softdepend: [PlaceholderAPI, Guilds, Factions, FactionsX, SuperiorSkyblock2, LegacyFactions, FeatherBoard, TAB, TitleManager, UltimateFactions]
version: 2.1.0.2
softdepend: [PlaceholderAPI, Guilds, Factions, FactionsX, SuperiorSkyblock2, LegacyFactions, FeatherBoard, TAB, TitleManager, UltimateFactions, Multiverse-Core]
commands:
api-version: 1.13

View File

@ -222,7 +222,7 @@ public class ZKoth extends ZUtils implements Koth {
if (event.isCancelled())
return;
scheduleFix(0, 1000, (task, isCancelled) -> {
scheduleFix(0, Config.enableDebug ? 10 : 1000, (task, isCancelled) -> {
this.timerTask = task;
@ -247,6 +247,7 @@ public class ZKoth extends ZUtils implements Koth {
this.isCooldown = false;
this.timerTask.cancel();
this.spawnNow();
return;
}
this.currentCaptureSeconds.decrementAndGet();
@ -569,7 +570,7 @@ public class ZKoth extends ZUtils implements Koth {
Location location = center;
if (this.itemStacks.size() != 0)
if (this.itemStacks.size() != 0) {
switch (this.type) {
case CHEST:
location.getBlock().setType(Material.CHEST);
@ -602,6 +603,7 @@ public class ZKoth extends ZUtils implements Koth {
default:
break;
}
}
/* FIN Gestion des loots */
@ -615,12 +617,14 @@ public class ZKoth extends ZUtils implements Koth {
@Override
public CollectionConsumer<Player> onScoreboard() {
if (this.isCooldown) {
return p -> Config.scoreboardCooldown.stream().map(e -> papi(replaceMessage(e), p))
.collect(Collectors.toList());
} else {
return p -> Config.scoreboard.stream().map(e -> papi(replaceMessage(e), p)).collect(Collectors.toList());
}
return p -> {
if (this.isCooldown) {
return Config.scoreboardCooldown.stream().map(e -> papi(replaceMessage(e), p))
.collect(Collectors.toList());
} else {
return Config.scoreboard.stream().map(e -> papi(replaceMessage(e), p)).collect(Collectors.toList());
}
};
}
@Override
@ -739,9 +743,10 @@ public class ZKoth extends ZUtils implements Koth {
}
private Entry<Player, Integer> getEntryAt(int position) {
try {
return this.playersValues.entrySet().stream().sorted((f1, f2) -> Integer.compare(f2.getValue(), f1.getValue()))
.collect(Collectors.toList()).get(position - 1);
try {
return this.playersValues.entrySet().stream()
.sorted((f1, f2) -> Integer.compare(f2.getValue(), f1.getValue())).collect(Collectors.toList())
.get(position - 1);
} catch (Exception e) {
return null;
}

View File

@ -11,8 +11,8 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
@ -113,4 +113,5 @@ public abstract class ListenerAdapter extends ZUtils{
public void onKothStop(KothStopEvent event, Koth koth) {
}
}