📝 Fix scoreboard

This commit is contained in:
Maxlego08 2024-02-22 16:23:25 +01:00
parent a9d5d395ce
commit b074d81b9d
15 changed files with 275 additions and 128 deletions

View File

@ -66,13 +66,14 @@ public class KothManager extends ZUtils implements Savable {
File[] files = this.folder.listFiles((dir, name) -> name.endsWith(".yml"));
if (files == null) return;
this.koths.clear();
for (File file : files) {
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
Koth koth = this.kothLoader.load(configuration, "", file);
this.koths.add(koth);
}
System.out.println(koths);
Logger.info("Load " + this.koths.size() + " koths");
}
public Optional<Selection> getSelection(UUID uuid) {
@ -171,13 +172,5 @@ public class KothManager extends ZUtils implements Savable {
Koth koth = optional.get();
koth.spawn(sender, now);
/*if (Config.enableScoreboard) {
this.manager.setLinesAndSchedule(koth.onScoreboard());
for (Player player : Bukkit.getOnlinePlayers()) {
this.manager.createBoard(player, Config.scoreboardTitle);
}
}*/
}
}

View File

@ -7,6 +7,7 @@ import fr.maxlego08.koth.hook.scoreboard.DefaultHook;
import fr.maxlego08.koth.placeholder.LocalPlaceholder;
import fr.maxlego08.koth.save.Config;
import fr.maxlego08.koth.save.MessageLoader;
import fr.maxlego08.koth.scoreboard.ScoreBoardManager;
import fr.maxlego08.koth.storage.StorageManager;
import fr.maxlego08.koth.zcore.ZPlugin;
import fr.maxlego08.koth.zcore.logger.Logger;
@ -19,6 +20,7 @@ import fr.maxlego08.koth.zcore.logger.Logger;
*/
public class KothPlugin extends ZPlugin {
private final ScoreBoardManager scoreBoardManager = new ScoreBoardManager(this);
private KothManager kothManager;
private StorageManager storageManager;
private KothScoreboard kothScoreboard = new DefaultHook();
@ -53,6 +55,7 @@ public class KothPlugin extends ZPlugin {
break;
}
}
this.scoreBoardManager.setScoreboard(this.kothScoreboard);
this.postEnable();
}
@ -78,4 +81,8 @@ public class KothPlugin extends ZPlugin {
public StorageManager getStorageManager() {
return this.storageManager;
}
public ScoreBoardManager getScoreBoardManager() {
return scoreBoardManager;
}
}

View File

@ -14,9 +14,14 @@ import fr.maxlego08.koth.api.events.KothWinEvent;
import fr.maxlego08.koth.api.utils.ScoreboardConfiguration;
import fr.maxlego08.koth.hook.teams.NoneHook;
import fr.maxlego08.koth.save.Config;
import fr.maxlego08.koth.scoreboard.ScoreBoardManager;
import fr.maxlego08.koth.zcore.enums.Message;
import fr.maxlego08.koth.zcore.logger.Logger;
import fr.maxlego08.koth.zcore.utils.Cuboid;
import fr.maxlego08.koth.zcore.utils.ZUtils;
import fr.maxlego08.koth.zcore.utils.builder.TimerBuilder;
import fr.maxlego08.koth.zcore.utils.interfaces.CollectionConsumer;
import fr.mrmicky.fastboard.FastBoard;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -26,6 +31,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -33,6 +39,7 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
public class ZKoth extends ZUtils implements Koth {
@ -60,9 +67,7 @@ public class ZKoth extends ZUtils implements Koth {
private TimerTask timerTask;
private TimerTask timerTaskStop;
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) {
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) {
this.plugin = plugin;
this.fileName = fileName;
this.kothType = kothType;
@ -247,6 +252,7 @@ public class ZKoth extends ZUtils implements Koth {
this.timerTask = null;
this.remainingSeconds = null;
this.playersValues.clear();
this.plugin.getScoreBoardManager().clearBoard();
// this.resetBlocks();
if (this.timerTaskStop != null) this.timerTaskStop.cancel();
@ -264,6 +270,14 @@ public class ZKoth extends ZUtils implements Koth {
if (event.isCancelled()) return;
if (this.cooldownScoreboard.isEnable()) {
ScoreBoardManager scoreBoardManager = this.plugin.getScoreBoardManager();
scoreBoardManager.setLinesAndSchedule(onScoreboard());
for (Player player : Bukkit.getOnlinePlayers()) {
scoreBoardManager.createBoard(player, color(this.cooldownScoreboard.getTitle()));
}
}
this.timerTask = scheduleFix(this.plugin, 0, Config.enableDebug ? 10 : 1000, (task, isCancelled) -> {
if (!isCancelled) {
@ -304,7 +318,28 @@ public class ZKoth extends ZUtils implements Koth {
this.remainingSeconds = new AtomicInteger(this.captureSeconds);
this.broadcast(Message.EVENT_START);
broadcast(Message.EVENT_START);
ScoreBoardManager scoreBoardManager = this.plugin.getScoreBoardManager();
if (!this.cooldownScoreboard.isEnable() && this.startScoreboard.isEnable()) {
scoreBoardManager.setLinesAndSchedule(onScoreboard());
for (Player player : Bukkit.getOnlinePlayers()) {
scoreBoardManager.createBoard(player, color(this.startScoreboard.getTitle()));
}
} else if (this.cooldownScoreboard.isEnable() && this.startScoreboard.isEnable()) {
if (scoreBoardManager.getBoards().isEmpty()) {
scoreBoardManager.setLinesAndSchedule(onScoreboard());
for (Player player : Bukkit.getOnlinePlayers()) {
scoreBoardManager.createBoard(player, color(this.startScoreboard.getTitle()));
}
} else {
for (Player player : Bukkit.getOnlinePlayers()) {
FastBoard board = scoreBoardManager.getBoard(player);
if (board == null) scoreBoardManager.createBoard(player, color(this.startScoreboard.getTitle()));
else board.updateTitle(color(this.startScoreboard.getTitle()));
}
}
}
// this.changeBlocks(Config.noOneCapturingMaterial, true);
@ -318,9 +353,7 @@ public class ZKoth extends ZUtils implements Koth {
@Override
public void run() {
// plugin.getHologram().end(koth);
Bukkit.getScheduler().runTask(plugin, () -> {
stop(Bukkit.getConsoleSender());
});
Bukkit.getScheduler().runTask(plugin, () -> stop(Bukkit.getConsoleSender()));
}
};
timer.schedule(this.timerTaskStop, this.stopAfterSeconds * 1000L);
@ -381,8 +414,7 @@ public class ZKoth extends ZUtils implements Koth {
private void startCap(Player player) {
if (this.currentPlayer == null)
return;
if (this.currentPlayer == null) return;
KothCatchEvent event = new KothCatchEvent(this, player, this.captureSeconds);
event.call();
@ -421,8 +453,7 @@ public class ZKoth extends ZUtils implements Koth {
int currentRemainingSeconds = this.remainingSeconds.get();
if (this.currentPlayer != null) {
if (!this.currentPlayer.isValid() || !this.currentPlayer.isOnline()
|| !cuboid.contains(this.currentPlayer.getLocation())) {
if (!this.currentPlayer.isValid() || !this.currentPlayer.isOnline() || !cuboid.contains(this.currentPlayer.getLocation())) {
this.currentPlayer = null;
// this.plugin.getHologram().update(this);
}
@ -497,6 +528,8 @@ public class ZKoth extends ZUtils implements Koth {
task.cancel();
broadcast(Message.EVENT_WIN);
this.plugin.getScoreBoardManager().clearBoard();
/* Gestion des loots */
this.endCommands.forEach(command -> {
@ -559,8 +592,7 @@ public class ZKoth extends ZUtils implements Koth {
this.remainingSeconds = null;
this.playersValues.clear();
// this.resetBlocks();
if (this.timerTaskStop != null)
this.timerTaskStop.cancel();
if (this.timerTaskStop != null) this.timerTaskStop.cancel();
}
public int getValue(Player player) {
@ -581,9 +613,57 @@ public class ZKoth extends ZUtils implements Koth {
}
}
private void broadcast(Message message) {
switch (message.getType()) {
case ACTION: {
if (message.getMessage() == null) {
Logger.info(message.name() + " is null, check your config plz !", Logger.LogType.ERROR);
return;
}
String realMessage = replaceMessage(message.getMessage());
this.broadcastAction(realMessage);
break;
}
case CENTER: {
if (message.getMessages().size() == 0) {
String realMessage = replaceMessage(message.getMessage());
broadcastCenterMessage(Collections.singletonList(realMessage));
} else {
broadcastCenterMessage(message.getMessages().stream().map(this::replaceMessage).collect(Collectors.toList()));
}
break;
}
case TCHAT: {
if (message.getMessages().size() == 0) this.broadcast(replaceMessage(message.getMessage()));
else message.getMessages().forEach(m -> this.broadcast(replaceMessage(m)));
break;
}
case TITLE: {
String title = replaceMessage(message.getTitle());
String subTitle = replaceMessage(message.getSubTitle());
int fadeInTime = message.getStart();
int showTime = message.getTime();
int fadeOutTime = message.getEnd();
for (Player player : Bukkit.getOnlinePlayers()) {
this.title(player, title, subTitle, fadeInTime, showTime, fadeOutTime);
}
break;
}
case NONE:
default:
break;
}
}
private String replaceMessage(String string) {
string = string.replace("%playerName%", this.currentPlayer != null ? this.currentPlayer.getName() : Config.noPlayer);
string = string.replace("%teamName%", this.currentPlayer != null ? this.currentPlayer.getName() : Config.noPlayer);
int seconds = this.remainingSeconds == null ? this.captureSeconds : this.remainingSeconds.get();
string = string.replace("%captureFormat%", TimerBuilder.getStringTime(seconds));
string = string.replace("%captureSeconds%", String.valueOf(seconds));
return replaceKothInformations(string);
}
@ -591,6 +671,9 @@ public class ZKoth extends ZUtils implements Koth {
private String replaceKothInformations(String string) {
Location centerLocation = getCenter();
int seconds = this.remainingSeconds == null ? this.captureSeconds : this.remainingSeconds.get();
string = string.replace("%spawnSeconds%", String.valueOf(seconds));
string = string.replace("%spawnFormat%", TimerBuilder.getStringTime(seconds));
string = string.replace("%name%", this.name);
string = string.replace("%world%", centerLocation.getWorld().getName());
@ -607,4 +690,11 @@ public class ZKoth extends ZUtils implements Koth {
return string;
}
@Override
public CollectionConsumer<Player> onScoreboard() {
return player -> {
ScoreboardConfiguration scoreboard = (this.kothStatus == KothStatus.COOLDOWN) ? this.cooldownScoreboard : this.startScoreboard;
return scoreboard.getLines().stream().map(e -> color(papi(replaceMessage(e), player))).collect(Collectors.toList());
};
}
}

View File

@ -3,6 +3,7 @@ package fr.maxlego08.koth.api;
import fr.maxlego08.koth.KothPlugin;
import fr.maxlego08.koth.api.utils.ScoreboardConfiguration;
import fr.maxlego08.koth.zcore.utils.Cuboid;
import fr.maxlego08.koth.zcore.utils.interfaces.CollectionConsumer;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -58,5 +59,8 @@ public interface Koth {
boolean isEnableStartCapMessage();
boolean isEnableLooseCapMessage();
boolean isEnableEverySecondsCapMessage();
CollectionConsumer<Player> onScoreboard();
}

View File

@ -14,6 +14,7 @@ public class CommandKoth extends VCommand {
this.addSubCommand(new CommandKothAxe(plugin));
this.addSubCommand(new CommandKothCreate(plugin));
this.addSubCommand(new CommandKothNow(plugin));
this.addSubCommand(new CommandKothSpawn(plugin));
}
@Override

View File

@ -0,0 +1,28 @@
package fr.maxlego08.koth.command.commands;
import fr.maxlego08.koth.KothPlugin;
import fr.maxlego08.koth.command.VCommand;
import fr.maxlego08.koth.zcore.enums.Message;
import fr.maxlego08.koth.zcore.enums.Permission;
import fr.maxlego08.koth.zcore.utils.commands.CommandType;
public class CommandKothSpawn extends VCommand {
public CommandKothSpawn(KothPlugin plugin) {
super(plugin);
this.setPermission(Permission.ZKOTH_SPAWN);
this.addSubCommand("spawn");
this.setDescription(Message.DESCRIPTION_SPAWN);
this.addRequireArg("name", (a,b) -> plugin.getKothManager().getNameKoths());
}
@Override
protected CommandType perform(KothPlugin plugin) {
String name = argAsString(0);
this.manager.spawnKoth(sender, name, false);
return CommandType.SUCCESS;
}
}

View File

@ -38,11 +38,11 @@ public class KothLoader extends ZUtils implements Loader<Koth> {
List<String> startCommands = configuration.getStringList("startCommands");
List<String> endCommands = configuration.getStringList("endCommands");
Location minLocation = locationLoader.load(configuration, "minLocation.", file);
Location manLocation = locationLoader.load(configuration, "maxLocation.", file);
Location maxLocation = locationLoader.load(configuration, "maxLocation.", file);
ScoreboardConfiguration cooldownScoreboard = scoreboardLoaderLoader.load(configuration, "scoreboard.cooldown.", file);
ScoreboardConfiguration startScoreboard = scoreboardLoaderLoader.load(configuration, "scoreboard.start.", file);
return new ZKoth(this.plugin, fileName, kothType, name, captureSeconds, minLocation, manLocation, startCommands, endCommands, cooldownScoreboard,
return new ZKoth(this.plugin, fileName, kothType, name, captureSeconds, minLocation, maxLocation, startCommands, endCommands, cooldownScoreboard,
startScoreboard, cooldownStart, stopAfterSeconds, enableStartCapMessage, enableLooseCapMessage, enableEverySecondsCapMessage);
}
@ -60,7 +60,7 @@ public class KothLoader extends ZUtils implements Loader<Koth> {
configuration.set("enableLooseCapMessage", koth.isEnableLooseCapMessage());
configuration.set("enableEverySecondsCapMessage", koth.isEnableEverySecondsCapMessage());
locationLoader.save(koth.getMinLocation(), configuration, "minLocation.");
locationLoader.save(koth.getMaxLocation(), configuration, "manLocation.");
locationLoader.save(koth.getMaxLocation(), configuration, "maxLocation.");
scoreboardLoaderLoader.save(koth.getCooldownScoreboard(), configuration, "scoreboard.cooldown.");
scoreboardLoaderLoader.save(koth.getStartScoreboard(), configuration, "scoreboard.start.");

View File

@ -13,9 +13,11 @@ public class Config {
public static boolean enableDebug = true;
public static boolean enableDebugTime = false;
public static long playerMoveEventCooldown = 50;
public static long schedulerMillisecond = 1000;
public static List<Integer> displayMessageCooldown = Arrays.asList(300, 120, 60, 30, 10, 5, 4, 3, 2, 1);
public static List<Integer> displayMessageKothCap = Arrays.asList(300, 120, 60, 30, 10, 5, 4, 3, 2, 1);
public static String noPlayer = "X";
public static String noFaction = "X";
/**
* static Singleton instance.
@ -55,6 +57,8 @@ public class Config {
displayMessageCooldown = configuration.getIntegerList("displayMessageCooldown");
displayMessageKothCap = configuration.getIntegerList("displayMessageKothCap");
noPlayer = configuration.getString("noPlayer", "X");
noFaction = configuration.getString("noFaction", "X");
schedulerMillisecond = configuration.getLong("schedulerMillisecond", 1000);
}
}

View File

@ -1,26 +1,29 @@
package fr.maxlego08.koth.scoreboard;
import fr.maxlego08.koth.KothPlugin;
import fr.maxlego08.koth.api.KothScoreboard;
import fr.maxlego08.koth.save.Config;
import fr.maxlego08.koth.zcore.utils.ZUtils;
import fr.maxlego08.koth.zcore.utils.interfaces.CollectionConsumer;
import fr.mrmicky.fastboard.FastBoard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Consumer;
public class ScoreBoardManager extends ZUtils {
private final Plugin plugin;
private final Map<Player, FastBoard> boards = new HashMap<Player, FastBoard>();
private final long schedulerMillisecond;
private final ConcurrentMap<Player, FastBoard> boards = new ConcurrentHashMap<>();
private final KothPlugin plugin;
private boolean isRunning = false;
private CollectionConsumer<Player> lines;
private KothScoreboard scoreboard;
public ScoreBoardManager(Plugin plugin, long schedulerMillisecond) {
super();
this.schedulerMillisecond = schedulerMillisecond;
public ScoreBoardManager(KothPlugin plugin) {
this.plugin = plugin;
}
@ -29,49 +32,46 @@ public class ScoreBoardManager extends ZUtils {
*/
public void schedule() {
if (this.isRunning) {
if (isRunning)
return;
}
this.isRunning = true;
isRunning = true;
scheduleFix(this.plugin, this.schedulerMillisecond, (task, canRun) -> {
scheduleFix(plugin, Config.schedulerMillisecond, (task, canRun) -> {
// If the task cannot continue then we do not update the scoreboard
if (!canRun)
return;
if (!this.isRunning) {
if (!isRunning) {
task.cancel();
return;
}
// if the addition of the lines is null then we stop the task
if (this.lines == null) {
if (lines == null) {
task.cancel();
return;
}
Iterator<FastBoard> iterator = this.boards.values().iterator();
while (iterator.hasNext()) {
FastBoard b = iterator.next();
if (b.isDeleted() || !b.getPlayer().isOnline()) {
this.boards.remove(b.getPlayer());
try {
FastBoard b = iterator.next();
if (b.isDeleted() || !b.getPlayer().isOnline()) {
this.boards.remove(b.getPlayer());
}
} catch (Exception ignored) {
}
}
this.boards.forEach((player, board) -> board.updateLines(this.lines.accept(player)));
this.boards.forEach((player, board) -> {
board.updateLines(this.lines.accept(player));
});
});
}
/**
* Create a scoreboard for a player
*
* @param player
* @param title
* @return {@link FastBoard}
*/
public FastBoard createBoard(Player player, String title) {
if (this.hasBoard(player)) {
@ -86,17 +86,30 @@ public class ScoreBoardManager extends ZUtils {
}
this.boards.put(player, board);
this.scoreboard.hide(player, create(board, player, title));
return board;
}
/**
* Delete player board
*
* @param player
* @return
*/
private Consumer<Player> create(FastBoard current, Player player, String title) {
return p -> {
if (current != null)
current.delete();
this.boards.remove(player);
FastBoard board = new FastBoard(player);
board.updateTitle(title);
if (this.lines != null) {
board.updateLines(this.lines.accept(player));
}
this.boards.put(player, board);
};
}
public boolean delete(Player player) {
if (!this.hasBoard(player)) {
@ -106,10 +119,11 @@ public class ScoreBoardManager extends ZUtils {
FastBoard board = getBoard(player);
if (!board.isDeleted()) {
board.delete();
return true;
}
return false;
Bukkit.getScheduler().runTaskLater(this.plugin, () -> this.scoreboard.toggle(player, p -> {
}), 10);
return true;
}
/**
@ -117,40 +131,33 @@ public class ScoreBoardManager extends ZUtils {
*
* @param player
* @param title
* @return boolean
* @return
*/
public boolean updateTitle(Player player, String title) {
if (!hasBoard(player)) {
if (!this.hasBoard(player)) {
return false;
}
FastBoard board = getBoard(player);
if (!board.isDeleted()) {
board.updateTitle(title);
return true;
}
return false;
board.updateTitle(title);
return true;
}
public void clearBoard() {
this.isRunning = false;
this.boards.keySet().forEach(this::delete);
this.boards.clear();
}
public boolean updateLine(Player player, int line, String string) {
if (!hasBoard(player)) {
if (!this.hasBoard(player)) {
return false;
}
FastBoard board = getBoard(player);
if (!board.isDeleted()) {
board.updateLine(line, string);
return true;
}
return false;
board.updateLine(line, string);
return true;
}
/**
* Check if player has board
*
* @param player
* @return {@link Boolean}
*/
public boolean hasBoard(Player player) {
@ -158,9 +165,6 @@ public class ScoreBoardManager extends ZUtils {
}
/**
* Return player's board
*
* @param player
* @return {@link FastBoard}
*/
public FastBoard getBoard(Player player) {
@ -174,13 +178,6 @@ public class ScoreBoardManager extends ZUtils {
return this.boards;
}
/**
* @return the schedulerMillisecond
*/
public long getSchedulerMillisecond() {
return this.schedulerMillisecond;
}
/**
* @return the isRunning
*/
@ -217,4 +214,12 @@ public class ScoreBoardManager extends ZUtils {
this.schedule();
}
public KothScoreboard getScoreboard() {
return scoreboard;
}
public void setScoreboard(KothScoreboard scoreboard) {
this.scoreboard = scoreboard;
}
}

View File

@ -45,6 +45,7 @@ public enum Message {
DESCRIPTION_RELOAD("Reload configuration files"),
DESCRIPTION_NOW("Spawn a koth without cooldown"),
DESCRIPTION_SPAWN("Spawn a koth with cooldown"),
DESCRIPTION_AXE("Getting the selection axe"),
DESCRIPTION_CREATE("Create new koth"),
@ -74,8 +75,8 @@ public enum Message {
EVENT_START(MessageType.CENTER,
"§8§m-+------------------------------+-",
"",
"§fThe koth §b%name% §has just appeared!",
"§fCoordinate§8: §7%x%, %y%, %z%.",
"§fThe koth §b%name% §fhas just appeared!",
"§fCoordinate§8: §7%centerX%, %centerY%, %centerZ%.",
"",
"§8§m-+------------------------------+-"
),
@ -83,7 +84,7 @@ public enum Message {
EVENT_WIN(MessageType.CENTER,
"§8§m-+------------------------------+-",
"",
"§d%player% §fof faction §7%faction% §fhas just captured",
"§d%playerName% §fof faction §7%playerName% §fhas just captured",
"§fthe koth, and §nwins§f the event!",
"",
"§8§m-+------------------------------+-"
@ -92,8 +93,8 @@ public enum Message {
EVENT_COOLDOWN(MessageType.CENTER,
"§8§m-+------------------------------+-",
"",
"§fThe koth §n%name%§f will appear in §d%capture%",
"§fCoordinate§8: §7%x%, %y%, %z%.",
"§fThe koth §n%name%§f will appear in §d%spawnFormat%",
"§fCoordinate§8: §7%centerX%, %centerY%, %centerZ%.",
"",
"§8§m-+------------------------------+-"
),
@ -113,10 +114,10 @@ public enum Message {
EVENT_PLAYER("Person"),
EVENT_DISABLE("§cThe event is not enable."),
EVENT_CATCH(MessageType.ACTION, "§d%player% §fjust started capturing the koth §n%name%§f. §8(§7%x%, %y%, %z%§8)"),
EVENT_LOOSE(MessageType.ACTION, "§d%player% §fjust loose koth §n%name%§f. §8(§7%x%, %y%, %z%§8)"),
EVENT_TIMER(MessageType.ACTION, "§fAnother §b%capture% §fbefore §d%player% §fwins the koth §n%name%§e. §8(§7%x%, %y%, %z%§8)"),
EVENT_EVERYSECONDS(MessageType.ACTION, "§d%player% §7- §8[§f%classicProgress%§8] §7- §b%classicPercent%§f%"),
EVENT_CATCH(MessageType.ACTION, "§d%playerName% §fjust started capturing the koth §n%name%§f. §8(§7%centerX%, %centerY%, %centerZ%§8)"),
EVENT_LOOSE(MessageType.ACTION, "§d%playerName% §fjust loose koth §n%name%§f. §8(§7%centerX%, %centerY%, %centerZ%§8)"),
EVENT_TIMER(MessageType.ACTION, "§fAnother §b%captureFormat% §fbefore §d%playerName% §fwins the koth §n%name%§e. §8(§7%centerX%, %centerY%, %centerZ%§8)"),
EVENT_EVERYSECONDS(MessageType.ACTION, "§d%playerName% §7- §8[§f%classicProgress%§8] §7- §b%classicPercent%§f%"),
;

View File

@ -6,7 +6,7 @@ public enum Permission {
ZKOTH_RELOAD,
ZKOTH_NOW,
ZKOTH_AXE,
ZKOTH_CREATE;
ZKOTH_CREATE, ZKOTH_SPAWN;
private String permission;

View File

@ -126,6 +126,10 @@ public abstract class MessageUtils extends LocationUtils {
message(Bukkit.getConsoleSender(), message, args);
}
protected void broadcast(String message) {
Bukkit.broadcastMessage(Message.PREFIX.msg() + message);
}
/**
*
* @param player

View File

@ -58,13 +58,13 @@ public class TimerBuilder {
public static String getStringTime(long second) {
if (second < 60) {
return (TimerBuilder.getFormatLongSecondes(second * 1000l));
} else if (second >= 60 && second < 3600) {
return (TimerBuilder.getFormatLongMinutes(second * 1000l));
} else if (second >= 3600 && second < 86400) {
return (TimerBuilder.getFormatLongHours(second * 1000l));
return (TimerBuilder.getFormatLongSecondes(second * 1000L));
} else if (second < 3600) {
return (TimerBuilder.getFormatLongMinutes(second * 1000L));
} else if (second < 86400) {
return (TimerBuilder.getFormatLongHours(second * 1000L));
} else {
return (TimerBuilder.getFormatLongDays(second * 1000l));
return (TimerBuilder.getFormatLongDays(second * 1000L));
}
}

View File

@ -13,6 +13,7 @@
# /zkoth axe - zkoth.axe - Getting the selection axe
# /zkoth create <koth name> [<koth type>] [<capture/score] - zkoth.create - Create koth
# /zkoth now <koth name> - zkoth.now - Spawn a koth without cooldown
# /zkoth spawn <koth name> - zkoth.now - Spawn a koth
#
# Placeholders:
#
@ -61,4 +62,8 @@ displayMessageKothCap:
- 2
- 1
noPlayer: 'X'
noPlayer: 'X'
noFaction: 'X'
schedulerMillisecond: 1000

View File

@ -23,9 +23,12 @@ enableLooseCapMessage: true
# - %centerX% - Center location X
# - %centerY% - Center location Y
# - %centerZ% - Center location Z
# - %spawnSeconds% - Second before koth spawn
# - %spawnFormat% - Time format before koth spawn
startCommands: []
# Available placeholders:
# - %online-player% - Allows to run the order to all online players of the team
# - %name% - Koth name
# - %world% - World name
# - %minX% - Min location X
@ -37,7 +40,12 @@ startCommands: []
# - %centerX% - Center location X
# - %centerY% - Center location Y
# - %centerZ% - Center location Z
# - %spawnSeconds% - Second before koth spawn
# - %spawnFormat% - Time format before koth spawn
# - %playerName% - Current player name
# - %teamName% - Current player team name
# - %captureSeconds% - Capture seconds (only for CAPTURE type)
# - %captureFormat% - Capture time format (only for CAPTURE type)
endCommands: []
minLocation:
@ -54,30 +62,27 @@ manLocation:
scoreboard:
cooldown:
enable: false
enable: true
title: "&f&l⌈ &7&ozKoth &f&l⌋"
lines:
- "&r"
- "&6&l⟣ &fKoth: &b%name%"
- "&6&l⟣ &fCoordinate: &b%x% %y% %z%"
- "&6&l⟣ &fStarts in: &d%capture%"
- "&1"
- "&6&l⟣ &fhttps://groupez.dev"
- "&r"
- "#16db47Location:"
- " #636363◊ #ffffffX: %centerX% Y: %centerY% Z: %centerZ%"
- "&r"
- "#16db47Starts in:"
- " #636363◊ #ffffff%spawnFormat%"
- "&r"
start:
enable: false
enable: true
title: "&f&l⌈ &7&ozKoth &f&l⌋"
lines:
- "&r"
- "&6&l⟣ &fKoth: &b%name%"
- "&6&l⟣ &b%x% %y% %z%"
- "&6&l⟣ &fFaction: &b%faction%"
- "&0"
- "&6&l⟣ &fTime: &d%capture%"
- "&b"
- "&6&l⟣ &fPoints: &b%points%&f/&a%maxPoints%"
- "&6&l⟣ &fPercent: &b%pointsPercent%&7%"
- "&6&l⟣ &fTimer: &b%timer%"
- "&6&l⟣ &fTimer: &b%timerSeconds%&f/&a%maxTimerSeconds%"
- "&6&l⟣ &fPercent: &b%timerPercent%&7%"
- "&1"
- "&6&l⟣ &fhttps://groupez.dev"
- "&r"
- "#16db47Location"
- " #636363◊ #ffffffX: %centerX% Y: %centerY% Z: %centerZ%"
- "&r"
- "#16db47Player:"
- " #636363◊ #ffffff%playerName%"
- "&r"
- "#16db47Time left:"
- " #636363◊ #ffffff%captureFormat%"
- "&r"